API Reference
Rockets Core API
nestjs-password
classes
PasswordStorageService

Class: PasswordStorageService

Service with functions related to password security

Implements

Constructors

new PasswordStorageService()

new PasswordStorageService(): PasswordStorageService

Returns

PasswordStorageService

Methods

generateSalt()

generateSalt(): Promise<string>

Generate Salts to safeguard passwords in storage.

Returns

Promise<string>

Implementation of

PasswordStorageServiceInterface.generateSalt

Defined in

packages/nestjs-password/src/services/password-storage.service.ts:17 (opens in a new tab)


hash()

hash(password, options?): Promise<PasswordStorageInterface>

Hash a password using a salt, if no was passed, then one will be generated.

Parameters

ParameterTypeDescription
passwordstringPassword to be hashed
options?PasswordHashOptionsInterfaceHash options

Returns

Promise<PasswordStorageInterface>

Implementation of

PasswordStorageServiceInterface.hash

Defined in

packages/nestjs-password/src/services/password-storage.service.ts:28 (opens in a new tab)


hashObject()

Hash password for an object.

Param

An object containing the new password to hash.

Param

Hash object options

hashObject(object, options)

hashObject<T>(object, options?): Promise<Omit<T, "password"> & PasswordStorageInterface>

Hash password for an object.

Type Parameters
Type Parameter
T extends PasswordPlainInterface
Parameters
ParameterTypeDescription
objectTAn object containing the new password to hash.
options?PasswordHashObjectOptionsInterfaceHash object options
Returns

Promise<Omit<T, "password"> & PasswordStorageInterface>

A new object with the password hashed, with salt added.

Implementation of

PasswordStorageServiceInterface.hashObject

Defined in

packages/nestjs-password/src/services/password-storage.service.ts:48 (opens in a new tab)

hashObject(object, options)

hashObject<T>(object, options?): Promise<Omit<T, "password"> | Omit<T, "password"> & PasswordStorageInterface>

Hash password for an object if the password property exists.

Type Parameters
Type Parameter
T extends PasswordPlainInterface
Parameters
ParameterTypeDescription
objectPartial<T>An object containing the new password to hash.
options?PasswordHashObjectOptionsInterfaceHash object options
Returns

Promise<Omit<T, "password"> | Omit<T, "password"> & PasswordStorageInterface>

A new object with the password hashed, with salt added.

Implementation of

PasswordStorageServiceInterface.hashObject

Defined in

packages/nestjs-password/src/services/password-storage.service.ts:60 (opens in a new tab)