jose 4.8.3 → 4.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/browser/index.js +1 -1
- package/dist/browser/jwe/flattened/decrypt.js +3 -3
- package/dist/browser/jwk/thumbprint.js +7 -1
- package/dist/browser/jws/flattened/verify.js +1 -1
- package/dist/browser/lib/decrypt_key_management.js +4 -1
- package/dist/node/cjs/index.js +2 -1
- package/dist/node/cjs/jwe/flattened/decrypt.js +3 -3
- package/dist/node/cjs/jwk/thumbprint.js +9 -2
- package/dist/node/cjs/jws/flattened/verify.js +1 -1
- package/dist/node/cjs/lib/decrypt_key_management.js +4 -1
- package/dist/node/cjs/runtime/key_to_jwk.js +4 -0
- package/dist/node/esm/index.js +1 -1
- package/dist/node/esm/jwe/flattened/decrypt.js +3 -3
- package/dist/node/esm/jwk/thumbprint.js +7 -1
- package/dist/node/esm/jws/flattened/verify.js +1 -1
- package/dist/node/esm/lib/decrypt_key_management.js +4 -1
- package/dist/node/esm/runtime/key_to_jwk.js +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/jwe/compact/decrypt.d.ts +9 -7
- package/dist/types/jwe/compact/encrypt.d.ts +14 -20
- package/dist/types/jwe/flattened/decrypt.d.ts +12 -13
- package/dist/types/jwe/flattened/encrypt.d.ts +17 -26
- package/dist/types/jwe/general/decrypt.d.ts +13 -14
- package/dist/types/jwe/general/encrypt.d.ts +6 -15
- package/dist/types/jwk/embedded.d.ts +8 -7
- package/dist/types/jwk/thumbprint.d.ts +30 -7
- package/dist/types/jwks/local.d.ts +12 -15
- package/dist/types/jwks/remote.d.ts +22 -36
- package/dist/types/jws/compact/sign.d.ts +3 -6
- package/dist/types/jws/compact/verify.d.ts +11 -8
- package/dist/types/jws/flattened/sign.d.ts +3 -6
- package/dist/types/jws/flattened/verify.d.ts +12 -9
- package/dist/types/jws/general/sign.d.ts +7 -18
- package/dist/types/jws/general/verify.d.ts +14 -11
- package/dist/types/jwt/decrypt.d.ts +13 -12
- package/dist/types/jwt/encrypt.d.ts +15 -18
- package/dist/types/jwt/produce.d.ts +9 -14
- package/dist/types/jwt/sign.d.ts +2 -2
- package/dist/types/jwt/unsecured.d.ts +4 -4
- package/dist/types/jwt/verify.d.ts +15 -13
- package/dist/types/key/export.d.ts +13 -8
- package/dist/types/key/generate_key_pair.d.ts +14 -19
- package/dist/types/key/generate_secret.d.ts +3 -2
- package/dist/types/key/import.d.ts +50 -39
- package/dist/types/types.d.ts +203 -371
- package/dist/types/util/decode_jwt.d.ts +7 -6
- package/dist/types/util/decode_protected_header.d.ts +3 -2
- package/dist/types/util/errors.d.ts +20 -61
- package/package.json +4 -2
package/dist/types/types.d.ts
CHANGED
|
@@ -1,39 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* KeyLike are runtime-specific classes representing asymmetric keys or symmetric secrets.
|
|
3
|
-
*
|
|
4
|
-
* [
|
|
5
|
-
* [KeyObject](https://nodejs.org/api/crypto.html#crypto_class_keyobject)
|
|
6
|
-
* in Node.js runtime.
|
|
2
|
+
* KeyLike are runtime-specific classes representing asymmetric keys or symmetric secrets. These are
|
|
3
|
+
* instances of [CryptoKey](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) and
|
|
4
|
+
* additionally [KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) in Node.js runtime.
|
|
7
5
|
* [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
|
|
8
6
|
* instances are also accepted as symmetric secret representation only.
|
|
9
7
|
*
|
|
10
|
-
* [Key Import Functions](../modules/key_import.md#readme) can be used to import PEM,
|
|
11
|
-
*
|
|
8
|
+
* [Key Import Functions](../modules/key_import.md#readme) can be used to import PEM, or JWK
|
|
9
|
+
* formatted asymmetric keys and certificates to these runtime-specific representations.
|
|
12
10
|
*
|
|
13
|
-
* In Node.js the
|
|
14
|
-
*
|
|
15
|
-
* and so Buffer can be provided for symmetric secrets as well.
|
|
11
|
+
* In Node.js the [Buffer](https://nodejs.org/api/buffer.html#buffer) class is a subclass of
|
|
12
|
+
* Uint8Array and so Buffer can be provided for symmetric secrets as well.
|
|
16
13
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* [crypto.createPrivateKey](https://nodejs.org/api/crypto.html#crypto_crypto_createprivatekey_key), and
|
|
25
|
-
* [crypto.createSecretKey](https://nodejs.org/api/crypto.html#crypto_crypto_createsecretkey_key_encoding)
|
|
26
|
-
* to obtain a KeyObject from your existing key material.
|
|
14
|
+
* [KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) is a representation of a
|
|
15
|
+
* key/secret available in the Node.js runtime. In addition to the import functions of this library
|
|
16
|
+
* you may use the runtime APIs
|
|
17
|
+
* [crypto.createPublicKey](https://nodejs.org/api/crypto.html#cryptocreatepublickeykey),
|
|
18
|
+
* [crypto.createPrivateKey](https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey), and
|
|
19
|
+
* [crypto.createSecretKey](https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding) to
|
|
20
|
+
* obtain a KeyObject from your existing key material.
|
|
27
21
|
*
|
|
28
22
|
* [CryptoKey](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) is a representation of a
|
|
29
|
-
* key/secret available in the Browser and Deno runtimes.
|
|
30
|
-
*
|
|
31
|
-
* [SubtleCrypto.importKey](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey)
|
|
32
|
-
* to obtain a CryptoKey from your existing key material.
|
|
33
|
-
*
|
|
34
|
-
* ---
|
|
23
|
+
* key/secret available in the Browser and Deno runtimes. In addition to the import functions of
|
|
24
|
+
* this library you may use the
|
|
25
|
+
* [SubtleCrypto.importKey](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey)
|
|
26
|
+
* API to obtain a CryptoKey from your existing key material.
|
|
35
27
|
*
|
|
36
28
|
* @example Import a PEM-encoded SPKI Public Key
|
|
29
|
+
*
|
|
37
30
|
* ```js
|
|
38
31
|
* const algorithm = 'ES256'
|
|
39
32
|
* const spki = `-----BEGIN PUBLIC KEY-----
|
|
@@ -44,6 +37,7 @@
|
|
|
44
37
|
* ```
|
|
45
38
|
*
|
|
46
39
|
* @example Import a X.509 Certificate
|
|
40
|
+
*
|
|
47
41
|
* ```js
|
|
48
42
|
* const algorithm = 'ES256'
|
|
49
43
|
* const x509 = `-----BEGIN CERTIFICATE-----
|
|
@@ -60,6 +54,7 @@
|
|
|
60
54
|
* ```
|
|
61
55
|
*
|
|
62
56
|
* @example Import a PEM-encoded PKCS8 Private Key
|
|
57
|
+
*
|
|
63
58
|
* ```js
|
|
64
59
|
* const algorithm = 'ES256'
|
|
65
60
|
* const pkcs8 = `-----BEGIN PRIVATE KEY-----
|
|
@@ -71,53 +66,50 @@
|
|
|
71
66
|
* ```
|
|
72
67
|
*
|
|
73
68
|
* @example Import a JSON Web Key (JWK)
|
|
69
|
+
*
|
|
74
70
|
* ```js
|
|
75
|
-
* const ecPublicKey = await jose.importJWK(
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
71
|
+
* const ecPublicKey = await jose.importJWK(
|
|
72
|
+
* {
|
|
73
|
+
* crv: 'P-256',
|
|
74
|
+
* kty: 'EC',
|
|
75
|
+
* x: 'ySK38C1jBdLwDsNWKzzBHqKYEE5Cgv-qjWvorUXk9fw',
|
|
76
|
+
* y: '_LeQBw07cf5t57Iavn4j-BqJsAD1dpoz8gokd3sBsOo',
|
|
77
|
+
* },
|
|
78
|
+
* 'ES256',
|
|
79
|
+
* )
|
|
81
80
|
*
|
|
82
|
-
* const rsaPublicKey = await jose.importJWK(
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
81
|
+
* const rsaPublicKey = await jose.importJWK(
|
|
82
|
+
* {
|
|
83
|
+
* kty: 'RSA',
|
|
84
|
+
* e: 'AQAB',
|
|
85
|
+
* n: '12oBZRhCiZFJLcPg59LkZZ9mdhSMTKAQZYq32k_ti5SBB6jerkh-WzOMAO664r_qyLkqHUSp3u5SbXtseZEpN3XPWGKSxjsy-1JyEFTdLSYe6f9gfrmxkUF_7DTpq0gn6rntP05g2-wFW50YO7mosfdslfrTJYWHFhJALabAeYirYD7-9kqq9ebfFMF4sRRELbv9oi36As6Q9B3Qb5_C1rAzqfao_PCsf9EPsTZsVVVkA5qoIAr47lo1ipfiBPxUCCNSdvkmDTYgvvRm6ZoMjFbvOtgyts55fXKdMWv7I9HMD5HwE9uW839PWA514qhbcIsXEYSFMPMV6fnlsiZvQQ',
|
|
86
|
+
* },
|
|
87
|
+
* 'PS256',
|
|
88
|
+
* )
|
|
87
89
|
* ```
|
|
88
90
|
*/
|
|
89
91
|
export type KeyLike = { type: string }
|
|
90
92
|
|
|
91
93
|
/**
|
|
92
|
-
* JSON Web Key ([JWK](https://www.rfc-editor.org/rfc/rfc7517)).
|
|
93
|
-
*
|
|
94
|
+
* JSON Web Key ([JWK](https://www.rfc-editor.org/rfc/rfc7517)). "RSA", "EC", "OKP", and "oct" key
|
|
95
|
+
* types are supported.
|
|
94
96
|
*/
|
|
95
97
|
export interface JWK {
|
|
96
|
-
/**
|
|
97
|
-
* JWK "alg" (Algorithm) Parameter.
|
|
98
|
-
*/
|
|
98
|
+
/** JWK "alg" (Algorithm) Parameter. */
|
|
99
99
|
alg?: string
|
|
100
100
|
crv?: string
|
|
101
101
|
d?: string
|
|
102
102
|
dp?: string
|
|
103
103
|
dq?: string
|
|
104
104
|
e?: string
|
|
105
|
-
/**
|
|
106
|
-
* JWK "ext" (Extractable) Parameter.
|
|
107
|
-
*/
|
|
105
|
+
/** JWK "ext" (Extractable) Parameter. */
|
|
108
106
|
ext?: boolean
|
|
109
107
|
k?: string
|
|
110
|
-
/**
|
|
111
|
-
* JWK "key_ops" (Key Operations) Parameter.
|
|
112
|
-
*/
|
|
108
|
+
/** JWK "key_ops" (Key Operations) Parameter. */
|
|
113
109
|
key_ops?: string[]
|
|
114
|
-
/**
|
|
115
|
-
* JWK "kid" (Key ID) Parameter.
|
|
116
|
-
*/
|
|
110
|
+
/** JWK "kid" (Key ID) Parameter. */
|
|
117
111
|
kid?: string
|
|
118
|
-
/**
|
|
119
|
-
* JWK "kty" (Key Type) Parameter.
|
|
120
|
-
*/
|
|
112
|
+
/** JWK "kty" (Key Type) Parameter. */
|
|
121
113
|
kty?: string
|
|
122
114
|
n?: string
|
|
123
115
|
oth?: Array<{
|
|
@@ -128,35 +120,25 @@ export interface JWK {
|
|
|
128
120
|
p?: string
|
|
129
121
|
q?: string
|
|
130
122
|
qi?: string
|
|
131
|
-
/**
|
|
132
|
-
* JWK "use" (Public Key Use) Parameter.
|
|
133
|
-
*/
|
|
123
|
+
/** JWK "use" (Public Key Use) Parameter. */
|
|
134
124
|
use?: string
|
|
135
125
|
x?: string
|
|
136
126
|
y?: string
|
|
137
|
-
/**
|
|
138
|
-
* JWK "x5c" (X.509 Certificate Chain) Parameter.
|
|
139
|
-
*/
|
|
127
|
+
/** JWK "x5c" (X.509 Certificate Chain) Parameter. */
|
|
140
128
|
x5c?: string[]
|
|
141
|
-
/**
|
|
142
|
-
* JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter.
|
|
143
|
-
*/
|
|
129
|
+
/** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter. */
|
|
144
130
|
x5t?: string
|
|
145
|
-
/**
|
|
146
|
-
* "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter.
|
|
147
|
-
*/
|
|
131
|
+
/** "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter. */
|
|
148
132
|
'x5t#S256'?: string
|
|
149
|
-
/**
|
|
150
|
-
* JWK "x5u" (X.509 URL) Parameter.
|
|
151
|
-
*/
|
|
133
|
+
/** JWK "x5u" (X.509 URL) Parameter. */
|
|
152
134
|
x5u?: string
|
|
153
135
|
|
|
154
136
|
[propName: string]: unknown
|
|
155
137
|
}
|
|
156
138
|
|
|
157
139
|
/**
|
|
158
|
-
* Generic Interface for consuming operations dynamic key resolution.
|
|
159
|
-
*
|
|
140
|
+
* Generic Interface for consuming operations dynamic key resolution. No token components have been
|
|
141
|
+
* verified at the time of this function call.
|
|
160
142
|
*
|
|
161
143
|
* If you cannot match a key suitable for the token, throw an error instead.
|
|
162
144
|
*
|
|
@@ -168,65 +150,56 @@ export interface GetKeyFunction<T, T2> {
|
|
|
168
150
|
}
|
|
169
151
|
|
|
170
152
|
/**
|
|
171
|
-
* Flattened JWS definition for verify function inputs, allows payload as
|
|
172
|
-
*
|
|
153
|
+
* Flattened JWS definition for verify function inputs, allows payload as Uint8Array for detached
|
|
154
|
+
* signature validation.
|
|
173
155
|
*/
|
|
174
156
|
export interface FlattenedJWSInput {
|
|
175
157
|
/**
|
|
176
|
-
* The "header" member MUST be present and contain the value JWS
|
|
177
|
-
* Unprotected Header
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* Parameter values are not integrity protected.
|
|
158
|
+
* The "header" member MUST be present and contain the value JWS Unprotected Header when the JWS
|
|
159
|
+
* Unprotected Header value is non- empty; otherwise, it MUST be absent. This value is represented
|
|
160
|
+
* as an unencoded JSON object, rather than as a string. These Header Parameter values are not
|
|
161
|
+
* integrity protected.
|
|
181
162
|
*/
|
|
182
163
|
header?: JWSHeaderParameters
|
|
183
164
|
|
|
184
165
|
/**
|
|
185
|
-
* The "payload" member MUST be present and contain the value
|
|
186
|
-
*
|
|
187
|
-
* the value passed may also be a Uint8Array.
|
|
166
|
+
* The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When RFC7797
|
|
167
|
+
* "b64": false is used the value passed may also be a Uint8Array.
|
|
188
168
|
*/
|
|
189
169
|
payload: string | Uint8Array
|
|
190
170
|
|
|
191
171
|
/**
|
|
192
|
-
* The "protected" member MUST be present and contain the value
|
|
193
|
-
*
|
|
194
|
-
* Header value is non-empty; otherwise, it MUST be absent. These
|
|
172
|
+
* The "protected" member MUST be present and contain the value BASE64URL(UTF8(JWS Protected
|
|
173
|
+
* Header)) when the JWS Protected Header value is non-empty; otherwise, it MUST be absent. These
|
|
195
174
|
* Header Parameter values are integrity protected.
|
|
196
175
|
*/
|
|
197
176
|
protected?: string
|
|
198
177
|
|
|
199
|
-
/**
|
|
200
|
-
* The "signature" member MUST be present and contain the value
|
|
201
|
-
* BASE64URL(JWS Signature).
|
|
202
|
-
*/
|
|
178
|
+
/** The "signature" member MUST be present and contain the value BASE64URL(JWS Signature). */
|
|
203
179
|
signature: string
|
|
204
180
|
}
|
|
205
181
|
|
|
206
182
|
/**
|
|
207
|
-
* General JWS definition for verify function inputs, allows payload as
|
|
208
|
-
*
|
|
183
|
+
* General JWS definition for verify function inputs, allows payload as Uint8Array for detached
|
|
184
|
+
* signature validation.
|
|
209
185
|
*/
|
|
210
186
|
export interface GeneralJWSInput {
|
|
211
187
|
/**
|
|
212
|
-
* The "payload" member MUST be present and contain the value
|
|
213
|
-
*
|
|
214
|
-
* the value passed may also be a Uint8Array.
|
|
188
|
+
* The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When RFC7797
|
|
189
|
+
* "b64": false is used the value passed may also be a Uint8Array.
|
|
215
190
|
*/
|
|
216
191
|
payload: string | Uint8Array
|
|
217
192
|
|
|
218
193
|
/**
|
|
219
|
-
* The "signatures" member value MUST be an array of JSON objects.
|
|
220
|
-
*
|
|
221
|
-
* the JWS Protected Header.
|
|
194
|
+
* The "signatures" member value MUST be an array of JSON objects. Each object represents a
|
|
195
|
+
* signature or MAC over the JWS Payload and the JWS Protected Header.
|
|
222
196
|
*/
|
|
223
197
|
signatures: Omit<FlattenedJWSInput, 'payload'>[]
|
|
224
198
|
}
|
|
225
199
|
|
|
226
200
|
/**
|
|
227
|
-
* Flattened JWS definition. Payload is returned as an empty
|
|
228
|
-
*
|
|
229
|
-
* [RFC7797](https://www.rfc-editor.org/rfc/rfc7797) is used.
|
|
201
|
+
* Flattened JWS definition. Payload is returned as an empty string when JWS Unencoded Payload
|
|
202
|
+
* Option [RFC7797](https://www.rfc-editor.org/rfc/rfc7797) is used.
|
|
230
203
|
*/
|
|
231
204
|
export interface FlattenedJWS extends Partial<FlattenedJWSInput> {
|
|
232
205
|
payload: string
|
|
@@ -234,8 +207,7 @@ export interface FlattenedJWS extends Partial<FlattenedJWSInput> {
|
|
|
234
207
|
}
|
|
235
208
|
|
|
236
209
|
/**
|
|
237
|
-
* General JWS definition. Payload is returned as an empty
|
|
238
|
-
* string when JWS Unencoded Payload Option
|
|
210
|
+
* General JWS definition. Payload is returned as an empty string when JWS Unencoded Payload Option
|
|
239
211
|
* [RFC7797](https://www.rfc-editor.org/rfc/rfc7797) is used.
|
|
240
212
|
*/
|
|
241
213
|
export interface GeneralJWS {
|
|
@@ -244,167 +216,125 @@ export interface GeneralJWS {
|
|
|
244
216
|
}
|
|
245
217
|
|
|
246
218
|
export interface JoseHeaderParameters {
|
|
247
|
-
/**
|
|
248
|
-
* "kid" (Key ID) Header Parameter.
|
|
249
|
-
*/
|
|
219
|
+
/** "kid" (Key ID) Header Parameter. */
|
|
250
220
|
kid?: string
|
|
251
221
|
|
|
252
|
-
/**
|
|
253
|
-
* "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter.
|
|
254
|
-
*/
|
|
222
|
+
/** "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter. */
|
|
255
223
|
x5t?: string
|
|
256
224
|
|
|
257
|
-
/**
|
|
258
|
-
* "x5c" (X.509 Certificate Chain) Header Parameter.
|
|
259
|
-
*/
|
|
225
|
+
/** "x5c" (X.509 Certificate Chain) Header Parameter. */
|
|
260
226
|
x5c?: string[]
|
|
261
227
|
|
|
262
|
-
/**
|
|
263
|
-
* "x5u" (X.509 URL) Header Parameter.
|
|
264
|
-
*/
|
|
228
|
+
/** "x5u" (X.509 URL) Header Parameter. */
|
|
265
229
|
x5u?: string
|
|
266
230
|
|
|
267
|
-
/**
|
|
268
|
-
* "jku" (JWK Set URL) Header Parameter.
|
|
269
|
-
*/
|
|
231
|
+
/** "jku" (JWK Set URL) Header Parameter. */
|
|
270
232
|
jku?: string
|
|
271
233
|
|
|
272
|
-
/**
|
|
273
|
-
* "jwk" (JSON Web Key) Header Parameter.
|
|
274
|
-
*/
|
|
234
|
+
/** "jwk" (JSON Web Key) Header Parameter. */
|
|
275
235
|
jwk?: Pick<JWK, 'kty' | 'crv' | 'x' | 'y' | 'e' | 'n'>
|
|
276
236
|
|
|
277
|
-
/**
|
|
278
|
-
* "typ" (Type) Header Parameter.
|
|
279
|
-
*/
|
|
237
|
+
/** "typ" (Type) Header Parameter. */
|
|
280
238
|
typ?: string
|
|
281
239
|
|
|
282
|
-
/**
|
|
283
|
-
* "cty" (Content Type) Header Parameter.
|
|
284
|
-
*/
|
|
240
|
+
/** "cty" (Content Type) Header Parameter. */
|
|
285
241
|
cty?: string
|
|
286
242
|
}
|
|
287
243
|
|
|
288
|
-
/**
|
|
289
|
-
* Recognized JWS Header Parameters, any other Header Members
|
|
290
|
-
* may also be present.
|
|
291
|
-
*/
|
|
244
|
+
/** Recognized JWS Header Parameters, any other Header Members may also be present. */
|
|
292
245
|
export interface JWSHeaderParameters extends JoseHeaderParameters {
|
|
293
|
-
/**
|
|
294
|
-
* JWS "alg" (Algorithm) Header Parameter.
|
|
295
|
-
*/
|
|
246
|
+
/** JWS "alg" (Algorithm) Header Parameter. */
|
|
296
247
|
alg?: string
|
|
297
248
|
|
|
298
249
|
/**
|
|
299
|
-
* This JWS Extension Header Parameter modifies the JWS Payload
|
|
300
|
-
*
|
|
301
|
-
* [RFC7797](https://www.rfc-editor.org/rfc/rfc7797).
|
|
250
|
+
* This JWS Extension Header Parameter modifies the JWS Payload representation and the JWS Signing
|
|
251
|
+
* Input computation as per [RFC7797](https://www.rfc-editor.org/rfc/rfc7797).
|
|
302
252
|
*/
|
|
303
253
|
b64?: boolean
|
|
304
254
|
|
|
305
|
-
/**
|
|
306
|
-
* JWS "crit" (Critical) Header Parameter.
|
|
307
|
-
*/
|
|
255
|
+
/** JWS "crit" (Critical) Header Parameter. */
|
|
308
256
|
crit?: string[]
|
|
309
257
|
|
|
310
|
-
/**
|
|
311
|
-
* Any other JWS Header member.
|
|
312
|
-
*/
|
|
258
|
+
/** Any other JWS Header member. */
|
|
313
259
|
[propName: string]: unknown
|
|
314
260
|
}
|
|
315
261
|
|
|
316
|
-
/**
|
|
317
|
-
* Recognized JWE Key Management-related Header Parameters.
|
|
318
|
-
*/
|
|
262
|
+
/** Recognized JWE Key Management-related Header Parameters. */
|
|
319
263
|
export interface JWEKeyManagementHeaderParameters {
|
|
320
264
|
apu?: Uint8Array
|
|
321
265
|
apv?: Uint8Array
|
|
322
266
|
/**
|
|
323
|
-
* @deprecated You should not use this parameter. It is only really intended
|
|
324
|
-
*
|
|
267
|
+
* @deprecated You should not use this parameter. It is only really intended for test and vector
|
|
268
|
+
* validation purposes.
|
|
325
269
|
*/
|
|
326
270
|
p2c?: number
|
|
327
271
|
/**
|
|
328
|
-
* @deprecated You should not use this parameter. It is only really intended
|
|
329
|
-
*
|
|
272
|
+
* @deprecated You should not use this parameter. It is only really intended for test and vector
|
|
273
|
+
* validation purposes.
|
|
330
274
|
*/
|
|
331
275
|
p2s?: Uint8Array
|
|
332
276
|
/**
|
|
333
|
-
* @deprecated You should not use this parameter. It is only really intended
|
|
334
|
-
*
|
|
277
|
+
* @deprecated You should not use this parameter. It is only really intended for test and vector
|
|
278
|
+
* validation purposes.
|
|
335
279
|
*/
|
|
336
280
|
iv?: Uint8Array
|
|
337
281
|
/**
|
|
338
|
-
* @deprecated You should not use this parameter. It is only really intended
|
|
339
|
-
*
|
|
282
|
+
* @deprecated You should not use this parameter. It is only really intended for test and vector
|
|
283
|
+
* validation purposes.
|
|
340
284
|
*/
|
|
341
285
|
epk?: KeyLike
|
|
342
286
|
}
|
|
343
287
|
|
|
344
|
-
/**
|
|
345
|
-
* Flattened JWE definition.
|
|
346
|
-
*/
|
|
288
|
+
/** Flattened JWE definition. */
|
|
347
289
|
export interface FlattenedJWE {
|
|
348
290
|
/**
|
|
349
|
-
* The "aad" member MUST be present and contain the value
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
* supply a base64url-encoded value to be integrity protected but not
|
|
353
|
-
* encrypted.
|
|
291
|
+
* The "aad" member MUST be present and contain the value BASE64URL(JWE AAD)) when the JWE AAD
|
|
292
|
+
* value is non-empty; otherwise, it MUST be absent. A JWE AAD value can be included to supply a
|
|
293
|
+
* base64url-encoded value to be integrity protected but not encrypted.
|
|
354
294
|
*/
|
|
355
295
|
aad?: string
|
|
356
296
|
|
|
357
|
-
/**
|
|
358
|
-
* The "ciphertext" member MUST be present and contain the value
|
|
359
|
-
* BASE64URL(JWE Ciphertext).
|
|
360
|
-
*/
|
|
297
|
+
/** The "ciphertext" member MUST be present and contain the value BASE64URL(JWE Ciphertext). */
|
|
361
298
|
ciphertext: string
|
|
362
299
|
|
|
363
300
|
/**
|
|
364
|
-
* The "encrypted_key" member MUST be present and contain the value
|
|
365
|
-
*
|
|
366
|
-
* non-empty; otherwise, it MUST be absent.
|
|
301
|
+
* The "encrypted_key" member MUST be present and contain the value BASE64URL(JWE Encrypted Key)
|
|
302
|
+
* when the JWE Encrypted Key value is non-empty; otherwise, it MUST be absent.
|
|
367
303
|
*/
|
|
368
304
|
encrypted_key?: string
|
|
369
305
|
|
|
370
306
|
/**
|
|
371
|
-
* The "header" member MUST be present and contain the value JWE Per-
|
|
372
|
-
* Recipient Unprotected Header
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* rather than as a string. These Header Parameter values are not
|
|
376
|
-
* integrity protected.
|
|
307
|
+
* The "header" member MUST be present and contain the value JWE Per- Recipient Unprotected Header
|
|
308
|
+
* when the JWE Per-Recipient Unprotected Header value is non-empty; otherwise, it MUST be absent.
|
|
309
|
+
* This value is represented as an unencoded JSON object, rather than as a string. These Header
|
|
310
|
+
* Parameter values are not integrity protected.
|
|
377
311
|
*/
|
|
378
312
|
header?: JWEHeaderParameters
|
|
379
313
|
|
|
380
314
|
/**
|
|
381
|
-
* The "iv" member MUST be present and contain the value
|
|
382
|
-
*
|
|
383
|
-
* Vector value is non-empty; otherwise, it MUST be absent.
|
|
315
|
+
* The "iv" member MUST be present and contain the value BASE64URL(JWE Initialization Vector) when
|
|
316
|
+
* the JWE Initialization Vector value is non-empty; otherwise, it MUST be absent.
|
|
384
317
|
*/
|
|
385
318
|
iv: string
|
|
386
319
|
|
|
387
320
|
/**
|
|
388
|
-
* The "protected" member MUST be present and contain the value
|
|
389
|
-
*
|
|
390
|
-
* Header value is non-empty; otherwise, it MUST be absent. These
|
|
321
|
+
* The "protected" member MUST be present and contain the value BASE64URL(UTF8(JWE Protected
|
|
322
|
+
* Header)) when the JWE Protected Header value is non-empty; otherwise, it MUST be absent. These
|
|
391
323
|
* Header Parameter values are integrity protected.
|
|
392
324
|
*/
|
|
393
325
|
protected?: string
|
|
394
326
|
|
|
395
327
|
/**
|
|
396
|
-
* The "tag" member MUST be present and contain the value
|
|
397
|
-
*
|
|
398
|
-
* value is non-empty; otherwise, it MUST be absent.
|
|
328
|
+
* The "tag" member MUST be present and contain the value BASE64URL(JWE Authentication Tag) when
|
|
329
|
+
* the JWE Authentication Tag value is non-empty; otherwise, it MUST be absent.
|
|
399
330
|
*/
|
|
400
331
|
tag: string
|
|
401
332
|
|
|
402
333
|
/**
|
|
403
|
-
* The "unprotected" member MUST be present and contain the value JWE
|
|
404
|
-
* Shared Unprotected Header
|
|
405
|
-
* value is
|
|
406
|
-
*
|
|
407
|
-
* These Header Parameter values are not integrity protected.
|
|
334
|
+
* The "unprotected" member MUST be present and contain the value JWE Shared Unprotected Header
|
|
335
|
+
* when the JWE Shared Unprotected Header value is non-empty; otherwise, it MUST be absent. This
|
|
336
|
+
* value is represented as an unencoded JSON object, rather than as a string. These Header
|
|
337
|
+
* Parameter values are not integrity protected.
|
|
408
338
|
*/
|
|
409
339
|
unprotected?: JWEHeaderParameters
|
|
410
340
|
}
|
|
@@ -413,358 +343,260 @@ export interface GeneralJWE extends Omit<FlattenedJWE, 'encrypted_key' | 'header
|
|
|
413
343
|
recipients: Pick<FlattenedJWE, 'encrypted_key' | 'header'>[]
|
|
414
344
|
}
|
|
415
345
|
|
|
416
|
-
/**
|
|
417
|
-
* Recognized JWE Header Parameters, any other Header members
|
|
418
|
-
* may also be present.
|
|
419
|
-
*/
|
|
346
|
+
/** Recognized JWE Header Parameters, any other Header members may also be present. */
|
|
420
347
|
export interface JWEHeaderParameters extends JoseHeaderParameters {
|
|
421
|
-
/**
|
|
422
|
-
* JWE "alg" (Algorithm) Header Parameter.
|
|
423
|
-
*/
|
|
348
|
+
/** JWE "alg" (Algorithm) Header Parameter. */
|
|
424
349
|
alg?: string
|
|
425
350
|
|
|
426
|
-
/**
|
|
427
|
-
* JWE "enc" (Encryption Algorithm) Header Parameter.
|
|
428
|
-
*/
|
|
351
|
+
/** JWE "enc" (Encryption Algorithm) Header Parameter. */
|
|
429
352
|
enc?: string
|
|
430
353
|
|
|
431
|
-
/**
|
|
432
|
-
* JWE "crit" (Critical) Header Parameter.
|
|
433
|
-
*/
|
|
354
|
+
/** JWE "crit" (Critical) Header Parameter. */
|
|
434
355
|
crit?: string[]
|
|
435
356
|
|
|
436
|
-
/**
|
|
437
|
-
* JWE "zip" (Compression Algorithm) Header Parameter.
|
|
438
|
-
*/
|
|
357
|
+
/** JWE "zip" (Compression Algorithm) Header Parameter. */
|
|
439
358
|
zip?: string
|
|
440
359
|
|
|
441
|
-
/**
|
|
442
|
-
* Any other JWE Header member.
|
|
443
|
-
*/
|
|
360
|
+
/** Any other JWE Header member. */
|
|
444
361
|
[propName: string]: unknown
|
|
445
362
|
}
|
|
446
363
|
|
|
447
|
-
/**
|
|
448
|
-
* Shared Interface with a "crit" property for all sign, verify, encrypt and decrypt
|
|
449
|
-
* operations.
|
|
450
|
-
*/
|
|
364
|
+
/** Shared Interface with a "crit" property for all sign, verify, encrypt and decrypt operations. */
|
|
451
365
|
export interface CritOption {
|
|
452
366
|
/**
|
|
453
|
-
* An object with keys representing recognized "crit" (Critical) Header Parameter
|
|
454
|
-
*
|
|
455
|
-
*
|
|
367
|
+
* An object with keys representing recognized "crit" (Critical) Header Parameter names. The value
|
|
368
|
+
* for those is either `true` or `false`. `true` when the Header Parameter MUST be integrity
|
|
369
|
+
* protected, `false` when it's irrelevant.
|
|
456
370
|
*
|
|
457
|
-
* This makes the "Extension Header Parameter "${parameter}" is not recognized"
|
|
458
|
-
* error go away.
|
|
371
|
+
* This makes the "Extension Header Parameter "${parameter}" is not recognized" error go away.
|
|
459
372
|
*
|
|
460
|
-
* Use this when a given JWS/JWT/JWE profile requires the use of proprietary
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
* profile's validation steps after the operation succeeds.
|
|
373
|
+
* Use this when a given JWS/JWT/JWE profile requires the use of proprietary non-registered "crit"
|
|
374
|
+
* (Critical) Header Parameters. This will only make sure the Header Parameter is syntactically
|
|
375
|
+
* correct when provided and that it is optionally integrity protected. It will not process the
|
|
376
|
+
* Header Parameter in any way or reject the operation if it is missing. You MUST still verify the
|
|
377
|
+
* Header Parameter was present and process it according to the profile's validation steps after
|
|
378
|
+
* the operation succeeds.
|
|
467
379
|
*
|
|
468
|
-
* The JWS extension Header Parameter `b64` is always recognized and processed
|
|
469
|
-
*
|
|
470
|
-
* default built-in treatment are currently available.
|
|
380
|
+
* The JWS extension Header Parameter `b64` is always recognized and processed properly. No other
|
|
381
|
+
* registered Header Parameters that need this kind of default built-in treatment are currently available.
|
|
471
382
|
*/
|
|
472
383
|
crit?: {
|
|
473
384
|
[propName: string]: boolean
|
|
474
385
|
}
|
|
475
386
|
}
|
|
476
387
|
|
|
477
|
-
/**
|
|
478
|
-
* JWE Decryption options.
|
|
479
|
-
*/
|
|
388
|
+
/** JWE Decryption options. */
|
|
480
389
|
export interface DecryptOptions extends CritOption {
|
|
481
|
-
/**
|
|
482
|
-
* A list of accepted JWE "alg" (Algorithm) Header Parameter values.
|
|
483
|
-
*/
|
|
390
|
+
/** A list of accepted JWE "alg" (Algorithm) Header Parameter values. */
|
|
484
391
|
keyManagementAlgorithms?: string[]
|
|
485
392
|
|
|
486
393
|
/**
|
|
487
|
-
* A list of accepted JWE "enc" (Encryption Algorithm) Header Parameter values.
|
|
488
|
-
*
|
|
489
|
-
* key/secret are allowed.
|
|
394
|
+
* A list of accepted JWE "enc" (Encryption Algorithm) Header Parameter values. By default all
|
|
395
|
+
* "enc" (Encryption Algorithm) values applicable for the used key/secret are allowed.
|
|
490
396
|
*/
|
|
491
397
|
contentEncryptionAlgorithms?: string[]
|
|
492
398
|
|
|
493
399
|
/**
|
|
494
|
-
* In a browser runtime you have to provide an implementation for Inflate Raw
|
|
495
|
-
*
|
|
400
|
+
* In a browser runtime you have to provide an implementation for Inflate Raw when you expect JWEs
|
|
401
|
+
* with compressed plaintext.
|
|
496
402
|
*/
|
|
497
403
|
inflateRaw?: InflateFunction
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* (PBES2 Key Management Algorithms only) Maximum allowed "p2c" (PBES2 Count) Header Parameter
|
|
407
|
+
* value. The PBKDF2 iteration count defines the algorithm's computational expense. By default
|
|
408
|
+
* this value is set to 10000.
|
|
409
|
+
*/
|
|
410
|
+
maxPBES2Count?: number
|
|
498
411
|
}
|
|
499
412
|
|
|
500
|
-
/**
|
|
501
|
-
* JWE Deflate option.
|
|
502
|
-
*/
|
|
413
|
+
/** JWE Deflate option. */
|
|
503
414
|
export interface DeflateOption {
|
|
504
415
|
/**
|
|
505
|
-
* In a browser runtime you have to provide an implementation for Deflate Raw
|
|
506
|
-
*
|
|
416
|
+
* In a browser runtime you have to provide an implementation for Deflate Raw when you will be
|
|
417
|
+
* producing JWEs with compressed plaintext.
|
|
507
418
|
*/
|
|
508
419
|
deflateRaw?: DeflateFunction
|
|
509
420
|
}
|
|
510
421
|
|
|
511
|
-
/**
|
|
512
|
-
* JWE Encryption options.
|
|
513
|
-
*/
|
|
422
|
+
/** JWE Encryption options. */
|
|
514
423
|
export interface EncryptOptions extends CritOption, DeflateOption {}
|
|
515
424
|
|
|
516
|
-
/**
|
|
517
|
-
* JWT Claims Set verification options.
|
|
518
|
-
*/
|
|
425
|
+
/** JWT Claims Set verification options. */
|
|
519
426
|
export interface JWTClaimVerificationOptions {
|
|
520
|
-
/**
|
|
521
|
-
* Expected JWT "aud" (Audience) Claim value(s).
|
|
522
|
-
*/
|
|
427
|
+
/** Expected JWT "aud" (Audience) Claim value(s). */
|
|
523
428
|
audience?: string | string[]
|
|
524
429
|
|
|
525
430
|
/**
|
|
526
431
|
* Expected clock tolerance
|
|
527
|
-
*
|
|
528
|
-
* -
|
|
432
|
+
*
|
|
433
|
+
* - In seconds when number (e.g. 5)
|
|
434
|
+
* - Parsed as seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
|
|
529
435
|
*/
|
|
530
436
|
clockTolerance?: string | number
|
|
531
437
|
|
|
532
|
-
/**
|
|
533
|
-
* Expected JWT "iss" (Issuer) Claim value(s).
|
|
534
|
-
*/
|
|
438
|
+
/** Expected JWT "iss" (Issuer) Claim value(s). */
|
|
535
439
|
issuer?: string | string[]
|
|
536
440
|
|
|
537
441
|
/**
|
|
538
442
|
* Maximum time elapsed (in seconds) from the JWT "iat" (Issued At) Claim value.
|
|
539
|
-
*
|
|
540
|
-
* -
|
|
443
|
+
*
|
|
444
|
+
* - In seconds when number (e.g. 5)
|
|
445
|
+
* - Parsed as seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
|
|
541
446
|
*/
|
|
542
447
|
maxTokenAge?: string | number
|
|
543
448
|
|
|
544
|
-
/**
|
|
545
|
-
* Expected JWT "sub" (Subject) Claim value.
|
|
546
|
-
*/
|
|
449
|
+
/** Expected JWT "sub" (Subject) Claim value. */
|
|
547
450
|
subject?: string
|
|
548
451
|
|
|
549
|
-
/**
|
|
550
|
-
* Expected JWT "typ" (Type) Header Parameter value.
|
|
551
|
-
*/
|
|
452
|
+
/** Expected JWT "typ" (Type) Header Parameter value. */
|
|
552
453
|
typ?: string
|
|
553
454
|
|
|
554
|
-
/**
|
|
555
|
-
* Date to use when comparing NumericDate claims, defaults to `new Date()`.
|
|
556
|
-
*/
|
|
455
|
+
/** Date to use when comparing NumericDate claims, defaults to `new Date()`. */
|
|
557
456
|
currentDate?: Date
|
|
558
457
|
}
|
|
559
458
|
|
|
560
|
-
/**
|
|
561
|
-
* JWS Verification options.
|
|
562
|
-
*/
|
|
459
|
+
/** JWS Verification options. */
|
|
563
460
|
export interface VerifyOptions extends CritOption {
|
|
564
461
|
/**
|
|
565
|
-
* A list of accepted JWS "alg" (Algorithm) Header Parameter values.
|
|
566
|
-
*
|
|
567
|
-
* key/secret are allowed. Note: "none" is never accepted.
|
|
462
|
+
* A list of accepted JWS "alg" (Algorithm) Header Parameter values. By default all "alg"
|
|
463
|
+
* (Algorithm) values applicable for the used key/secret are allowed. Note: "none" is never accepted.
|
|
568
464
|
*/
|
|
569
465
|
algorithms?: string[]
|
|
570
466
|
}
|
|
571
467
|
|
|
572
|
-
/**
|
|
573
|
-
* JWS Signing options.
|
|
574
|
-
*/
|
|
468
|
+
/** JWS Signing options. */
|
|
575
469
|
export interface SignOptions extends CritOption {}
|
|
576
470
|
|
|
577
|
-
/**
|
|
578
|
-
* Recognized JWT Claims Set members, any other members
|
|
579
|
-
* may also be present.
|
|
580
|
-
*/
|
|
471
|
+
/** Recognized JWT Claims Set members, any other members may also be present. */
|
|
581
472
|
export interface JWTPayload {
|
|
582
|
-
/**
|
|
583
|
-
* JWT Issuer - [RFC7519#section-4.1.1](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.1).
|
|
584
|
-
*/
|
|
473
|
+
/** JWT Issuer - [RFC7519#section-4.1.1](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.1). */
|
|
585
474
|
iss?: string
|
|
586
475
|
|
|
587
|
-
/**
|
|
588
|
-
* JWT Subject - [RFC7519#section-4.1.2](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.2).
|
|
589
|
-
*/
|
|
476
|
+
/** JWT Subject - [RFC7519#section-4.1.2](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.2). */
|
|
590
477
|
sub?: string
|
|
591
478
|
|
|
592
|
-
/**
|
|
593
|
-
* JWT Audience [RFC7519#section-4.1.3](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.3).
|
|
594
|
-
*/
|
|
479
|
+
/** JWT Audience [RFC7519#section-4.1.3](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.3). */
|
|
595
480
|
aud?: string | string[]
|
|
596
481
|
|
|
597
|
-
/**
|
|
598
|
-
* JWT ID - [RFC7519#section-4.1.7](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.7).
|
|
599
|
-
*/
|
|
482
|
+
/** JWT ID - [RFC7519#section-4.1.7](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.7). */
|
|
600
483
|
jti?: string
|
|
601
484
|
|
|
602
|
-
/**
|
|
603
|
-
* JWT Not Before - [RFC7519#section-4.1.5](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.5).
|
|
604
|
-
*/
|
|
485
|
+
/** JWT Not Before - [RFC7519#section-4.1.5](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.5). */
|
|
605
486
|
nbf?: number
|
|
606
487
|
|
|
607
|
-
/**
|
|
608
|
-
* JWT Expiration Time - [RFC7519#section-4.1.4](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4).
|
|
609
|
-
*/
|
|
488
|
+
/** JWT Expiration Time - [RFC7519#section-4.1.4](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4). */
|
|
610
489
|
exp?: number
|
|
611
490
|
|
|
612
|
-
/**
|
|
613
|
-
* JWT Issued At - [RFC7519#section-4.1.6](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6).
|
|
614
|
-
*/
|
|
491
|
+
/** JWT Issued At - [RFC7519#section-4.1.6](https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6). */
|
|
615
492
|
iat?: number
|
|
616
493
|
|
|
617
|
-
/**
|
|
618
|
-
* Any other JWT Claim Set member.
|
|
619
|
-
*/
|
|
494
|
+
/** Any other JWT Claim Set member. */
|
|
620
495
|
[propName: string]: unknown
|
|
621
496
|
}
|
|
622
497
|
|
|
623
498
|
/**
|
|
624
|
-
* Deflate Raw implementation, e.g. promisified
|
|
499
|
+
* Deflate Raw implementation, e.g. promisified
|
|
500
|
+
* [zlib.deflateRaw](https://nodejs.org/api/zlib.html#zlibdeflaterawbuffer-options-callback).
|
|
625
501
|
*/
|
|
626
502
|
export interface DeflateFunction {
|
|
627
503
|
(input: Uint8Array): Promise<Uint8Array>
|
|
628
504
|
}
|
|
629
505
|
|
|
630
506
|
/**
|
|
631
|
-
* Inflate Raw implementation, e.g. promisified
|
|
507
|
+
* Inflate Raw implementation, e.g. promisified
|
|
508
|
+
* [zlib.inflateRaw](https://nodejs.org/api/zlib.html#zlibinflaterawbuffer-options-callback).
|
|
632
509
|
*/
|
|
633
510
|
export interface InflateFunction {
|
|
634
511
|
(input: Uint8Array): Promise<Uint8Array>
|
|
635
512
|
}
|
|
636
513
|
|
|
637
514
|
export interface FlattenedDecryptResult {
|
|
638
|
-
/**
|
|
639
|
-
* JWE AAD.
|
|
640
|
-
*/
|
|
515
|
+
/** JWE AAD. */
|
|
641
516
|
additionalAuthenticatedData?: Uint8Array
|
|
642
517
|
|
|
643
|
-
/**
|
|
644
|
-
* Plaintext.
|
|
645
|
-
*/
|
|
518
|
+
/** Plaintext. */
|
|
646
519
|
plaintext: Uint8Array
|
|
647
520
|
|
|
648
|
-
/**
|
|
649
|
-
* JWE Protected Header.
|
|
650
|
-
*/
|
|
521
|
+
/** JWE Protected Header. */
|
|
651
522
|
protectedHeader?: JWEHeaderParameters
|
|
652
523
|
|
|
653
|
-
/**
|
|
654
|
-
* JWE Shared Unprotected Header.
|
|
655
|
-
*/
|
|
524
|
+
/** JWE Shared Unprotected Header. */
|
|
656
525
|
sharedUnprotectedHeader?: JWEHeaderParameters
|
|
657
526
|
|
|
658
|
-
/**
|
|
659
|
-
* JWE Per-Recipient Unprotected Header.
|
|
660
|
-
*/
|
|
527
|
+
/** JWE Per-Recipient Unprotected Header. */
|
|
661
528
|
unprotectedHeader?: JWEHeaderParameters
|
|
662
529
|
}
|
|
663
530
|
|
|
664
531
|
export interface GeneralDecryptResult extends FlattenedDecryptResult {}
|
|
665
532
|
|
|
666
533
|
export interface CompactDecryptResult {
|
|
667
|
-
/**
|
|
668
|
-
* Plaintext.
|
|
669
|
-
*/
|
|
534
|
+
/** Plaintext. */
|
|
670
535
|
plaintext: Uint8Array
|
|
671
536
|
|
|
672
|
-
/**
|
|
673
|
-
* JWE Protected Header.
|
|
674
|
-
*/
|
|
537
|
+
/** JWE Protected Header. */
|
|
675
538
|
protectedHeader: CompactJWEHeaderParameters
|
|
676
539
|
}
|
|
677
540
|
|
|
678
541
|
export interface FlattenedVerifyResult {
|
|
679
|
-
/**
|
|
680
|
-
* JWS Payload.
|
|
681
|
-
*/
|
|
542
|
+
/** JWS Payload. */
|
|
682
543
|
payload: Uint8Array
|
|
683
544
|
|
|
684
|
-
/**
|
|
685
|
-
* JWS Protected Header.
|
|
686
|
-
*/
|
|
545
|
+
/** JWS Protected Header. */
|
|
687
546
|
protectedHeader?: JWSHeaderParameters
|
|
688
547
|
|
|
689
|
-
/**
|
|
690
|
-
* JWS Unprotected Header.
|
|
691
|
-
*/
|
|
548
|
+
/** JWS Unprotected Header. */
|
|
692
549
|
unprotectedHeader?: JWSHeaderParameters
|
|
693
550
|
}
|
|
694
551
|
|
|
695
552
|
export interface GeneralVerifyResult extends FlattenedVerifyResult {}
|
|
696
553
|
|
|
697
554
|
export interface CompactVerifyResult {
|
|
698
|
-
/**
|
|
699
|
-
* JWS Payload.
|
|
700
|
-
*/
|
|
555
|
+
/** JWS Payload. */
|
|
701
556
|
payload: Uint8Array
|
|
702
557
|
|
|
703
|
-
/**
|
|
704
|
-
* JWS Protected Header.
|
|
705
|
-
*/
|
|
558
|
+
/** JWS Protected Header. */
|
|
706
559
|
protectedHeader: CompactJWSHeaderParameters
|
|
707
560
|
}
|
|
708
561
|
|
|
709
562
|
export interface JWTVerifyResult {
|
|
710
|
-
/**
|
|
711
|
-
* JWT Claims Set.
|
|
712
|
-
*/
|
|
563
|
+
/** JWT Claims Set. */
|
|
713
564
|
payload: JWTPayload
|
|
714
565
|
|
|
715
|
-
/**
|
|
716
|
-
* JWS Protected Header.
|
|
717
|
-
*/
|
|
566
|
+
/** JWS Protected Header. */
|
|
718
567
|
protectedHeader: JWTHeaderParameters
|
|
719
568
|
}
|
|
720
569
|
|
|
721
570
|
export interface JWTDecryptResult {
|
|
722
|
-
/**
|
|
723
|
-
* JWT Claims Set.
|
|
724
|
-
*/
|
|
571
|
+
/** JWT Claims Set. */
|
|
725
572
|
payload: JWTPayload
|
|
726
573
|
|
|
727
|
-
/**
|
|
728
|
-
* JWE Protected Header.
|
|
729
|
-
*/
|
|
574
|
+
/** JWE Protected Header. */
|
|
730
575
|
protectedHeader: CompactJWEHeaderParameters
|
|
731
576
|
}
|
|
732
577
|
|
|
733
578
|
export interface ResolvedKey {
|
|
734
|
-
/**
|
|
735
|
-
* Key resolved from the key resolver function.
|
|
736
|
-
*/
|
|
579
|
+
/** Key resolved from the key resolver function. */
|
|
737
580
|
key: KeyLike | Uint8Array
|
|
738
581
|
}
|
|
739
582
|
|
|
740
|
-
/**
|
|
741
|
-
* Recognized Compact JWS Header Parameters, any other Header Members
|
|
742
|
-
* may also be present.
|
|
743
|
-
*/
|
|
583
|
+
/** Recognized Compact JWS Header Parameters, any other Header Members may also be present. */
|
|
744
584
|
export interface CompactJWSHeaderParameters extends JWSHeaderParameters {
|
|
745
585
|
alg: string
|
|
746
586
|
}
|
|
747
587
|
|
|
748
|
-
/**
|
|
749
|
-
* Recognized Signed JWT Header Parameters, any other Header Members
|
|
750
|
-
* may also be present.
|
|
751
|
-
*/
|
|
588
|
+
/** Recognized Signed JWT Header Parameters, any other Header Members may also be present. */
|
|
752
589
|
export interface JWTHeaderParameters extends CompactJWSHeaderParameters {
|
|
753
590
|
b64?: true
|
|
754
591
|
}
|
|
755
592
|
|
|
756
|
-
/**
|
|
757
|
-
* Recognized Compact JWE Header Parameters, any other Header Members
|
|
758
|
-
* may also be present.
|
|
759
|
-
*/
|
|
593
|
+
/** Recognized Compact JWE Header Parameters, any other Header Members may also be present. */
|
|
760
594
|
export interface CompactJWEHeaderParameters extends JWEHeaderParameters {
|
|
761
595
|
alg: string
|
|
762
596
|
enc: string
|
|
763
597
|
}
|
|
764
598
|
|
|
765
|
-
/**
|
|
766
|
-
* JSON Web Key Set
|
|
767
|
-
*/
|
|
599
|
+
/** JSON Web Key Set */
|
|
768
600
|
export interface JSONWebKeySet {
|
|
769
601
|
keys: JWK[]
|
|
770
602
|
}
|