Back to Jose

Function: exportJWK()

docs/key/export/functions/exportJWK.md

6.2.21.5 KB
Original Source

Function: exportJWK()

šŸ’— Help the project

Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by becoming a sponsor.

ā–ø exportJWK(key): Promise<JWK>

Exports a CryptoKey, KeyObject, or Uint8Array to a JWK.

This function is exported (as a named export) from the main 'jose' module entry point as well as from its subpath export 'jose/key/export'.

Parameters

ParameterTypeDescription
keyUint8Array | CryptoKey | KeyObjectKey to export as JWK.

Returns

Promise<JWK>

Example

js
const privateJwk = await jose.exportJWK(privateKey)
const publicJwk = await jose.exportJWK(publicKey)

console.log(privateJwk)
console.log(publicJwk)