2022-10-21 00:14:17 -05:00
|
|
|
import type { Response } from 'got';
|
2022-06-16 00:00:01 -05:00
|
|
|
|
|
|
|
export const extractCookie = (response: Response) => {
|
|
|
|
const { headers } = response;
|
|
|
|
|
|
|
|
return headers['set-cookie']?.join('; ') ?? '';
|
|
|
|
};
|
|
|
|
|
2022-06-30 14:18:44 -05:00
|
|
|
export const generateUsername = () => `usr_${crypto.randomUUID().replaceAll('-', '_')}`;
|
|
|
|
export const generatePassword = () => `pwd_${crypto.randomUUID()}`;
|
2022-07-20 22:37:51 -05:00
|
|
|
|
|
|
|
export const generateResourceName = () => `res_${crypto.randomUUID()}`;
|
|
|
|
export const generateResourceIndicator = () => `https://${crypto.randomUUID()}.logto.io`;
|
2022-11-09 03:25:54 -05:00
|
|
|
export const generateEmail = () => `${crypto.randomUUID().toLowerCase()}@logto.io`;
|
2022-07-31 20:51:27 -05:00
|
|
|
|
|
|
|
export const generatePhone = () => {
|
|
|
|
const array = new Uint32Array(1);
|
|
|
|
|
|
|
|
return crypto.getRandomValues(array).join('');
|
|
|
|
};
|