Skip to main content

hotp

@webda/core


Function: hotp()

hotp(secret, counter, opts?): string

Defined in: packages/core/src/utils/totp.ts:98

Compute an HMAC-based One-Time Password (RFC 4226)

Parameters​

secret​

string | Buffer<ArrayBufferLike>

Base32 secret string or raw Buffer

counter​

number

64-bit integer counter

opts?​

TotpOptions

options (digits, algorithm)

Returns​

string

numeric OTP code padded with leading zeroes