Skip to content

otplib API Documentation / otplib / / Base32Plugin

Type Alias: Base32Plugin ​

Base32Plugin = object

Defined in: packages/core/src/types.ts:168

Base32 plugin type for abstracting Base32 encoding/decoding across different implementations (native, TypeScript, etc.)

Properties ​

name ​

readonly name: string

Defined in: packages/core/src/types.ts:172

The name of the base32 plugin (e.g., 'native', 'ts')

Methods ​

decode() ​

decode(str): Uint8Array

Defined in: packages/core/src/types.ts:190

Decode Base32 string to binary data

Parameters ​

str ​

string

Base32 string to decode

Returns ​

Uint8Array

Decoded Uint8Array

Throws ​

If string contains invalid characters


encode() ​

encode(data, options?): string

Defined in: packages/core/src/types.ts:181

Encode binary data to Base32 string

Parameters ​

data ​

Uint8Array

Uint8Array to encode

options? ​

Base32EncodeOptions

Encoding options

Returns ​

string

Base32 encoded string

Released under the MIT License.