UNPKG

otp-io

Version:

🕖 Typed library to work 2fa via Google Authenticator/Time-based TOTP/Hmac-based HOTP

6 lines • 299 B
import {createHmac,randomFillSync}from'crypto';const hmac = async function hmac(algorithm, key, message) { return createHmac(algorithm, key).update(message).digest(); }; const randomBytes = function randomBytes(size) { return randomFillSync(new Uint8Array(size)); };export{hmac,randomBytes};