Skip to content

lib/auth/password

function hashPassword(password: string): Promise<string>

Defined in: studiocms/packages/studiocms/src/lib/auth/password.ts:46

Hashes a plain text password using bcrypt.

string

The plain text password to hash.

Promise<string>

A promise that resolves to the hashed password.


function verifyPasswordHash(hash: string, password: string): Promise<boolean>

Defined in: studiocms/packages/studiocms/src/lib/auth/password.ts:58

Verifies if the provided password matches the hashed password.

string

The hashed password to compare against.

string

The plain text password to verify.

Promise<boolean>

A promise that resolves to a boolean indicating whether the password matches the hash.


function verifyPasswordStrength(password: string): Promise<boolean>

Defined in: studiocms/packages/studiocms/src/lib/auth/password.ts:74

Verifies the strength of a given password.

The password must meet the following criteria:

  • Be between 6 and 255 characters in length.
  • Not be a known unsafe password.
  • Not be found in the pwned password database.

string

The password to verify.

Promise<boolean>

A promise that resolves to true if the password is strong/secure enough, otherwise false.