Skip to content

otplib API Documentation / @otplib/core / / CreateCryptoPluginOptions

Type Alias: CreateCryptoPluginOptions

CreateCryptoPluginOptions = object

Defined in: packages/core/src/plugin-factories.ts:29

Options for creating a custom Crypto plugin

Properties

constantTimeEqual()?

optional constantTimeEqual: (a, b) => boolean

Defined in: packages/core/src/plugin-factories.ts:52

Constant-time comparison (optional, falls back to core utility)

Parameters

a

string | Uint8Array

b

string | Uint8Array

Returns

boolean


hmac()

hmac: (algorithm, key, data) => Promise<Uint8Array> | Uint8Array

Defined in: packages/core/src/plugin-factories.ts:38

Compute HMAC using the specified hash algorithm

Parameters

algorithm

HashAlgorithm

key

Uint8Array

data

Uint8Array

Returns

Promise<Uint8Array> | Uint8Array


name?

optional name: string

Defined in: packages/core/src/plugin-factories.ts:33

Plugin name for identification (default: "custom")


randomBytes()

randomBytes: (length) => Uint8Array

Defined in: packages/core/src/plugin-factories.ts:47

Generate cryptographically secure random bytes

Parameters

length

number

Returns

Uint8Array

Released under the MIT License.