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