UNPKG

lbx-jwt

Version:

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

35 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OtpAuthUtilities = void 0; const otpauth_1 = require("otpauth"); /** * Encapsulates functionality of the otpauth package. */ class OtpAuthUtilities { /** * Creates a TOTP object. * @param options - Options for generating the TOTP. * @returns A TOTP (Time based One Time Password). */ static createTOTP(options) { return new otpauth_1.TOTP(options); } /** * Generates a TOTP token. * @param options - Configuration options. * @returns — Token. */ static generate(options) { return otpauth_1.TOTP.generate(options); } /** * Converts a base32 string to a Secret object. * @param value - Base32 string. * @returns Secret object. */ static secretFromBase32(value) { return otpauth_1.Secret.fromBase32(value); } } exports.OtpAuthUtilities = OtpAuthUtilities; //# sourceMappingURL=otp-auth.utilities.js.map