createHOTPKeyURI()
Creates a new key URI for HOTP.
Definition
function createHOTPKeyURI(
issuer: string,
accountName: string,
secret: ArrayBuffer | TypedArray,
options?: {
counter?: number;
digits?: number;
}
): string;
Parameters
issuer
: Your company/website nameaccountName
: Account identifier (e.g. username)secret
: HOTP secret keyoptions
counter
(default:0
): Counter countdigits
(default:6
): OTP digits
Example
import { createHOTPKeyURI } from "oslo/otp";
import { HMAC } from "oslo/crypto";
const secret = await new HMAC("SHA-1").generateKey();
const issuer = "My website";
const accountName = "user@example.com";
const uri = createHOTPKeyURI(issuer, accountName, secret);