Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/otpauth/dist/otpauth.esm.min.js>Secret

One Time Password (HOTP/TOTP) library for Node.js, Deno, Bun and browsers.
Go to Latest
class Secret
import { Secret } from "https://deno.land/x/otpauth@v9.3.3/dist/otpauth.esm.min.js";

OTP secret key.

Constructors

new
Secret(unnamed 0?: { buffer?: ArrayBufferLike | undefined; size?: number | undefined; } | undefined)

Creates a secret key object.

Properties

readonly
base32: string

Base32 string representation of secret key.

deprecated
readonly
buffer: ArrayBufferLike

Secret key buffer.

readonly
bytes: Uint8Array

Secret key.

readonly
hex: string

Hexadecimal string representation of secret key.

readonly
latin1: string

Latin-1 string representation of secret key.

readonly
utf8: string

UTF-8 string representation of secret key.

Static Methods

fromBase32(str: string): Secret

Converts a base32 string to a Secret object.

fromHex(str: string): Secret

Converts a hexadecimal string to a Secret object.

fromLatin1(str: string): Secret

Converts a Latin-1 string to a Secret object.

fromUTF8(str: string): Secret

Converts an UTF-8 string to a Secret object.