tshex-cli 1.0.25 → 1.0.26
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/docs/generated-file-reference.md +35 -5
- package/docs/library-structure.md +23 -4
- package/docs/library-types.md +45 -3
- package/docs/shared/application/http.md +216 -67
- package/docs/shared/application/loggers.md +48 -24
- package/package.json +1 -1
- package/templates/lib/shared/application/http/http.ts +76 -0
- package/templates/lib/shared/application/http/json-api.ts +611 -0
- package/templates/lib/shared/application/http/json-web-token.ts +980 -0
- package/templates/lib/shared/application/http/opengraph.ts +533 -0
- package/templates/lib/shared/application/loggers.ts +25 -0
- package/templates/lib/types/cldr.d.ts +770 -0
- package/templates/lib/types/iana.d.ts +423 -0
- package/templates/lib/types/json.d.ts +9 -0
- package/templates/lib/types/objects.d.ts +1 -0
- package/templates/lib/index.d.ts +0 -1
- package/templates/lib/shared/application/http.ts +0 -35
|
@@ -0,0 +1,980 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue } from '../../../types/json'
|
|
2
|
+
import type { Generic } from '../../../types/objects'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @see
|
|
6
|
+
* - RFC 7515: JSON Web Signature (JWS)
|
|
7
|
+
* - RFC 7516: JSON Web Encryption (JWE)
|
|
8
|
+
* - RFC 7517: JSON Web Key (JWK)
|
|
9
|
+
* - RFC 7518: JSON Web Algorithms (JWA)
|
|
10
|
+
* - RFC 7519: JSON Web Token (JWT)
|
|
11
|
+
* - RFC 7638: JWK Thumbprint
|
|
12
|
+
* - RFC 7797: JWS Unencoded Payload Option
|
|
13
|
+
* - RFC 7800: Proof-of-Possession Key Semantics
|
|
14
|
+
* - RFC 8037: CFRG Curves for JOSE
|
|
15
|
+
* - RFC 8725: JWT Best Current Practices
|
|
16
|
+
* - RFC 8812: secp256k1 for JOSE
|
|
17
|
+
* - RFC 9068: JWT Profile for OAuth 2.0 Access Tokens
|
|
18
|
+
* - RFC 9278: JWK Thumbprint URI
|
|
19
|
+
* - RFC 9396: Rich Authorization Requests
|
|
20
|
+
* - RFC 9449: DPoP
|
|
21
|
+
* - RFC 9864: Fully-Specified Algorithms for JOSE and COSE
|
|
22
|
+
* - RFC 9901: Selective Disclosure for JWTs
|
|
23
|
+
* - RFC 9964: ML-DSA for JOSE and COSE
|
|
24
|
+
*
|
|
25
|
+
* Registry coverage:
|
|
26
|
+
* - IANA JOSE registries, updated 2026-05-22
|
|
27
|
+
* - IANA JWT registries, updated 2026-07-20
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/* -------------------------------------------------------------------------- */
|
|
31
|
+
/* JSON primitives and branded wire values */
|
|
32
|
+
/* -------------------------------------------------------------------------- */
|
|
33
|
+
|
|
34
|
+
export type Base64Url = string & {
|
|
35
|
+
readonly __base64UrlBrand: unique symbol
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type Base64 = string & {
|
|
39
|
+
readonly __base64Brand: unique symbol
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type NumericDate = number & {
|
|
43
|
+
readonly __numericDateBrand: unique symbol
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type StringOrURI = string & {
|
|
47
|
+
readonly __stringOrUriBrand: unique symbol
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type UriString = string & {
|
|
51
|
+
readonly __uriBrand: unique symbol
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type MediaType = string & {
|
|
55
|
+
readonly __mediaTypeBrand: unique symbol
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type KeyId = string & {
|
|
59
|
+
readonly __keyIdBrand: unique symbol
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type BinaryData = ArrayBuffer | Uint8Array
|
|
63
|
+
|
|
64
|
+
/* -------------------------------------------------------------------------- */
|
|
65
|
+
/* IANA JOSE algorithm registry */
|
|
66
|
+
/* -------------------------------------------------------------------------- */
|
|
67
|
+
|
|
68
|
+
/** Algorithms used by the JWS "alg" protected-header parameter. */
|
|
69
|
+
export type JwsAlgorithm =
|
|
70
|
+
| 'HS256'
|
|
71
|
+
| 'HS384'
|
|
72
|
+
| 'HS512'
|
|
73
|
+
| 'RS256'
|
|
74
|
+
| 'RS384'
|
|
75
|
+
| 'RS512'
|
|
76
|
+
| 'ES256'
|
|
77
|
+
| 'ES384'
|
|
78
|
+
| 'ES512'
|
|
79
|
+
| 'PS256'
|
|
80
|
+
| 'PS384'
|
|
81
|
+
| 'PS512'
|
|
82
|
+
| 'none'
|
|
83
|
+
| 'EdDSA'
|
|
84
|
+
| 'ES256K'
|
|
85
|
+
| 'ML-DSA-44'
|
|
86
|
+
| 'ML-DSA-65'
|
|
87
|
+
| 'ML-DSA-87'
|
|
88
|
+
| 'Ed25519'
|
|
89
|
+
| 'Ed448'
|
|
90
|
+
|
|
91
|
+
/** Fully-specified signature identifiers. */
|
|
92
|
+
export type FullySpecifiedJwsAlgorithm = Exclude<JwsAlgorithm, 'EdDSA'> | 'Ed25519' | 'Ed448'
|
|
93
|
+
|
|
94
|
+
/** Polymorphic identifier deprecated by RFC 9864. */
|
|
95
|
+
export type DeprecatedJwsAlgorithm = 'EdDSA'
|
|
96
|
+
|
|
97
|
+
/** Algorithms used by the JWE "alg" key-management parameter. */
|
|
98
|
+
export type JweKeyManagementAlgorithm =
|
|
99
|
+
| 'RSA1_5'
|
|
100
|
+
| 'RSA-OAEP'
|
|
101
|
+
| 'RSA-OAEP-256'
|
|
102
|
+
| 'RSA-OAEP-384'
|
|
103
|
+
| 'RSA-OAEP-512'
|
|
104
|
+
| 'A128KW'
|
|
105
|
+
| 'A192KW'
|
|
106
|
+
| 'A256KW'
|
|
107
|
+
| 'dir'
|
|
108
|
+
| 'ECDH-ES'
|
|
109
|
+
| 'ECDH-ES+A128KW'
|
|
110
|
+
| 'ECDH-ES+A192KW'
|
|
111
|
+
| 'ECDH-ES+A256KW'
|
|
112
|
+
| 'A128GCMKW'
|
|
113
|
+
| 'A192GCMKW'
|
|
114
|
+
| 'A256GCMKW'
|
|
115
|
+
| 'PBES2-HS256+A128KW'
|
|
116
|
+
| 'PBES2-HS384+A192KW'
|
|
117
|
+
| 'PBES2-HS512+A256KW'
|
|
118
|
+
|
|
119
|
+
/** Algorithms used by the JWE "enc" content-encryption parameter. */
|
|
120
|
+
export type JweContentEncryptionAlgorithm =
|
|
121
|
+
'A128CBC-HS256' | 'A192CBC-HS384' | 'A256CBC-HS512' | 'A128GCM' | 'A192GCM' | 'A256GCM'
|
|
122
|
+
|
|
123
|
+
/** Identifiers registered only for use as JWK "alg" values. */
|
|
124
|
+
export type JwkOnlyAlgorithm =
|
|
125
|
+
'RS1' | 'A128CBC' | 'A192CBC' | 'A256CBC' | 'A128CTR' | 'A192CTR' | 'A256CTR' | 'HS1'
|
|
126
|
+
|
|
127
|
+
export type ProhibitedJwkAlgorithm = JwkOnlyAlgorithm
|
|
128
|
+
|
|
129
|
+
export type JoseAlgorithm =
|
|
130
|
+
JwsAlgorithm | JweKeyManagementAlgorithm | JweContentEncryptionAlgorithm | JwkOnlyAlgorithm
|
|
131
|
+
|
|
132
|
+
export type JweCompressionAlgorithm = 'DEF'
|
|
133
|
+
|
|
134
|
+
export type HashAlgorithm = 'sha-256' | 'sha-384' | 'sha-512' | (string & {})
|
|
135
|
+
|
|
136
|
+
/* -------------------------------------------------------------------------- */
|
|
137
|
+
/* JSON Web Key */
|
|
138
|
+
/* -------------------------------------------------------------------------- */
|
|
139
|
+
|
|
140
|
+
export type JwkKeyType = 'EC' | 'RSA' | 'oct' | 'OKP' | 'AKP'
|
|
141
|
+
|
|
142
|
+
export type EcCurve = 'P-256' | 'P-384' | 'P-521' | 'secp256k1'
|
|
143
|
+
|
|
144
|
+
export type OkpCurve = 'Ed25519' | 'Ed448' | 'X25519' | 'X448'
|
|
145
|
+
|
|
146
|
+
export type MldsaAlgorithm = 'ML-DSA-44' | 'ML-DSA-65' | 'ML-DSA-87'
|
|
147
|
+
|
|
148
|
+
export type JwkUse = 'sig' | 'enc'
|
|
149
|
+
|
|
150
|
+
export type JwkOperation =
|
|
151
|
+
'sign' | 'verify' | 'encrypt' | 'decrypt' | 'wrapKey' | 'unwrapKey' | 'deriveKey' | 'deriveBits'
|
|
152
|
+
|
|
153
|
+
export type JwkRevocationProperties = Generic<JsonValue> & {
|
|
154
|
+
revoked_at?: NumericDate
|
|
155
|
+
reason?: string
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface JwkCommonParameters {
|
|
159
|
+
/** Key type. */
|
|
160
|
+
kty: JwkKeyType
|
|
161
|
+
/** Intended public-key use. */
|
|
162
|
+
use?: JwkUse
|
|
163
|
+
/** Permitted operations. */
|
|
164
|
+
key_ops?: JwkOperation[]
|
|
165
|
+
/** Intended algorithm. */
|
|
166
|
+
alg?: JoseAlgorithm
|
|
167
|
+
/** Key identifier. */
|
|
168
|
+
kid?: KeyId | string
|
|
169
|
+
/** URL for an X.509 certificate or certificate chain. */
|
|
170
|
+
x5u?: UriString | string
|
|
171
|
+
/** Base64-encoded DER X.509 certificate chain. */
|
|
172
|
+
x5c?: Base64[]
|
|
173
|
+
/** SHA-1 X.509 certificate thumbprint. */
|
|
174
|
+
x5t?: Base64Url
|
|
175
|
+
/** SHA-256 X.509 certificate thumbprint. */
|
|
176
|
+
'x5t#S256'?: Base64Url
|
|
177
|
+
/** WebCrypto extractability flag registered for JWK use. */
|
|
178
|
+
ext?: boolean
|
|
179
|
+
/** Key issue time registered by OpenID Federation. */
|
|
180
|
+
iat?: NumericDate
|
|
181
|
+
/** Key activation time registered by OpenID Federation. */
|
|
182
|
+
nbf?: NumericDate
|
|
183
|
+
/** Key expiration time registered by OpenID Federation. */
|
|
184
|
+
exp?: NumericDate
|
|
185
|
+
/** Revocation properties registered by OpenID Federation. */
|
|
186
|
+
revoked?: JwkRevocationProperties | boolean
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface EcPublicJwk extends JwkCommonParameters {
|
|
190
|
+
kty: 'EC'
|
|
191
|
+
crv: EcCurve
|
|
192
|
+
x: Base64Url
|
|
193
|
+
y: Base64Url
|
|
194
|
+
d?: never
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface EcPrivateJwk extends JwkCommonParameters {
|
|
198
|
+
kty: 'EC'
|
|
199
|
+
crv: EcCurve
|
|
200
|
+
x: Base64Url
|
|
201
|
+
y: Base64Url
|
|
202
|
+
d: Base64Url
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface RsaOtherPrimeInfo {
|
|
206
|
+
r: Base64Url
|
|
207
|
+
d: Base64Url
|
|
208
|
+
t: Base64Url
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface RsaPublicJwk extends JwkCommonParameters {
|
|
212
|
+
kty: 'RSA'
|
|
213
|
+
n: Base64Url
|
|
214
|
+
e: Base64Url
|
|
215
|
+
d?: never
|
|
216
|
+
p?: never
|
|
217
|
+
q?: never
|
|
218
|
+
dp?: never
|
|
219
|
+
dq?: never
|
|
220
|
+
qi?: never
|
|
221
|
+
oth?: never
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface RsaPrivateJwk extends JwkCommonParameters {
|
|
225
|
+
kty: 'RSA'
|
|
226
|
+
n: Base64Url
|
|
227
|
+
e: Base64Url
|
|
228
|
+
d: Base64Url
|
|
229
|
+
p?: Base64Url
|
|
230
|
+
q?: Base64Url
|
|
231
|
+
dp?: Base64Url
|
|
232
|
+
dq?: Base64Url
|
|
233
|
+
qi?: Base64Url
|
|
234
|
+
oth?: RsaOtherPrimeInfo[]
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface OctJwk extends JwkCommonParameters {
|
|
238
|
+
kty: 'oct'
|
|
239
|
+
k: Base64Url
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface OkpPublicJwk extends JwkCommonParameters {
|
|
243
|
+
kty: 'OKP'
|
|
244
|
+
crv: OkpCurve
|
|
245
|
+
x: Base64Url
|
|
246
|
+
d?: never
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface OkpPrivateJwk extends JwkCommonParameters {
|
|
250
|
+
kty: 'OKP'
|
|
251
|
+
crv: OkpCurve
|
|
252
|
+
x: Base64Url
|
|
253
|
+
d: Base64Url
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export interface AkpPublicJwk extends JwkCommonParameters {
|
|
257
|
+
kty: 'AKP'
|
|
258
|
+
alg: MldsaAlgorithm
|
|
259
|
+
pub: Base64Url
|
|
260
|
+
priv?: never
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface AkpPrivateJwk extends JwkCommonParameters {
|
|
264
|
+
kty: 'AKP'
|
|
265
|
+
alg: MldsaAlgorithm
|
|
266
|
+
pub: Base64Url
|
|
267
|
+
priv: Base64Url
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export type PublicJwk = EcPublicJwk | RsaPublicJwk | OkpPublicJwk | AkpPublicJwk
|
|
271
|
+
|
|
272
|
+
export type PrivateJwk = EcPrivateJwk | RsaPrivateJwk | OctJwk | OkpPrivateJwk | AkpPrivateJwk
|
|
273
|
+
|
|
274
|
+
export type JsonWebKey = PublicJwk | PrivateJwk
|
|
275
|
+
|
|
276
|
+
export interface JsonWebKeySet {
|
|
277
|
+
keys: JsonWebKey[]
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export type PublicJsonWebKeySet = {
|
|
281
|
+
keys: PublicJwk[]
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export type JwkThumbprint = Base64Url
|
|
285
|
+
|
|
286
|
+
export type JwkThumbprintUri = `urn:ietf:params:oauth:jwk-thumbprint:${string}:${string}`
|
|
287
|
+
|
|
288
|
+
/* -------------------------------------------------------------------------- */
|
|
289
|
+
/* JOSE header parameters */
|
|
290
|
+
/* -------------------------------------------------------------------------- */
|
|
291
|
+
|
|
292
|
+
export interface JoseCommonHeaderParameters {
|
|
293
|
+
/** URL for the JWK Set containing the key used to secure the object. */
|
|
294
|
+
jku?: UriString | string
|
|
295
|
+
/** Public key used to secure the object. */
|
|
296
|
+
jwk?: PublicJwk
|
|
297
|
+
/** Key identifier. */
|
|
298
|
+
kid?: KeyId | string
|
|
299
|
+
/** URL for an X.509 certificate or certificate chain. */
|
|
300
|
+
x5u?: UriString | string
|
|
301
|
+
/** Base64-encoded DER X.509 certificate chain. */
|
|
302
|
+
x5c?: Base64[]
|
|
303
|
+
/** SHA-1 certificate thumbprint. */
|
|
304
|
+
x5t?: Base64Url
|
|
305
|
+
/** SHA-256 certificate thumbprint. */
|
|
306
|
+
'x5t#S256'?: Base64Url
|
|
307
|
+
/** Type of the complete JOSE object, commonly "JWT". */
|
|
308
|
+
typ?: MediaType | string
|
|
309
|
+
/** Media type of the secured payload, commonly "JWT" for nesting. */
|
|
310
|
+
cty?: MediaType | string
|
|
311
|
+
/** Header parameters that must be understood and processed. */
|
|
312
|
+
crit?: string[]
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export interface JwsHeaderParameters extends JoseCommonHeaderParameters {
|
|
316
|
+
alg: JwsAlgorithm
|
|
317
|
+
/** RFC 7797: whether the payload is base64url encoded. Defaults to true. */
|
|
318
|
+
b64?: boolean
|
|
319
|
+
/** PASSporT extension identifier. */
|
|
320
|
+
ppt?: string
|
|
321
|
+
/** ACME URL header parameter. */
|
|
322
|
+
url?: UriString | string
|
|
323
|
+
/** Nonce registered for JWS/JWE use. */
|
|
324
|
+
nonce?: string
|
|
325
|
+
/** Signature Validation Token. */
|
|
326
|
+
svt?: string
|
|
327
|
+
/** Header containing a JWT. */
|
|
328
|
+
jwt?: CompactJwt
|
|
329
|
+
/** OAuth Client Identifier. */
|
|
330
|
+
client_id?: string
|
|
331
|
+
/** OpenID Federation trust chain. */
|
|
332
|
+
trust_chain?: CompactJwt[]
|
|
333
|
+
/** OpenID Federation peer trust chain. */
|
|
334
|
+
peer_trust_chain?: CompactJwt[]
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export interface JweHeaderParameters extends JoseCommonHeaderParameters {
|
|
338
|
+
alg: JweKeyManagementAlgorithm
|
|
339
|
+
enc: JweContentEncryptionAlgorithm
|
|
340
|
+
zip?: JweCompressionAlgorithm
|
|
341
|
+
epk?: PublicJwk
|
|
342
|
+
apu?: Base64Url
|
|
343
|
+
apv?: Base64Url
|
|
344
|
+
/** AES-GCM key-wrap initialization vector. */
|
|
345
|
+
iv?: Base64Url
|
|
346
|
+
/** AES-GCM key-wrap authentication tag. */
|
|
347
|
+
tag?: Base64Url
|
|
348
|
+
p2s?: Base64Url
|
|
349
|
+
p2c?: number
|
|
350
|
+
/** Replicated JWT issuer claim for encrypted JWTs. */
|
|
351
|
+
iss?: StringOrURI | string
|
|
352
|
+
/** Replicated JWT subject claim for encrypted JWTs. */
|
|
353
|
+
sub?: StringOrURI | string
|
|
354
|
+
/** Replicated JWT audience claim for encrypted JWTs. */
|
|
355
|
+
aud?: StringOrURI | string | Array<StringOrURI | string>
|
|
356
|
+
/** ACME URL header parameter. */
|
|
357
|
+
url?: UriString | string
|
|
358
|
+
/** Nonce registered for JWS/JWE use. */
|
|
359
|
+
nonce?: string
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export type JwsHeader<CustomHeader extends object = Record<never, never>> = JwsHeaderParameters &
|
|
363
|
+
CustomHeader
|
|
364
|
+
|
|
365
|
+
export type JweHeader<CustomHeader extends object = Record<never, never>> = JweHeaderParameters &
|
|
366
|
+
CustomHeader
|
|
367
|
+
|
|
368
|
+
export type JoseHeader = JwsHeaderParameters | JweHeaderParameters
|
|
369
|
+
|
|
370
|
+
/* -------------------------------------------------------------------------- */
|
|
371
|
+
/* JWS serializations */
|
|
372
|
+
/* -------------------------------------------------------------------------- */
|
|
373
|
+
|
|
374
|
+
export type CompactJws = `${string}.${string}.${string}` & {
|
|
375
|
+
readonly __compactJwsBrand: unique symbol
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export type UnsecuredCompactJws = `${string}.${string}.` & {
|
|
379
|
+
readonly __unsecuredCompactJwsBrand: unique symbol
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface JwsSignature<Header extends JwsHeaderParameters = JwsHeaderParameters> {
|
|
383
|
+
protected?: Base64Url
|
|
384
|
+
header?: Partial<Header>
|
|
385
|
+
signature: Base64Url
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface GeneralJwsJsonSerialization<
|
|
389
|
+
Header extends JwsHeaderParameters = JwsHeaderParameters,
|
|
390
|
+
Payload extends string = Base64Url
|
|
391
|
+
> {
|
|
392
|
+
payload: Payload
|
|
393
|
+
signatures: Array<JwsSignature<Header>>
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface FlattenedJwsJsonSerialization<
|
|
397
|
+
Header extends JwsHeaderParameters = JwsHeaderParameters,
|
|
398
|
+
Payload extends string = Base64Url
|
|
399
|
+
> extends JwsSignature<Header> {
|
|
400
|
+
payload: Payload
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export interface DetachedJwsSignature<Header extends JwsHeaderParameters = JwsHeaderParameters> {
|
|
404
|
+
protected?: Base64Url
|
|
405
|
+
header?: Partial<Header>
|
|
406
|
+
signature: Base64Url
|
|
407
|
+
payload?: never
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export type JwsJsonSerialization<
|
|
411
|
+
Header extends JwsHeaderParameters = JwsHeaderParameters,
|
|
412
|
+
Payload extends string = Base64Url
|
|
413
|
+
> = GeneralJwsJsonSerialization<Header, Payload> | FlattenedJwsJsonSerialization<Header, Payload>
|
|
414
|
+
|
|
415
|
+
/* -------------------------------------------------------------------------- */
|
|
416
|
+
/* JWE serializations */
|
|
417
|
+
/* -------------------------------------------------------------------------- */
|
|
418
|
+
|
|
419
|
+
export type CompactJwe = `${string}.${string}.${string}.${string}.${string}` & {
|
|
420
|
+
readonly __compactJweBrand: unique symbol
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export interface JweRecipient<Header extends JweHeaderParameters = JweHeaderParameters> {
|
|
424
|
+
header?: Partial<Header>
|
|
425
|
+
encrypted_key: Base64Url
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export interface JweJsonSharedMembers<Header extends JweHeaderParameters = JweHeaderParameters> {
|
|
429
|
+
protected?: Base64Url
|
|
430
|
+
unprotected?: Partial<Header>
|
|
431
|
+
aad?: Base64Url
|
|
432
|
+
iv: Base64Url
|
|
433
|
+
ciphertext: Base64Url
|
|
434
|
+
tag: Base64Url
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export interface GeneralJweJsonSerialization<
|
|
438
|
+
Header extends JweHeaderParameters = JweHeaderParameters
|
|
439
|
+
> extends JweJsonSharedMembers<Header> {
|
|
440
|
+
recipients: Array<JweRecipient<Header>>
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export interface FlattenedJweJsonSerialization<
|
|
444
|
+
Header extends JweHeaderParameters = JweHeaderParameters
|
|
445
|
+
>
|
|
446
|
+
extends JweJsonSharedMembers<Header>, JweRecipient<Header> {
|
|
447
|
+
recipients?: never
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export type JweJsonSerialization<Header extends JweHeaderParameters = JweHeaderParameters> =
|
|
451
|
+
GeneralJweJsonSerialization<Header> | FlattenedJweJsonSerialization<Header>
|
|
452
|
+
|
|
453
|
+
/* -------------------------------------------------------------------------- */
|
|
454
|
+
/* JWT claims */
|
|
455
|
+
/* -------------------------------------------------------------------------- */
|
|
456
|
+
|
|
457
|
+
export type JwtAudience = StringOrURI | string | Array<StringOrURI | string>
|
|
458
|
+
|
|
459
|
+
/** The seven registered claim names defined directly by RFC 7519. */
|
|
460
|
+
export interface JwtRegisteredClaims {
|
|
461
|
+
/** Issuer. */
|
|
462
|
+
iss?: StringOrURI | string
|
|
463
|
+
/** Subject. */
|
|
464
|
+
sub?: StringOrURI | string
|
|
465
|
+
/** Audience. */
|
|
466
|
+
aud?: JwtAudience
|
|
467
|
+
/** Expiration time. */
|
|
468
|
+
exp?: NumericDate
|
|
469
|
+
/** Not-before time. */
|
|
470
|
+
nbf?: NumericDate
|
|
471
|
+
/** Issued-at time. */
|
|
472
|
+
iat?: NumericDate
|
|
473
|
+
/** JWT identifier. */
|
|
474
|
+
jti?: string
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export interface OidcAddressClaim {
|
|
478
|
+
formatted?: string
|
|
479
|
+
street_address?: string
|
|
480
|
+
locality?: string
|
|
481
|
+
region?: string
|
|
482
|
+
postal_code?: string
|
|
483
|
+
country?: string
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export type JwtActorClaim = Generic<JsonValue> & {
|
|
487
|
+
iss?: StringOrURI | string
|
|
488
|
+
sub?: StringOrURI | string
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export type JwtConfirmationClaim = Generic<JsonValue> & {
|
|
492
|
+
jwk?: PublicJwk
|
|
493
|
+
jwe?: CompactJwe
|
|
494
|
+
kid?: KeyId | string
|
|
495
|
+
jku?: UriString | string
|
|
496
|
+
'x5t#S256'?: Base64Url
|
|
497
|
+
osc?: JsonObject
|
|
498
|
+
jkt?: JwkThumbprint
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export type AuthorizationDetail = Generic<JsonValue> & {
|
|
502
|
+
type: string
|
|
503
|
+
locations?: Array<UriString | string>
|
|
504
|
+
actions?: string[]
|
|
505
|
+
datatypes?: string[]
|
|
506
|
+
identifier?: string
|
|
507
|
+
privileges?: string[]
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export interface DistributedClaimSource {
|
|
511
|
+
endpoint?: UriString | string
|
|
512
|
+
access_token?: string
|
|
513
|
+
JWT?: CompactJwt
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export interface AggregatedClaimSource {
|
|
517
|
+
JWT: CompactJwt
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export type ClaimSource = DistributedClaimSource | AggregatedClaimSource
|
|
521
|
+
|
|
522
|
+
export type JwtStatusReference = Generic<JsonValue> & {
|
|
523
|
+
status_list?: JsonObject
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Every currently registered IANA JWT claim name is represented here.
|
|
528
|
+
* Reusable claims have concrete types. Domain-specific claims remain JsonValue.
|
|
529
|
+
*/
|
|
530
|
+
export interface IanaRegisteredJwtClaims extends JwtRegisteredClaims {
|
|
531
|
+
name?: string
|
|
532
|
+
given_name?: string
|
|
533
|
+
family_name?: string
|
|
534
|
+
middle_name?: string
|
|
535
|
+
nickname?: string
|
|
536
|
+
preferred_username?: string
|
|
537
|
+
profile?: UriString | string
|
|
538
|
+
picture?: UriString | string
|
|
539
|
+
website?: UriString | string
|
|
540
|
+
email?: string
|
|
541
|
+
email_verified?: boolean
|
|
542
|
+
gender?: string
|
|
543
|
+
birthdate?: string
|
|
544
|
+
zoneinfo?: string
|
|
545
|
+
locale?: string
|
|
546
|
+
phone_number?: string
|
|
547
|
+
phone_number_verified?: boolean
|
|
548
|
+
address?: OidcAddressClaim
|
|
549
|
+
updated_at?: NumericDate
|
|
550
|
+
azp?: string
|
|
551
|
+
nonce?: string
|
|
552
|
+
auth_time?: NumericDate
|
|
553
|
+
at_hash?: Base64Url
|
|
554
|
+
c_hash?: Base64Url
|
|
555
|
+
acr?: StringOrURI | string
|
|
556
|
+
amr?: string[]
|
|
557
|
+
sub_jwk?: PublicJwk
|
|
558
|
+
cnf?: JwtConfirmationClaim
|
|
559
|
+
|
|
560
|
+
sip_from_tag?: string
|
|
561
|
+
sip_date?: string
|
|
562
|
+
sip_callid?: string
|
|
563
|
+
sip_cseq_num?: number
|
|
564
|
+
sip_via_branch?: string
|
|
565
|
+
orig?: JsonValue
|
|
566
|
+
dest?: JsonValue
|
|
567
|
+
mky?: JsonValue
|
|
568
|
+
events?: JsonObject
|
|
569
|
+
toe?: NumericDate
|
|
570
|
+
txn?: string
|
|
571
|
+
rph?: JsonValue
|
|
572
|
+
sid?: string
|
|
573
|
+
vot?: string
|
|
574
|
+
vtm?: UriString | string
|
|
575
|
+
attest?: string
|
|
576
|
+
origid?: string
|
|
577
|
+
act?: JwtActorClaim
|
|
578
|
+
scope?: string | string[]
|
|
579
|
+
client_id?: string
|
|
580
|
+
may_act?: JwtActorClaim
|
|
581
|
+
jcard?: JsonValue
|
|
582
|
+
at_use_nbr?: number
|
|
583
|
+
div?: JsonValue
|
|
584
|
+
opt?: JsonValue
|
|
585
|
+
vc?: JsonObject
|
|
586
|
+
vp?: JsonObject
|
|
587
|
+
sph?: string
|
|
588
|
+
ace_profile?: StringOrURI | string
|
|
589
|
+
cnonce?: Base64Url | string
|
|
590
|
+
exi?: number
|
|
591
|
+
roles?: string[]
|
|
592
|
+
groups?: string[]
|
|
593
|
+
entitlements?: string[]
|
|
594
|
+
token_introspection?: JsonObject
|
|
595
|
+
|
|
596
|
+
eat_nonce?: Base64Url | Base64Url[]
|
|
597
|
+
ueid?: Base64Url
|
|
598
|
+
sueids?: Base64Url[]
|
|
599
|
+
oemid?: JsonValue
|
|
600
|
+
hwmodel?: JsonValue
|
|
601
|
+
hwversion?: JsonValue
|
|
602
|
+
oemboot?: boolean
|
|
603
|
+
dbgstat?: JsonValue
|
|
604
|
+
location?: JsonValue
|
|
605
|
+
eat_profile?: StringOrURI | string
|
|
606
|
+
submods?: JsonObject
|
|
607
|
+
uptime?: number
|
|
608
|
+
bootcount?: number
|
|
609
|
+
bootseed?: Base64Url
|
|
610
|
+
dloas?: JsonValue
|
|
611
|
+
swname?: string
|
|
612
|
+
swversion?: string
|
|
613
|
+
manifests?: JsonValue
|
|
614
|
+
measurements?: JsonValue
|
|
615
|
+
measres?: JsonValue
|
|
616
|
+
intuse?: JsonValue
|
|
617
|
+
|
|
618
|
+
cdniv?: number
|
|
619
|
+
cdnicrit?: string[]
|
|
620
|
+
cdniip?: string
|
|
621
|
+
cdniuc?: JsonObject
|
|
622
|
+
cdniets?: number
|
|
623
|
+
cdnistt?: number
|
|
624
|
+
cdnistd?: number
|
|
625
|
+
sig_val_claims?: JsonObject
|
|
626
|
+
|
|
627
|
+
authorization_details?: AuthorizationDetail[]
|
|
628
|
+
verified_claims?: JsonObject
|
|
629
|
+
place_of_birth?: JsonObject
|
|
630
|
+
nationalities?: string[]
|
|
631
|
+
birth_family_name?: string
|
|
632
|
+
birth_given_name?: string
|
|
633
|
+
birth_middle_name?: string
|
|
634
|
+
salutation?: string
|
|
635
|
+
title?: string
|
|
636
|
+
msisdn?: string
|
|
637
|
+
also_known_as?: string
|
|
638
|
+
|
|
639
|
+
htm?: string
|
|
640
|
+
htu?: UriString | string
|
|
641
|
+
ath?: Base64Url
|
|
642
|
+
atc?: string
|
|
643
|
+
sub_id?: JsonValue
|
|
644
|
+
rcd?: JsonValue
|
|
645
|
+
rcdi?: JsonValue
|
|
646
|
+
crn?: string
|
|
647
|
+
msgi?: JsonValue
|
|
648
|
+
|
|
649
|
+
_claim_names?: Record<string, string>
|
|
650
|
+
_claim_sources?: Record<string, ClaimSource>
|
|
651
|
+
rdap_allowed_purposes?: string[]
|
|
652
|
+
rdap_dnt_allowed?: boolean
|
|
653
|
+
geohash?: string | string[]
|
|
654
|
+
|
|
655
|
+
/** RFC 9901 digests for selectively disclosable object properties. */
|
|
656
|
+
_sd?: Base64Url[]
|
|
657
|
+
/** RFC 9901 array-element digest placeholder. */
|
|
658
|
+
'...'?: Base64Url
|
|
659
|
+
/** RFC 9901 digest algorithm. */
|
|
660
|
+
_sd_alg?: HashAlgorithm
|
|
661
|
+
/** RFC 9901 key-binding hash. */
|
|
662
|
+
sd_hash?: Base64Url
|
|
663
|
+
|
|
664
|
+
consumerPlmnId?: JsonValue
|
|
665
|
+
consumerSnpnId?: JsonValue
|
|
666
|
+
producerPlmnId?: JsonValue
|
|
667
|
+
producerSnpnId?: JsonValue
|
|
668
|
+
producerSnssaiList?: JsonValue
|
|
669
|
+
producerNsiList?: JsonValue
|
|
670
|
+
producerNfSetId?: string
|
|
671
|
+
producerNfServiceSetId?: string
|
|
672
|
+
sourceNfInstanceId?: string
|
|
673
|
+
analyticsIdList?: JsonValue
|
|
674
|
+
resOwnerId?: string
|
|
675
|
+
|
|
676
|
+
cmw?: JsonValue
|
|
677
|
+
jwks?: JsonWebKeySet
|
|
678
|
+
metadata?: JsonObject
|
|
679
|
+
constraints?: JsonObject
|
|
680
|
+
crit?: string[]
|
|
681
|
+
ref?: string
|
|
682
|
+
delegation?: JsonValue
|
|
683
|
+
logo_uri?: UriString | string
|
|
684
|
+
authority_hints?: Array<StringOrURI | string>
|
|
685
|
+
trust_anchor_hints?: Array<StringOrURI | string>
|
|
686
|
+
trust_marks?: JsonValue
|
|
687
|
+
trust_mark_issuers?: JsonValue
|
|
688
|
+
trust_mark_owners?: JsonValue
|
|
689
|
+
metadata_policy?: JsonObject
|
|
690
|
+
metadata_policy_crit?: string[]
|
|
691
|
+
source_endpoint?: UriString | string
|
|
692
|
+
keys?: JsonWebKey[]
|
|
693
|
+
trust_mark_type?: StringOrURI | string
|
|
694
|
+
trust_chain?: CompactJwt[]
|
|
695
|
+
trust_anchor?: StringOrURI | string
|
|
696
|
+
|
|
697
|
+
status?: JwtStatusReference
|
|
698
|
+
status_list?: JsonObject
|
|
699
|
+
ttl?: number
|
|
700
|
+
stpl?: string
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export type JwtClaims<CustomClaims extends object = Record<never, never>> =
|
|
704
|
+
IanaRegisteredJwtClaims & CustomClaims
|
|
705
|
+
|
|
706
|
+
/* -------------------------------------------------------------------------- */
|
|
707
|
+
/* Common standardized JWT profiles */
|
|
708
|
+
/* -------------------------------------------------------------------------- */
|
|
709
|
+
|
|
710
|
+
export interface OpenIdConnectIdTokenClaims extends JwtRegisteredClaims {
|
|
711
|
+
iss: StringOrURI | string
|
|
712
|
+
sub: StringOrURI | string
|
|
713
|
+
aud: JwtAudience
|
|
714
|
+
exp: NumericDate
|
|
715
|
+
iat: NumericDate
|
|
716
|
+
auth_time?: NumericDate
|
|
717
|
+
nonce?: string
|
|
718
|
+
acr?: StringOrURI | string
|
|
719
|
+
amr?: string[]
|
|
720
|
+
azp?: string
|
|
721
|
+
at_hash?: Base64Url
|
|
722
|
+
c_hash?: Base64Url
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
export interface OAuth2JwtAccessTokenClaims extends JwtRegisteredClaims {
|
|
726
|
+
iss: StringOrURI | string
|
|
727
|
+
exp: NumericDate
|
|
728
|
+
aud: JwtAudience
|
|
729
|
+
sub: StringOrURI | string
|
|
730
|
+
client_id: string
|
|
731
|
+
iat: NumericDate
|
|
732
|
+
jti: string
|
|
733
|
+
scope?: string
|
|
734
|
+
roles?: string[]
|
|
735
|
+
groups?: string[]
|
|
736
|
+
entitlements?: string[]
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export interface DpopProofClaims extends JwtRegisteredClaims {
|
|
740
|
+
jti: string
|
|
741
|
+
htm: string
|
|
742
|
+
htu: UriString | string
|
|
743
|
+
iat: NumericDate
|
|
744
|
+
nonce?: string
|
|
745
|
+
ath?: Base64Url
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export interface SdJwtClaims extends IanaRegisteredJwtClaims {
|
|
749
|
+
_sd?: Base64Url[]
|
|
750
|
+
_sd_alg?: HashAlgorithm
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export type SdJwtDisclosure = Base64Url & {
|
|
754
|
+
readonly __sdJwtDisclosureBrand: unique symbol
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
export type SdJwt = string & {
|
|
758
|
+
readonly __sdJwtBrand: unique symbol
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
export type SdJwtPresentation = string & {
|
|
762
|
+
readonly __sdJwtPresentationBrand: unique symbol
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/* -------------------------------------------------------------------------- */
|
|
766
|
+
/* JWT compact forms and decoded structures */
|
|
767
|
+
/* -------------------------------------------------------------------------- */
|
|
768
|
+
|
|
769
|
+
/** RFC 7519 JWTs use JWS Compact or JWE Compact Serialization. */
|
|
770
|
+
export type CompactJwt = CompactJws | CompactJwe
|
|
771
|
+
|
|
772
|
+
export interface DecodedJws<
|
|
773
|
+
Claims extends object = IanaRegisteredJwtClaims,
|
|
774
|
+
Header extends JwsHeaderParameters = JwsHeaderParameters
|
|
775
|
+
> {
|
|
776
|
+
kind: 'JWS'
|
|
777
|
+
compact: CompactJws
|
|
778
|
+
protectedHeader: Header
|
|
779
|
+
claims: Claims
|
|
780
|
+
encodedProtectedHeader: Base64Url
|
|
781
|
+
encodedPayload: Base64Url | string
|
|
782
|
+
signature: Base64Url
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
export interface DecodedJwe<Header extends JweHeaderParameters = JweHeaderParameters> {
|
|
786
|
+
kind: 'JWE'
|
|
787
|
+
compact: CompactJwe
|
|
788
|
+
protectedHeader: Header
|
|
789
|
+
encodedProtectedHeader: Base64Url
|
|
790
|
+
encryptedKey: Base64Url
|
|
791
|
+
initializationVector: Base64Url
|
|
792
|
+
ciphertext: Base64Url
|
|
793
|
+
authenticationTag: Base64Url
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
export type DecodedJwt<Claims extends object = IanaRegisteredJwtClaims> =
|
|
797
|
+
DecodedJws<Claims> | DecodedJwe
|
|
798
|
+
|
|
799
|
+
/* -------------------------------------------------------------------------- */
|
|
800
|
+
/* Type-only service contracts */
|
|
801
|
+
/* -------------------------------------------------------------------------- */
|
|
802
|
+
|
|
803
|
+
export type JoseKeyMaterial = JsonWebKey | JsonWebKeySet | BinaryData | string
|
|
804
|
+
|
|
805
|
+
export interface JwtDecodeOptions {
|
|
806
|
+
/** Parse payload JSON without validating cryptographic integrity. */
|
|
807
|
+
parseClaims?: boolean
|
|
808
|
+
/** Permit RFC 7797 unencoded JWS payloads. */
|
|
809
|
+
allowUnencodedPayload?: boolean
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export interface JwsSignOptions<Header extends JwsHeaderParameters = JwsHeaderParameters> {
|
|
813
|
+
protectedHeader: Header
|
|
814
|
+
unprotectedHeader?: Partial<Header>
|
|
815
|
+
detached?: boolean
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
export interface JwsVerifyOptions {
|
|
819
|
+
algorithms?: JwsAlgorithm[]
|
|
820
|
+
criticalHeaders?: string[]
|
|
821
|
+
detachedPayload?: string | BinaryData
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
export interface JweEncryptOptions<Header extends JweHeaderParameters = JweHeaderParameters> {
|
|
825
|
+
protectedHeader: Header
|
|
826
|
+
sharedUnprotectedHeader?: Partial<Header>
|
|
827
|
+
additionalAuthenticatedData?: string | BinaryData
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
export interface JweDecryptOptions {
|
|
831
|
+
keyManagementAlgorithms?: JweKeyManagementAlgorithm[]
|
|
832
|
+
contentEncryptionAlgorithms?: JweContentEncryptionAlgorithm[]
|
|
833
|
+
criticalHeaders?: string[]
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
export interface JwtValidationPolicy {
|
|
837
|
+
issuers?: Array<StringOrURI | string>
|
|
838
|
+
audiences?: Array<StringOrURI | string>
|
|
839
|
+
subjects?: Array<StringOrURI | string>
|
|
840
|
+
algorithms?: JwsAlgorithm[]
|
|
841
|
+
requiredClaims?: Array<keyof IanaRegisteredJwtClaims | string>
|
|
842
|
+
clockToleranceSeconds?: number
|
|
843
|
+
maxTokenAgeSeconds?: number
|
|
844
|
+
typ?: MediaType | string
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export interface JwtValidationSuccess<Claims extends object = IanaRegisteredJwtClaims> {
|
|
848
|
+
valid: true
|
|
849
|
+
value: DecodedJws<Claims>
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
export interface JwtValidationFailure {
|
|
853
|
+
valid: false
|
|
854
|
+
code:
|
|
855
|
+
| 'malformed'
|
|
856
|
+
| 'unsupported_serialization'
|
|
857
|
+
| 'unsupported_algorithm'
|
|
858
|
+
| 'invalid_signature'
|
|
859
|
+
| 'decryption_failed'
|
|
860
|
+
| 'expired'
|
|
861
|
+
| 'not_active'
|
|
862
|
+
| 'issued_in_future'
|
|
863
|
+
| 'issuer_mismatch'
|
|
864
|
+
| 'audience_mismatch'
|
|
865
|
+
| 'subject_mismatch'
|
|
866
|
+
| 'missing_claim'
|
|
867
|
+
| 'critical_header_unsupported'
|
|
868
|
+
| 'policy_rejected'
|
|
869
|
+
| (string & {})
|
|
870
|
+
message: string
|
|
871
|
+
cause?: unknown
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
export type JwtValidationResult<Claims extends object = IanaRegisteredJwtClaims> =
|
|
875
|
+
JwtValidationSuccess<Claims> | JwtValidationFailure
|
|
876
|
+
|
|
877
|
+
export interface JwtDecoder {
|
|
878
|
+
decode<Claims extends object = IanaRegisteredJwtClaims>(
|
|
879
|
+
token: CompactJwt,
|
|
880
|
+
options?: JwtDecodeOptions
|
|
881
|
+
): DecodedJwt<Claims>
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
export interface JwsSigner {
|
|
885
|
+
signCompact<Claims extends object, Header extends JwsHeaderParameters = JwsHeaderParameters>(
|
|
886
|
+
claims: Claims,
|
|
887
|
+
key: JoseKeyMaterial,
|
|
888
|
+
options: JwsSignOptions<Header>
|
|
889
|
+
): CompactJws
|
|
890
|
+
|
|
891
|
+
signFlattened<Header extends JwsHeaderParameters = JwsHeaderParameters>(
|
|
892
|
+
payload: string | BinaryData,
|
|
893
|
+
key: JoseKeyMaterial,
|
|
894
|
+
options: JwsSignOptions<Header>
|
|
895
|
+
): FlattenedJwsJsonSerialization<Header>
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export interface JwsVerifier {
|
|
899
|
+
verify<Claims extends object = IanaRegisteredJwtClaims>(
|
|
900
|
+
jws: CompactJws | JwsJsonSerialization,
|
|
901
|
+
key: JoseKeyMaterial,
|
|
902
|
+
options?: JwsVerifyOptions
|
|
903
|
+
): JwtValidationResult<Claims>
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
export interface JweEncrypter {
|
|
907
|
+
encryptCompact<Header extends JweHeaderParameters = JweHeaderParameters>(
|
|
908
|
+
plaintext: string | BinaryData,
|
|
909
|
+
key: JoseKeyMaterial,
|
|
910
|
+
options: JweEncryptOptions<Header>
|
|
911
|
+
): CompactJwe
|
|
912
|
+
|
|
913
|
+
encryptFlattened<Header extends JweHeaderParameters = JweHeaderParameters>(
|
|
914
|
+
plaintext: string | BinaryData,
|
|
915
|
+
key: JoseKeyMaterial,
|
|
916
|
+
options: JweEncryptOptions<Header>
|
|
917
|
+
): FlattenedJweJsonSerialization<Header>
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
export interface JweDecrypter {
|
|
921
|
+
decrypt(
|
|
922
|
+
jwe: CompactJwe | JweJsonSerialization,
|
|
923
|
+
key: JoseKeyMaterial,
|
|
924
|
+
options?: JweDecryptOptions
|
|
925
|
+
): BinaryData
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export interface JwkThumbprinter {
|
|
929
|
+
thumbprint(key: JsonWebKey, hashAlgorithm?: HashAlgorithm): JwkThumbprint
|
|
930
|
+
|
|
931
|
+
thumbprintUri(key: JsonWebKey, hashAlgorithm?: HashAlgorithm): JwkThumbprintUri
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export interface JwksResolver {
|
|
935
|
+
resolve(jwksUri: UriString | string): Promise<JsonWebKeySet>
|
|
936
|
+
|
|
937
|
+
select(
|
|
938
|
+
jwks: JsonWebKeySet,
|
|
939
|
+
header: Pick<JoseCommonHeaderParameters, 'kid' | 'x5t' | 'x5t#S256'>
|
|
940
|
+
): JsonWebKey | undefined
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/* -------------------------------------------------------------------------- */
|
|
944
|
+
/* Registry metadata contracts */
|
|
945
|
+
/* -------------------------------------------------------------------------- */
|
|
946
|
+
|
|
947
|
+
export type JoseImplementationRequirement =
|
|
948
|
+
| 'Required'
|
|
949
|
+
| 'Recommended'
|
|
950
|
+
| 'Recommended+'
|
|
951
|
+
| 'Recommended-'
|
|
952
|
+
| 'Optional'
|
|
953
|
+
| 'Deprecated'
|
|
954
|
+
| 'Prohibited'
|
|
955
|
+
|
|
956
|
+
export type JoseAlgorithmUsageLocation = 'alg' | 'enc' | 'JWK'
|
|
957
|
+
|
|
958
|
+
export interface JoseAlgorithmRegistryEntry {
|
|
959
|
+
name: JoseAlgorithm
|
|
960
|
+
description: string
|
|
961
|
+
usage: JoseAlgorithmUsageLocation
|
|
962
|
+
requirement: JoseImplementationRequirement
|
|
963
|
+
reference: string
|
|
964
|
+
analysisReference?: string
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
export type JoseHeaderUsageLocation = 'JWS' | 'JWE' | 'JWS, JWE'
|
|
968
|
+
|
|
969
|
+
export interface JoseHeaderParameterRegistryEntry {
|
|
970
|
+
name: string
|
|
971
|
+
description: string
|
|
972
|
+
usage: JoseHeaderUsageLocation
|
|
973
|
+
reference: string
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
export interface JwtClaimRegistryEntry {
|
|
977
|
+
name: keyof IanaRegisteredJwtClaims | string
|
|
978
|
+
description: string
|
|
979
|
+
reference: string
|
|
980
|
+
}
|