jose/docs/functions/key_export.exportJWK.md
2021-10-06 16:12:59 +02:00

911 B

Function: exportJWK

key/export.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.0/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>