API reference for crystals-kyber-js/main
    Preparing search index...

    Interface MlKemInterface

    Interface for synchronous ML-KEM operations.

    Use the async factory functions createMlKem512, createMlKem768, or createMlKem1024 to create instances that implement this interface.

    interface MlKemInterface {
        decap(ct: Uint8Array, sk: Uint8Array): Uint8Array;
        deriveKeyPair(
            seed: Uint8Array,
        ): [Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>];
        encap(
            pk: Uint8Array,
            seed?: Uint8Array,
        ): [Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>];
        generateKeyPair(): [
            Uint8Array<ArrayBufferLike>,
            Uint8Array<ArrayBufferLike>,
        ];
    }
    Index

    Methods

    • Decapsulates: returns sharedSecret.

      Parameters

      • ct: Uint8Array
      • sk: Uint8Array

      Returns Uint8Array

    • Derives a keypair [publicKey, privateKey] deterministically from a 64-octet seed.

      Parameters

      • seed: Uint8Array

      Returns [Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>]

    • Encapsulates: returns [ciphertext, sharedSecret].

      Parameters

      • pk: Uint8Array
      • Optionalseed: Uint8Array

      Returns [Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>]

    • Generates a keypair [publicKey, privateKey].

      Returns [Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>]