Skip to content

otplib API Documentation / @otplib/core / hasBase32

Function: hasBase32()

hasBase32<T>(options): options is T & { base32: Base32Plugin }

Defined in: packages/core/src/utility-types.ts:173

Type predicate to check if an object has a base32 plugin

Type Parameters

T

T extends object

Parameters

options

T

Returns

options is T & { base32: Base32Plugin }

Example

ts
if (hasBase32(options)) {
  const decoded = options.base32.decode(secret);
}

Released under the MIT License.