UNPKG

lbx-jwt

Version:

Provides JWT authentication for loopback applications. Includes storing roles inside tokens and handling refreshing. Built-in reuse detection.

28 lines 928 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BcryptUtilities = void 0; const bcryptjs_1 = require("bcryptjs"); /** * Encapsulates functionality of the bcryptjs package. */ class BcryptUtilities { /** * Asynchronously compares the given data against the given hash. * @param s - Data to compare. * @param hash - Data to be compared to. * @returns Promise, if callback has been omitted. */ static async compare(s, hash) { return (0, bcryptjs_1.compare)(s, hash); } /** * Asynchronously generates a hash for the given string. * @param value - The value that should be hashed. * @returns A hash of the given value. */ static async hash(value) { return (0, bcryptjs_1.hash)(value, await (0, bcryptjs_1.genSalt)()); } } exports.BcryptUtilities = BcryptUtilities; //# sourceMappingURL=bcrypt.utilities.js.map