deriveKey method

JSPromise<JSAny?> deriveKey(
  1. AlgorithmIdentifier algorithm,
  2. CryptoKey baseKey,
  3. AlgorithmIdentifier derivedKeyType,
  4. bool extractable,
  5. JSArray<JSString> keyUsages,
)

The deriveKey() method of the SubtleCrypto interface can be used to derive a secret key from a master key.

It takes as arguments some initial key material, the derivation algorithm to use, and the desired properties for the key to derive. It returns a Promise which will be fulfilled with a CryptoKey object representing the new key.

It's worth noting that the three key derivation algorithms you can use have quite different characteristics and are appropriate in quite different situations. See Supported algorithms for some more detail on this.

Implementation

external JSPromise<JSAny?> deriveKey(
  AlgorithmIdentifier algorithm,
  CryptoKey baseKey,
  AlgorithmIdentifier derivedKeyType,
  bool extractable,
  JSArray<JSString> keyUsages,
);