Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions cookbook/jwe.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -668,4 +668,44 @@ export default [
},
},
},
{
title:
'https://datatracker.ietf.org/doc/draft-ietf-jose-hpke-encrypt/ - HPKE Integrated Encryption',
deterministic: false,
input: {
plaintext:
'You can trust us to stick with you through thick and thin–to the bitter end. And you can trust us to keep any secret of yours–closer than you keep it yourself. But you cannot trust us to let you face trouble alone, and go off without a word. We are your friends, Frodo.',
key: {
kty: 'EC',
use: 'enc',
alg: 'HPKE-0',
kid: 'yCnfbmYMZcWrKDt_DjNebRCB1vxVoqv4umJ4WK8RYjk',
crv: 'P-256',
x: 'gixQJ0qg4Ag-6HSMaIEDL_zbDhoXavMyKlmdn__AQVE',
y: 'ZxTgRLWaKONCL_GbZKLNPsW9EW6nBsN4AwQGEFAFFbM',
d: 'g2DXtKapi2oN2zL_RCWX8D4bWURHCKN2-ZNGC05ZaR8',
},
alg: 'HPKE-0',
aad: 'The Fellowship of the Ring',
},
encrypting_content: {
protected: {
alg: 'HPKE-0',
kid: 'yCnfbmYMZcWrKDt_DjNebRCB1vxVoqv4umJ4WK8RYjk',
},
},
output: {
compact:
'eyJhbGciOiJIUEtFLTAiLCJraWQiOiJ5Q25mYm1ZTVpjV3JLRHRfRGpOZWJSQ0IxdnhWb3F2NHVtSjRXSzhSWWprIn0.BLAJX8adrFsDKaoJAc3iy2dq-6jEH3Uv-bSgqIoDeREqpWglMoTS67XsXere1ZYxiQKEFU6MbWe8O7vmdlSmcUk..NcN9ew5aijn8W7piLVRU8r2cOP0JKqxOF4RllVsJM4qsAfVXW5Ka6so9zdUmXXNOXyCEk0wV_s8ICAnD4LbRa5TkhTeuhijIfAt9bQ2fMLOeyed3WyArs8yaMraa9Zbh4i6SaHunM7jU_xoz_N2WbykSOSySmCO49H4mP3jLW9L_TYQfeVfYsrB8clqokZ8h-3eQGNwmOPtkjWdpAfaHUsp4-HC9nRd6yrTU6mV65Nn2iYynu3Xkgy2Lm-kQKDavIEW3PBpEeiw6mtPJE9o8sT-0lZ9kpWtqog2XbNGEfjSOjujvNe1b0g4-FdNFMFO_fo0rxe902W1pGT7znv4Q-xBkIydK4ZwjiFN6dAXutnococ37A0Hr5esPLwHRTTrBFw.',
json_flat: {
ciphertext:
'LabI8_KIPDbymUSbyVctj8AfISXQ07sMt1xQ1lrS-0heU2jjejpQIK75K1KXcvwn15E6Kil_tJ6LBcYCu02O1H8_aooJGuoLw1vEzQn16h498YX9e2SA2IcVrJTkcCjL7YpF9fsAF3JEzGfsmmrpZPPVdxCn7g8dkGRcyulnHrNvBu4BFtub-URtf-nYCFIJHZ4k-ul9fDddquicFzCxQonx66-ZX5nbj6azHG65tAZntd6VFkRgihdxTvIpvTS4gfulQeKyShbiw-OCJNbzFdEnOKEMnsyqRjwG7iVrFEilFAMsvLJ14-lcuR5btIkUntIwlnsfUa2Ytk33znCfAFN0wYukdDvJe-V0nnNUFlOeLyYV0eEGisgC9dQQ1kFu3g',
encrypted_key:
'BAOlZ-VnbhQu4NOlTlDAVYwUJB-Q6YcWwnRNWK6YLSiHHlW4rN0qUzBJ3Rc2_y8nkasn8nUVGBzdq7OhdKKiLq4',
aad: 'VGhlIEZlbGxvd3NoaXAgb2YgdGhlIFJpbmc',
protected:
'eyJhbGciOiJIUEtFLTAiLCJraWQiOiJ5Q25mYm1ZTVpjV3JLRHRfRGpOZWJSQ0IxdnhWb3F2NHVtSjRXSzhSWWprIn0',
},
},
},
]
8 changes: 8 additions & 0 deletions docs/jwt/decrypt/interfaces/JWTDecryptOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ This option makes the JWT "iat" (Issued At) Claim presence required.

***

### psk?

• `optional` **psk**: [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)

HPKE Pre-Shared Key (PSK) for use in PSK mode.

***

### requiredClaims?

• `optional` **requiredClaims?**: `string`[]
Expand Down
32 changes: 20 additions & 12 deletions docs/types/interfaces/CompactJWEHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ JWE "alg" (Algorithm) Header Parameter

***

### enc

• **enc**: `string`

JWE "enc" (Encryption Algorithm) Header Parameter

#### See

[Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg)

***

### crit?

• `optional` **crit?**: `string`[]
Expand All @@ -54,6 +42,18 @@ JWE "crit" (Critical) Header Parameter

***

### enc?

• `optional` **enc**: `string`

JWE "enc" (Encryption Algorithm) Header Parameter

#### See

[Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg)

***

### jku?

• `optional` **jku?**: `string`
Expand All @@ -78,6 +78,14 @@ JWE "crit" (Critical) Header Parameter

***

### psk\_id?

• `optional` **psk\_id**: `string`

HPKE Pre-Shared Key Identifier (PSK ID) for use in PSK mode.

***

### typ?

• `optional` **typ?**: `string`
Expand Down
8 changes: 8 additions & 0 deletions docs/types/interfaces/DecryptOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ Set to `Infinity` to disable the decompressed size limit.
(PBES2 Key Management Algorithms only) Maximum allowed "p2c" (PBES2 Count) Header Parameter
value. The PBKDF2 iteration count defines the algorithm's computational expense. By default
this value is set to 10000.

***

### psk?

• `optional` **psk**: [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)

HPKE Pre-Shared Key (PSK) for use in PSK mode.
8 changes: 8 additions & 0 deletions docs/types/interfaces/JWEHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ JWE "enc" (Encryption Algorithm) Header Parameter

***

### psk\_id?

• `optional` **psk\_id**: `string`

HPKE Pre-Shared Key Identifier (PSK ID) for use in PSK mode.

***

### typ?

• `optional` **typ?**: `string`
Expand Down
16 changes: 16 additions & 0 deletions docs/types/interfaces/JWEKeyManagementHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,19 @@ You should not use this parameter. It is only intended for testing and vector

You should not use this parameter. It is only intended for testing and vector
validation purposes.

***

### psk?

• `optional` **psk**: [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)

HPKE Pre-Shared Key (PSK) for use in PSK mode.

***

### psk\_id?

• `optional` **psk\_id**: [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)

HPKE Pre-Shared Key Identifier (PSK ID) for use in PSK mode.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@
"ava": "^7.0.0",
"esbuild": "^0.27.4",
"glob": "^13.0.6",
"hpke": "^1.0.6",
"npm-run-all2": "^8.0.4",
"patch-package": "^8.0.1",
"prettier": "^3.8.1",
Expand Down
Loading
Loading