Back to Jose

Function: exportSPKI()

docs/key/export/functions/exportSPKI.md

6.2.21.2 KB
Original Source

Function: exportSPKI()

šŸ’— 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.

ā–ø exportSPKI(key): Promise<string>

Exports a public CryptoKey or KeyObject to a PEM-encoded SPKI string format.

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
keyCryptoKey | KeyObjectKey to export to a PEM-encoded SPKI string format.

Returns

Promise<string>

Example

js
const spkiPem = await jose.exportSPKI(publicKey)

console.log(spkiPem)