exportKey method

JSPromise<JSAny?> exportKey(
  1. KeyFormat format,
  2. CryptoKey key
)

The exportKey() method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.

To export a key, the key must have CryptoKey.extractable set to true.

Keys can be exported in several formats: see Supported formats in the SubtleCrypto.importKey() page for details.

Keys are not exported in an encrypted format: to encrypt keys when exporting them use the SubtleCrypto.wrapKey() API instead.

Implementation

external JSPromise<JSAny?> exportKey(
  KeyFormat format,
  CryptoKey key,
);