@teammy/server 0.2.23 → 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.
Files changed (166) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -7
  3. package/dist/main.js +20331 -13329
  4. package/dist/native-pi-entry.js +755 -19
  5. package/dist/project-pi-entry.js +758 -22
  6. package/dist/runtime/en/shared/system.md +9 -0
  7. package/dist/runtime/en/shared/tools.json +22 -0
  8. package/dist/runtime/en/workflows/directory-analysis/prompt.md +11 -0
  9. package/dist/runtime/en/workflows/file-summary/prompt.md +7 -0
  10. package/dist/runtime/en/workflows/session-handoff/prompt.md +31 -0
  11. package/dist/runtime/en/workflows/session-overview/prompt.md +26 -0
  12. package/dist/runtime/en/workflows/task-bootstrap/prompt.md +84 -0
  13. package/dist/runtime/shared/system.md +1 -1
  14. package/dist/runtime/workflows/session-handoff/prompt.md +1 -1
  15. package/dist/runtime/workflows/session-overview/prompt.md +1 -1
  16. package/dist/web/THIRD-PARTY-LICENSES.md +2025 -0
  17. package/dist/web/assets/Assistant-BeWIo88A.js +1 -0
  18. package/dist/web/assets/{Computers-BtcIsnDD.css → Computers-BJKv9oJv.css} +1 -1
  19. package/dist/web/assets/Computers-CEBC9xd4.js +14 -0
  20. package/dist/web/assets/Conversation-BMA0djTl.js +1 -0
  21. package/dist/web/assets/Dashboard-DtNpBYI5.js +1 -0
  22. package/dist/web/assets/Files-C-00txBh.js +1 -0
  23. package/dist/web/assets/Help-C5yLJzSE.js +2392 -0
  24. package/dist/web/assets/MessageComposer-D7ml-LaD.js +1 -0
  25. package/dist/web/assets/MessageComposer-DqcbXBIG.css +1 -0
  26. package/dist/web/assets/ResourceLibrary-Ceon9f0i.js +6 -0
  27. package/dist/web/assets/TerminalPane-CZYb0vIG.js +22 -0
  28. package/dist/web/assets/WorkspaceTree-C2sVptdG.js +1 -0
  29. package/dist/web/assets/file-links-CQ6ShuxD.js +1 -0
  30. package/dist/web/assets/index-B9gF6reY.css +1 -0
  31. package/dist/web/assets/index-BCj5CDtq.js +40 -0
  32. package/dist/web/assets/project-links-BwYckk7L.js +105 -0
  33. package/dist/web/assets/workflow-DR-M8YZx.svg +111 -0
  34. package/dist/web/downloads/teammy-inbox-skill.zip +0 -0
  35. package/dist/web/downloads/teammy-skill.zip +0 -0
  36. package/dist/web/index.html +4 -4
  37. package/dist/web/notification-worker.js +2 -10
  38. package/node_modules/i18next/LICENSE +21 -0
  39. package/node_modules/i18next/README.md +77 -0
  40. package/node_modules/i18next/dist/cjs/i18next.js +2495 -0
  41. package/node_modules/i18next/dist/esm/i18next.js +2505 -0
  42. package/node_modules/i18next/dist/esm/package.json +1 -0
  43. package/node_modules/i18next/dist/umd/i18next.js +2501 -0
  44. package/node_modules/i18next/dist/umd/i18next.min.js +1 -0
  45. package/node_modules/i18next/i18next.js +2501 -0
  46. package/node_modules/i18next/i18next.min.js +1 -0
  47. package/node_modules/i18next/index.d.mts +71 -0
  48. package/node_modules/i18next/index.d.ts +739 -0
  49. package/node_modules/i18next/package.json +125 -0
  50. package/node_modules/i18next/typescript/helpers.d.ts +73 -0
  51. package/node_modules/i18next/typescript/options.d.ts +871 -0
  52. package/node_modules/i18next/typescript/t.d.ts +1449 -0
  53. package/node_modules/jose/LICENSE.md +21 -0
  54. package/node_modules/jose/README.md +150 -0
  55. package/node_modules/jose/dist/types/index.d.ts +55 -0
  56. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +25 -0
  57. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +40 -0
  58. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +25 -0
  59. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +46 -0
  60. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +29 -0
  61. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +51 -0
  62. package/node_modules/jose/dist/types/jwk/embedded.d.ts +10 -0
  63. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +15 -0
  64. package/node_modules/jose/dist/types/jwks/local.d.ts +17 -0
  65. package/node_modules/jose/dist/types/jwks/remote.d.ts +94 -0
  66. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +21 -0
  67. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +25 -0
  68. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +23 -0
  69. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +26 -0
  70. package/node_modules/jose/dist/types/jws/general/sign.d.ts +41 -0
  71. package/node_modules/jose/dist/types/jws/general/verify.d.ts +31 -0
  72. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +38 -0
  73. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +57 -0
  74. package/node_modules/jose/dist/types/jwt/sign.d.ts +21 -0
  75. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +21 -0
  76. package/node_modules/jose/dist/types/jwt/verify.d.ts +36 -0
  77. package/node_modules/jose/dist/types/key/export.d.ts +19 -0
  78. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +33 -0
  79. package/node_modules/jose/dist/types/key/generate_secret.d.ts +30 -0
  80. package/node_modules/jose/dist/types/key/import.d.ts +67 -0
  81. package/node_modules/jose/dist/types/types.d.ts +802 -0
  82. package/node_modules/jose/dist/types/util/base64url.d.ts +16 -0
  83. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +9 -0
  84. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +10 -0
  85. package/node_modules/jose/dist/types/util/errors.d.ts +182 -0
  86. package/node_modules/jose/dist/webapi/index.js +70 -0
  87. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -0
  88. package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +26 -0
  89. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +15 -0
  90. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +35 -0
  91. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +41 -0
  92. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +105 -0
  93. package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -0
  94. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +55 -0
  95. package/node_modules/jose/dist/webapi/jwks/local.js +60 -0
  96. package/node_modules/jose/dist/webapi/jwks/remote.js +103 -0
  97. package/node_modules/jose/dist/webapi/jws/compact/sign.js +20 -0
  98. package/node_modules/jose/dist/webapi/jws/compact/verify.js +8 -0
  99. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +23 -0
  100. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +12 -0
  101. package/node_modules/jose/dist/webapi/jws/general/sign.js +58 -0
  102. package/node_modules/jose/dist/webapi/jws/general/verify.js +42 -0
  103. package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -0
  104. package/node_modules/jose/dist/webapi/jwt/encrypt.js +42 -0
  105. package/node_modules/jose/dist/webapi/jwt/sign.js +19 -0
  106. package/node_modules/jose/dist/webapi/jwt/unsecured.js +34 -0
  107. package/node_modules/jose/dist/webapi/jwt/verify.js +13 -0
  108. package/node_modules/jose/dist/webapi/key/export.js +35 -0
  109. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +35 -0
  110. package/node_modules/jose/dist/webapi/key/generate_secret.js +36 -0
  111. package/node_modules/jose/dist/webapi/key/import.js +53 -0
  112. package/node_modules/jose/dist/webapi/lib/asn1.js +138 -0
  113. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +75 -0
  114. package/node_modules/jose/dist/webapi/lib/content_encryption.js +90 -0
  115. package/node_modules/jose/dist/webapi/lib/deflate.js +41 -0
  116. package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +116 -0
  117. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +190 -0
  118. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +75 -0
  119. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +74 -0
  120. package/node_modules/jose/dist/webapi/lib/jws_sign.js +46 -0
  121. package/node_modules/jose/dist/webapi/lib/jws_verify.js +89 -0
  122. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +150 -0
  123. package/node_modules/jose/dist/webapi/lib/key.js +157 -0
  124. package/node_modules/jose/dist/webapi/lib/key_algorithm.js +15 -0
  125. package/node_modules/jose/dist/webapi/lib/key_descriptor.js +9 -0
  126. package/node_modules/jose/dist/webapi/lib/key_management.js +195 -0
  127. package/node_modules/jose/dist/webapi/lib/validate.js +122 -0
  128. package/node_modules/jose/dist/webapi/util/base64url.js +16 -0
  129. package/node_modules/jose/dist/webapi/util/decode_jwt.js +33 -0
  130. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +19 -0
  131. package/node_modules/jose/dist/webapi/util/errors.js +109 -0
  132. package/node_modules/jose/package.json +134 -0
  133. package/node_modules/oauth4webapi/LICENSE.md +21 -0
  134. package/node_modules/oauth4webapi/README.md +104 -0
  135. package/node_modules/oauth4webapi/build/index.d.ts +3046 -0
  136. package/node_modules/oauth4webapi/build/index.js +2530 -0
  137. package/node_modules/oauth4webapi/build/index.js.map +1 -0
  138. package/node_modules/oauth4webapi/package.json +112 -0
  139. package/node_modules/openid-client/LICENSE.md +21 -0
  140. package/node_modules/openid-client/README.md +258 -0
  141. package/node_modules/openid-client/build/index.d.ts +2478 -0
  142. package/node_modules/openid-client/build/index.js +1347 -0
  143. package/node_modules/openid-client/build/index.js.map +1 -0
  144. package/node_modules/openid-client/build/passport.d.ts +258 -0
  145. package/node_modules/openid-client/build/passport.js +264 -0
  146. package/node_modules/openid-client/build/passport.js.map +1 -0
  147. package/node_modules/openid-client/package.json +130 -0
  148. package/package.json +5 -1
  149. package/dist/web/assets/Assistant-Dks48Y5w.js +0 -1
  150. package/dist/web/assets/Computers-CaCzZeCc.js +0 -13
  151. package/dist/web/assets/Conversation-kAMzKADw.js +0 -1
  152. package/dist/web/assets/Dashboard-ComNJNOg.js +0 -1
  153. package/dist/web/assets/Dropdown-DGFI68Vd.js +0 -55
  154. package/dist/web/assets/Files-Blsq_C-B.js +0 -1
  155. package/dist/web/assets/Help-BM23uS-t.js +0 -1079
  156. package/dist/web/assets/Markdown-CXnZDm5J.js +0 -29
  157. package/dist/web/assets/MessageComposer-BoOgfyPA.js +0 -1
  158. package/dist/web/assets/MessageComposer-hKEluJsT.css +0 -1
  159. package/dist/web/assets/ResourceLibrary-C12_47kE.js +0 -6
  160. package/dist/web/assets/TerminalPane-BTRM-36z.js +0 -22
  161. package/dist/web/assets/WorkspaceTree-Co7XG2RG.js +0 -1
  162. package/dist/web/assets/file-links-CoVqmrXg.js +0 -1
  163. package/dist/web/assets/index-CeKzFsxV.css +0 -1
  164. package/dist/web/assets/index-mhJ33-bH.js +0 -10
  165. package/dist/web/assets/task-links-BE36-8mc.js +0 -1
  166. /package/dist/web/assets/{Dropdown-ktgqMqAD.css → project-links-ktgqMqAD.css} +0 -0
@@ -0,0 +1,2478 @@
1
+ import * as oauth from 'oauth4webapi';
2
+ export { AuthorizationResponseError, ResponseBodyError, WWWAuthenticateChallengeError, type AuthorizationDetails, type BackchannelAuthenticationResponse, type ConfirmationClaims, type CryptoKey, type CryptoKeyPair, type DeviceAuthorizationResponse, type OmitSymbolProperties, type ExportedJWKSCache, type GenerateKeyPairOptions, type IDToken, type IntrospectionResponse, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type JWK, type JWKS, type JWSAlgorithm, type ModifyAssertionFunction, type ModifyAssertionOptions, type MTLSEndpointAliases, type PrivateKey, type TokenEndpointResponse, type UserInfoAddress, type UserInfoResponse, type WWWAuthenticateChallenge, type WWWAuthenticateChallengeParameters, } from 'oauth4webapi';
3
+ /**
4
+ * A function that applies client authentication to an authorization server
5
+ * request.
6
+ *
7
+ * The default is {@link ClientSecretPost} if {@link ClientMetadata.client_secret}
8
+ * is present, {@link None} otherwise.
9
+ *
10
+ * Other Client Authentication Methods must be provided explicitly and their
11
+ * implementations are linked below.
12
+ *
13
+ * @see {@link ClientSecretBasic}
14
+ * @see {@link ClientSecretJwt}
15
+ * @see {@link ClientSecretPost}
16
+ * @see {@link None}
17
+ * @see {@link PrivateKeyJwt}
18
+ * @see {@link TlsClientAuth}
19
+ */
20
+ export type ClientAuth = (as: ServerMetadata, client: ClientMetadata, body: URLSearchParams, headers: Headers) => void;
21
+ /**
22
+ * Creates a `client_secret_post` client authentication method.
23
+ *
24
+ * **`client_secret_post`** uses the HTTP request body to send `client_id` and
25
+ * `client_secret` as `application/x-www-form-urlencoded` body parameters
26
+ *
27
+ * @example
28
+ *
29
+ * Usage with a {@link Configuration} obtained through {@link discovery}
30
+ *
31
+ * ```ts
32
+ * let server!: URL
33
+ * let clientId!: string
34
+ * let clientSecret!: string
35
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
36
+ *
37
+ * let config = await client.discovery(
38
+ * server,
39
+ * clientId,
40
+ * clientMetadata,
41
+ * client.ClientSecretPost(clientSecret),
42
+ * )
43
+ * ```
44
+ *
45
+ * @example
46
+ *
47
+ * Usage with a {@link Configuration} instance
48
+ *
49
+ * ```ts
50
+ * let server!: client.ServerMetadata
51
+ * let clientId!: string
52
+ * let clientSecret!: string
53
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
54
+ *
55
+ * let config = new client.Configuration(
56
+ * server,
57
+ * clientId,
58
+ * clientMetadata,
59
+ * client.ClientSecretPost(clientSecret),
60
+ * )
61
+ * ```
62
+ *
63
+ * @param clientSecret Client Secret
64
+ *
65
+ * @group Client Authentication Methods
66
+ *
67
+ * @see [OAuth Token Endpoint Authentication Methods](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#token-endpoint-auth-method)
68
+ * @see [RFC 6749 - The OAuth 2.0 Authorization Framework](https://www.rfc-editor.org/rfc/rfc6749.html#section-2.3)
69
+ * @see [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#ClientAuthentication)
70
+ */
71
+ export declare function ClientSecretPost(clientSecret?: string): ClientAuth;
72
+ /**
73
+ * Creates a `client_secret_basic` client authentication method.
74
+ *
75
+ * **`client_secret_basic`** uses the HTTP `Basic` authentication scheme to send
76
+ * `client_id` and `client_secret` in an `Authorization` HTTP Header.
77
+ *
78
+ * @example
79
+ *
80
+ * Usage with a {@link Configuration} obtained through {@link discovery}
81
+ *
82
+ * ```ts
83
+ * let server!: URL
84
+ * let clientId!: string
85
+ * let clientSecret!: string
86
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
87
+ *
88
+ * let config = await client.discovery(
89
+ * server,
90
+ * clientId,
91
+ * clientMetadata,
92
+ * client.ClientSecretBasic(clientSecret),
93
+ * )
94
+ * ```
95
+ *
96
+ * @example
97
+ *
98
+ * Usage with a {@link Configuration} instance
99
+ *
100
+ * ```ts
101
+ * let server!: client.ServerMetadata
102
+ * let clientId!: string
103
+ * let clientSecret!: string
104
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
105
+ *
106
+ * let config = new client.Configuration(
107
+ * server,
108
+ * clientId,
109
+ * clientMetadata,
110
+ * client.ClientSecretBasic(clientSecret),
111
+ * )
112
+ * ```
113
+ *
114
+ * @param clientSecret Client Secret
115
+ *
116
+ * @group Client Authentication Methods
117
+ *
118
+ * @see [OAuth Token Endpoint Authentication Methods](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#token-endpoint-auth-method)
119
+ * @see [RFC 6749 - The OAuth 2.0 Authorization Framework](https://www.rfc-editor.org/rfc/rfc6749.html#section-2.3)
120
+ * @see [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#ClientAuthentication)
121
+ */
122
+ export declare function ClientSecretBasic(clientSecret?: string): ClientAuth;
123
+ /**
124
+ * Creates a `client_secret_jwt` client authentication method.
125
+ *
126
+ * **`client_secret_jwt`** uses the HTTP request body to send `client_id`,
127
+ * `client_assertion_type`, and `client_assertion` as
128
+ * `application/x-www-form-urlencoded` body parameters. HMAC is used for the
129
+ * assertion's authenticity and integrity.
130
+ *
131
+ * @example
132
+ *
133
+ * Usage with a {@link Configuration} obtained through {@link discovery}
134
+ *
135
+ * ```ts
136
+ * let server!: URL
137
+ * let clientId!: string
138
+ * let clientSecret!: string
139
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
140
+ *
141
+ * let config = await client.discovery(
142
+ * server,
143
+ * clientId,
144
+ * clientMetadata,
145
+ * client.ClientSecretJwt(clientSecret),
146
+ * )
147
+ * ```
148
+ *
149
+ * @example
150
+ *
151
+ * Usage with a {@link Configuration} instance
152
+ *
153
+ * ```ts
154
+ * let server!: client.ServerMetadata
155
+ * let clientId!: string
156
+ * let clientSecret!: string
157
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
158
+ *
159
+ * let config = new client.Configuration(
160
+ * server,
161
+ * clientId,
162
+ * clientMetadata,
163
+ * client.ClientSecretJwt(clientSecret),
164
+ * )
165
+ * ```
166
+ *
167
+ * @param clientSecret Client Secret
168
+ * @param options
169
+ *
170
+ * @group Client Authentication Methods
171
+ *
172
+ * @see [OAuth Token Endpoint Authentication Methods](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#token-endpoint-auth-method)
173
+ * @see [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#ClientAuthentication)
174
+ */
175
+ export declare function ClientSecretJwt(clientSecret?: string, options?: oauth.ModifyAssertionOptions): ClientAuth;
176
+ /**
177
+ * Creates a `none` client authentication method.
178
+ *
179
+ * **`none`** (public client) uses the HTTP request body to send only
180
+ * `client_id` as `application/x-www-form-urlencoded` body parameter.
181
+ *
182
+ * @example
183
+ *
184
+ * Usage with a {@link Configuration} obtained through {@link discovery}
185
+ *
186
+ * ```ts
187
+ * let server!: URL
188
+ * let clientId!: string
189
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
190
+ *
191
+ * let config = await client.discovery(
192
+ * server,
193
+ * clientId,
194
+ * clientMetadata,
195
+ * client.None(),
196
+ * )
197
+ * ```
198
+ *
199
+ * @example
200
+ *
201
+ * Usage with a {@link Configuration} instance
202
+ *
203
+ * ```ts
204
+ * let server!: client.ServerMetadata
205
+ * let clientId!: string
206
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
207
+ *
208
+ * let config = new client.Configuration(
209
+ * server,
210
+ * clientId,
211
+ * clientMetadata,
212
+ * client.None(),
213
+ * )
214
+ * ```
215
+ *
216
+ * @group Client Authentication Methods
217
+ *
218
+ * @see [OAuth Token Endpoint Authentication Methods](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#token-endpoint-auth-method)
219
+ * @see [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#ClientAuthentication)
220
+ */
221
+ export declare function None(): ClientAuth;
222
+ /**
223
+ * Creates a `private_key_jwt` client authentication method.
224
+ *
225
+ * **`private_key_jwt`** uses the HTTP request body to send `client_id`,
226
+ * `client_assertion_type`, and `client_assertion` as
227
+ * `application/x-www-form-urlencoded` body parameters. Digital signature is
228
+ * used for the assertion's authenticity and integrity.
229
+ *
230
+ * @example
231
+ *
232
+ * Usage with a {@link Configuration} obtained through {@link discovery}
233
+ *
234
+ * ```ts
235
+ * let server!: URL
236
+ * let key!: client.CryptoKey | client.PrivateKey
237
+ * let clientId!: string
238
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
239
+ *
240
+ * let config = await client.discovery(
241
+ * server,
242
+ * clientId,
243
+ * clientMetadata,
244
+ * client.PrivateKeyJwt(key),
245
+ * )
246
+ * ```
247
+ *
248
+ * @example
249
+ *
250
+ * Usage with a {@link Configuration} instance
251
+ *
252
+ * ```ts
253
+ * let server!: client.ServerMetadata
254
+ * let key!: client.CryptoKey | client.PrivateKey
255
+ * let clientId!: string
256
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
257
+ *
258
+ * let config = new client.Configuration(
259
+ * server,
260
+ * clientId,
261
+ * clientMetadata,
262
+ * client.PrivateKeyJwt(key),
263
+ * )
264
+ * ```
265
+ *
266
+ * @param clientPrivateKey
267
+ *
268
+ * @group Client Authentication Methods
269
+ *
270
+ * @see [OAuth Token Endpoint Authentication Methods](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#token-endpoint-auth-method)
271
+ * @see [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#ClientAuthentication)
272
+ */
273
+ export declare function PrivateKeyJwt(clientPrivateKey: oauth.CryptoKey | oauth.PrivateKey, options?: oauth.ModifyAssertionOptions): ClientAuth;
274
+ /**
275
+ * Creates a `tls_client_auth` client authentication method.
276
+ *
277
+ * **`tls_client_auth`** uses the HTTP request body to send only `client_id` as
278
+ * `application/x-www-form-urlencoded` body parameter and the mTLS key and
279
+ * certificate is configured through
280
+ * {@link ClientMetadata.use_mtls_endpoint_aliases} and {@link customFetch}.
281
+ *
282
+ * @example
283
+ *
284
+ * Usage with a {@link Configuration} obtained through {@link discovery}
285
+ *
286
+ * ```ts
287
+ * let server!: URL
288
+ * let clientId!: string
289
+ *
290
+ * let clientMetadata = { use_mtls_endpoint_aliases: true }
291
+ * let config = await client.discovery(
292
+ * server,
293
+ * clientId,
294
+ * clientMetadata,
295
+ * client.TlsClientAuth(),
296
+ * )
297
+ * ```
298
+ *
299
+ * @example
300
+ *
301
+ * Usage with a {@link Configuration} instance
302
+ *
303
+ * ```ts
304
+ * let server!: client.ServerMetadata
305
+ * let clientId!: string
306
+ *
307
+ * let clientMetadata = { use_mtls_endpoint_aliases: true }
308
+ * let config = new client.Configuration(
309
+ * server,
310
+ * clientId,
311
+ * clientMetadata,
312
+ * client.TlsClientAuth(),
313
+ * )
314
+ * ```
315
+ *
316
+ * @group Client Authentication Methods
317
+ *
318
+ * @see [OAuth Token Endpoint Authentication Methods](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#token-endpoint-auth-method)
319
+ * @see [RFC 8705 - OAuth 2.0 Mutual-TLS Client Authentication (PKI Mutual-TLS Method)](https://www.rfc-editor.org/rfc/rfc8705.html#name-pki-mutual-tls-method)
320
+ */
321
+ export declare function TlsClientAuth(): ClientAuth;
322
+ /**
323
+ * Skips authorization response `state` validation.
324
+ *
325
+ * > [!WARNING]\
326
+ * > This option has security implications that must be understood, assessed for
327
+ * > applicability, and accepted before use.
328
+ *
329
+ * Use this as a value for `state` check state parameter options to skip the
330
+ * `state` value check. This should only be done if the `state` parameter value
331
+ * used is integrity protected (and its integrity and expiration is checked) and
332
+ * bound to the browsing session. One such mechanism to do so is described in an
333
+ * I-D
334
+ * [draft-bradley-oauth-jwt-encoded-state-09](https://datatracker.ietf.org/doc/html/draft-bradley-oauth-jwt-encoded-state-09).
335
+ *
336
+ * @deprecated Marked as deprecated only to make it stand out as something you
337
+ * shouldn't use unless you've assessed the implications.
338
+ */
339
+ export declare const skipStateCheck: typeof oauth.skipStateCheck;
340
+ /**
341
+ * Skips UserInfo `sub` claim validation.
342
+ *
343
+ * > [!WARNING]\
344
+ * > This option has security implications that must be understood, assessed for
345
+ * > applicability, and accepted before use.
346
+ *
347
+ * Use this as a value to {@link fetchUserInfo} `expectedSubject` parameter to
348
+ * skip the `sub` claim value check.
349
+ *
350
+ * @deprecated Marked as deprecated only to make it stand out as something you
351
+ * shouldn't use unless you've assessed the implications.
352
+ *
353
+ * @see [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#UserInfoResponse)
354
+ */
355
+ export declare const skipSubjectCheck: typeof oauth.skipSubjectCheck;
356
+ /**
357
+ * Overrides the Fetch API implementation used for outbound HTTP requests.
358
+ *
359
+ * When set on a {@link Configuration}, this replaces the use of global fetch. As
360
+ * a fetch replacement the arguments and expected return are the same as fetch.
361
+ *
362
+ * In theory any module that claims to be compatible with the
363
+ * {@link !fetch Fetch API} can be used but your mileage may vary. No workarounds
364
+ * to allow use of non-conform {@link !Response} instances will be considered.
365
+ *
366
+ * If you only need to update the {@link !Request} properties you do not need to
367
+ * use a {@link !fetch Fetch API} module, just change what you need and pass it
368
+ * to globalThis.fetch just like this module would normally do.
369
+ *
370
+ * Its intended use cases are:
371
+ *
372
+ * - {@link !Request}/{@link !Response} tracing and logging
373
+ * - Custom caching strategies
374
+ * - Changing the {@link !Request} properties like headers, body, credentials, mode
375
+ * before it is passed to fetch
376
+ *
377
+ * Known caveats:
378
+ *
379
+ * - Expect Type-related issues when passing the inputs through to fetch-like
380
+ * modules, they hardly ever get their typings inline with actual fetch, you
381
+ * should `@ts-expect-error` them.
382
+ *
383
+ * @example
384
+ *
385
+ * Using [sindresorhus/ky](https://github.com/sindresorhus/ky) for retries and
386
+ * its hooks feature for logging outgoing requests and their responses.
387
+ *
388
+ * ```ts
389
+ * import ky from 'ky'
390
+ *
391
+ * let config!: client.Configuration
392
+ * let logRequest!: (request: Request) => void
393
+ * let logResponse!: (request: Request, response: Response) => void
394
+ * let logRetry!: (
395
+ * request: Request,
396
+ * error: Error,
397
+ * retryCount: number,
398
+ * ) => void
399
+ *
400
+ * config[client.customFetch] = (...args) =>
401
+ * // @ts-expect-error
402
+ * ky(args[0], {
403
+ * ...args[1],
404
+ * hooks: {
405
+ * beforeRequest: [
406
+ * ({ request }) => {
407
+ * logRequest(request)
408
+ * },
409
+ * ],
410
+ * beforeRetry: [
411
+ * ({ request, error, retryCount }) => {
412
+ * logRetry(request, error, retryCount)
413
+ * },
414
+ * ],
415
+ * afterResponse: [
416
+ * ({ request, response }) => {
417
+ * logResponse(request, response)
418
+ * },
419
+ * ],
420
+ * },
421
+ * })
422
+ * ```
423
+ *
424
+ * @example
425
+ *
426
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to detect and use
427
+ * HTTP proxies.
428
+ *
429
+ * ```ts
430
+ * import * as undici from 'undici'
431
+ *
432
+ * // see https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent
433
+ * let envHttpProxyAgent = new undici.EnvHttpProxyAgent()
434
+ *
435
+ * let config!: client.Configuration
436
+ *
437
+ * // @ts-ignore
438
+ * config[client.customFetch] = (...args) => {
439
+ * // @ts-ignore
440
+ * return undici.fetch(args[0], { ...args[1], dispatcher: envHttpProxyAgent }) // prettier-ignore
441
+ * }
442
+ * ```
443
+ *
444
+ * @example
445
+ *
446
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to automatically
447
+ * retry network errors.
448
+ *
449
+ * ```ts
450
+ * import * as undici from 'undici'
451
+ *
452
+ * // see https://undici.nodejs.org/#/docs/api/RetryAgent
453
+ * let retryAgent = new undici.RetryAgent(new undici.Agent(), {
454
+ * statusCodes: [],
455
+ * errorCodes: [
456
+ * 'ECONNRESET',
457
+ * 'ECONNREFUSED',
458
+ * 'ENOTFOUND',
459
+ * 'ENETDOWN',
460
+ * 'ENETUNREACH',
461
+ * 'EHOSTDOWN',
462
+ * 'UND_ERR_SOCKET',
463
+ * ],
464
+ * })
465
+ *
466
+ * let config!: client.Configuration
467
+ *
468
+ * // @ts-ignore
469
+ * config[client.customFetch] = (...args) => {
470
+ * // @ts-ignore
471
+ * return undici.fetch(args[0], { ...args[1], dispatcher: retryAgent }) // prettier-ignore
472
+ * }
473
+ * ```
474
+ *
475
+ * @example
476
+ *
477
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to mock responses in
478
+ * tests.
479
+ *
480
+ * ```ts
481
+ * import * as undici from 'undici'
482
+ *
483
+ * // see https://undici.nodejs.org/#/docs/api/MockAgent
484
+ * let mockAgent = new undici.MockAgent()
485
+ * mockAgent.disableNetConnect()
486
+ *
487
+ * let config!: client.Configuration
488
+ *
489
+ * // @ts-ignore
490
+ * config[client.customFetch] = (...args) => {
491
+ * // @ts-ignore
492
+ * return undici.fetch(args[0], { ...args[1], dispatcher: mockAgent }) // prettier-ignore
493
+ * }
494
+ * ```
495
+ *
496
+ * @example
497
+ *
498
+ * Correcting the `redirect_uri` token endpoint request parameter when the
499
+ * registered redirect URI contains query string components or when URL
500
+ * normalization alters it (e.g. adding a trailing slash to a bare origin). The
501
+ * module derives `redirect_uri` from the callback URL by stripping all query
502
+ * parameters but it cannot distinguish the redirect URI's own parameters from
503
+ * those added by the authorization server response.
504
+ *
505
+ * ```ts
506
+ * let config!: client.Configuration
507
+ * let registeredRedirectUri!: string
508
+ *
509
+ * // @ts-ignore
510
+ * config[client.customFetch] = (...args) => {
511
+ * let [url, options] = args
512
+ * if (
513
+ * options.body instanceof URLSearchParams &&
514
+ * options.body.get('grant_type') === 'authorization_code'
515
+ * ) {
516
+ * options.body.set('redirect_uri', registeredRedirectUri)
517
+ * }
518
+ *
519
+ * // @ts-ignore
520
+ * return fetch(...args)
521
+ * }
522
+ * ```
523
+ */
524
+ export declare const customFetch: typeof oauth.customFetch;
525
+ /**
526
+ * Provides a hook for mutating JWT headers and claims immediately before
527
+ * signing.
528
+ *
529
+ * Use to mutate JWT header and payload before they are signed. Its intended use
530
+ * is working around non-conform server behaviours, such as modifying JWT "aud"
531
+ * (audience) claims, or otherwise changing fixed claims used by this library.
532
+ *
533
+ * @example
534
+ *
535
+ * Changing the `alg: "Ed25519"` back to `alg: "EdDSA"`
536
+ *
537
+ * ```ts
538
+ * let key!: client.CryptoKey | client.PrivateKey
539
+ * let config!: client.Configuration
540
+ * let parameters!: URLSearchParams
541
+ * let keyPair!: client.CryptoKeyPair
542
+ *
543
+ * let remapEd25519: client.ModifyAssertionOptions = {
544
+ * [client.modifyAssertion]: (header) => {
545
+ * if (header.alg === 'Ed25519') {
546
+ * header.alg = 'EdDSA'
547
+ * }
548
+ * },
549
+ * }
550
+ *
551
+ * // For JAR
552
+ * client.buildAuthorizationUrlWithJAR(
553
+ * config,
554
+ * parameters,
555
+ * key,
556
+ * remapEd25519,
557
+ * )
558
+ *
559
+ * // For Private Key JWT
560
+ * client.PrivateKeyJwt(key, remapEd25519)
561
+ *
562
+ * // For DPoP
563
+ * client.getDPoPHandle(config, keyPair, remapEd25519)
564
+ * ```
565
+ */
566
+ export declare const modifyAssertion: typeof oauth.modifyAssertion;
567
+ /**
568
+ * Adjusts the current time used by protocol validations.
569
+ *
570
+ * Use to adjust the assumed current time. Positive and negative finite values
571
+ * representing seconds are allowed. Default is `0` (Date.now() + 0 seconds is
572
+ * used).
573
+ *
574
+ * @example
575
+ *
576
+ * When the local clock is mistakenly 1 hour in the past
577
+ *
578
+ * ```ts
579
+ * let clientMetadata: client.ClientMetadata = {
580
+ * client_id: 'abc4ba37-4ab8-49b5-99d4-9441ba35d428',
581
+ * // ... other metadata
582
+ * [client.clockSkew]: +(60 * 60),
583
+ * }
584
+ * ```
585
+ *
586
+ * @example
587
+ *
588
+ * When the local clock is mistakenly 1 hour in the future
589
+ *
590
+ * ```ts
591
+ * let clientMetadata: client.ClientMetadata = {
592
+ * client_id: 'abc4ba37-4ab8-49b5-99d4-9441ba35d428',
593
+ * // ... other metadata
594
+ * [client.clockSkew]: -(60 * 60),
595
+ * }
596
+ * ```
597
+ */
598
+ export declare const clockSkew: typeof oauth.clockSkew;
599
+ /**
600
+ * Sets the allowed clock tolerance for JWT timestamp claim validation.
601
+ *
602
+ * Use to set allowed clock tolerance when checking DateTime JWT Claims. Only
603
+ * positive finite values representing seconds are allowed. Default is `30` (30
604
+ * seconds).
605
+ *
606
+ * @example
607
+ *
608
+ * Tolerate 30 seconds clock skew when validating JWT claims like exp or nbf.
609
+ *
610
+ * ```ts
611
+ * let clientMetadata: client.ClientMetadata = {
612
+ * client_id: 'abc4ba37-4ab8-49b5-99d4-9441ba35d428',
613
+ * // ... other metadata
614
+ * [client.clockTolerance]: 30,
615
+ * }
616
+ * ```
617
+ */
618
+ export declare const clockTolerance: typeof oauth.clockTolerance;
619
+ /**
620
+ * A request body supported by openid-client's Fetch API integration.
621
+ */
622
+ export type FetchBody = ArrayBuffer | null | ReadableStream | string | Uint8Array | undefined | URLSearchParams;
623
+ /**
624
+ * A DPoP proof-generation and nonce-management handle returned by
625
+ * {@link getDPoPHandle}.
626
+ *
627
+ * @see {@link !DPoP RFC 9449 - OAuth 2.0 Demonstrating Proof of Possession (DPoP)}
628
+ */
629
+ export interface DPoPHandle extends oauth.DPoPHandle {
630
+ }
631
+ /**
632
+ * Client metadata that affects openid-client behavior.
633
+ *
634
+ * This is a subset of the [IANA OAuth Client Metadata
635
+ * registry](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#client-metadata).
636
+ *
637
+ * @group You are probably looking for this
638
+ */
639
+ export interface ClientMetadata extends oauth.Client {
640
+ /**
641
+ * Client secret.
642
+ */
643
+ client_secret?: string;
644
+ /**
645
+ * Indicates the requirement for a client to use mutual TLS endpoint aliases
646
+ * indicated by the
647
+ * {@link ServerMetadata.mtls_endpoint_aliases Authorization Server Metadata}.
648
+ * Default is `false`.
649
+ *
650
+ * When combined with {@link customFetch} (to use a {@link !fetch Fetch API}
651
+ * implementation that supports client certificates) this can be used to
652
+ * target security profiles that utilize Mutual-TLS for either client
653
+ * authentication or sender constraining.
654
+ *
655
+ * @example
656
+ *
657
+ * (Node.js) Using [nodejs/undici](https://github.com/nodejs/undici) for
658
+ * Mutual-TLS Client Authentication and Certificate-Bound Access Tokens
659
+ * support.
660
+ *
661
+ * ```ts
662
+ * import * as undici from 'undici'
663
+ *
664
+ * let config!: client.Configuration
665
+ * let key!: string // PEM-encoded key
666
+ * let cert!: string // PEM-encoded certificate
667
+ *
668
+ * let agent = new undici.Agent({ connect: { key, cert } })
669
+ *
670
+ * config[client.customFetch] = (...args) =>
671
+ * // @ts-expect-error
672
+ * undici.fetch(args[0], { ...args[1], dispatcher: agent })
673
+ * ```
674
+ *
675
+ * @example
676
+ *
677
+ * (Deno) Using Deno.createHttpClient API for Mutual-TLS Client Authentication
678
+ * and Certificate-Bound Access Tokens support.
679
+ *
680
+ * ```ts
681
+ * let config!: client.Configuration
682
+ * let key!: string // PEM-encoded key
683
+ * let cert!: string // PEM-encoded certificate
684
+ *
685
+ * // @ts-expect-error
686
+ * let agent = Deno.createHttpClient({ key, cert })
687
+ *
688
+ * config[client.customFetch] = (...args) =>
689
+ * // @ts-expect-error
690
+ * fetch(args[0], { ...args[1], client: agent })
691
+ * ```
692
+ *
693
+ * @see [RFC 8705 - OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens](https://www.rfc-editor.org/rfc/rfc8705.html)
694
+ */
695
+ use_mtls_endpoint_aliases?: boolean;
696
+ }
697
+ /**
698
+ * Metadata describing an OAuth 2.0 authorization server.
699
+ *
700
+ * @group You are probably looking for this
701
+ *
702
+ * @see [IANA OAuth Authorization Server Metadata registry](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#authorization-server-metadata)
703
+ */
704
+ export interface ServerMetadata extends oauth.AuthorizationServer {
705
+ }
706
+ /**
707
+ * Calculates an S256 PKCE `code_challenge` from a `code_verifier`.
708
+ *
709
+ * @param codeVerifier `code_verifier` value generated e.g. from
710
+ * {@link randomPKCECodeVerifier}
711
+ *
712
+ * @returns S256 `code_challenge` value calculated from a provided
713
+ * `code_verifier`
714
+ *
715
+ * @group PKCE
716
+ * @group Authorization Request
717
+ */
718
+ export declare function calculatePKCECodeChallenge(codeVerifier: string): Promise<string>;
719
+ /**
720
+ * Generates a random PKCE `code_verifier` value.
721
+ *
722
+ * @returns Random `code_verifier` value
723
+ *
724
+ * @group PKCE
725
+ */
726
+ export declare function randomPKCECodeVerifier(): string;
727
+ /**
728
+ * Generates a random OpenID Connect `nonce` value.
729
+ *
730
+ * @returns Random `nonce` value
731
+ *
732
+ * @group Authorization Request
733
+ */
734
+ export declare function randomNonce(): string;
735
+ /**
736
+ * Generates a random OAuth 2.0 `state` value.
737
+ *
738
+ * @returns Random `state` value
739
+ *
740
+ * @group Authorization Request
741
+ */
742
+ export declare function randomState(): string;
743
+ /**
744
+ * An error raised by openid-client.
745
+ *
746
+ * @group Errors
747
+ */
748
+ export declare class ClientError extends Error {
749
+ code?: string;
750
+ }
751
+ /**
752
+ * Generates an asymmetric key pair for signing DPoP proofs.
753
+ *
754
+ * @param alg One of the supported {@link JWSAlgorithm JWS Algorithm}
755
+ * identifiers. Default is `ES256`.
756
+ * @param options
757
+ *
758
+ * @group DPoP
759
+ *
760
+ * @see {@link !DPoP}
761
+ */
762
+ export declare function randomDPoPKeyPair(alg?: string, options?: oauth.GenerateKeyPairOptions): Promise<oauth.CryptoKeyPair>;
763
+ /**
764
+ * Options for authorization server metadata discovery.
765
+ */
766
+ export interface DiscoveryRequestOptions {
767
+ /**
768
+ * Custom {@link !fetch Fetch API} implementation to use for the HTTP Requests
769
+ * the client will be making. If this option is used, then the customFetch
770
+ * value will be assigned to the resolved {@link Configuration} instance for
771
+ * use with all its future individual HTTP requests.
772
+ *
773
+ * @see {@link customFetch}
774
+ */
775
+ [customFetch]?: CustomFetch;
776
+ /**
777
+ * The issuer transformation algorithm to use. Default is `oidc`.
778
+ *
779
+ * @example
780
+ *
781
+ * ```txt
782
+ * Given the Issuer Identifier is https://example.com
783
+ * oidc => https://example.com/.well-known/openid-configuration
784
+ * oauth => https://example.com/.well-known/oauth-authorization-server
785
+ *
786
+ * Given the Issuer Identifier is https://example.com/pathname
787
+ * oidc => https://example.com/pathname/.well-known/openid-configuration
788
+ * oauth => https://example.com/.well-known/oauth-authorization-server/pathname
789
+ * ```
790
+ *
791
+ * @see {@link https://openid.net/specs/openid-connect-discovery-1_0-errata2.html OpenID Connect Discovery 1.0 (oidc)}
792
+ * @see {@link https://www.rfc-editor.org/rfc/rfc8414.html RFC8414 - OAuth 2.0 Authorization Server Metadata (oauth)}
793
+ */
794
+ algorithm?: 'oidc' | 'oauth2';
795
+ /**
796
+ * Methods (available list linked below) to execute with the
797
+ * {@link Configuration} instance as argument after it is instantiated
798
+ *
799
+ * > [!NOTE]\
800
+ * > Presence of {@link allowInsecureRequests} in this option also enables the
801
+ * > use of insecure HTTP requests for the Authorization Server Metadata
802
+ * > discovery request itself.
803
+ *
804
+ * @example
805
+ *
806
+ * Disable the HTTPS-only restriction for the discovery call and subsequently
807
+ * for all requests made with the resulting {@link Configuration} instance.
808
+ *
809
+ * ```ts
810
+ * let server!: URL
811
+ * let clientId!: string
812
+ * let clientMetadata!:
813
+ * Partial<client.ClientMetadata> | undefined | string
814
+ * let clientAuth!: client.ClientAuth | undefined
815
+ *
816
+ * let config = await client.discovery(
817
+ * server,
818
+ * clientId,
819
+ * clientMetadata,
820
+ * clientAuth,
821
+ * {
822
+ * execute: [client.allowInsecureRequests],
823
+ * },
824
+ * )
825
+ * ```
826
+ *
827
+ * @see {@link allowInsecureRequests}
828
+ * @see {@link enableNonRepudiationChecks}
829
+ * @see {@link useCodeIdTokenResponseType}
830
+ * @see {@link useIdTokenResponseType}
831
+ * @see {@link enableDetachedSignatureResponseChecks}
832
+ * @see {@link useJwtResponseMode}
833
+ */
834
+ execute?: Array<(config: Configuration) => void>;
835
+ /**
836
+ * Timeout (in seconds) for the Authorization Server Metadata discovery. If
837
+ * this option is used, then the same timeout value will be assigned to the
838
+ * resolved {@link Configuration} instance for use with all its future
839
+ * individual HTTP requests. Default is `30` (seconds)
840
+ */
841
+ timeout?: number;
842
+ }
843
+ /**
844
+ * Options for Dynamic Client Registration requests.
845
+ */
846
+ export interface DynamicClientRegistrationRequestOptions extends DiscoveryRequestOptions, DPoPOptions {
847
+ /**
848
+ * Access token optionally issued by an authorization server used to authorize
849
+ * calls to the client registration endpoint.
850
+ */
851
+ initialAccessToken?: string;
852
+ }
853
+ /**
854
+ * Discovers an authorization server and dynamically registers a client.
855
+ *
856
+ * Performs Authorization Server Metadata discovery and subsequently a Dynamic
857
+ * Client Registration at the discovered Authorization Server's
858
+ * {@link ServerMetadata.registration_endpoint} using the provided client
859
+ * metadata.
860
+ *
861
+ * > [!NOTE]\
862
+ * > This method also accepts a URL pointing directly to the Authorization
863
+ * > Server's discovery document. Doing so is NOT RECOMMENDED as it disables the
864
+ * > {@link ServerMetadata.issuer} validation.
865
+ *
866
+ * > [!NOTE]\
867
+ * > The method does not contain any logic to default the registered
868
+ * > "token_endpoint_auth_method" based on
869
+ * > {@link ServerMetadata.token_endpoint_auth_methods_supported}, nor does it
870
+ * > default the "clientAuthentication" argument value beyond what its description
871
+ * > says.
872
+ *
873
+ * @param server URL representation of the Authorization Server's Issuer
874
+ * Identifier
875
+ * @param metadata Client Metadata to register at the Authorization Server
876
+ * @param clientAuthentication Implementation of the Client's Authentication
877
+ * Method at the Authorization Server. Default is {@link ClientSecretPost}
878
+ * using the {@link ClientMetadata.client_secret} that the Authorization Server
879
+ * issued, {@link None} otherwise.
880
+ * @param options
881
+ *
882
+ * @group Advanced Configuration
883
+ * @group Dynamic Client Registration (DCR)
884
+ *
885
+ * @see [RFC 7591 - OAuth 2.0 Dynamic Client Registration Protocol (DCR)](https://www.rfc-editor.org/rfc/rfc7591.html)
886
+ * @see [OpenID Connect Dynamic Client Registration 1.0 (DCR)](https://openid.net/specs/openid-connect-registration-1_0-errata2.html)
887
+ * @see [RFC 9449 - OAuth 2.0 Demonstrating Proof-of-Possession at the Application Layer (DPoP)](https://www.rfc-editor.org/rfc/rfc9449.html#name-protected-resource-access)
888
+ */
889
+ export declare function dynamicClientRegistration(server: URL, metadata: Partial<ClientMetadata>, clientAuthentication?: ClientAuth, options?: DynamicClientRegistrationRequestOptions): Promise<Configuration>;
890
+ /**
891
+ * Discovers authorization server metadata and creates a client configuration.
892
+ *
893
+ * Performs Authorization Server Metadata discovery and returns a
894
+ * {@link Configuration} with the discovered
895
+ * {@link ServerMetadata Authorization Server} metadata.
896
+ *
897
+ * Passing the Authorization Server's Issuer Identifier to this method is the
898
+ * RECOMMENDED method of client configuration.
899
+ *
900
+ * This has the same effect as calling the {@link Configuration} constructor
901
+ * except that the server metadata is discovered from its own Authorization
902
+ * Server Metadata discovery document.
903
+ *
904
+ * > [!NOTE]\
905
+ * > This method also accepts a URL pointing directly to the Authorization
906
+ * > Server's discovery document, doing so is merely a shorthand for using
907
+ * > {@link !fetch} and passing the discovered JSON metadata (as
908
+ * > {@link ServerMetadata}) into the {@link Configuration} constructor. Doing so is
909
+ * > NOT RECOMMENDED as it disables the {@link ServerMetadata.issuer} validation.
910
+ *
911
+ * @param server URL representation of the Authorization Server's Issuer
912
+ * Identifier
913
+ * @param clientId Client Identifier at the Authorization Server
914
+ * @param metadata Client Metadata, when a string is passed it is a shorthand
915
+ * for passing just {@link ClientMetadata.client_secret}
916
+ * @param clientAuthentication Implementation of the Client's Authentication
917
+ * Method at the Authorization Server. Default is {@link ClientSecretPost}
918
+ * using the {@link ClientMetadata.client_secret}.
919
+ * @param options
920
+ *
921
+ * @group OpenID Connect 1.0
922
+ * @group Configuration
923
+ * @group You are probably looking for this
924
+ */
925
+ export declare function discovery(server: URL, clientId: string, metadata?: Partial<ClientMetadata> | string, clientAuthentication?: ClientAuth, options?: DiscoveryRequestOptions): Promise<Configuration>;
926
+ /**
927
+ * An asymmetric private key and optional JOSE metadata used to decrypt
928
+ * responses.
929
+ */
930
+ export interface DecryptionKey {
931
+ /**
932
+ * An asymmetric private CryptoKey. Its algorithm must be compatible with a
933
+ * supported JWE Key Management Algorithm Identifier
934
+ */
935
+ key: oauth.CryptoKey;
936
+ /**
937
+ * The key's JWE Key Management Algorithm Identifier, this can be used to
938
+ * limit ECDH and X25519 keys to only a specified ECDH-ES* JWE Key Management
939
+ * Algorithm (The other (RSA) keys have a JWE Key Management Algorithm
940
+ * Identifier fully specified by their CryptoKey algorithm).
941
+ */
942
+ alg?: string;
943
+ /**
944
+ * The key's JWK Key ID.
945
+ */
946
+ kid?: string;
947
+ }
948
+ /**
949
+ * Enables processing of encrypted authorization server responses.
950
+ *
951
+ * Enables the client to process encrypted ID Tokens, encrypted JWT UserInfo
952
+ * responses, and encrypted JWT Introspection responses. Multiple private keys
953
+ * may be provided for the decryption key selection process but only a single
954
+ * one must match the process.
955
+ *
956
+ * The following JWE Key Management Algorithms are supported
957
+ *
958
+ * - ECDH-ES
959
+ * - ECDH-ES+A128KW
960
+ * - ECDH-ES+A192KW
961
+ * - ECDH-ES+A256KW
962
+ * - RSA-OAEP
963
+ * - RSA-OAEP-256
964
+ * - RSA-OAEP-384
965
+ * - RSA-OAEP-512
966
+ *
967
+ * > [!NOTE]\
968
+ * > ECDH algorithms only allow P-256 or X25519 key curve to be used
969
+ *
970
+ * The following JWE Content Encryption Algorithms are supported
971
+ *
972
+ * - A128GCM
973
+ * - A192GCM
974
+ * - A256GCM
975
+ * - A128CBC-HS256
976
+ * - A192CBC-HS384
977
+ * - A256CBC-HS512
978
+ *
979
+ * @example
980
+ *
981
+ * ```ts
982
+ * let key!: client.CryptoKey | client.DecryptionKey
983
+ * let config!: client.Configuration
984
+ *
985
+ * client.enableDecryptingResponses(config, ['A128CBC-HS256'], key)
986
+ * ```
987
+ *
988
+ * @param contentEncryptionAlgorithms An allow list for JWE Content Encryption
989
+ * Algorithms identifiers
990
+ * @param keys Keys to enable decrypting assertions with
991
+ *
992
+ * @group Advanced Configuration
993
+ *
994
+ * @see {@link getDecryptedResponses}
995
+ */
996
+ export declare function enableDecryptingResponses(config: Configuration, contentEncryptionAlgorithms?: string[], ...keys: Array<oauth.CryptoKey | DecryptionKey>): void;
997
+ /**
998
+ * Inner compact JWS values decrypted by {@link authorizationCodeGrant}.
999
+ */
1000
+ export interface DecryptedAuthorizationCodeResponses {
1001
+ /**
1002
+ * Inner signed ID Tokens decrypted from Token and Authorization Endpoint
1003
+ * responses.
1004
+ */
1005
+ readonly id_token?: {
1006
+ /**
1007
+ * Inner signed ID Token decrypted from the Token Endpoint response.
1008
+ */
1009
+ readonly token_endpoint?: string;
1010
+ /**
1011
+ * Inner signed ID Token decrypted from a hybrid or FAPI 1.0 Advanced
1012
+ * detached-signature authorization response.
1013
+ */
1014
+ readonly authorization_endpoint?: string;
1015
+ };
1016
+ /**
1017
+ * Inner signed JWT Secured Authorization Response Mode (JARM) response.
1018
+ */
1019
+ readonly authorization_response?: string;
1020
+ }
1021
+ declare const decryptedResponseType: unique symbol;
1022
+ /**
1023
+ * Exported so downstream declarations can name inferred response types.
1024
+ *
1025
+ * @ignore
1026
+ */
1027
+ export type WithDecryptedResponse<T, S extends string | DecryptedAuthorizationCodeResponses> = T & {
1028
+ readonly [decryptedResponseType]: S;
1029
+ };
1030
+ /**
1031
+ * Returns the inner compact JWS values decrypted from a successfully processed
1032
+ * response.
1033
+ *
1034
+ * {@link enableDecryptingResponses} must have been enabled when the response was
1035
+ * processed. Only JWTs decrypted from a JWE are retained. Unencrypted responses
1036
+ * do not contribute any values.
1037
+ *
1038
+ * For {@link authorizationCodeGrant}, returns a
1039
+ * {@link DecryptedAuthorizationCodeResponses} record covering both the
1040
+ * authorization response and any token endpoint ID Token.
1041
+ * {@link refreshTokenGrant}, {@link genericGrantRequest},
1042
+ * {@link pollDeviceAuthorizationGrant},
1043
+ * {@link pollBackchannelAuthenticationGrant}, {@link implicitAuthentication},
1044
+ * {@link fetchUserInfo}, and {@link tokenIntrospection} return a single compact
1045
+ * JWS. Returns `undefined` whenever no JWT was decrypted, including
1046
+ * authorization code grants.
1047
+ *
1048
+ * Returns `undefined` if decryption support was not enabled or the argument is
1049
+ * not the original result object. Retrieving a JWS does not enable signature
1050
+ * verification beyond the checks already configured for the operation.
1051
+ *
1052
+ * @example
1053
+ *
1054
+ * ```ts
1055
+ * let config!: client.Configuration
1056
+ * let key!: client.CryptoKey
1057
+ * let currentUrl!: URL
1058
+ *
1059
+ * client.enableDecryptingResponses(config, undefined, key)
1060
+ *
1061
+ * let tokens = await client.authorizationCodeGrant(config, currentUrl)
1062
+ * let signed = client.getDecryptedResponses(tokens)
1063
+ * signed?.id_token?.token_endpoint
1064
+ * signed?.id_token?.authorization_endpoint
1065
+ * signed?.authorization_response
1066
+ * ```
1067
+ *
1068
+ * @example
1069
+ *
1070
+ * ```ts
1071
+ * let config!: client.Configuration
1072
+ * let key!: client.CryptoKey
1073
+ * let accessToken!: string
1074
+ * let subject!: string
1075
+ *
1076
+ * client.enableDecryptingResponses(config, undefined, key)
1077
+ *
1078
+ * let userInfo = await client.fetchUserInfo(config, accessToken, subject)
1079
+ * let signed: string | undefined = client.getDecryptedResponses(userInfo)
1080
+ * ```
1081
+ *
1082
+ * @param result Original result returned by a response-processing operation.
1083
+ *
1084
+ * @group Advanced Configuration
1085
+ */
1086
+ export declare function getDecryptedResponses<S extends string | DecryptedAuthorizationCodeResponses>(result: WithDecryptedResponse<object, S>): S | undefined;
1087
+ /**
1088
+ * @param result Original result returned by a response-processing operation.
1089
+ */
1090
+ export declare function getDecryptedResponses(result: oauth.TokenEndpointResponse | oauth.IDToken | oauth.UserInfoResponse | oauth.IntrospectionResponse): string | DecryptedAuthorizationCodeResponses | undefined;
1091
+ /**
1092
+ * Helpers for querying authorization server capabilities.
1093
+ */
1094
+ export interface ServerMetadataHelpers {
1095
+ /**
1096
+ * Determines whether the Authorization Server supports a given Code Challenge
1097
+ * Method
1098
+ *
1099
+ * @param method Code Challenge Method. Default is `S256`
1100
+ */
1101
+ supportsPKCE(method?: string): boolean;
1102
+ }
1103
+ /**
1104
+ * Methods exposed by a {@link Configuration} instance.
1105
+ */
1106
+ export interface ConfigurationMethods {
1107
+ /**
1108
+ * Used to retrieve the Authorization Server Metadata
1109
+ */
1110
+ serverMetadata(): Readonly<ServerMetadata> & ServerMetadataHelpers;
1111
+ /**
1112
+ * Used to retrieve the Client Metadata
1113
+ */
1114
+ clientMetadata(): Readonly<oauth.OmitSymbolProperties<ClientMetadata>>;
1115
+ }
1116
+ /**
1117
+ * Options passed to a custom HTTP request implementation.
1118
+ */
1119
+ export interface CustomFetchOptions {
1120
+ /**
1121
+ * The request body content to send to the server
1122
+ */
1123
+ body: FetchBody;
1124
+ /**
1125
+ * Request body streaming mode. Set to `half` when `body` is a
1126
+ * `ReadableStream`.
1127
+ */
1128
+ duplex?: 'half';
1129
+ /**
1130
+ * HTTP Headers
1131
+ */
1132
+ headers: Record<string, string>;
1133
+ /**
1134
+ * The
1135
+ * {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods request method}
1136
+ */
1137
+ method: string;
1138
+ /**
1139
+ * See {@link !Request.redirect}
1140
+ */
1141
+ redirect: 'manual';
1142
+ /**
1143
+ * An AbortSignal configured as per the {@link ConfigurationProperties.timeout}
1144
+ * value
1145
+ */
1146
+ signal?: AbortSignal;
1147
+ }
1148
+ /**
1149
+ * A Fetch API-compatible function used for outbound HTTP requests.
1150
+ *
1151
+ * @see {@link customFetch}
1152
+ */
1153
+ export type CustomFetch = (
1154
+ /**
1155
+ * URL the request is being made sent to {@link !fetch} as the `resource`
1156
+ * argument
1157
+ */
1158
+ url: string,
1159
+ /**
1160
+ * Options otherwise sent to {@link !fetch} as the `options` argument
1161
+ */
1162
+ options: CustomFetchOptions) => Promise<Response>;
1163
+ /**
1164
+ * Configurable properties exposed by a {@link Configuration} instance.
1165
+ */
1166
+ export interface ConfigurationProperties {
1167
+ /**
1168
+ * Custom {@link !fetch Fetch API} implementation to use for the HTTP Requests
1169
+ * the client will be making.
1170
+ *
1171
+ * @see {@link customFetch}
1172
+ */
1173
+ [customFetch]?: CustomFetch | undefined;
1174
+ /**
1175
+ * Timeout (in seconds) for the HTTP Requests the client will be making.
1176
+ * Default is `30` (seconds)
1177
+ */
1178
+ timeout?: number | undefined;
1179
+ }
1180
+ /**
1181
+ * Represents an authorization server and its client configuration.
1182
+ *
1183
+ * Configuration is an abstraction over the
1184
+ * {@link ServerMetadata OAuth 2.0 Authorization Server metadata} and
1185
+ * {@link ClientMetadata OAuth 2.0 Client metadata}
1186
+ *
1187
+ * Configuration instances are obtained either through
1188
+ *
1189
+ * - (RECOMMENDED) the {@link discovery} function that discovers the
1190
+ * {@link ServerMetadata OAuth 2.0 Authorization Server metadata} using the
1191
+ * Authorization Server's Issuer Identifier, or
1192
+ * - The {@link Configuration} constructor if the
1193
+ * {@link ServerMetadata OAuth 2.0 Authorization Server metadata} is known
1194
+ * upfront
1195
+ *
1196
+ * @example
1197
+ *
1198
+ * (RECOMMENDED) Setting up a Configuration with a Server Metadata discovery
1199
+ * step
1200
+ *
1201
+ * ```ts
1202
+ * let server!: URL
1203
+ * let clientId!: string
1204
+ * let clientSecret!: string | undefined
1205
+ *
1206
+ * let config = await client.discovery(server, clientId, clientSecret)
1207
+ * ```
1208
+ *
1209
+ * @example
1210
+ *
1211
+ * Setting up a Configuration with a constructor
1212
+ *
1213
+ * ```ts
1214
+ * let server!: client.ServerMetadata
1215
+ * let clientId!: string
1216
+ * let clientSecret!: string | undefined
1217
+ *
1218
+ * let config = new client.Configuration(server, clientId, clientSecret)
1219
+ * ```
1220
+ *
1221
+ * @group Configuration
1222
+ */
1223
+ export declare class Configuration implements ConfigurationMethods, ConfigurationProperties {
1224
+ /**
1225
+ * @param server Authorization Server Metadata
1226
+ * @param clientId Client Identifier at the Authorization Server
1227
+ * @param metadata Client Metadata, when a string is passed it is a shorthand
1228
+ * for passing just {@link ClientMetadata.client_secret}.
1229
+ * @param clientAuthentication Implementation of the Client's Authentication
1230
+ * Method at the Authorization Server. Default is {@link ClientSecretPost}
1231
+ * using the {@link ClientMetadata.client_secret}.
1232
+ */
1233
+ constructor(server: ServerMetadata, clientId: string, metadata?: Partial<ClientMetadata> | string, clientAuthentication?: ClientAuth);
1234
+ /**
1235
+ * @ignore
1236
+ */
1237
+ serverMetadata(): Readonly<ServerMetadata> & ServerMetadataHelpers;
1238
+ /**
1239
+ * @ignore
1240
+ */
1241
+ clientMetadata(): Readonly<oauth.OmitSymbolProperties<ClientMetadata>>;
1242
+ /**
1243
+ * @ignore
1244
+ */
1245
+ get timeout(): number | undefined;
1246
+ /**
1247
+ * @ignore
1248
+ */
1249
+ set timeout(value: number | undefined);
1250
+ /**
1251
+ * @ignore
1252
+ */
1253
+ get [customFetch](): CustomFetch | undefined;
1254
+ /**
1255
+ * @ignore
1256
+ */
1257
+ set [customFetch](value: CustomFetch);
1258
+ }
1259
+ /**
1260
+ * Helpers attached to a parsed {@link TokenEndpointResponse}.
1261
+ */
1262
+ export interface TokenEndpointResponseHelpers {
1263
+ /**
1264
+ * Returns the parsed JWT Claims Set of an
1265
+ * {@link TokenEndpointResponse.id_token id_token} returned by the
1266
+ * authorization server
1267
+ *
1268
+ * > [!NOTE]\
1269
+ * > Returns `undefined` when {@link TokenEndpointResponse.id_token id_token} was
1270
+ * > not returned by the authorization server
1271
+ */
1272
+ claims(): oauth.IDToken | undefined;
1273
+ /**
1274
+ * Returns the number of seconds until the
1275
+ * {@link TokenEndpointResponse.access_token access_token} expires
1276
+ *
1277
+ * > [!NOTE]\
1278
+ * > Returns `0` when already expired
1279
+ *
1280
+ * > [!NOTE]\
1281
+ * > Returns `undefined` when {@link TokenEndpointResponse.expires_in expires_in}
1282
+ * > was not returned by the authorization server
1283
+ */
1284
+ expiresIn(): number | undefined;
1285
+ }
1286
+ /**
1287
+ * Creates a DPoP handle for sender-constrained token requests.
1288
+ *
1289
+ * Returns a wrapper / handle around a public/private key pair that is used for
1290
+ * negotiating and proving proof-of-possession to sender-constrain OAuth 2.0
1291
+ * tokens via {@link !DPoP} at the Authorization Server and Resource Server.
1292
+ *
1293
+ * Support for {@link !DPoP} at the authorization is indicated by
1294
+ * {@link ServerMetadata.dpop_signing_alg_values_supported}. Whether the
1295
+ * authorization server ends up sender-constraining the access token is at the
1296
+ * server's discretion. When an access token is sender-constrained then the
1297
+ * resulting
1298
+ * {@link TokenEndpointResponse.token_type `token_type` will be `dpop`}.
1299
+ *
1300
+ * This wrapper / handle also keeps track of server-issued nonces, allowing this
1301
+ * module to automatically retry requests with a fresh nonce when the server
1302
+ * indicates the need to use one.
1303
+ *
1304
+ * > [!NOTE]\
1305
+ * > Public Clients that use DPoP will also get their Refresh Token
1306
+ * > sender-constrained, this binding is not indicated in the response.
1307
+ *
1308
+ * @param keyPair {@link CryptoKeyPair} to sign the DPoP Proof JWT,
1309
+ * {@link randomDPoPKeyPair} may be used to generate it
1310
+ *
1311
+ * @group DPoP
1312
+ *
1313
+ * @see {@link !DPoP RFC 9449 - OAuth 2.0 Demonstrating Proof of Possession (DPoP)}
1314
+ */
1315
+ export declare function getDPoPHandle(config: Configuration, keyPair: oauth.CryptoKeyPair, options?: oauth.ModifyAssertionOptions): DPoPHandle;
1316
+ /**
1317
+ * Options for polling an OAuth 2.0 Device Authorization Grant.
1318
+ */
1319
+ export interface DeviceAuthorizationGrantPollOptions extends DPoPOptions {
1320
+ /**
1321
+ * AbortSignal to abort polling. Default is that the operation will time out
1322
+ * after the indicated expires_in property returned by the server in
1323
+ * {@link initiateDeviceAuthorization}
1324
+ */
1325
+ signal?: AbortSignal;
1326
+ }
1327
+ /**
1328
+ * Polls until an OAuth 2.0 Device Authorization Grant completes.
1329
+ *
1330
+ * Continuously polls the {@link ServerMetadata.token_endpoint token endpoint}
1331
+ * until the end-user finishes the {@link !"Device Authorization Grant"} process
1332
+ * on their secondary device
1333
+ *
1334
+ * > [!NOTE]\
1335
+ * > {@link ServerMetadata.token_endpoint URL of the authorization server's token endpoint}
1336
+ * > must be configured.
1337
+ *
1338
+ * @example
1339
+ *
1340
+ * ```ts
1341
+ * let config!: client.Configuration
1342
+ * let scope!: string
1343
+ *
1344
+ * let deviceAuthorizationResponse =
1345
+ * await client.initiateDeviceAuthorization(config, { scope })
1346
+ *
1347
+ * let { user_code, verification_uri, verification_uri_complete } =
1348
+ * deviceAuthorizationResponse
1349
+ *
1350
+ * console.log({ user_code, verification_uri, verification_uri_complete })
1351
+ *
1352
+ * let tokenEndpointResponse = await client.pollDeviceAuthorizationGrant(
1353
+ * config,
1354
+ * deviceAuthorizationResponse,
1355
+ * )
1356
+ * ```
1357
+ *
1358
+ * @param deviceAuthorizationResponse Device Authorization Response obtained
1359
+ * from {@link initiateDeviceAuthorization}
1360
+ * @param parameters Additional parameters that will be sent to the token
1361
+ * endpoint, typically used for parameters such as `scope` and a `resource`
1362
+ * ({@link !"Resource Indicators" Resource Indicator})
1363
+ *
1364
+ * @group Grants
1365
+ */
1366
+ export declare function pollDeviceAuthorizationGrant(config: Configuration, deviceAuthorizationResponse: oauth.DeviceAuthorizationResponse, parameters?: URLSearchParams | Record<string, string>, options?: DeviceAuthorizationGrantPollOptions): Promise<WithDecryptedResponse<oauth.TokenEndpointResponse & TokenEndpointResponseHelpers, string>>;
1367
+ /**
1368
+ * Initiates an OAuth 2.0 Device Authorization Grant.
1369
+ *
1370
+ * Initiates a {@link !"Device Authorization Grant"} using parameters from the
1371
+ * `parameters` argument.
1372
+ *
1373
+ * > [!NOTE]\
1374
+ * > {@link ServerMetadata.device_authorization_endpoint URL of the authorization server's device authorization endpoint}
1375
+ * > must be configured.
1376
+ *
1377
+ * @example
1378
+ *
1379
+ * ```ts
1380
+ * let config!: client.Configuration
1381
+ * let scope!: string
1382
+ *
1383
+ * let deviceAuthorizationResponse =
1384
+ * await client.initiateDeviceAuthorization(config, { scope })
1385
+ *
1386
+ * let { user_code, verification_uri, verification_uri_complete } =
1387
+ * deviceAuthorizationResponse
1388
+ *
1389
+ * console.log({ user_code, verification_uri, verification_uri_complete })
1390
+ * ```
1391
+ *
1392
+ * @param parameters Authorization request parameters that will be sent to the
1393
+ * device authorization endpoint
1394
+ *
1395
+ * @group Grants
1396
+ */
1397
+ export declare function initiateDeviceAuthorization(config: Configuration, parameters: URLSearchParams | Record<string, string>): Promise<oauth.DeviceAuthorizationResponse>;
1398
+ /**
1399
+ * Initiates a Client-Initiated Backchannel Authentication request.
1400
+ *
1401
+ * Initiates a {@link !"Client-Initiated Backchannel Authentication Grant"} using
1402
+ * parameters from the `parameters` argument.
1403
+ *
1404
+ * > [!NOTE]\
1405
+ * > {@link ServerMetadata.backchannel_authentication_endpoint URL of the authorization server's backchannel authentication endpoint}
1406
+ * > must be configured.
1407
+ *
1408
+ * @example
1409
+ *
1410
+ * ```ts
1411
+ * let config!: client.Configuration
1412
+ * let scope!: string
1413
+ * let login_hint!: string // one of login_hint, id_token_hint, or login_hint_token parameters must be provided in CIBA
1414
+ *
1415
+ * let backchannelAuthenticationResponse =
1416
+ * await client.initiateBackchannelAuthentication(config, {
1417
+ * scope,
1418
+ * login_hint,
1419
+ * })
1420
+ *
1421
+ * let { auth_req_id } = backchannelAuthenticationResponse
1422
+ * ```
1423
+ *
1424
+ * @param parameters Authorization request parameters that will be sent to the
1425
+ * backchannel authentication endpoint
1426
+ *
1427
+ * @group Grants
1428
+ */
1429
+ export declare function initiateBackchannelAuthentication(config: Configuration, parameters: URLSearchParams | Record<string, string>): Promise<oauth.BackchannelAuthenticationResponse>;
1430
+ /**
1431
+ * Options for polling a Client-Initiated Backchannel Authentication Grant.
1432
+ */
1433
+ export interface BackchannelAuthenticationGrantPollOptions extends DPoPOptions {
1434
+ /**
1435
+ * AbortSignal to abort polling. Default is that the operation will time out
1436
+ * after the indicated expires_in property returned by the server in
1437
+ * {@link initiateBackchannelAuthentication}
1438
+ */
1439
+ signal?: AbortSignal;
1440
+ }
1441
+ /**
1442
+ * Polls until a Client-Initiated Backchannel Authentication Grant completes.
1443
+ *
1444
+ * Continuously polls the {@link ServerMetadata.token_endpoint token endpoint}
1445
+ * until the end-user finishes the
1446
+ * {@link !"Client-Initiated Backchannel Authentication Grant"} process
1447
+ *
1448
+ * > [!NOTE]\
1449
+ * > {@link ServerMetadata.token_endpoint URL of the authorization server's token endpoint}
1450
+ * > must be configured.
1451
+ *
1452
+ * @example
1453
+ *
1454
+ * ```ts
1455
+ * let config!: client.Configuration
1456
+ * let scope!: string
1457
+ * let login_hint!: string // one of login_hint, id_token_hint, or login_hint_token parameters must be provided in CIBA
1458
+ *
1459
+ * let backchannelAuthenticationResponse =
1460
+ * await client.initiateBackchannelAuthentication(config, {
1461
+ * scope,
1462
+ * login_hint,
1463
+ * })
1464
+ *
1465
+ * // OPTIONAL: If your client is configured with Ping Mode you'd invoke the following after getting the CIBA Ping Callback (its implementation is framework specific and therefore out of scope for openid-client)
1466
+ *
1467
+ * let { auth_req_id } = backchannelAuthenticationResponse
1468
+ *
1469
+ * let tokenEndpointResponse =
1470
+ * await client.pollBackchannelAuthenticationGrant(
1471
+ * config,
1472
+ * backchannelAuthenticationResponse,
1473
+ * )
1474
+ * ```
1475
+ *
1476
+ * @param backchannelAuthenticationResponse Backchannel Authentication Response
1477
+ * obtained from {@link initiateBackchannelAuthentication}
1478
+ * @param parameters Additional parameters that will be sent to the token
1479
+ * endpoint, typically used for parameters such as `scope` and a `resource`
1480
+ * ({@link !"Resource Indicators" Resource Indicator})
1481
+ *
1482
+ * @group Grants
1483
+ */
1484
+ export declare function pollBackchannelAuthenticationGrant(config: Configuration, backchannelAuthenticationResponse: oauth.BackchannelAuthenticationResponse, parameters?: URLSearchParams | Record<string, string>, options?: BackchannelAuthenticationGrantPollOptions): Promise<WithDecryptedResponse<oauth.TokenEndpointResponse & TokenEndpointResponseHelpers, string>>;
1485
+ /**
1486
+ * Options for performing an Authorization Code Grant.
1487
+ */
1488
+ export interface AuthorizationCodeGrantOptions extends DPoPOptions {
1489
+ }
1490
+ /**
1491
+ * By default the module only allows interactions with HTTPS endpoints. This
1492
+ * removes that restriction.
1493
+ *
1494
+ * @deprecated Marked as deprecated only to make it stand out as something you
1495
+ * shouldn't have the need to use, possibly only for local development and
1496
+ * testing against non-TLS secured environments.
1497
+ *
1498
+ * @example
1499
+ *
1500
+ * Usage with a {@link Configuration} obtained through {@link discovery} to also
1501
+ * disable its HTTPS-only restriction.
1502
+ *
1503
+ * ```ts
1504
+ * let server!: URL
1505
+ * let clientId!: string
1506
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
1507
+ * let clientAuth!: client.ClientAuth | undefined
1508
+ *
1509
+ * let config = await client.discovery(
1510
+ * server,
1511
+ * clientId,
1512
+ * clientMetadata,
1513
+ * clientAuth,
1514
+ * {
1515
+ * execute: [client.allowInsecureRequests],
1516
+ * },
1517
+ * )
1518
+ * ```
1519
+ *
1520
+ * @example
1521
+ *
1522
+ * Usage with a {@link Configuration} instance
1523
+ *
1524
+ * ```ts
1525
+ * let config!: client.Configuration
1526
+ *
1527
+ * client.allowInsecureRequests(config)
1528
+ * ```
1529
+ *
1530
+ * @group Advanced Configuration
1531
+ */
1532
+ export declare function allowInsecureRequests(config: Configuration): void;
1533
+ /**
1534
+ * Imports an externally managed JSON Web Key Set cache.
1535
+ *
1536
+ * > [!WARNING]\
1537
+ * > Use of this function has security implications that must be understood,
1538
+ * > assessed for applicability, and accepted before use. It is critical that the
1539
+ * > JSON Web Key Set cache only be writable by your own code.
1540
+ *
1541
+ * This option is intended for cloud computing runtimes that cannot keep an in
1542
+ * memory cache between their code's invocations. Use in runtimes where an in
1543
+ * memory cache between requests is available is not desirable.
1544
+ *
1545
+ * @param jwksCache JWKS Cache previously obtained from {@link getJwksCache}
1546
+ *
1547
+ * @group Advanced Configuration
1548
+ */
1549
+ export declare function setJwksCache(config: Configuration, jwksCache: oauth.ExportedJWKSCache): void;
1550
+ /**
1551
+ * Exports the JSON Web Key Set cache used for signature validation.
1552
+ *
1553
+ * This function can be used to export the JSON Web Key Set and the timestamp at
1554
+ * which it was last fetched if the client used the
1555
+ * {@link ServerMetadata.jwks_uri authorization server's JWK Set} to validate
1556
+ * digital signatures.
1557
+ *
1558
+ * This function is intended for cloud computing runtimes that cannot keep an in
1559
+ * memory cache between their code's invocations. Use in runtimes where an in
1560
+ * memory cache between requests is available is not desirable.
1561
+ *
1562
+ * > [!NOTE]\
1563
+ * > The client only uses the authorization server's JWK Set when
1564
+ * > {@link enableNonRepudiationChecks}, {@link useJwtResponseMode},
1565
+ * > {@link useCodeIdTokenResponseType}, or {@link useIdTokenResponseType} is used.
1566
+ *
1567
+ * @group Advanced Configuration
1568
+ */
1569
+ export declare function getJwksCache(config: Configuration): oauth.ExportedJWKSCache | undefined;
1570
+ /**
1571
+ * Enables JWS signature validation for processed JWT responses.
1572
+ *
1573
+ * Enables validating the JWS Signature of either a JWT {@link !Response.body} or
1574
+ * {@link TokenEndpointResponse.id_token} of a processed {@link !Response} such as
1575
+ * JWT UserInfo or JWT Introspection responses.
1576
+ *
1577
+ * > [!NOTE]\
1578
+ * > Validating signatures of JWTs received via direct communication between the
1579
+ * > client and a TLS-secured endpoint (which it is here) is not mandatory since
1580
+ * > the TLS server validation is used to validate the issuer instead of checking
1581
+ * > the token signature. You only need to use this method for non-repudiation
1582
+ * > purposes.
1583
+ *
1584
+ * > [!NOTE]\
1585
+ * > {@link ServerMetadata.jwks_uri URL of the authorization server's JWK Set document}
1586
+ * > must be configured.
1587
+ *
1588
+ * > [!NOTE]\
1589
+ * > Supports only digital signatures using
1590
+ * > {@link JWSAlgorithm these supported JWS Algorithms}.
1591
+ *
1592
+ * @example
1593
+ *
1594
+ * Usage with a {@link Configuration} obtained through {@link discovery} to also
1595
+ * disable the its HTTPS-only restriction.
1596
+ *
1597
+ * ```ts
1598
+ * let server!: URL
1599
+ * let clientId!: string
1600
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
1601
+ * let clientAuth!: client.ClientAuth | undefined
1602
+ *
1603
+ * let config = await client.discovery(
1604
+ * server,
1605
+ * clientId,
1606
+ * clientMetadata,
1607
+ * clientAuth,
1608
+ * {
1609
+ * execute: [client.enableNonRepudiationChecks],
1610
+ * },
1611
+ * )
1612
+ * ```
1613
+ *
1614
+ * @example
1615
+ *
1616
+ * Usage with a {@link Configuration} instance
1617
+ *
1618
+ * ```ts
1619
+ * let config!: client.Configuration
1620
+ *
1621
+ * client.enableNonRepudiationChecks(config)
1622
+ * ```
1623
+ *
1624
+ * @group Advanced Configuration
1625
+ */
1626
+ export declare function enableNonRepudiationChecks(config: Configuration): void;
1627
+ /**
1628
+ * Configures the client to use JWT Secured Authorization Response Mode (JARM).
1629
+ *
1630
+ * This changes the `response_mode` used by the client to be `jwt` and expects
1631
+ * the authorization server response passed to {@link authorizationCodeGrant} to
1632
+ * be one described by {@link !JARM}.
1633
+ *
1634
+ * > [!NOTE]\
1635
+ * > {@link ServerMetadata.jwks_uri URL of the authorization server's JWK Set document}
1636
+ * > must be configured.
1637
+ *
1638
+ * @example
1639
+ *
1640
+ * Usage with a {@link Configuration} obtained through {@link discovery}
1641
+ *
1642
+ * ```ts
1643
+ * let server!: URL
1644
+ * let clientId!: string
1645
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
1646
+ * let clientAuth!: client.ClientAuth | undefined
1647
+ *
1648
+ * let config = await client.discovery(
1649
+ * server,
1650
+ * clientId,
1651
+ * clientMetadata,
1652
+ * clientAuth,
1653
+ * {
1654
+ * execute: [client.useJwtResponseMode],
1655
+ * },
1656
+ * )
1657
+ * ```
1658
+ *
1659
+ * @example
1660
+ *
1661
+ * Usage with a {@link Configuration} instance
1662
+ *
1663
+ * ```ts
1664
+ * let config!: client.Configuration
1665
+ *
1666
+ * client.useJwtResponseMode(config)
1667
+ * ```
1668
+ *
1669
+ * @group Advanced Configuration
1670
+ *
1671
+ * @see {@link !JARM}
1672
+ */
1673
+ export declare function useJwtResponseMode(config: Configuration): void;
1674
+ /**
1675
+ * Enables FAPI 1.0 Advanced detached-signature response validation.
1676
+ *
1677
+ * This builds on top of {@link useCodeIdTokenResponseType} and enables the
1678
+ * response to be validated as per the
1679
+ * {@link https://openid.net/specs/openid-financial-api-part-2-1_0-final.html#id-token-as-detached-signature FAPI 1.0 Advanced profile}.
1680
+ *
1681
+ * @example
1682
+ *
1683
+ * Usage with a {@link Configuration} obtained through {@link discovery}
1684
+ *
1685
+ * ```ts
1686
+ * let server!: URL
1687
+ * let clientId!: string
1688
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
1689
+ * let clientAuth!: client.ClientAuth | undefined
1690
+ *
1691
+ * let config = await client.discovery(
1692
+ * server,
1693
+ * clientId,
1694
+ * clientMetadata,
1695
+ * clientAuth,
1696
+ * {
1697
+ * execute: [
1698
+ * client.useCodeIdTokenResponseType,
1699
+ * client.enableDetachedSignatureResponseChecks,
1700
+ * ],
1701
+ * },
1702
+ * )
1703
+ * ```
1704
+ *
1705
+ * @example
1706
+ *
1707
+ * Usage with a {@link Configuration} instance
1708
+ *
1709
+ * ```ts
1710
+ * let config!: client.Configuration
1711
+ *
1712
+ * client.useCodeIdTokenResponseType(config)
1713
+ * client.enableDetachedSignatureResponseChecks(config)
1714
+ * ```
1715
+ *
1716
+ * @group Advanced Configuration
1717
+ *
1718
+ * @see {@link https://openid.net/specs/openid-financial-api-part-2-1_0-final.html#id-token-as-detached-signature ID Token as Detached Signature}
1719
+ */
1720
+ export declare function enableDetachedSignatureResponseChecks(config: Configuration): void;
1721
+ /**
1722
+ * Expected values and validation checks for an OpenID Connect Implicit Flow
1723
+ * response.
1724
+ */
1725
+ export interface ImplicitAuthenticationResponseChecks extends Pick<AuthorizationCodeGrantChecks, 'expectedState' | 'maxAge'> {
1726
+ }
1727
+ /**
1728
+ * Validates an OpenID Connect Implicit Flow response.
1729
+ *
1730
+ * This method validates the authorization server's
1731
+ * {@link https://openid.net/specs/openid-connect-core-1_0-errata2.html#ImplicitFlowAuth Implicit Authentication Flow}
1732
+ * Response.
1733
+ *
1734
+ * > [!NOTE]\
1735
+ * > {@link ServerMetadata.jwks_uri URL of the authorization server's JWK Set document}
1736
+ * > must be configured.
1737
+ *
1738
+ * > [!NOTE]\
1739
+ * > Only `response_type=id_token` responses are supported and prior use of
1740
+ * > {@link useIdTokenResponseType} is required.
1741
+ *
1742
+ * @example
1743
+ *
1744
+ * Using an incoming {@link !Request} instance
1745
+ *
1746
+ * ```ts
1747
+ * let config!: client.Configuration
1748
+ * let expectedNonce!: string
1749
+ * let request!: Request
1750
+ *
1751
+ * let idTokenClaims = await client.implicitAuthentication(
1752
+ * config,
1753
+ * request,
1754
+ * expectedNonce,
1755
+ * )
1756
+ * ```
1757
+ *
1758
+ * @example
1759
+ *
1760
+ * When using a `form_post` response mode without a {@link !Request} instance
1761
+ *
1762
+ * ```ts
1763
+ * let config!: client.Configuration
1764
+ * let expectedNonce!: string
1765
+ * let getCurrentUrl!: (...args: any) => URL
1766
+ * let getBody!: (...args: any) => Record<string, string>
1767
+ *
1768
+ * let url = getCurrentUrl()
1769
+ * url.hash = new URLSearchParams(getBody()).toString()
1770
+ *
1771
+ * let idTokenClaims = await client.implicitAuthentication(
1772
+ * config,
1773
+ * url,
1774
+ * expectedNonce,
1775
+ * )
1776
+ * ```
1777
+ *
1778
+ * @example
1779
+ *
1780
+ * In a browser environment
1781
+ *
1782
+ * ```ts
1783
+ * let config!: client.Configuration
1784
+ * let expectedNonce!: string
1785
+ * let getCurrentUrl!: (...args: any) => URL
1786
+ *
1787
+ * let tokens = await client.implicitAuthentication(
1788
+ * config,
1789
+ * new URL(location.href),
1790
+ * expectedNonce,
1791
+ * )
1792
+ * ```
1793
+ *
1794
+ * @param currentUrl Current {@link !URL} the Authorization Server provided an
1795
+ * Authorization Response to or a {@link !Request}, the
1796
+ * {@link https://openid.net/specs/openid-connect-core-1_0-errata2.html#ImplicitAuthResponse Authentication Response Parameters}
1797
+ * are extracted from this.
1798
+ * @param expectedNonce Expected value of the `nonce` ID Token claim. This value
1799
+ * must match exactly.
1800
+ * @param checks Additional optional Implicit Authentication Response checks
1801
+ *
1802
+ * @returns ID Token Claims Set
1803
+ *
1804
+ * @group OpenID Connect 1.0
1805
+ *
1806
+ * @see {@link https://openid.net/specs/openid-connect-core-1_0-errata2.html#ImplicitFlowAuth OpenID Connect 1.0 Implicit Flow}
1807
+ */
1808
+ export declare function implicitAuthentication(config: Configuration, currentUrl: URL | Request, expectedNonce: string, checks?: ImplicitAuthenticationResponseChecks): Promise<WithDecryptedResponse<oauth.IDToken, string>>;
1809
+ /**
1810
+ * Configures the client to use the OpenID Connect Hybrid Flow.
1811
+ *
1812
+ * This changes the `response_type` used by the client to be `code id_token` and
1813
+ * expects the authorization server response passed to
1814
+ * {@link authorizationCodeGrant} to be one described by
1815
+ * {@link https://openid.net/specs/openid-connect-core-1_0-errata2.html#HybridFlowAuth OpenID Connect 1.0 Hybrid Flow}.
1816
+ *
1817
+ * > [!NOTE]\
1818
+ * > {@link ServerMetadata.jwks_uri URL of the authorization server's JWK Set document}
1819
+ * > must be configured.
1820
+ *
1821
+ * @example
1822
+ *
1823
+ * Usage with a {@link Configuration} obtained through {@link discovery}
1824
+ *
1825
+ * ```ts
1826
+ * let server!: URL
1827
+ * let clientId!: string
1828
+ * let clientMetadata!: Partial<client.ClientMetadata> | string | undefined
1829
+ * let clientAuth!: client.ClientAuth | undefined
1830
+ *
1831
+ * let config = await client.discovery(
1832
+ * server,
1833
+ * clientId,
1834
+ * clientMetadata,
1835
+ * clientAuth,
1836
+ * {
1837
+ * execute: [client.useCodeIdTokenResponseType],
1838
+ * },
1839
+ * )
1840
+ * ```
1841
+ *
1842
+ * @example
1843
+ *
1844
+ * Usage with a {@link Configuration} instance
1845
+ *
1846
+ * ```ts
1847
+ * let config!: client.Configuration
1848
+ *
1849
+ * client.useCodeIdTokenResponseType(config)
1850
+ * ```
1851
+ *
1852
+ * @group Advanced Configuration
1853
+ *
1854
+ * @see {@link https://openid.net/specs/openid-connect-core-1_0-errata2.html#HybridFlowAuth OpenID Connect 1.0 Hybrid Flow}
1855
+ */
1856
+ export declare function useCodeIdTokenResponseType(config: Configuration): void;
1857
+ /**
1858
+ * Configures the client to use the OpenID Connect Implicit Flow.
1859
+ *
1860
+ * This changes the `response_type` used by the client to be `id_token`, this
1861
+ * subsequently requires that the authorization server response be passed to
1862
+ * {@link implicitAuthentication} (instead of {@link authorizationCodeGrant}) and
1863
+ * for it to be one described by
1864
+ * {@link https://openid.net/specs/openid-connect-core-1_0-errata2.html#ImplicitFlowAuth OpenID Connect 1.0 Implicit Flow}.
1865
+ *
1866
+ * > [!NOTE]\
1867
+ * > {@link ServerMetadata.jwks_uri URL of the authorization server's JWK Set document}
1868
+ * > must be configured.
1869
+ *
1870
+ * @example
1871
+ *
1872
+ * Usage with a {@link Configuration} obtained through {@link discovery}
1873
+ *
1874
+ * ```ts
1875
+ * let server!: URL
1876
+ * let clientId!: string
1877
+ * let clientMetadata!: Partial<client.ClientMetadata> | undefined
1878
+ * let clientAuth = client.None()
1879
+ *
1880
+ * let config = await client.discovery(
1881
+ * server,
1882
+ * clientId,
1883
+ * clientMetadata,
1884
+ * clientAuth,
1885
+ * {
1886
+ * execute: [client.useIdTokenResponseType],
1887
+ * },
1888
+ * )
1889
+ * ```
1890
+ *
1891
+ * @example
1892
+ *
1893
+ * Usage with a {@link Configuration} instance
1894
+ *
1895
+ * ```ts
1896
+ * let config!: client.Configuration
1897
+ *
1898
+ * client.useIdTokenResponseType(config)
1899
+ * ```
1900
+ *
1901
+ * @group Advanced Configuration
1902
+ *
1903
+ * @see {@link https://openid.net/specs/openid-connect-core-1_0-errata2.html#ImplicitFlowAuth OpenID Connect 1.0 Implicit Flow}
1904
+ */
1905
+ export declare function useIdTokenResponseType(config: Configuration): void;
1906
+ /**
1907
+ * Expected values and validation checks for an Authorization Code Grant
1908
+ * response.
1909
+ */
1910
+ export interface AuthorizationCodeGrantChecks {
1911
+ /**
1912
+ * Expected value of the `nonce` ID Token claim. This value must match
1913
+ * exactly. When `undefined` the expectation is that there is no `nonce` in
1914
+ * the ID Token (i.e. also `undefined`).
1915
+ *
1916
+ * Using this option also means that an ID Token must be part of the response.
1917
+ */
1918
+ expectedNonce?: string;
1919
+ /**
1920
+ * Expected value of the `state` authorization response parameter. This value
1921
+ * must match exactly. When `undefined` the expectation is that there is no
1922
+ * `state` in the authorization response.
1923
+ */
1924
+ expectedState?: string | typeof skipStateCheck;
1925
+ /**
1926
+ * Use this to have the client assert that an ID Token is returned by the
1927
+ * Authorization Server.
1928
+ *
1929
+ * > [!NOTE]\
1930
+ * > When `expectedNonce` or `maxAge` is used this has no effect.
1931
+ */
1932
+ idTokenExpected?: boolean;
1933
+ /**
1934
+ * ID Token {@link IDToken.auth_time `auth_time`} claim value will be checked
1935
+ * to be present and conform to this `maxAge` value. Use of this option is
1936
+ * required if you sent a `max_age` parameter in the authorization request.
1937
+ * Default is {@link ClientMetadata.default_max_age } and falls back to not
1938
+ * checking the claim's value beyond it being a number when present.
1939
+ */
1940
+ maxAge?: number;
1941
+ /**
1942
+ * When PKCE is used this is the `code_verifier` that will be sent to the
1943
+ * {@link ServerMetadata.token_endpoint token endpoint}.
1944
+ */
1945
+ pkceCodeVerifier?: string;
1946
+ }
1947
+ /**
1948
+ * Processes an authorization response and performs the Authorization Code
1949
+ * Grant.
1950
+ *
1951
+ * This method validates the authorization response and then executes the
1952
+ * {@link !"Authorization Code Grant"} at the Authorization Server's
1953
+ * {@link ServerMetadata.token_endpoint token endpoint} to obtain an access
1954
+ * token. ID Token and Refresh Token are also optionally issued by the server.
1955
+ *
1956
+ * > [!NOTE]\
1957
+ * > {@link ServerMetadata.token_endpoint URL of the authorization server's token endpoint}
1958
+ * > must be configured.
1959
+ *
1960
+ * @example
1961
+ *
1962
+ * ```ts
1963
+ * let config!: client.Configuration
1964
+ * let getCodeVerifierFromSession!: (...args: any) => string
1965
+ * let getCurrentUrl!: (...args: any) => URL
1966
+ *
1967
+ * let tokens = await client.authorizationCodeGrant(
1968
+ * config,
1969
+ * getCurrentUrl(),
1970
+ * {
1971
+ * pkceCodeVerifier: getCodeVerifierFromSession(),
1972
+ * },
1973
+ * )
1974
+ * ```
1975
+ *
1976
+ * @example
1977
+ *
1978
+ * Using an incoming {@link !Request} instance
1979
+ *
1980
+ * ```ts
1981
+ * let config!: client.Configuration
1982
+ * let getCodeVerifierFromSession!: (...args: any) => string
1983
+ * let request!: Request
1984
+ *
1985
+ * let tokens = await client.authorizationCodeGrant(config, request, {
1986
+ * pkceCodeVerifier: getCodeVerifierFromSession(),
1987
+ * })
1988
+ * ```
1989
+ *
1990
+ * @param currentUrl Current {@link !URL} the Authorization Server provided an
1991
+ * Authorization Response to or a {@link !Request}, the
1992
+ * {@link !"Authorization Code Grant"} parameters are extracted from this.
1993
+ * @param checks CSRF Protection checks like PKCE, expected state, or expected
1994
+ * nonce
1995
+ * @param tokenEndpointParameters Additional parameters that will be sent to the
1996
+ * token endpoint, typically used for parameters such as `resource`
1997
+ * ({@link !"Resource Indicators" Resource Indicator}) in cases where multiple
1998
+ * resource indicators were requested but the authorization server only
1999
+ * supports issuing an access token with a single audience
2000
+ *
2001
+ * @group OpenID Connect 1.0
2002
+ * @group Grants
2003
+ * @group PKCE
2004
+ * @group You are probably looking for this
2005
+ */
2006
+ export declare function authorizationCodeGrant(config: Configuration, currentUrl: URL | Request, checks?: AuthorizationCodeGrantChecks, tokenEndpointParameters?: URLSearchParams | Record<string, string>, options?: AuthorizationCodeGrantOptions): Promise<WithDecryptedResponse<oauth.TokenEndpointResponse & TokenEndpointResponseHelpers, DecryptedAuthorizationCodeResponses>>;
2007
+ /**
2008
+ * Performs an OAuth 2.0 Refresh Token Grant.
2009
+ *
2010
+ * Performs an OAuth 2.0 {@link !"Refresh Token Grant"} at the Authorization
2011
+ * Server's {@link ServerMetadata.token_endpoint token endpoint} using parameters
2012
+ * from the `parameters` argument, allowing a client to obtain a new access
2013
+ * token using a valid refresh token.
2014
+ *
2015
+ * > [!NOTE]\
2016
+ * > {@link ServerMetadata.token_endpoint URL of the authorization server's token endpoint}
2017
+ * > must be configured.
2018
+ *
2019
+ * @example
2020
+ *
2021
+ * Requesting a new Access Token using the {@link !"Refresh Token Grant"} with a
2022
+ * `scope` and a `resource` ({@link !"Resource Indicators" Resource Indicator})
2023
+ * parameters.
2024
+ *
2025
+ * ```ts
2026
+ * let config!: client.Configuration
2027
+ * let refreshToken!: string
2028
+ * let scope!: string
2029
+ * let resource!: string
2030
+ *
2031
+ * let tokenEndpointResponse = await client.refreshTokenGrant(
2032
+ * config,
2033
+ * refreshToken,
2034
+ * {
2035
+ * scope,
2036
+ * resource,
2037
+ * },
2038
+ * )
2039
+ * ```
2040
+ *
2041
+ * @param refreshToken OAuth 2.0 Refresh Token provided by the authorization
2042
+ * server that is used to obtain a new access token.
2043
+ * @param parameters Additional parameters that will be sent to the token
2044
+ * endpoint, typically used for parameters such as `scope` and a `resource`
2045
+ * ({@link !"Resource Indicators" Resource Indicator})
2046
+ *
2047
+ * @group Grants
2048
+ */
2049
+ export declare function refreshTokenGrant(config: Configuration, refreshToken: string, parameters?: URLSearchParams | Record<string, string>, options?: DPoPOptions): Promise<WithDecryptedResponse<oauth.TokenEndpointResponse & TokenEndpointResponseHelpers, string>>;
2050
+ /**
2051
+ * Performs an OAuth 2.0 Client Credentials Grant.
2052
+ *
2053
+ * Performs an OAuth 2.0 {@link !"Client Credentials Grant"} at the Authorization
2054
+ * Server's {@link ServerMetadata.token_endpoint token endpoint} using parameters
2055
+ * from the `parameters` argument
2056
+ *
2057
+ * > [!NOTE]\
2058
+ * > {@link ServerMetadata.token_endpoint URL of the authorization server's token endpoint}
2059
+ * > must be configured.
2060
+ *
2061
+ * @example
2062
+ *
2063
+ * Requesting an Access Token using the {@link !"Client Credentials Grant"} with
2064
+ * a `scope` and a `resource` ({@link !"Resource Indicators" Resource Indicator})
2065
+ * parameters.
2066
+ *
2067
+ * ```ts
2068
+ * let config!: client.Configuration
2069
+ * let scope!: string
2070
+ * let resource!: string
2071
+ *
2072
+ * let tokenEndpointResponse = await client.clientCredentialsGrant(config, {
2073
+ * scope,
2074
+ * resource,
2075
+ * })
2076
+ * ```
2077
+ *
2078
+ * @param parameters Additional parameters that will be sent to the token
2079
+ * endpoint, typically used for parameters such as `scope` and a `resource`
2080
+ * ({@link !"Resource Indicators" Resource Indicator})
2081
+ *
2082
+ * @group Grants
2083
+ */
2084
+ export declare function clientCredentialsGrant(config: Configuration, parameters?: URLSearchParams | Record<string, string>, options?: DPoPOptions): Promise<oauth.TokenEndpointResponse & TokenEndpointResponseHelpers>;
2085
+ /**
2086
+ * Builds an authorization request URL.
2087
+ *
2088
+ * Returns a URL to redirect the user-agent to, in order to request
2089
+ * authorization at the Authorization Server
2090
+ *
2091
+ * > [!NOTE]\
2092
+ * > {@link ServerMetadata.authorization_endpoint URL of the authorization server's authorization endpoint}
2093
+ * > must be configured.
2094
+ *
2095
+ * > [!NOTE]\
2096
+ * > When used, PKCE code challenge, state, and nonce parameter values must always
2097
+ * > be random and be tied to the user-agent.
2098
+ *
2099
+ * @example
2100
+ *
2101
+ * ```ts
2102
+ * let config!: client.Configuration
2103
+ * let redirect_uri!: string
2104
+ * let scope!: string
2105
+ *
2106
+ * // these must be unique for every single authorization request
2107
+ * let code_verifier = client.randomPKCECodeVerifier()
2108
+ * let code_challenge =
2109
+ * await client.calculatePKCECodeChallenge(code_verifier)
2110
+ *
2111
+ * let redirectTo = client.buildAuthorizationUrl(config, {
2112
+ * redirect_uri,
2113
+ * scope,
2114
+ * code_challenge,
2115
+ * code_challenge_method: 'S256',
2116
+ * })
2117
+ * // redirect now
2118
+ * ```
2119
+ *
2120
+ * @param parameters Authorization request parameters that will be included in
2121
+ * the {@link !URL.searchParams}
2122
+ *
2123
+ * @returns {@link !URL} Instance with {@link !URL.searchParams} including
2124
+ * `client_id`, `response_type`, and all parameters from the `parameters`
2125
+ * argument
2126
+ *
2127
+ * @group Authorization Request
2128
+ * @group You are probably looking for this
2129
+ */
2130
+ export declare function buildAuthorizationUrl(config: Configuration, parameters: URLSearchParams | Record<string, string>): URL;
2131
+ /**
2132
+ * Builds an authorization request URL using a JWT Secured Authorization Request
2133
+ * (JAR).
2134
+ *
2135
+ * Returns a URL to redirect the user-agent to, in order to request
2136
+ * authorization at the Authorization Server with a prior step of using
2137
+ * {@link !JAR}
2138
+ *
2139
+ * > [!NOTE]\
2140
+ * > {@link ServerMetadata.authorization_endpoint URL of the authorization server's authorization endpoint}
2141
+ * > must be configured.
2142
+ *
2143
+ * @example
2144
+ *
2145
+ * Using {@link !JAR}
2146
+ *
2147
+ * ```ts
2148
+ * let config!: client.Configuration
2149
+ * let redirect_uri!: string
2150
+ * let scope!: string
2151
+ * let key!: client.CryptoKey
2152
+ *
2153
+ * // these must be unique for every single authorization request
2154
+ * let code_verifier = client.randomPKCECodeVerifier()
2155
+ * let code_challenge =
2156
+ * await client.calculatePKCECodeChallenge(code_verifier)
2157
+ *
2158
+ * let redirectTo = await client.buildAuthorizationUrlWithJAR(
2159
+ * config,
2160
+ * {
2161
+ * redirect_uri,
2162
+ * scope,
2163
+ * code_challenge,
2164
+ * code_challenge_method: 'S256',
2165
+ * },
2166
+ * key,
2167
+ * )
2168
+ * // redirect now
2169
+ * ```
2170
+ *
2171
+ * @example
2172
+ *
2173
+ * Using {@link !JAR} and {@link !PAR} together
2174
+ *
2175
+ * ```ts
2176
+ * let config!: client.Configuration
2177
+ * let redirect_uri!: string
2178
+ * let scope!: string
2179
+ * let key!: client.CryptoKey
2180
+ *
2181
+ * // these must be unique for every single authorization request
2182
+ * let code_verifier = client.randomPKCECodeVerifier()
2183
+ * let code_challenge =
2184
+ * await client.calculatePKCECodeChallenge(code_verifier)
2185
+ *
2186
+ * let { searchParams: params } = await client.buildAuthorizationUrlWithJAR(
2187
+ * config,
2188
+ * {
2189
+ * redirect_uri,
2190
+ * scope,
2191
+ * code_challenge,
2192
+ * code_challenge_method: 'S256',
2193
+ * },
2194
+ * key,
2195
+ * )
2196
+ *
2197
+ * let redirectTo = await client.buildAuthorizationUrlWithPAR(
2198
+ * config,
2199
+ * params,
2200
+ * )
2201
+ * // redirect now
2202
+ * ```
2203
+ *
2204
+ * @param parameters Authorization request parameters that will be encoded in a
2205
+ * {@link !JAR} Request Object
2206
+ * @param signingKey Key to sign the JAR Request Object with.
2207
+ *
2208
+ * @returns {@link !URL} Instance with {@link !URL.searchParams} including
2209
+ * `client_id` and `request`
2210
+ *
2211
+ * @group Authorization Request
2212
+ */
2213
+ export declare function buildAuthorizationUrlWithJAR(config: Configuration, parameters: URLSearchParams | Record<string, string>,
2214
+ /**
2215
+ * Key to sign the JAR Request Object with.
2216
+ */
2217
+ signingKey: oauth.CryptoKey | oauth.PrivateKey, options?: oauth.ModifyAssertionOptions): Promise<URL>;
2218
+ /**
2219
+ * Builds an authorization request URL using Pushed Authorization Requests
2220
+ * (PAR).
2221
+ *
2222
+ * Returns a URL to redirect the user-agent to, in order to request
2223
+ * authorization at the Authorization Server with a prior step of using
2224
+ * {@link !PAR}
2225
+ *
2226
+ * > [!NOTE]\
2227
+ * > {@link ServerMetadata.authorization_endpoint URL of the authorization server's authorization endpoint}
2228
+ * > must be configured.
2229
+ *
2230
+ * > [!NOTE]\
2231
+ * > {@link ServerMetadata.pushed_authorization_request_endpoint URL of the authorization server's pushed authorization request endpoint}
2232
+ * > must be configured.
2233
+ *
2234
+ * @example
2235
+ *
2236
+ * Using {@link !PAR}
2237
+ *
2238
+ * ```ts
2239
+ * let config!: client.Configuration
2240
+ * let redirect_uri!: string
2241
+ * let scope!: string
2242
+ *
2243
+ * // these must be unique for every single authorization request
2244
+ * let code_verifier = client.randomPKCECodeVerifier()
2245
+ * let code_challenge =
2246
+ * await client.calculatePKCECodeChallenge(code_verifier)
2247
+ *
2248
+ * let redirectTo = await client.buildAuthorizationUrlWithPAR(config, {
2249
+ * redirect_uri,
2250
+ * scope,
2251
+ * code_challenge,
2252
+ * code_challenge_method: 'S256',
2253
+ * })
2254
+ * // redirect now
2255
+ * ```
2256
+ *
2257
+ * @example
2258
+ *
2259
+ * Using {@link !JAR} and {@link !PAR} together
2260
+ *
2261
+ * ```ts
2262
+ * let config!: client.Configuration
2263
+ * let redirect_uri!: string
2264
+ * let scope!: string
2265
+ * let key!: client.CryptoKey
2266
+ *
2267
+ * // these must be unique for every single authorization request
2268
+ * let code_verifier = client.randomPKCECodeVerifier()
2269
+ * let code_challenge =
2270
+ * await client.calculatePKCECodeChallenge(code_verifier)
2271
+ *
2272
+ * let { searchParams: params } = await client.buildAuthorizationUrlWithJAR(
2273
+ * config,
2274
+ * {
2275
+ * redirect_uri,
2276
+ * scope,
2277
+ * code_challenge,
2278
+ * code_challenge_method: 'S256',
2279
+ * },
2280
+ * key,
2281
+ * )
2282
+ *
2283
+ * let redirectTo = await client.buildAuthorizationUrlWithPAR(
2284
+ * config,
2285
+ * params,
2286
+ * )
2287
+ * // redirect now
2288
+ * ```
2289
+ *
2290
+ * @param parameters Authorization request parameters that will be sent to
2291
+ * {@link !PAR}
2292
+ *
2293
+ * @returns {@link !URL} Instance with {@link !URL.searchParams} including
2294
+ * `client_id` and `request_uri`.
2295
+ *
2296
+ * @group Authorization Request
2297
+ */
2298
+ export declare function buildAuthorizationUrlWithPAR(config: Configuration, parameters: URLSearchParams | Record<string, string>, options?: DPoPOptions): Promise<URL>;
2299
+ /**
2300
+ * Builds an RP-Initiated Logout URL.
2301
+ *
2302
+ * Returns a URL to redirect the user-agent to after they log out to trigger
2303
+ * {@link https://openid.net/specs/openid-connect-rpinitiated-1_0-final.html#RPLogout RP-Initiated Logout}
2304
+ * at the Authorization Server.
2305
+ *
2306
+ * > [!NOTE]\
2307
+ * > {@link ServerMetadata.end_session_endpoint URL of the authorization server's end session endpoint}
2308
+ * > must be configured.
2309
+ *
2310
+ * @example
2311
+ *
2312
+ * ```ts
2313
+ * let config!: client.Configuration
2314
+ * let post_logout_redirect_uri!: string
2315
+ * let id_token!: string
2316
+ *
2317
+ * let redirectTo = client.buildEndSessionUrl(config, {
2318
+ * post_logout_redirect_uri,
2319
+ * id_token_hint: id_token,
2320
+ * })
2321
+ * // redirect now
2322
+ * ```
2323
+ *
2324
+ * @param parameters Logout endpoint parameters
2325
+ *
2326
+ * @returns {@link !URL} Instance with {@link !URL.searchParams} including
2327
+ * `client_id` and all parameters from the `parameters` argument
2328
+ *
2329
+ * @group OpenID Connect 1.0
2330
+ */
2331
+ export declare function buildEndSessionUrl(config: Configuration, parameters?: URLSearchParams | Record<string, string>): URL;
2332
+ /**
2333
+ * Fetches and parses OpenID Connect UserInfo claims.
2334
+ *
2335
+ * Performs a UserInfo Request at the
2336
+ * {@link ServerMetadata.userinfo_endpoint userinfo endpoint} and returns the
2337
+ * parsed UserInfo claims from either its JSON or JWT response.
2338
+ *
2339
+ * Authorization Header is used to transmit the Access Token value. No other
2340
+ * Access Token means of transport are supported.
2341
+ *
2342
+ * > [!NOTE]\
2343
+ * > {@link ServerMetadata.userinfo_endpoint URL of authorization server's UserInfo endpoint}
2344
+ * > must be configured.
2345
+ *
2346
+ * @param accessToken OAuth 2.0 Access Token
2347
+ * @param expectedSubject Expected `sub` claim value. In response to OpenID
2348
+ * Connect authentication requests, the expected subject is the one from the
2349
+ * ID Token claims retrieved from {@link TokenEndpointResponseHelpers.claims}
2350
+ * which is available on all returned Token Endpoint responses.
2351
+ *
2352
+ * @group OpenID Connect 1.0
2353
+ * @group Protected Resource Requests
2354
+ *
2355
+ * @see [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#UserInfo)
2356
+ */
2357
+ export declare function fetchUserInfo(config: Configuration, accessToken: string, expectedSubject: string | typeof skipSubjectCheck, options?: DPoPOptions): Promise<WithDecryptedResponse<oauth.UserInfoResponse, string>>;
2358
+ /**
2359
+ * Retrieves the status and metadata of an OAuth 2.0 token.
2360
+ *
2361
+ * Queries the
2362
+ * {@link ServerMetadata.introspection_endpoint token introspection endpoint} to
2363
+ * obtain the status and metadata of a given token. The range of metadata
2364
+ * returned is at the discretion of the authorization server.
2365
+ *
2366
+ * > [!NOTE]\
2367
+ * > {@link ServerMetadata.introspection_endpoint URL of the authorization server's token introspection endpoint}
2368
+ * > must be configured.
2369
+ *
2370
+ * @param token OAuth 2.0 token (either access token or refresh token) that is
2371
+ * being introspected
2372
+ * @param parameters Additional parameters to be included in the introspection
2373
+ * request body, such as `token_type_hint`
2374
+ * @param token
2375
+ * @param parameters
2376
+ *
2377
+ * @group Token Management
2378
+ *
2379
+ * @see [RFC 7662 - OAuth 2.0 Token Introspection](https://www.rfc-editor.org/rfc/rfc7662.html#section-2)
2380
+ * @see [RFC 9701 - JWT Response for OAuth Token Introspection](https://www.rfc-editor.org/rfc/rfc9701.html#section-4)
2381
+ */
2382
+ export declare function tokenIntrospection(config: Configuration, token: string, parameters?: URLSearchParams | Record<string, string>): Promise<WithDecryptedResponse<oauth.IntrospectionResponse, string>>;
2383
+ /**
2384
+ * Options for making DPoP-bound requests.
2385
+ */
2386
+ export interface DPoPOptions {
2387
+ /**
2388
+ * DPoP handle to use for requesting a sender-constrained access token.
2389
+ * Usually obtained from {@link getDPoPHandle}
2390
+ *
2391
+ * @see {@link !DPoP RFC 9449 - OAuth 2.0 Demonstrating Proof of Possession (DPoP)}
2392
+ */
2393
+ DPoP?: DPoPHandle;
2394
+ }
2395
+ /**
2396
+ * Performs an arbitrary OAuth grant request.
2397
+ *
2398
+ * Performs any Grant request at the
2399
+ * {@link ServerMetadata.token_endpoint token endpoint}. The purpose is to be
2400
+ * able to execute grant requests such as Token Exchange Grant, JWT Bearer Token
2401
+ * Grant, SAML 2.0 Bearer Assertion Grant, or any other grant.
2402
+ *
2403
+ * > [!NOTE]\
2404
+ * > {@link ServerMetadata.token_endpoint URL of the authorization server's token endpoint}
2405
+ * > must be configured.
2406
+ *
2407
+ * @example
2408
+ *
2409
+ * Requesting an Access Token using the JWT Bearer Token Grant
2410
+ *
2411
+ * ```ts
2412
+ * let config!: client.Configuration
2413
+ * let scope!: string
2414
+ * let resource!: string
2415
+ * let assertion!: string
2416
+ *
2417
+ * let tokenEndpointResponse = await client.genericGrantRequest(
2418
+ * config,
2419
+ * 'urn:ietf:params:oauth:grant-type:jwt-bearer',
2420
+ * { scope, resource, assertion },
2421
+ * )
2422
+ * ```
2423
+ *
2424
+ * @param grantType Grant Type
2425
+ * @param parameters Parameters required by the given grant type to send to the
2426
+ * {@link ServerMetadata.token_endpoint token endpoint}
2427
+ *
2428
+ * @group Grants
2429
+ *
2430
+ * @see {@link https://www.rfc-editor.org/rfc/rfc8693.html Token Exchange Grant}
2431
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7523.html#section-2.1 JWT Bearer Token Grant}
2432
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7522.html#section-2.1 SAML 2.0 Bearer Assertion Grant}
2433
+ */
2434
+ export declare function genericGrantRequest(config: Configuration, grantType: string, parameters: URLSearchParams | Record<string, string>, options?: DPoPOptions): Promise<WithDecryptedResponse<oauth.TokenEndpointResponse & TokenEndpointResponseHelpers, string>>;
2435
+ /**
2436
+ * Requests revocation of an OAuth 2.0 token.
2437
+ *
2438
+ * Attempts revocation of an OAuth 2.0 token by making a request to the
2439
+ * {@link ServerMetadata.revocation_endpoint token revocation endpoint}. Whether
2440
+ * the token gets revoked, and the effect of that revocation is at the
2441
+ * discretion of the authorization server.
2442
+ *
2443
+ * > [!NOTE]\
2444
+ * > {@link ServerMetadata.revocation_endpoint URL of the authorization server's token revocation endpoint}
2445
+ * > must be configured.
2446
+ *
2447
+ * @param token OAuth 2.0 token (either access token or refresh token) that is
2448
+ * being revoked
2449
+ * @param parameters Additional parameters to be included in the revocation
2450
+ * request body, such as `token_type_hint`
2451
+ *
2452
+ * @group Token Management
2453
+ *
2454
+ * @see [RFC 7009 - OAuth 2.0 Token Revocation](https://www.rfc-editor.org/rfc/rfc7009.html#section-2)
2455
+ */
2456
+ export declare function tokenRevocation(config: Configuration, token: string, parameters?: URLSearchParams | Record<string, string>): Promise<void>;
2457
+ /**
2458
+ * Fetches an arbitrary OAuth 2.0 protected resource.
2459
+ *
2460
+ * Authorization Header is used to transmit the Access Token value. No other
2461
+ * Access Token means of transport are supported.
2462
+ *
2463
+ * @param accessToken OAuth 2.0 Access Token
2464
+ * @param url URL to send the request to
2465
+ * @param method HTTP Request method to use for the request
2466
+ * @param body HTTP Request body to send in the request
2467
+ * @param headers HTTP Request headers to add to the request
2468
+ *
2469
+ * @group Protected Resource Requests
2470
+ */
2471
+ export declare function fetchProtectedResource(config: Configuration, accessToken: string, url: URL, method: string, body?: FetchBody, headers?: Headers, options?: DPoPOptions): Promise<Response>;
2472
+ /**
2473
+ * @ignore
2474
+ *
2475
+ * @deprecated Use {@link DeviceAuthorizationGrantPollOptions}.
2476
+ */
2477
+ export interface DeviceAutorizationGrantPollOptions extends DeviceAuthorizationGrantPollOptions {
2478
+ }