mirror of
https://github.com/hanzoai/jose.git
synced 2026-09-24 17:00:01 +00:00
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]>
1.6 KiB
1.6 KiB
Function: calculateJwkThumbprintUri()
💗 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.
â–¸ calculateJwkThumbprintUri(key, digestAlgorithm?): Promise<string>
Calculates a JSON Web Key (JWK) Thumbprint URI
This function is exported (as a named export) from the main 'jose' module entry point as well
as from its subpath export 'jose/jwk/thumbprint'.
Parameters
| Parameter | Type | Description |
|---|---|---|
key |
CryptoKey | JWK | KeyObject |
Key to calculate the thumbprint for. |
digestAlgorithm? |
"sha256" | "sha384" | "sha512" |
Digest Algorithm to use for calculating the thumbprint. Default is "sha256". |
Returns
Promise<string>
Example
const thumbprintUri = await jose.calculateJwkThumbprintUri({
kty: 'EC',
crv: 'P-256',
x: 'jJ6Flys3zK9jUhnOHf6G49Dyp5hah6CNP84-gY-n9eo',
y: 'nhI6iD5eFXgBTLt_1p3aip-5VbZeMhxeFSpjfEAf7Ww',
})
console.log(thumbprintUri)
// 'urn:ietf:params:oauth:jwk-thumbprint:sha-256:w9eYdC6_s_tLQ8lH6PUpc0mddazaqtPgeC2IgWDiqY8'