Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "hmac/hmac"

Index

Classes

Variables

Functions

Variables

equal

equal: equal = constantTimeEqual

Returns true if two HMAC digests are equal. Uses contant-time comparison to avoid leaking timing information.

Example:

const receivedDigest = ... const realDigest = hmac(SHA256, key, data); if (!equal(receivedDigest, realDigest)) { throw new Error("Authentication error"); }

Functions

hmac

  • hmac(hash: object, key: Uint8Array, data: Uint8Array): Uint8Array
  • Returns HMAC using the given hash constructor for the key over data.

    Parameters

    • hash: object
    • key: Uint8Array
    • data: Uint8Array

    Returns Uint8Array

Generated using TypeDoc