open-nav
    Preparing search index...

    Interface CryptoProvider

    The low-level cryptographic primitives the NAV protocol needs, abstracted so the library can run on any JavaScript runtime.

    The default is nodeCryptoProvider, backed by Node's built-in node:crypto. On runtimes whose node:crypto lacks SHA-3 — notably Cloudflare Workers (workerd/BoringSSL), where createHash('sha3-512') throws Digest method not supported — install createWebCryptoProvider via setCryptoProvider once at startup, before making any request.

    interface CryptoProvider {
        aes128EcbDecrypt(ciphertext: Uint8Array, key: Uint8Array): Uint8Array;
        randomBytes(length: number): Uint8Array;
        sha3_512(data: Uint8Array): Uint8Array;
        sha512(data: Uint8Array): Uint8Array;
    }
    Index
    • AES-128 ECB decryption without padding; key is exactly 16 bytes.

      Parameters

      • ciphertext: Uint8Array
      • key: Uint8Array

      Returns Uint8Array