otp-io
Version:
🕖 Typed library to work 2fa via Google Authenticator/Time-based TOTP/Hmac-based HOTP
6 lines • 335 B
JavaScript
;const crypto=require('crypto');const hmac = async function hmac(algorithm, key, message) {
return crypto.createHmac(algorithm, key).update(message).digest();
};
const randomBytes = function randomBytes(size) {
return crypto.randomFillSync(new Uint8Array(size));
};exports.hmac=hmac;exports.randomBytes=randomBytes;