Skip to main content

exportKey

method webcrypto.SubtleCrypto.exportKey
Jump to headingSubtleCrypto.exportKey(
format: "jwk",
key: CryptoKey,
): Promise<JsonWebKey>

Exports the given key into the specified format, if supported.

If the <CryptoKey> is not extractable, the returned promise will reject.

When format is either 'pkcs8' or 'spki' and the export is successful, the returned promise will be resolved with an <ArrayBuffer> containing the exported key data.

When format is 'jwk' and the export is successful, the returned promise will be resolved with a JavaScript object conforming to the JSON Web Key specification.

Parameters Jump to heading

Jump to headingformat: "jwk"

Must be one of 'raw', 'pkcs8', 'spki', or 'jwk'.

Return Type Jump to heading

Promise<JsonWebKey>

<Promise> containing <ArrayBuffer>.

Jump to headingSubtleCrypto.exportKey(
format: Exclude<KeyFormat, "jwk">,
key: CryptoKey,
): Promise<ArrayBuffer>

Parameters Jump to heading

Return Type Jump to heading

Promise<ArrayBuffer>
Back to top