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

37 lines
805 B
Markdown

# 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
```js
import { exportSPKI } from 'jose/key/export'
```
**`example`** CJS import
```js
const { exportSPKI } = require('jose/key/export')
```
**`example`** Deno import
```js
import { exportSPKI } from 'https://deno.land/x/jose@v3.20.2/key/export.ts'
```
**`example`** Usage
```js
const spkiPem = await exportSPKI(publicKey)
console.log(spkiPem)
```
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `key` | [`KeyLike`](../types/types.KeyLike.md) | Key representation to transform to an PEM-encoded SPKI string format. |
#### Returns
`Promise`<`string`\>