importKey method

JSPromise<CryptoKey> importKey(
  1. KeyFormat format,
  2. JSObject keyData,
  3. AlgorithmIdentifier algorithm,
  4. bool extractable,
  5. JSArray<JSString> keyUsages,
)

The importKey() method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.

The function accepts several import formats: see Supported formats for details.

Implementation

external JSPromise<CryptoKey> importKey(
  KeyFormat format,
  JSObject keyData,
  AlgorithmIdentifier algorithm,
  bool extractable,
  JSArray<JSString> keyUsages,
);