@teammy/server 0.2.22 → 0.2.24
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/LICENSE +21 -0
- package/README.md +11 -7
- package/dist/main.js +20654 -13289
- package/dist/native-pi-entry.js +755 -19
- package/dist/project-pi-entry.js +758 -22
- package/dist/runtime/en/shared/system.md +9 -0
- package/dist/runtime/en/shared/tools.json +22 -0
- package/dist/runtime/en/workflows/directory-analysis/prompt.md +11 -0
- package/dist/runtime/en/workflows/file-summary/prompt.md +7 -0
- package/dist/runtime/en/workflows/session-handoff/prompt.md +31 -0
- package/dist/runtime/en/workflows/session-overview/prompt.md +26 -0
- package/dist/runtime/en/workflows/task-bootstrap/prompt.md +84 -0
- package/dist/runtime/shared/system.md +1 -1
- package/dist/runtime/workflows/session-handoff/prompt.md +1 -1
- package/dist/runtime/workflows/session-overview/prompt.md +1 -1
- package/dist/web/THIRD-PARTY-LICENSES.md +2025 -0
- package/dist/web/assets/Assistant-BeWIo88A.js +1 -0
- package/dist/web/assets/{Computers-BtcIsnDD.css → Computers-BJKv9oJv.css} +1 -1
- package/dist/web/assets/Computers-CEBC9xd4.js +14 -0
- package/dist/web/assets/Conversation-BMA0djTl.js +1 -0
- package/dist/web/assets/Dashboard-DtNpBYI5.js +1 -0
- package/dist/web/assets/Files-C-00txBh.js +1 -0
- package/dist/web/assets/Help-C5yLJzSE.js +2392 -0
- package/dist/web/assets/MessageComposer-D7ml-LaD.js +1 -0
- package/dist/web/assets/MessageComposer-DqcbXBIG.css +1 -0
- package/dist/web/assets/ResourceLibrary-Ceon9f0i.js +6 -0
- package/dist/web/assets/TerminalPane-CZYb0vIG.js +22 -0
- package/dist/web/assets/WorkspaceTree-C2sVptdG.js +1 -0
- package/dist/web/assets/file-links-CQ6ShuxD.js +1 -0
- package/dist/web/assets/index-B9gF6reY.css +1 -0
- package/dist/web/assets/index-BCj5CDtq.js +40 -0
- package/dist/web/assets/project-links-BwYckk7L.js +105 -0
- package/dist/web/assets/workflow-DR-M8YZx.svg +111 -0
- package/dist/web/downloads/teammy-inbox-skill.zip +0 -0
- package/dist/web/downloads/teammy-skill.zip +0 -0
- package/dist/web/index.html +4 -4
- package/dist/web/notification-worker.js +2 -10
- package/node_modules/i18next/LICENSE +21 -0
- package/node_modules/i18next/README.md +77 -0
- package/node_modules/i18next/dist/cjs/i18next.js +2495 -0
- package/node_modules/i18next/dist/esm/i18next.js +2505 -0
- package/node_modules/i18next/dist/esm/package.json +1 -0
- package/node_modules/i18next/dist/umd/i18next.js +2501 -0
- package/node_modules/i18next/dist/umd/i18next.min.js +1 -0
- package/node_modules/i18next/i18next.js +2501 -0
- package/node_modules/i18next/i18next.min.js +1 -0
- package/node_modules/i18next/index.d.mts +71 -0
- package/node_modules/i18next/index.d.ts +739 -0
- package/node_modules/i18next/package.json +125 -0
- package/node_modules/i18next/typescript/helpers.d.ts +73 -0
- package/node_modules/i18next/typescript/options.d.ts +871 -0
- package/node_modules/i18next/typescript/t.d.ts +1449 -0
- package/node_modules/jose/LICENSE.md +21 -0
- package/node_modules/jose/README.md +150 -0
- package/node_modules/jose/dist/types/index.d.ts +55 -0
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +25 -0
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +40 -0
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +25 -0
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +46 -0
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +29 -0
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +51 -0
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +10 -0
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +15 -0
- package/node_modules/jose/dist/types/jwks/local.d.ts +17 -0
- package/node_modules/jose/dist/types/jwks/remote.d.ts +94 -0
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +21 -0
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +25 -0
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +23 -0
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +26 -0
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +41 -0
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +31 -0
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +38 -0
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +57 -0
- package/node_modules/jose/dist/types/jwt/sign.d.ts +21 -0
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +21 -0
- package/node_modules/jose/dist/types/jwt/verify.d.ts +36 -0
- package/node_modules/jose/dist/types/key/export.d.ts +19 -0
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +33 -0
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +30 -0
- package/node_modules/jose/dist/types/key/import.d.ts +67 -0
- package/node_modules/jose/dist/types/types.d.ts +802 -0
- package/node_modules/jose/dist/types/util/base64url.d.ts +16 -0
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +9 -0
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +10 -0
- package/node_modules/jose/dist/types/util/errors.d.ts +182 -0
- package/node_modules/jose/dist/webapi/index.js +70 -0
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -0
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +26 -0
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +15 -0
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +35 -0
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +41 -0
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +105 -0
- package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -0
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +55 -0
- package/node_modules/jose/dist/webapi/jwks/local.js +60 -0
- package/node_modules/jose/dist/webapi/jwks/remote.js +103 -0
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +20 -0
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +8 -0
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +23 -0
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +12 -0
- package/node_modules/jose/dist/webapi/jws/general/sign.js +58 -0
- package/node_modules/jose/dist/webapi/jws/general/verify.js +42 -0
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -0
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +42 -0
- package/node_modules/jose/dist/webapi/jwt/sign.js +19 -0
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +34 -0
- package/node_modules/jose/dist/webapi/jwt/verify.js +13 -0
- package/node_modules/jose/dist/webapi/key/export.js +35 -0
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +35 -0
- package/node_modules/jose/dist/webapi/key/generate_secret.js +36 -0
- package/node_modules/jose/dist/webapi/key/import.js +53 -0
- package/node_modules/jose/dist/webapi/lib/asn1.js +138 -0
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +75 -0
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +90 -0
- package/node_modules/jose/dist/webapi/lib/deflate.js +41 -0
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +116 -0
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +190 -0
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +75 -0
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +74 -0
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +46 -0
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +89 -0
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +150 -0
- package/node_modules/jose/dist/webapi/lib/key.js +157 -0
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +15 -0
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +9 -0
- package/node_modules/jose/dist/webapi/lib/key_management.js +195 -0
- package/node_modules/jose/dist/webapi/lib/validate.js +122 -0
- package/node_modules/jose/dist/webapi/util/base64url.js +16 -0
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +33 -0
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +19 -0
- package/node_modules/jose/dist/webapi/util/errors.js +109 -0
- package/node_modules/jose/package.json +134 -0
- package/node_modules/oauth4webapi/LICENSE.md +21 -0
- package/node_modules/oauth4webapi/README.md +104 -0
- package/node_modules/oauth4webapi/build/index.d.ts +3046 -0
- package/node_modules/oauth4webapi/build/index.js +2530 -0
- package/node_modules/oauth4webapi/build/index.js.map +1 -0
- package/node_modules/oauth4webapi/package.json +112 -0
- package/node_modules/openid-client/LICENSE.md +21 -0
- package/node_modules/openid-client/README.md +258 -0
- package/node_modules/openid-client/build/index.d.ts +2478 -0
- package/node_modules/openid-client/build/index.js +1347 -0
- package/node_modules/openid-client/build/index.js.map +1 -0
- package/node_modules/openid-client/build/passport.d.ts +258 -0
- package/node_modules/openid-client/build/passport.js +264 -0
- package/node_modules/openid-client/build/passport.js.map +1 -0
- package/node_modules/openid-client/package.json +130 -0
- package/package.json +5 -1
- package/dist/web/assets/Assistant-Dm68Y4gs.js +0 -1
- package/dist/web/assets/Computers-mf4P8Wjw.js +0 -13
- package/dist/web/assets/Conversation-ClLZZ3fG.js +0 -1
- package/dist/web/assets/Dashboard-pokwbwJV.js +0 -1
- package/dist/web/assets/Dropdown-DGFI68Vd.js +0 -55
- package/dist/web/assets/Files-CtxaCO6n.js +0 -1
- package/dist/web/assets/Help-B_1p7Xir.js +0 -1064
- package/dist/web/assets/Markdown-gPLWRWEJ.js +0 -29
- package/dist/web/assets/MessageComposer-BoOgfyPA.js +0 -1
- package/dist/web/assets/MessageComposer-hKEluJsT.css +0 -1
- package/dist/web/assets/ResourceLibrary-Cr_Emgq2.js +0 -6
- package/dist/web/assets/TerminalPane-5Gw9ZNxq.js +0 -22
- package/dist/web/assets/WorkspaceTree-DZ6DN_OX.js +0 -1
- package/dist/web/assets/file-links-CoVqmrXg.js +0 -1
- package/dist/web/assets/index-BZEKT27U.js +0 -10
- package/dist/web/assets/index-CeKzFsxV.css +0 -1
- package/dist/web/assets/task-links-DTqf18C2.js +0 -1
- /package/dist/web/assets/{Dropdown-ktgqMqAD.css → project-links-ktgqMqAD.css} +0 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
/** Supported JWS "alg" (Algorithm) Header Parameter values. Availability depends on the runtime. */
|
|
2
|
+
export type JWSAlgorithm =
|
|
3
|
+
| 'HS256'
|
|
4
|
+
| 'HS384'
|
|
5
|
+
| 'HS512'
|
|
6
|
+
| 'RS256'
|
|
7
|
+
| 'RS384'
|
|
8
|
+
| 'RS512'
|
|
9
|
+
| 'PS256'
|
|
10
|
+
| 'PS384'
|
|
11
|
+
| 'PS512'
|
|
12
|
+
| 'ES256'
|
|
13
|
+
| 'ES384'
|
|
14
|
+
| 'ES512'
|
|
15
|
+
| 'EdDSA'
|
|
16
|
+
| 'Ed25519'
|
|
17
|
+
| 'ML-DSA-44'
|
|
18
|
+
| 'ML-DSA-65'
|
|
19
|
+
| 'ML-DSA-87'
|
|
20
|
+
| (string & {})
|
|
21
|
+
|
|
22
|
+
/** Supported JWE "alg" (Algorithm) Header Parameter values. Availability depends on the runtime. */
|
|
23
|
+
export type JWEKeyManagementAlgorithm =
|
|
24
|
+
| 'dir'
|
|
25
|
+
| 'A128KW'
|
|
26
|
+
| 'A192KW'
|
|
27
|
+
| 'A256KW'
|
|
28
|
+
| 'A128GCMKW'
|
|
29
|
+
| 'A192GCMKW'
|
|
30
|
+
| 'A256GCMKW'
|
|
31
|
+
| 'ECDH-ES'
|
|
32
|
+
| 'ECDH-ES+A128KW'
|
|
33
|
+
| 'ECDH-ES+A192KW'
|
|
34
|
+
| 'ECDH-ES+A256KW'
|
|
35
|
+
| 'RSA-OAEP'
|
|
36
|
+
| 'RSA-OAEP-256'
|
|
37
|
+
| 'RSA-OAEP-384'
|
|
38
|
+
| 'RSA-OAEP-512'
|
|
39
|
+
| 'PBES2-HS256+A128KW'
|
|
40
|
+
| 'PBES2-HS384+A192KW'
|
|
41
|
+
| 'PBES2-HS512+A256KW'
|
|
42
|
+
| (string & {})
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Supported JWE "enc" (Encryption Algorithm) Header Parameter values. Availability depends on the
|
|
46
|
+
* runtime.
|
|
47
|
+
*/
|
|
48
|
+
export type JWEContentEncryptionAlgorithm =
|
|
49
|
+
| 'A128CBC-HS256'
|
|
50
|
+
| 'A192CBC-HS384'
|
|
51
|
+
| 'A256CBC-HS512'
|
|
52
|
+
| 'A128GCM'
|
|
53
|
+
| 'A192GCM'
|
|
54
|
+
| 'A256GCM'
|
|
55
|
+
| (string & {})
|
|
56
|
+
|
|
57
|
+
/** JWK "kty" (Key Type) Parameter values supported by this module. */
|
|
58
|
+
export type JWKKeyType = 'EC' | 'RSA' | 'OKP' | 'AKP' | 'oct' | (string & {})
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Generic JSON Web Key Parameters.
|
|
62
|
+
*
|
|
63
|
+
* > Note: This is declared as a type alias rather than an interface so that it satisfies the implicit index
|
|
64
|
+
* > signature of the `JsonWebKey` types shipped by `@types/node` and `lib.dom`.
|
|
65
|
+
*/
|
|
66
|
+
export type JWKParameters = {
|
|
67
|
+
/** JWK "kty" (Key Type) Parameter */
|
|
68
|
+
kty?: JWKKeyType
|
|
69
|
+
/** JWK "alg" (Algorithm) Parameter */
|
|
70
|
+
alg?: JWSAlgorithm | JWEKeyManagementAlgorithm | JWEContentEncryptionAlgorithm
|
|
71
|
+
/** JWK "key_ops" (Key Operations) Parameter (RFC 7517, Section 4.3). */
|
|
72
|
+
key_ops?: string[]
|
|
73
|
+
/** Web Crypto "ext" (Extractable) member; whether the key may be exported. */
|
|
74
|
+
ext?: boolean
|
|
75
|
+
|
|
76
|
+
/** JWK "use" (Public Key Use) Parameter */
|
|
77
|
+
use?: 'sig' | 'enc' | (string & {})
|
|
78
|
+
/**
|
|
79
|
+
* "x5c" (X.509 Certificate Chain): base64-encoded DER certificates (RFC 7517, Section 4.7; RFC
|
|
80
|
+
* 7515, Section 4.1.6).
|
|
81
|
+
*/
|
|
82
|
+
x5c?: string[]
|
|
83
|
+
/** "x5t" (X.509 Certificate SHA-1 Thumbprint): base64url-encoded digest of the DER certificate. */
|
|
84
|
+
x5t?: string
|
|
85
|
+
/**
|
|
86
|
+
* "x5t#S256" (X.509 Certificate SHA-256 Thumbprint): base64url-encoded digest of the DER
|
|
87
|
+
* certificate.
|
|
88
|
+
*/
|
|
89
|
+
'x5t#S256'?: string
|
|
90
|
+
/** JWK "x5u" (X.509 URL) Parameter: URL of a PEM-encoded certificate or certificate chain. */
|
|
91
|
+
x5u?: string
|
|
92
|
+
|
|
93
|
+
/** JWK "kid" (Key ID) Parameter */
|
|
94
|
+
kid?: string
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Convenience interface for public OKP JSON Web Keys. */
|
|
98
|
+
export interface JWK_OKP_Public extends JWKParameters {
|
|
99
|
+
/** JWK "crv" (Subtype of Key Pair) Parameter (RFC 8037, Section 2). */
|
|
100
|
+
crv: string
|
|
101
|
+
/** Base64url-encoded public key (RFC 8037, Section 2). */
|
|
102
|
+
x: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Convenience interface for private OKP JSON Web Keys. */
|
|
106
|
+
export interface JWK_OKP_Private extends JWK_OKP_Public {
|
|
107
|
+
/** Base64url-encoded private key (RFC 8037, Section 2). */
|
|
108
|
+
d: string
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Convenience interface for public AKP JSON Web Keys. */
|
|
112
|
+
export interface JWK_AKP_Public extends JWKParameters {
|
|
113
|
+
/** JWK "alg" (Algorithm) Parameter */
|
|
114
|
+
alg: string
|
|
115
|
+
|
|
116
|
+
/** AKP JWK "pub" (Public Key): base64url-encoded public key (RFC 9964, Section 3) */
|
|
117
|
+
pub: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Convenience interface for private AKP JSON Web Keys. */
|
|
121
|
+
export interface JWK_AKP_Private extends JWK_AKP_Public {
|
|
122
|
+
/**
|
|
123
|
+
* AKP JWK "priv" (Private Key): base64url-encoded private key; ML-DSA uses a 32-octet seed (RFC
|
|
124
|
+
* 9964, Sections 3-4)
|
|
125
|
+
*/
|
|
126
|
+
priv: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Convenience interface for public EC JSON Web Keys. */
|
|
130
|
+
export interface JWK_EC_Public extends JWKParameters {
|
|
131
|
+
/** JWK "crv" (Curve) Parameter (RFC 7518, Section 6.2.1.1). */
|
|
132
|
+
crv: string
|
|
133
|
+
/** Base64url-encoded x-coordinate (RFC 7518, Section 6.2.1.2). */
|
|
134
|
+
x: string
|
|
135
|
+
/** Base64url-encoded y-coordinate (RFC 7518, Section 6.2.1.3). */
|
|
136
|
+
y: string
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Convenience interface for private EC JSON Web Keys. */
|
|
140
|
+
export interface JWK_EC_Private extends JWK_EC_Public {
|
|
141
|
+
/** Base64url-encoded private key (RFC 7518, Section 6.2.2). */
|
|
142
|
+
d: string
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Convenience interface for public RSA JSON Web Keys. */
|
|
146
|
+
export interface JWK_RSA_Public extends JWKParameters {
|
|
147
|
+
/** Public exponent, encoded as Base64urlUInt (RFC 7518, Section 6.3.1). */
|
|
148
|
+
e: string
|
|
149
|
+
/** Modulus, encoded as Base64urlUInt (RFC 7518, Section 6.3.1). */
|
|
150
|
+
n: string
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Convenience interface for private RSA JSON Web Keys. */
|
|
154
|
+
export interface JWK_RSA_Private extends JWK_RSA_Public {
|
|
155
|
+
/** Private exponent, encoded as Base64urlUInt (RFC 7518, Section 6.3.2). */
|
|
156
|
+
d: string
|
|
157
|
+
/** First factor CRT exponent, encoded as Base64urlUInt (RFC 7518, Section 6.3.2). */
|
|
158
|
+
dp: string
|
|
159
|
+
/** Second factor CRT exponent, encoded as Base64urlUInt (RFC 7518, Section 6.3.2). */
|
|
160
|
+
dq: string
|
|
161
|
+
/** First prime factor, encoded as Base64urlUInt (RFC 7518, Section 6.3.2). */
|
|
162
|
+
p: string
|
|
163
|
+
/** Second prime factor, encoded as Base64urlUInt (RFC 7518, Section 6.3.2). */
|
|
164
|
+
q: string
|
|
165
|
+
/** First CRT coefficient, encoded as Base64urlUInt (RFC 7518, Section 6.3.2). */
|
|
166
|
+
qi: string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Convenience interface for "oct" JSON Web Keys. */
|
|
170
|
+
export interface JWK_oct extends JWKParameters {
|
|
171
|
+
/** JWK "k" (Key Value): base64url-encoded key octets (RFC 7518, Section 6.4.1). */
|
|
172
|
+
k: string
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* JSON Web Key ({@link https://www.rfc-editor.org/info/rfc7517/ JWK}). "RSA", "EC", "OKP", "AKP",
|
|
177
|
+
* and "oct" key types are supported.
|
|
178
|
+
*
|
|
179
|
+
* > Note: This is declared as a type alias rather than an interface so that it satisfies the implicit index
|
|
180
|
+
* > signature of the `JsonWebKey` types shipped by `@types/node` and `lib.dom`. It spells out the
|
|
181
|
+
* > {@link JWKParameters} members rather than intersecting them so that every JWK member is documented
|
|
182
|
+
* > in one place.
|
|
183
|
+
*/
|
|
184
|
+
export type JWK = {
|
|
185
|
+
/** JWK "kty" (Key Type) Parameter */
|
|
186
|
+
kty?: JWKKeyType
|
|
187
|
+
/** JWK "alg" (Algorithm) Parameter */
|
|
188
|
+
alg?: JWSAlgorithm | JWEKeyManagementAlgorithm | JWEContentEncryptionAlgorithm
|
|
189
|
+
/** JWK "key_ops" (Key Operations) Parameter (RFC 7517, Section 4.3). */
|
|
190
|
+
key_ops?: string[]
|
|
191
|
+
/** Web Crypto "ext" (Extractable) member; whether the key may be exported. */
|
|
192
|
+
ext?: boolean
|
|
193
|
+
|
|
194
|
+
/** JWK "use" (Public Key Use) Parameter */
|
|
195
|
+
use?: 'sig' | 'enc' | (string & {})
|
|
196
|
+
/**
|
|
197
|
+
* "x5c" (X.509 Certificate Chain): base64-encoded DER certificates (RFC 7517, Section 4.7; RFC
|
|
198
|
+
* 7515, Section 4.1.6).
|
|
199
|
+
*/
|
|
200
|
+
x5c?: string[]
|
|
201
|
+
/** "x5t" (X.509 Certificate SHA-1 Thumbprint): base64url-encoded digest of the DER certificate. */
|
|
202
|
+
x5t?: string
|
|
203
|
+
/**
|
|
204
|
+
* "x5t#S256" (X.509 Certificate SHA-256 Thumbprint): base64url-encoded digest of the DER
|
|
205
|
+
* certificate.
|
|
206
|
+
*/
|
|
207
|
+
'x5t#S256'?: string
|
|
208
|
+
/** JWK "x5u" (X.509 URL) Parameter: URL of a PEM-encoded certificate or certificate chain. */
|
|
209
|
+
x5u?: string
|
|
210
|
+
|
|
211
|
+
/** JWK "kid" (Key ID) Parameter */
|
|
212
|
+
kid?: string
|
|
213
|
+
/** JWK "crv" Parameter: Curve for EC keys or Subtype of Key Pair for OKP keys. */
|
|
214
|
+
crv?: string
|
|
215
|
+
/**
|
|
216
|
+
* Private key material: Base64urlUInt for RSA (RFC 7518, Section 6.3.2.1), base64url-encoded
|
|
217
|
+
* octets for EC (Section 6.2.2.1) or OKP (RFC 8037, Section 2).
|
|
218
|
+
*/
|
|
219
|
+
d?: string
|
|
220
|
+
/** RSA first factor CRT exponent, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
221
|
+
dp?: string
|
|
222
|
+
/** RSA second factor CRT exponent, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
223
|
+
dq?: string
|
|
224
|
+
/** RSA public exponent, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
225
|
+
e?: string
|
|
226
|
+
/** JWK "k" (Key Value): base64url-encoded key octets (RFC 7518, Section 6.4.1). */
|
|
227
|
+
k?: string
|
|
228
|
+
/** RSA modulus, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
229
|
+
n?: string
|
|
230
|
+
/** RSA first prime factor, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
231
|
+
p?: string
|
|
232
|
+
/** RSA second prime factor, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
233
|
+
q?: string
|
|
234
|
+
/** RSA first CRT coefficient, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
235
|
+
qi?: string
|
|
236
|
+
/**
|
|
237
|
+
* Base64url-encoded EC x-coordinate (RFC 7518, Section 6.2.1.2) or OKP public key (RFC 8037,
|
|
238
|
+
* Section 2).
|
|
239
|
+
*/
|
|
240
|
+
x?: string
|
|
241
|
+
/** Base64url-encoded EC y-coordinate (RFC 7518, Section 6.2.1.3). */
|
|
242
|
+
y?: string
|
|
243
|
+
|
|
244
|
+
/** AKP JWK "pub" (Public Key): base64url-encoded public key (RFC 9964, Section 3) */
|
|
245
|
+
pub?: string
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* AKP JWK "priv" (Private Key): base64url-encoded private key; ML-DSA uses a 32-octet seed (RFC
|
|
249
|
+
* 9964, Sections 3-4)
|
|
250
|
+
*/
|
|
251
|
+
priv?: string
|
|
252
|
+
/** Additional RSA prime factors. */
|
|
253
|
+
oth?: Array<{
|
|
254
|
+
/** Factor CRT exponent, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
255
|
+
d?: string
|
|
256
|
+
/** Prime factor, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
257
|
+
r?: string
|
|
258
|
+
/** Factor CRT coefficient, encoded as Base64urlUInt (RFC 7518, Section 6.3). */
|
|
259
|
+
t?: string
|
|
260
|
+
}>
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Discriminated union of supported JSON Web Key shapes, narrowed by the "kty" (Key Type) Parameter. */
|
|
264
|
+
// Intersect "kty" into each member separately: typedoc omits the parentheses in `X & (A | B)`.
|
|
265
|
+
export type AnyJWK =
|
|
266
|
+
| (JWK_EC_Private & { kty: 'EC' })
|
|
267
|
+
| (JWK_EC_Public & { kty: 'EC' })
|
|
268
|
+
| (JWK_RSA_Private & { kty: 'RSA' })
|
|
269
|
+
| (JWK_RSA_Public & { kty: 'RSA' })
|
|
270
|
+
| (JWK_OKP_Private & { kty: 'OKP' })
|
|
271
|
+
| (JWK_OKP_Public & { kty: 'OKP' })
|
|
272
|
+
| (JWK_AKP_Private & { kty: 'AKP' })
|
|
273
|
+
| (JWK_AKP_Public & { kty: 'AKP' })
|
|
274
|
+
| (JWK_oct & { kty: 'oct' })
|
|
275
|
+
|
|
276
|
+
/** Key or secret input accepted by all sign, verify, encrypt, and decrypt operations. */
|
|
277
|
+
export type KeyInput = CryptoKey | KeyObject | JWK | Uint8Array
|
|
278
|
+
|
|
279
|
+
/** Dynamic key resolver for consuming operations. */
|
|
280
|
+
export interface GetKeyFunction<IProtectedHeader, IToken, KeyTypes extends KeyInput = KeyInput> {
|
|
281
|
+
/**
|
|
282
|
+
* Resolves a key for an unverified token. Throw if no suitable key can be resolved.
|
|
283
|
+
*
|
|
284
|
+
* @param token The consumed JWE or JWS token; none of its components have been verified.
|
|
285
|
+
*/
|
|
286
|
+
(protectedHeader: IProtectedHeader, token: IToken): Promise<KeyTypes> | KeyTypes
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Flattened JWS JSON Serialization verification input. */
|
|
290
|
+
export interface FlattenedJWSInput {
|
|
291
|
+
/** JWS Unprotected Header as a JSON object. Not integrity protected; omit when empty. */
|
|
292
|
+
header?: JWSHeaderParameters
|
|
293
|
+
|
|
294
|
+
/** Base64url-encoded JWS Payload; with `b64: false`, supply an unencoded string or Uint8Array. */
|
|
295
|
+
payload: string | Uint8Array
|
|
296
|
+
|
|
297
|
+
/** Base64url-encoded UTF-8 JWS Protected Header. Integrity protected; omit when empty. */
|
|
298
|
+
protected?: string
|
|
299
|
+
|
|
300
|
+
/** Base64url-encoded JWS Signature (digital signature or MAC). */
|
|
301
|
+
signature: string
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** General JWS JSON Serialization verification input. */
|
|
305
|
+
export interface GeneralJWSInput {
|
|
306
|
+
/** Base64url-encoded JWS Payload; with `b64: false`, supply an unencoded string or Uint8Array. */
|
|
307
|
+
payload: string | Uint8Array
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* The "signatures" member value MUST be an array of JSON objects. Each object represents a JWS
|
|
311
|
+
* Signature (digital signature or MAC) over the JWS Payload and the JWS Protected Header.
|
|
312
|
+
*/
|
|
313
|
+
signatures: Omit<FlattenedJWSInput, 'payload'>[]
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Flattened JWS JSON Serialization token. The payload is an empty string for detached content when
|
|
318
|
+
* the {@link https://www.rfc-editor.org/info/rfc7797/ unencoded payload option} is used.
|
|
319
|
+
*/
|
|
320
|
+
export interface FlattenedJWS extends Partial<FlattenedJWSInput> {
|
|
321
|
+
payload: string
|
|
322
|
+
signature: string
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* General JWS JSON Serialization token. The payload is an empty string for detached content when
|
|
327
|
+
* the {@link https://www.rfc-editor.org/info/rfc7797/ unencoded payload option} is used.
|
|
328
|
+
*/
|
|
329
|
+
export interface GeneralJWS {
|
|
330
|
+
payload: string
|
|
331
|
+
signatures: Omit<FlattenedJWSInput, 'payload'>[]
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** Header Parameters common to JWE and JWS. */
|
|
335
|
+
export interface JoseHeaderParameters {
|
|
336
|
+
/** "kid" (Key ID) Header Parameter */
|
|
337
|
+
kid?: string
|
|
338
|
+
|
|
339
|
+
/** "x5t" (X.509 Certificate SHA-1 Thumbprint): base64url-encoded digest of the DER certificate. */
|
|
340
|
+
x5t?: string
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* "x5c" (X.509 Certificate Chain): base64-encoded DER certificates (RFC 7517, Section 4.7; RFC
|
|
344
|
+
* 7515, Section 4.1.6).
|
|
345
|
+
*/
|
|
346
|
+
x5c?: string[]
|
|
347
|
+
|
|
348
|
+
/** "x5u" (X.509 URL) Header Parameter: URL of a PEM-encoded certificate or certificate chain. */
|
|
349
|
+
x5u?: string
|
|
350
|
+
|
|
351
|
+
/** "jku" (JWK Set URL) Header Parameter (RFC 7515, Section 4.1.2). */
|
|
352
|
+
jku?: string
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* "jwk" (JSON Web Key) Header Parameter: public JWK only; private and symmetric key parameters
|
|
356
|
+
* are not permitted.
|
|
357
|
+
*/
|
|
358
|
+
jwk?: Omit<JWK, 'd' | 'dp' | 'dq' | 'k' | 'p' | 'q' | 'qi' | 'priv' | 'oth'>
|
|
359
|
+
|
|
360
|
+
/** "typ" (Type) Header Parameter */
|
|
361
|
+
typ?: string
|
|
362
|
+
|
|
363
|
+
/** "cty" (Content Type) Header Parameter (RFC 7515, Section 4.1.10). */
|
|
364
|
+
cty?: string
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** Recognized JWS Header Parameters; additional members may also be present. */
|
|
368
|
+
export interface JWSHeaderParameters extends JoseHeaderParameters {
|
|
369
|
+
/** JWS "alg" (Algorithm) Header Parameter */
|
|
370
|
+
alg?: JWSAlgorithm
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Controls payload encoding and the JWS Signing Input as defined by
|
|
374
|
+
* {@link https://www.rfc-editor.org/info/rfc7797/ RFC7797}. Set to `false` and list `b64` in
|
|
375
|
+
* `crit` to use an unencoded payload.
|
|
376
|
+
*/
|
|
377
|
+
b64?: boolean
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* "crit" (Critical) Header Parameter: names of extensions that must be understood and processed;
|
|
381
|
+
* must be integrity protected (RFC 7515, Section 4.1.11).
|
|
382
|
+
*/
|
|
383
|
+
crit?: string[]
|
|
384
|
+
|
|
385
|
+
/** Any other JWS Header member. */
|
|
386
|
+
[propName: string]: unknown
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** Recognized JWE Key Management-related Header Parameters. */
|
|
390
|
+
export interface JWEKeyManagementHeaderParameters {
|
|
391
|
+
/**
|
|
392
|
+
* Raw Agreement PartyUInfo bytes; base64url-encoded as the "apu" Header Parameter (RFC 7518,
|
|
393
|
+
* Section 4.6.1.2).
|
|
394
|
+
*/
|
|
395
|
+
apu?: Uint8Array
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Raw Agreement PartyVInfo bytes; base64url-encoded as the "apv" Header Parameter (RFC 7518,
|
|
399
|
+
* Section 4.6.1.3).
|
|
400
|
+
*/
|
|
401
|
+
apv?: Uint8Array
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* "p2c" (PBES2 Count) Header Parameter: positive PBKDF2 iteration count (RFC 7518, Section
|
|
405
|
+
* 4.8.1.2).
|
|
406
|
+
*/
|
|
407
|
+
p2c?: number
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Raw PBES2 Salt Input bytes (RFC 7518, Section 4.8.1.1).
|
|
411
|
+
*
|
|
412
|
+
* @deprecated For testing and vector validation only.
|
|
413
|
+
*/
|
|
414
|
+
p2s?: Uint8Array
|
|
415
|
+
/**
|
|
416
|
+
* Raw Initialization Vector bytes for AES GCM Key Encryption (RFC 7518, Section 4.7.1.1).
|
|
417
|
+
*
|
|
418
|
+
* @deprecated For testing and vector validation only.
|
|
419
|
+
*/
|
|
420
|
+
iv?: Uint8Array
|
|
421
|
+
/**
|
|
422
|
+
* Ephemeral private key input. The resulting "epk" (Ephemeral Public Key) Header Parameter
|
|
423
|
+
* contains only the public key (RFC 7518, Section 4.6.1.1).
|
|
424
|
+
*
|
|
425
|
+
* @deprecated For testing and vector validation only.
|
|
426
|
+
*/
|
|
427
|
+
epk?: CryptoKey | KeyObject
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/** Flattened JWE JSON Serialization token. */
|
|
431
|
+
export interface FlattenedJWE {
|
|
432
|
+
/** Base64url-encoded JWE AAD; integrity protected but not encrypted. Omit when empty. */
|
|
433
|
+
aad?: string
|
|
434
|
+
|
|
435
|
+
/** Base64url-encoded JWE Ciphertext. */
|
|
436
|
+
ciphertext: string
|
|
437
|
+
|
|
438
|
+
/** Base64url-encoded JWE Encrypted Key. Omit when empty. */
|
|
439
|
+
encrypted_key?: string
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* JWE Per-Recipient Unprotected Header as a JSON object. Not integrity protected; omit when
|
|
443
|
+
* empty.
|
|
444
|
+
*/
|
|
445
|
+
header?: JWEHeaderParameters
|
|
446
|
+
|
|
447
|
+
/** Base64url-encoded JWE Initialization Vector. Omit when empty. */
|
|
448
|
+
iv?: string
|
|
449
|
+
|
|
450
|
+
/** Base64url-encoded UTF-8 JWE Protected Header. Integrity protected; omit when empty. */
|
|
451
|
+
protected?: string
|
|
452
|
+
|
|
453
|
+
/** Base64url-encoded JWE Authentication Tag. Omit when empty. */
|
|
454
|
+
tag?: string
|
|
455
|
+
|
|
456
|
+
/** JWE Shared Unprotected Header as a JSON object. Not integrity protected; omit when empty. */
|
|
457
|
+
unprotected?: JWEHeaderParameters
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/** General JWE JSON Serialization token. */
|
|
461
|
+
export interface GeneralJWE extends Omit<FlattenedJWE, 'encrypted_key' | 'header'> {
|
|
462
|
+
recipients: Pick<FlattenedJWE, 'encrypted_key' | 'header'>[]
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/** Recognized JWE Header Parameters; additional members may also be present. */
|
|
466
|
+
export interface JWEHeaderParameters extends JoseHeaderParameters {
|
|
467
|
+
/** JWE "alg" (Algorithm) Header Parameter */
|
|
468
|
+
alg?: JWEKeyManagementAlgorithm
|
|
469
|
+
|
|
470
|
+
/** JWE "enc" (Encryption Algorithm) Header Parameter */
|
|
471
|
+
enc?: JWEContentEncryptionAlgorithm
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* "crit" (Critical) Header Parameter: names of extensions that must be understood and processed;
|
|
475
|
+
* must be integrity protected (RFC 7516, Section 4.1.13).
|
|
476
|
+
*/
|
|
477
|
+
crit?: string[]
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* JWE "zip" (Compression Algorithm) Header Parameter; must be integrity protected. Only `"DEF"`
|
|
481
|
+
* (raw DEFLATE) is supported, requiring the runtime's `CompressionStream` / `DecompressionStream`
|
|
482
|
+
* APIs.
|
|
483
|
+
*/
|
|
484
|
+
zip?: 'DEF' | (string & {})
|
|
485
|
+
|
|
486
|
+
/** Any other JWE Header member. */
|
|
487
|
+
[propName: string]: unknown
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/** Shared "crit" option for signing, verification, encryption, and decryption. */
|
|
491
|
+
export interface CritOption {
|
|
492
|
+
/**
|
|
493
|
+
* Recognized "crit" (Critical) Header Parameter names. Set each value to `true` to require
|
|
494
|
+
* integrity protection, or `false` when protection is optional. The JWS `b64` extension is always
|
|
495
|
+
* recognized and processed.
|
|
496
|
+
*
|
|
497
|
+
* > Warning: Other extensions are only checked for syntax and optional integrity protection. Their presence
|
|
498
|
+
* > is not required by this option. You must check their presence and process them according to the
|
|
499
|
+
* > profile's validation steps after the operation succeeds.
|
|
500
|
+
*/
|
|
501
|
+
crit?: {
|
|
502
|
+
[propName: string]: boolean
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/** JWE Decryption options. */
|
|
507
|
+
export interface DecryptOptions extends CritOption {
|
|
508
|
+
/**
|
|
509
|
+
* Accepted JWE "alg" (Algorithm) Header Parameter values. Defaults to all algorithms applicable
|
|
510
|
+
* to the key or secret except PBES2, which must be explicitly allowed.
|
|
511
|
+
*/
|
|
512
|
+
keyManagementAlgorithms?: JWEKeyManagementAlgorithm[]
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Accepted JWE "enc" (Encryption Algorithm) Header Parameter values. Defaults to all algorithms
|
|
516
|
+
* applicable to the key or secret.
|
|
517
|
+
*/
|
|
518
|
+
contentEncryptionAlgorithms?: JWEContentEncryptionAlgorithm[]
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Maximum "p2c" (PBES2 Count) Header Parameter value, limiting PBKDF2 iterations and their
|
|
522
|
+
* computational expense. Defaults to 10000; must be a positive safe integer or `Infinity` to
|
|
523
|
+
* disable the limit.
|
|
524
|
+
*/
|
|
525
|
+
maxPBES2Count?: number
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Maximum decompressed plaintext size in bytes. Defaults to 250000; `0` rejects compressed JWEs,
|
|
529
|
+
* and `Infinity` disables the limit. Other values must be positive safe integers.
|
|
530
|
+
*/
|
|
531
|
+
maxDecompressedLength?: number
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/** JWE Encryption options. */
|
|
535
|
+
export interface EncryptOptions extends CritOption {}
|
|
536
|
+
|
|
537
|
+
/** JWT Claims Set verification options. */
|
|
538
|
+
export interface JWTClaimVerificationOptions {
|
|
539
|
+
/** Expected JWT "aud" (Audience) Claim value(s). Requires the claim to be present. */
|
|
540
|
+
audience?: string | string[]
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Clock skew tolerance in seconds or a duration string (e.g. "5 seconds"). Applies to the "nbf"
|
|
544
|
+
* (Not Before) and "exp" (Expiration Time) claims, and to "iat" (Issued At) when
|
|
545
|
+
* {@link maxTokenAge} is set.
|
|
546
|
+
*/
|
|
547
|
+
clockTolerance?: string | number
|
|
548
|
+
|
|
549
|
+
/** Expected JWT "iss" (Issuer) Claim value(s). Requires the claim to be present. */
|
|
550
|
+
issuer?: string | string[]
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Maximum time since the JWT "iat" (Issued At) Claim, in seconds or a duration string (e.g. "2
|
|
554
|
+
* hours"). Requires the claim to be present.
|
|
555
|
+
*/
|
|
556
|
+
maxTokenAge?: string | number
|
|
557
|
+
|
|
558
|
+
/** Expected JWT "sub" (Subject) Claim value. Requires the claim to be present. */
|
|
559
|
+
subject?: string
|
|
560
|
+
|
|
561
|
+
/** Expected JWT "typ" (Type) Header Parameter value. Requires the parameter to be present. */
|
|
562
|
+
typ?: string
|
|
563
|
+
|
|
564
|
+
/** Date for NumericDate comparisons. Defaults to `new Date()`. */
|
|
565
|
+
currentDate?: Date
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Additional claim names required in the JWT Claims Set. The {@link issuer}, {@link audience},
|
|
569
|
+
* {@link subject}, and {@link maxTokenAge} options independently require "iss", "aud", "sub", and
|
|
570
|
+
* "iat", respectively.
|
|
571
|
+
*/
|
|
572
|
+
requiredClaims?: string[]
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** JWS Verification options. */
|
|
576
|
+
export interface VerifyOptions extends CritOption {
|
|
577
|
+
/**
|
|
578
|
+
* Accepted JWS "alg" (Algorithm) Header Parameter values. Defaults to all algorithms applicable
|
|
579
|
+
* to the key or secret. Unsecured JWTs (`alg: "none"`) are never accepted.
|
|
580
|
+
*/
|
|
581
|
+
algorithms?: JWSAlgorithm[]
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/** JWS Signing options. */
|
|
585
|
+
export interface SignOptions extends CritOption {}
|
|
586
|
+
|
|
587
|
+
/** Recognized JWT Claims Set members; additional members may also be present. */
|
|
588
|
+
export interface JWTPayload {
|
|
589
|
+
/** "iss" (Issuer) Claim. */
|
|
590
|
+
iss?: string
|
|
591
|
+
|
|
592
|
+
/** "sub" (Subject) Claim. */
|
|
593
|
+
sub?: string
|
|
594
|
+
|
|
595
|
+
/** "aud" (Audience) Claim. */
|
|
596
|
+
aud?: string | string[]
|
|
597
|
+
|
|
598
|
+
/** "jti" (JWT ID) Claim. */
|
|
599
|
+
jti?: string
|
|
600
|
+
|
|
601
|
+
/** "nbf" (Not Before) Claim, expressed as a NumericDate (seconds since the Unix epoch). */
|
|
602
|
+
nbf?: number
|
|
603
|
+
|
|
604
|
+
/** "exp" (Expiration Time) Claim, expressed as a NumericDate (seconds since the Unix epoch). */
|
|
605
|
+
exp?: number
|
|
606
|
+
|
|
607
|
+
/** "iat" (Issued At) Claim, expressed as a NumericDate (seconds since the Unix epoch). */
|
|
608
|
+
iat?: number
|
|
609
|
+
|
|
610
|
+
/** Any other JWT Claims Set member. */
|
|
611
|
+
[propName: string]: unknown
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/** Flattened JWE JSON Serialization decryption result. */
|
|
615
|
+
export interface FlattenedDecryptResult {
|
|
616
|
+
/** Decoded JWE AAD bytes, integrity protected but not encrypted. */
|
|
617
|
+
additionalAuthenticatedData?: Uint8Array
|
|
618
|
+
|
|
619
|
+
/** Plaintext. */
|
|
620
|
+
plaintext: Uint8Array
|
|
621
|
+
|
|
622
|
+
/** JWE Protected Header. */
|
|
623
|
+
protectedHeader?: JWEHeaderParameters
|
|
624
|
+
|
|
625
|
+
/** JWE Shared Unprotected Header. Not integrity protected. */
|
|
626
|
+
sharedUnprotectedHeader?: JWEHeaderParameters
|
|
627
|
+
|
|
628
|
+
/** JWE Per-Recipient Unprotected Header. Not integrity protected. */
|
|
629
|
+
unprotectedHeader?: JWEHeaderParameters
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/** General JWE JSON Serialization decryption result. */
|
|
633
|
+
export interface GeneralDecryptResult extends FlattenedDecryptResult {}
|
|
634
|
+
|
|
635
|
+
/** JWE Compact Serialization decryption result. */
|
|
636
|
+
export interface CompactDecryptResult {
|
|
637
|
+
/** Plaintext. */
|
|
638
|
+
plaintext: Uint8Array
|
|
639
|
+
|
|
640
|
+
/** JWE Protected Header. */
|
|
641
|
+
protectedHeader: CompactJWEHeaderParameters
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/** Flattened JWS JSON Serialization verification result. */
|
|
645
|
+
export interface FlattenedVerifyResult {
|
|
646
|
+
/** JWS Payload. */
|
|
647
|
+
payload: Uint8Array
|
|
648
|
+
|
|
649
|
+
/** JWS Protected Header. */
|
|
650
|
+
protectedHeader?: JWSHeaderParameters
|
|
651
|
+
|
|
652
|
+
/** JWS Unprotected Header. Not integrity protected. */
|
|
653
|
+
unprotectedHeader?: JWSHeaderParameters
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** General JWS JSON Serialization verification result. */
|
|
657
|
+
export interface GeneralVerifyResult extends FlattenedVerifyResult {}
|
|
658
|
+
|
|
659
|
+
/** JWS Compact Serialization verification result. */
|
|
660
|
+
export interface CompactVerifyResult {
|
|
661
|
+
/** JWS Payload. */
|
|
662
|
+
payload: Uint8Array
|
|
663
|
+
|
|
664
|
+
/** JWS Protected Header. */
|
|
665
|
+
protectedHeader: CompactJWSHeaderParameters
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Infers the payload separately from its object check while preserving the result metadata. The
|
|
670
|
+
* guarded payload must be passed inline; moving the check here changes contextual inference.
|
|
671
|
+
*/
|
|
672
|
+
export type InferredJWTResult<Result, Payload> = Omit<Result, 'payload'> & {
|
|
673
|
+
payload: Payload & JWTPayload
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/** Signed or MACed JSON Web Token (JWT) verification result. */
|
|
677
|
+
export interface JWTVerifyResult<PayloadType = JWTPayload> {
|
|
678
|
+
/** JWT Claims Set. */
|
|
679
|
+
payload: PayloadType &
|
|
680
|
+
JWTPayload &
|
|
681
|
+
([PayloadType] extends [object] ? unknown : unknown extends PayloadType ? unknown : never)
|
|
682
|
+
|
|
683
|
+
/** JWS Protected Header. */
|
|
684
|
+
protectedHeader: JWTHeaderParameters
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/** Encrypted JSON Web Token (JWT) decryption result. */
|
|
688
|
+
export interface JWTDecryptResult<PayloadType = JWTPayload> {
|
|
689
|
+
/** JWT Claims Set. */
|
|
690
|
+
payload: PayloadType &
|
|
691
|
+
JWTPayload &
|
|
692
|
+
([PayloadType] extends [object] ? unknown : unknown extends PayloadType ? unknown : never)
|
|
693
|
+
|
|
694
|
+
/** JWE Protected Header. */
|
|
695
|
+
protectedHeader: CompactJWEHeaderParameters
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/** Key resolver result metadata. */
|
|
699
|
+
export interface ResolvedKey<KeyType extends CryptoKey | Uint8Array = CryptoKey | Uint8Array> {
|
|
700
|
+
/** The resolved key, present only when a key resolver is used. */
|
|
701
|
+
key: KeyType
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/** Recognized JWS Compact Serialization Header Parameters; additional members may also be present. */
|
|
705
|
+
export interface CompactJWSHeaderParameters extends JWSHeaderParameters {
|
|
706
|
+
alg: JWSAlgorithm
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/** Recognized JWT Header Parameters for JWS; additional members may also be present. */
|
|
710
|
+
export interface JWTHeaderParameters extends CompactJWSHeaderParameters {
|
|
711
|
+
b64?: boolean
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/** Recognized JWE Compact Serialization Header Parameters; additional members may also be present. */
|
|
715
|
+
export interface CompactJWEHeaderParameters extends JWEHeaderParameters {
|
|
716
|
+
alg: JWEKeyManagementAlgorithm
|
|
717
|
+
enc: JWEContentEncryptionAlgorithm
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/** JSON Web Key Set. */
|
|
721
|
+
export interface JSONWebKeySet {
|
|
722
|
+
/** "keys" Parameter: an array of JWKs (RFC 7517, Section 5.1). */
|
|
723
|
+
keys: JWK[]
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/** Node.js {@link !KeyObject} representation accepted as key input. */
|
|
727
|
+
export interface KeyObject {
|
|
728
|
+
type: string
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** The runtime's Web Crypto {@link !CryptoKey} representation accepted as key input. */
|
|
732
|
+
export type CryptoKey = typeof globalThis extends {
|
|
733
|
+
crypto: { subtle: { generateKey(...args: any[]): Promise<infer R> } }
|
|
734
|
+
}
|
|
735
|
+
? Extract<R, { type: string }>
|
|
736
|
+
: CryptoKeyStructuralFallback
|
|
737
|
+
|
|
738
|
+
/** Structural fallback used when the host {@link !CryptoKey} type cannot be inferred. */
|
|
739
|
+
export interface CryptoKeyStructuralFallback {
|
|
740
|
+
readonly algorithm: { name: string }
|
|
741
|
+
readonly extractable: boolean
|
|
742
|
+
readonly type: string
|
|
743
|
+
readonly usages: string[]
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/** Shared fluent API for JWT-producing classes. */
|
|
747
|
+
export interface ProduceJWT {
|
|
748
|
+
/**
|
|
749
|
+
* Set the "iss" (Issuer) Claim (RFC 7519, Section 4.1.1).
|
|
750
|
+
*
|
|
751
|
+
* @param issuer "Issuer" Claim value to set on the JWT Claims Set.
|
|
752
|
+
*/
|
|
753
|
+
setIssuer(issuer: string): this
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Set the "sub" (Subject) Claim (RFC 7519, Section 4.1.2).
|
|
757
|
+
*
|
|
758
|
+
* @param subject "sub" (Subject) Claim value to set on the JWT Claims Set.
|
|
759
|
+
*/
|
|
760
|
+
setSubject(subject: string): this
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Set the "aud" (Audience) Claim (RFC 7519, Section 4.1.3).
|
|
764
|
+
*
|
|
765
|
+
* @param audience "aud" (Audience) Claim value to set on the JWT Claims Set.
|
|
766
|
+
*/
|
|
767
|
+
setAudience(audience: string | string[]): this
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Set the "jti" (JWT ID) Claim (RFC 7519, Section 4.1.7).
|
|
771
|
+
*
|
|
772
|
+
* @param jwtId "jti" (JWT ID) Claim value to set on the JWT Claims Set.
|
|
773
|
+
*/
|
|
774
|
+
setJti(jwtId: string): this
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Set the "nbf" (Not Before) Claim. Numbers are NumericDate values (seconds since the Unix
|
|
778
|
+
* epoch); Dates are converted to seconds. Strings are relative to now, using seconds, minutes,
|
|
779
|
+
* hours, days, weeks, or years (365.25 days; no months). Prefix `-` or suffix `ago` subtracts the
|
|
780
|
+
* duration.
|
|
781
|
+
*
|
|
782
|
+
* @param input "nbf" (Not Before) Claim value as a timestamp, Date, or relative duration.
|
|
783
|
+
*/
|
|
784
|
+
setNotBefore(input: number | string | Date): this
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Set the "exp" (Expiration Time) Claim. Accepts a NumericDate value (seconds since the Unix
|
|
788
|
+
* epoch), a Date, or a duration relative to now using the same formats as {@link setNotBefore}.
|
|
789
|
+
*
|
|
790
|
+
* @param input "exp" (Expiration Time) Claim value as a timestamp, Date, or relative duration.
|
|
791
|
+
*/
|
|
792
|
+
setExpirationTime(input: number | string | Date): this
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Set the "iat" (Issued At) Claim. Defaults to the current Unix timestamp in seconds. Accepts a
|
|
796
|
+
* Unix timestamp in seconds, a Date, or a duration relative to now using the same formats as
|
|
797
|
+
* {@link setNotBefore}.
|
|
798
|
+
*
|
|
799
|
+
* @param input "iat" (Issued At) Claim value as a timestamp, Date, or relative duration.
|
|
800
|
+
*/
|
|
801
|
+
setIssuedAt(input?: number | string | Date): this
|
|
802
|
+
}
|