Skip to main content

Interface: PasswordAdapter

Auth.js adapter contract extended with password management helpers.

Extends

Methods

createUserPassword()

createUserPassword(params): Promise<PasswordRecord>

Persists a hashed password for the given user and returns the storage record.

Parameters

ParameterType
paramsobject
params.emailstring
params.passwordstring
params.userIdstring

Returns

Promise<PasswordRecord>


deleteUserPassword()

deleteUserPassword(userId): Promise<void>

Removes any stored password material for a user.

Parameters

ParameterType
userIdstring

Returns

Promise<void>


findUserIdByEmail()

findUserIdByEmail(email): Promise<null | string>

Looks up the internal user id associated with an email address.

Parameters

ParameterType
emailstring

Returns

Promise<null | string>


resetUserPassword()

resetUserPassword(params): Promise<null | PasswordRecord>

Replaces the existing password hash and returns the updated record.

Parameters

ParameterType
paramsobject
params.passwordstring
params.userIdstring

Returns

Promise<null | PasswordRecord>


verifyUserPassword()

verifyUserPassword(params): Promise<boolean>

Compares a plaintext password against the stored hash for the user.

Parameters

ParameterType
paramsobject
params.passwordstring
params.userIdstring

Returns

Promise<boolean>