jose/docs/functions/key_export.exportJWK.md
2021-10-14 12:24:49 +02:00

861 B

Function: exportJWK

exportJWK(key): Promise<JWK>

Exports a runtime-specific key representation (KeyLike) to a JWK.

example ESM import

import { exportJWK } from 'jose/key/export'

example CJS import

const { exportJWK } = require('jose/key/export')

example Deno import

import { exportJWK } from 'https://deno.land/x/jose@v3.20.3/key/export.ts'

example Usage

const privateJwk = await exportJWK(privateKey)
const publicJwk = await exportJWK(publicKey)

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

Parameters

Name Type Description
key KeyLike | Uint8Array Key representation to export as JWK.

Returns

Promise<JWK>