Files
jose/docs/util/base64url/functions/decode.md
T
Filip Skokan f7ef7912cd docs: correct subpaths and API documentation
Correct subpath names that otherwise lead users to unexported entries,
and fix examples, links, and missing descriptions in published JSDoc.

Use instanceof in JWKS recovery examples so strict TypeScript can
narrow caught errors.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00

1.2 KiB

Function: decode()

💗 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.

â–¸ decode(input): Uint8Array

Decodes a Base64URL encoded input.

These functions are exported (as the base64url namespace) from the main 'jose' module entry point as well as from its subpath export 'jose/base64url'.

Parameters

Parameter Type Description
input string | Uint8Array Base64URL encoded input, as a string or its UTF-8 bytes.

Returns

Uint8Array

The decoded bytes.

Example

const decoded = jose.base64url.decode('SGVsbG8gV29ybGQh')

Throws

When the input is not correctly Base64URL encoded. Standard Base64 input (i.e. containing + or /) is rejected.