Interface KeyWrapper<WrapKeyInput, UnwrapKeyInput>

The KeyWrapper interface provides methods for wrapping and unwrapping cryptographic keys. It includes wrapKey() for securely encapsulating a key within another key, and unwrapKey() for extracting the original key from its wrapped state.

This interface is crucial in scenarios where secure key management and exchange are required, ensuring that keys remain protected during transit or storage.

interface KeyWrapper<WrapKeyInput, UnwrapKeyInput> {
    unwrapKey(params): Promise<Jwk>;
    wrapKey(params): Promise<Uint8Array>;
}

Type Parameters

  • WrapKeyInput
  • UnwrapKeyInput

Methods

  • Unwraps a previously wrapped cryptographic key, restoring it to its original form.

    Parameters

    • params: UnwrapKeyInput

      The parameters for the key unwrapping operation.

    Returns Promise<Jwk>

    A Promise resolving to the unwrapped key in a cryptographic format, usually JWK.

    Remarks

    The unwrapKey() method of the KeyWrapper interface reverses the wrapping process, extracting the original key from its wrapped state, typically for use in cryptographic operations.

  • Wraps a cryptographic key using another key, typically for secure key transmission or storage.

    Parameters

    • params: WrapKeyInput

      The parameters for the key wrapping operation.

    Returns Promise<Uint8Array>

    A Promise resolving to the wrapped key as a Uint8Array.

    Remarks

    The wrapKey() method of the KeyWrapper interface secures a cryptographic key by encapsulating it within another key, producing a wrapped key represented as a Uint8Array.