jose/docs/functions/util_decode_protected_header.decodeProtectedHeader.md
2021-11-05 23:44:40 +01:00

36 lines
933 B
Markdown

# Function: decodeProtectedHeader
**decodeProtectedHeader**(`token`): [`ProtectedHeaderParameters`](../types/util_decode_protected_header.ProtectedHeaderParameters.md)
Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serialization.
**`example`** Usage
```js
const protectedHeader = decodeProtectedHeader(token)
console.log(protectedHeader)
```
**`example`** ESM import
```js
import { decodeProtectedHeader } from 'jose'
```
**`example`** CJS import
```js
const { decodeProtectedHeader } = require('jose')
```
**`example`** Deno import
```js
import { decodeProtectedHeader } from 'https://deno.land/x/jose@v4.1.5/index.ts'
```
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `token` | `string` \| `object` | JWE/JWS/JWT token in any JOSE serialization. |
#### Returns
[`ProtectedHeaderParameters`](../types/util_decode_protected_header.ProtectedHeaderParameters.md)