Skip to main content
webcrypto.SubtleCrypto.deriveKey - node__crypto.d.ts - Node documentation
method webcrypto.SubtleCrypto.deriveKey

Usage in Deno

```typescript import { type webcrypto } from "node:node__crypto.d.ts"; ```
SubtleCrypto.deriveKey(
baseKey: CryptoKey,
extractable: boolean,
keyUsages: readonly KeyUsage[],
): Promise<CryptoKey>
Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. The algorithms currently supported include: - `'ECDH'` - `'X25519'` - `'X448'` - `'HKDF'` - `'PBKDF2'`

Parameters

baseKey: CryptoKey
extractable: boolean
keyUsages: readonly KeyUsage[]
See [Key usages](https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages).

Return Type

Promise<CryptoKey>