Skip to content

sdk/lib/generators

function generateRandomIDNumber(length: number): number

Defined in: studiocms/packages/studiocms/src/sdk/lib/generators.ts:9

Generates a random ID number with the specified length.

number

The length of the random ID number to generate.

number

A random ID number with the specified length.


function generateRandomPassword(length: number): string

Defined in: studiocms/packages/studiocms/src/sdk/lib/generators.ts:40

Generates a random password of the specified length.

number

The length of the password to generate.

string

A randomly generated password string containing uppercase letters, lowercase letters, and digits.


function generateToken(userId: string): string

Defined in: studiocms/packages/studiocms/src/sdk/lib/generators.ts:19

Generates a JSON Web Token (JWT) for a given user ID.

string

The unique identifier of the user for whom the token is being generated.

string

A signed JWT string that expires in 3 hours.


function testToken(token: string): any

Defined in: studiocms/packages/studiocms/src/sdk/lib/generators.ts:30

Verifies the provided JWT token using the CMS encryption key.

string

The JWT token to be verified.

any

The decoded token if verification is successful.

Will throw an error if the token is invalid or verification fails.