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

805 B

Function: exportSPKI

exportSPKI(key): Promise<string>

Exports a runtime-specific public key representation (KeyObject or CryptoKey) to an PEM-encoded SPKI string format.

example ESM import

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

example CJS import

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

example Deno import

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

example Usage

const spkiPem = await exportSPKI(publicKey)

console.log(spkiPem)

Parameters

Name Type Description
key KeyLike Key representation to transform to an PEM-encoded SPKI string format.

Returns

Promise<string>