Interface KeyDeriver<DeriveBitsInput, DeriveKeyInput, DeriveKeyOutput>

The KeyDeriver interface provides methods for key derivation. It includes the methods deriveBits() to derive cryptographic bits and deriveKey() to derive JWK keys from input data using specific algorithms. This interface is designed to support various key derivation algorithms, accommodating different input and output types.

Both methods return a Promise that resolves to the derived cryptographic material.

interface KeyDeriver<DeriveBitsInput, DeriveKeyInput, DeriveKeyOutput> {
    deriveBits(params): Promise<Uint8Array>;
    deriveKey(params): Promise<DeriveKeyOutput>;
}

Type Parameters

  • DeriveBitsInput
  • DeriveKeyInput
  • DeriveKeyOutput

Methods

  • Generates a specified number of cryptographic bits from given input parameters.

    Parameters

    • params: DeriveBitsInput

      The parameters for the bit derivation process, specific to the chosen algorithm.

    Returns Promise<Uint8Array>

    A Promise resolving to the derived bits as a Uint8Array.

    Remarks

    The deriveBits() method of the KeyDeriver interface is used to create cryptographic material such as initialization vectors or keys from various sources. The method takes in parameters specific to the chosen key derivation algorithm and outputs a promise that resolves to a Uint8Array containing the derived bits.

  • Derives a cryptographic key in JWK format based on the provided input parameters.

    Parameters

    • params: DeriveKeyInput

      The parameters for the key derivation process, customized for the specific algorithm.

    Returns Promise<DeriveKeyOutput>

    A Promise resolving to the derived key in the specified output format.

    Remarks

    The deriveKey() method of the KeyDeriver interface is utilized to generate cryptographic keys for operations like encryption, decryption, or signing. The method takes in parameters tailored to the key derivation algorithm being used and returns a promise that resolves to the derived key.