Back to Jose

Function: exportPKCS8()

docs/key/export/functions/exportPKCS8.md

6.2.21.2 KB
Original Source

Function: exportPKCS8()

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

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

Exports a private CryptoKey or KeyObject to a PEM-encoded PKCS8 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 PKCS8 string format.

Returns

Promise<string>

Example

js
const pkcs8Pem = await jose.exportPKCS8(privateKey)

console.log(pkcs8Pem)