UNPKG

@hellocoop/identifier

Version:

A module for generating and verifying Hellō identifiers with a checksum.

21 lines (16 loc) 742 B
// Generated by build script type IdentifierType = 'sub' | 'app' | 'usr' | 'jti' | 'ses' | 'dvc' | 'inv' | 'pky' | 'non' | 'cod' | 'org' | 'req' | 'pub'; type Generators = { readonly [key in IdentifierType]: () => string; } & { readonly validate: (identifier: string) => boolean; readonly checksum: (prefix: string, id: string) => string; readonly HELLO_REGEX: RegExp; readonly HELLO_ALPHABET: string; readonly types: readonly IdentifierType[]; // Making the array itself read-only readonly isUUIDv4: (id: string) => boolean; readonly nanoidFromUUIDv4: (uuid: string) => string; readonly uuidv4FromNanoid: (nanoid: string) => string; }; declare const generators: Generators; export default generators;