@krypton-org/krypton-auth
Version:
Express authentication middleware, using GraphQL and JSON Web Tokens.
25 lines (24 loc) • 849 B
TypeScript
/**
* Module defining functions for password encryption.
* @module crypto/PasswordEncryption
*/
/// <reference types="node" />
/**
* Function generating random salt, destinated to encrypt the `password`. Returning the encrypted `password` hash and salt.
* @param {string} password
* @returns {Promise<{ salt: string; hash: string }>} Promise to the password encrypted hash and salt
*/
export declare const hashAndSalt: (password: string) => Promise<{
salt: string;
hash: string;
}>;
/**
* Encrypting `password` with the given `salt`. Returning hash and salt.
* @param {string} password
* @param {Buffer} salt
* @returns {Promise<{ salt: string; hash: string }>} Promise to the password encrypted hash and salt
*/
export declare const hash: (password: string, salt: Buffer) => Promise<{
salt: string;
hash: string;
}>;