Class: PasswordStorageService
Service with functions related to password security
Implements
Constructors
new PasswordStorageService()
new PasswordStorageService():
PasswordStorageService
Returns
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
Parameter | Type | Description |
---|---|---|
password | string | Password to be hashed |
options ? | PasswordHashOptionsInterface | Hash 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
Parameter | Type | Description |
---|---|---|
object | T | An object containing the new password to hash. |
options ? | PasswordHashObjectOptionsInterface | Hash 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
Parameter | Type | Description |
---|---|---|
object | Partial <T > | An object containing the new password to hash. |
options ? | PasswordHashObjectOptionsInterface | Hash 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)