Expand description

Wrapper for node/browser webcrypto

Variables

Crypto loader which loads native webcrypto depending on environment

Functions

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams

Parameters

  • algorithm: U
  • key: T
  • data: BufferSource

Returns Promise<ArrayBuffer>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params

Parameters

  • algorithm: U
  • baseKey: T
  • length: number

Returns Promise<ArrayBuffer>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | HkdfParams | Pbkdf2Params | AesDerivedKeyParams | HmacImportParams

Parameters

  • algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params
  • key: CryptoKey
  • derivedKeyType: U
  • extractable: boolean
  • keyUsages: KeyUsage[]

Returns Promise<T>

Type Parameters

  • T extends ArrayBuffer

Parameters

  • algorithm: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512"
  • data: BufferSource

Returns Promise<T>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams

Parameters

  • algorithm: U
  • key: T
  • data: BufferSource

Returns Promise<ArrayBuffer>

Type Parameters

  • T extends CryptoKey

Parameters

  • format: "jwk"
  • key: T

Returns Promise<JsonWebKey>

Type Parameters

  • T extends CryptoKey

Parameters

  • format: "pkcs8" | "raw" | "spki"
  • key: T

Returns Promise<ArrayBuffer>

Type Parameters

  • T extends CryptoKey | CryptoKeyPair

  • U extends AlgorithmIdentifier | Pbkdf2Params | RsaHashedKeyGenParams | EcKeyGenParams | AesKeyGenParams | HmacKeyGenParams

Parameters

  • algorithm: U
  • extractable: boolean
  • keyUsages: KeyUsage[]

Returns Promise<T>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm

Parameters

  • format: "jwk"
  • key: JsonWebKey
  • algorithm: U
  • extractable: boolean
  • keyUsages: KeyUsage[]

Returns Promise<T>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm

Parameters

  • format: "pkcs8" | "raw" | "spki"
  • key: BufferSource
  • algorithm: U
  • extractable: boolean
  • keyUsages: KeyUsage[]

Returns Promise<T>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | RsaPssParams | EcdsaParams

Parameters

  • algorithm: U
  • key: T
  • data: BufferSource

Returns Promise<ArrayBuffer>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams

  • V extends AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm

Parameters

  • format: KeyFormat
  • wrappedKey: BufferSource
  • unwrappingKey: T
  • unwrapAlgorithm: U
  • unwrappedKeyAlgorithm: V
  • extractable: boolean
  • keyUsages: KeyUsage[]

Returns Promise<CryptoKey>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | RsaPssParams | EcdsaParams

Parameters

  • algorithm: U
  • key: T
  • signature: BufferSource
  • data: BufferSource

Returns Promise<boolean>

Type Parameters

  • T extends CryptoKey

  • U extends AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams

Parameters

  • format: KeyFormat
  • key: CryptoKey
  • wrappingKey: T
  • wrapAlgorithm: U

Returns Promise<ArrayBuffer>