mirror of
https://github.com/documenso/documenso.git
synced 2026-07-11 13:35:20 +10:00
9ac7b94d9a
Allow organisations to manage an SSO OIDC compliant portal. This method is intended to streamline the onboarding process and paves the way to allow organisations to manage their members in a more strict way.
28 lines
647 B
TypeScript
28 lines
647 B
TypeScript
import { customAlphabet } from 'nanoid';
|
|
|
|
export const alphaid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 21);
|
|
|
|
export { nanoid } from 'nanoid';
|
|
|
|
export const fancyId = customAlphabet('abcdefhiklmnorstuvwxyz', 16);
|
|
|
|
export const prefixedId = (prefix: string, length = 16) => {
|
|
return `${prefix}_${fancyId(length)}`;
|
|
};
|
|
|
|
type DatabaseIdPrefix =
|
|
| 'email_domain'
|
|
| 'org'
|
|
| 'org_email'
|
|
| 'org_claim'
|
|
| 'org_group'
|
|
| 'org_sso'
|
|
| 'org_setting'
|
|
| 'member'
|
|
| 'member_invite'
|
|
| 'group_member'
|
|
| 'team_group'
|
|
| 'team_setting';
|
|
|
|
export const generateDatabaseId = (prefix: DatabaseIdPrefix) => prefixedId(prefix, 16);
|