@udibo/oauth2 0.14.1 → 0.15.0

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 (411) hide show
  1. package/README.md +45 -24
  2. package/{esm → dist}/adapters/hono/_common.d.ts +5 -5
  3. package/{esm → dist}/adapters/hono/_common.js +1 -1
  4. package/{esm → dist}/adapters/hono/authorization-server.d.ts +6 -7
  5. package/{esm → dist}/adapters/hono/authorization-server.js +0 -1
  6. package/{esm → dist}/adapters/hono/bff/auth-request-store.d.ts +2 -2
  7. package/{esm → dist}/adapters/hono/bff/auth-request-store.js +2 -2
  8. package/{esm → dist}/adapters/hono/bff/bff.d.ts +8 -8
  9. package/{esm → dist}/adapters/hono/bff/bff.js +31 -26
  10. package/{esm → dist}/adapters/hono/bff/cookie-prefix.js +1 -2
  11. package/{esm → dist}/adapters/hono/bff/mod.d.ts +5 -6
  12. package/{esm → dist}/adapters/hono/bff/mod.js +1 -2
  13. package/{esm → dist}/adapters/hono/bff/proxy.js +2 -1
  14. package/{esm → dist}/adapters/hono/bff/session-store.d.ts +2 -2
  15. package/{esm → dist}/adapters/hono/bff/session-store.js +7 -6
  16. package/{esm → dist}/adapters/hono/bff/testing.d.ts +7 -8
  17. package/{esm → dist}/adapters/hono/bff/testing.js +19 -22
  18. package/{esm → dist}/adapters/hono/identity.d.ts +1 -2
  19. package/{esm → dist}/adapters/hono/identity.js +10 -10
  20. package/{esm → dist}/adapters/hono/log.d.ts +0 -1
  21. package/{esm → dist}/adapters/hono/log.js +0 -6
  22. package/{esm → dist}/adapters/hono/resource-server.d.ts +5 -6
  23. package/{esm → dist}/adapters/hono/resource-server.js +0 -1
  24. package/dist/cli/bin.d.ts +2 -0
  25. package/dist/cli/bin.js +3 -0
  26. package/dist/cli/idp/config.d.ts +110 -0
  27. package/dist/cli/idp/config.js +269 -0
  28. package/dist/cli/idp/mod.d.ts +20 -0
  29. package/dist/cli/idp/mod.js +175 -0
  30. package/dist/cli/idp/pages.d.ts +56 -0
  31. package/dist/cli/idp/pages.js +190 -0
  32. package/dist/cli/idp/server.d.ts +93 -0
  33. package/dist/cli/idp/server.js +559 -0
  34. package/dist/cli/keygen.d.ts +13 -0
  35. package/dist/cli/keygen.js +30 -0
  36. package/dist/cli/mod.d.ts +34 -0
  37. package/dist/cli/mod.js +94 -0
  38. package/{esm → dist}/client/_http.d.ts +1 -1
  39. package/{esm → dist}/client/base.d.ts +1 -1
  40. package/{esm → dist}/client/bff-client.d.ts +1 -1
  41. package/{esm → dist}/client/bff-client.js +7 -6
  42. package/{esm → dist}/client/browser-storage.d.ts +1 -1
  43. package/{esm → dist}/client/check.js +1 -1
  44. package/{esm → dist}/client/direct-client.d.ts +6 -6
  45. package/{esm → dist}/client/direct-client.js +11 -13
  46. package/{esm → dist}/client/discovery-cache.d.ts +1 -1
  47. package/{esm → dist}/client/discovery-cache.js +2 -2
  48. package/{esm → dist}/client/events.d.ts +1 -1
  49. package/{esm → dist}/client/mod.d.ts +11 -12
  50. package/{esm → dist}/client/mod.js +1 -1
  51. package/{esm → dist}/errors.d.ts +1 -1
  52. package/{esm → dist}/errors.js +1 -1
  53. package/{esm → dist}/identity/events.d.ts +1 -1
  54. package/{esm → dist}/identity/external/_shared.d.ts +1 -1
  55. package/{esm → dist}/identity/external/_shared.js +1 -2
  56. package/{esm → dist}/identity/external/apple-client-secret.d.ts +1 -1
  57. package/{esm → dist}/identity/external/apple-client-secret.js +6 -7
  58. package/{esm → dist}/identity/external/apple.d.ts +5 -5
  59. package/{esm → dist}/identity/external/apple.js +10 -11
  60. package/{esm → dist}/identity/external/discord.d.ts +3 -3
  61. package/{esm → dist}/identity/external/discord.js +2 -2
  62. package/{esm → dist}/identity/external/flow.d.ts +1 -1
  63. package/{esm → dist}/identity/external/flow.js +2 -2
  64. package/{esm → dist}/identity/external/github.d.ts +3 -3
  65. package/{esm → dist}/identity/external/github.js +12 -17
  66. package/{esm → dist}/identity/external/google.d.ts +5 -5
  67. package/{esm → dist}/identity/external/google.js +2 -2
  68. package/{esm → dist}/identity/external/mod.d.ts +12 -13
  69. package/{esm → dist}/identity/external/mod.js +0 -1
  70. package/{esm → dist}/identity/external/oauth2.d.ts +1 -1
  71. package/{esm → dist}/identity/external/oauth2.js +8 -8
  72. package/{esm → dist}/identity/external/oidc.d.ts +4 -4
  73. package/{esm → dist}/identity/external/oidc.js +9 -8
  74. package/{esm → dist}/identity/hibp.d.ts +1 -1
  75. package/{esm → dist}/identity/hibp.js +1 -1
  76. package/{esm → dist}/identity/lockout.js +1 -2
  77. package/{esm → dist}/identity/mfa/mod.d.ts +4 -5
  78. package/{esm → dist}/identity/mfa/mod.js +1 -2
  79. package/{esm → dist}/identity/mfa/service.d.ts +3 -3
  80. package/{esm → dist}/identity/mfa/service.js +4 -3
  81. package/{esm → dist}/identity/mfa/totp.d.ts +1 -1
  82. package/{esm → dist}/identity/mfa/totp.js +2 -2
  83. package/{esm → dist}/identity/migration.d.ts +2 -3
  84. package/{esm → dist}/identity/migration.js +3 -4
  85. package/{esm → dist}/identity/mod.d.ts +14 -15
  86. package/{esm → dist}/identity/mod.js +0 -1
  87. package/{esm → dist}/identity/otp.d.ts +1 -1
  88. package/{esm → dist}/identity/otp.js +4 -2
  89. package/{esm → dist}/identity/password.js +8 -5
  90. package/{esm → dist}/identity/rate-limit.d.ts +1 -1
  91. package/{esm → dist}/identity/service.d.ts +10 -10
  92. package/{esm → dist}/identity/service.js +17 -18
  93. package/{esm → dist}/identity/session.js +2 -2
  94. package/{esm → dist}/identity/token-flow.js +3 -2
  95. package/{esm → dist}/models/authorization-code.d.ts +3 -3
  96. package/{esm → dist}/models/authorization.d.ts +1 -1
  97. package/{esm → dist}/models/authorization.js +1 -2
  98. package/{esm → dist}/models/device-authorization.d.ts +2 -2
  99. package/{esm → dist}/models/token.d.ts +3 -3
  100. package/{esm → dist}/react/callback.d.ts +1 -1
  101. package/{esm → dist}/react/callback.js +0 -1
  102. package/{esm → dist}/react/components/class-names.d.ts +1 -1
  103. package/{esm → dist}/react/components/class-names.js +3 -2
  104. package/{esm → dist}/react/components/internal.d.ts +2 -2
  105. package/{esm → dist}/react/components/internal.js +5 -11
  106. package/{esm → dist}/react/components/mfa-challenge-form.d.ts +2 -2
  107. package/{esm → dist}/react/components/mfa-challenge-form.js +4 -6
  108. package/{esm → dist}/react/components/mfa-enrollment-form.d.ts +2 -2
  109. package/{esm → dist}/react/components/mfa-enrollment-form.js +2 -6
  110. package/{esm → dist}/react/components/mod.d.ts +20 -21
  111. package/{esm → dist}/react/components/mod.js +1 -2
  112. package/{esm → dist}/react/components/request-password-reset-form.d.ts +2 -2
  113. package/{esm → dist}/react/components/request-password-reset-form.js +1 -3
  114. package/{esm → dist}/react/components/reset-password-form.d.ts +2 -2
  115. package/{esm → dist}/react/components/reset-password-form.js +2 -2
  116. package/{esm → dist}/react/components/sign-in-form.d.ts +2 -2
  117. package/{esm → dist}/react/components/sign-in-form.js +1 -5
  118. package/{esm → dist}/react/components/sign-up-form.d.ts +2 -2
  119. package/{esm → dist}/react/components/sign-up-form.js +4 -10
  120. package/{esm → dist}/react/components/types.d.ts +2 -2
  121. package/{esm → dist}/react/components/use-auth-form.d.ts +3 -3
  122. package/{esm → dist}/react/components/use-auth-form.js +4 -7
  123. package/{esm → dist}/react/components/user-menu.d.ts +2 -2
  124. package/{esm → dist}/react/components/user-menu.js +9 -14
  125. package/{esm → dist}/react/context.d.ts +1 -1
  126. package/{esm → dist}/react/mod.d.ts +6 -7
  127. package/{esm → dist}/react/mod.js +0 -1
  128. package/{esm → dist}/react/provider.d.ts +2 -2
  129. package/{esm → dist}/react/require-auth.js +1 -3
  130. package/{esm → dist}/react/testing.d.ts +2 -3
  131. package/{esm → dist}/react/testing.js +1 -2
  132. package/{esm → dist}/react/use-authorization.d.ts +1 -1
  133. package/{esm → dist}/react/use-oauth2.d.ts +8 -1
  134. package/{esm → dist}/react/use-oauth2.js +0 -1
  135. package/{esm → dist}/server/_clock-skew.js +2 -1
  136. package/{esm → dist}/server/authorization-server.d.ts +40 -41
  137. package/{esm → dist}/server/authorization-server.js +32 -42
  138. package/{esm → dist}/server/client-authentication.d.ts +2 -2
  139. package/{esm → dist}/server/grants/authorization-code.d.ts +9 -9
  140. package/{esm → dist}/server/grants/authorization-code.js +5 -6
  141. package/{esm → dist}/server/grants/client-credentials.d.ts +4 -4
  142. package/{esm → dist}/server/grants/device-authorization.d.ts +6 -6
  143. package/{esm → dist}/server/grants/device-authorization.js +4 -4
  144. package/{esm → dist}/server/grants/grant.d.ts +7 -7
  145. package/{esm → dist}/server/grants/grant.js +7 -7
  146. package/{esm → dist}/server/grants/password.d.ts +5 -5
  147. package/{esm → dist}/server/grants/refresh-token.d.ts +4 -4
  148. package/{esm → dist}/server/grants/refresh-token.js +5 -6
  149. package/{esm → dist}/server/introspection-token-reader.d.ts +5 -5
  150. package/{esm → dist}/server/introspection-token-reader.js +4 -4
  151. package/{esm → dist}/server/jwks-token-reader.d.ts +5 -5
  152. package/{esm → dist}/server/jwks-token-reader.js +4 -4
  153. package/{esm → dist}/server/mod.d.ts +12 -13
  154. package/{esm → dist}/server/mod.js +0 -1
  155. package/{esm → dist}/server/public-suffix/mod.d.ts +2 -3
  156. package/{esm → dist}/server/public-suffix/mod.js +1 -2
  157. package/{esm → dist}/server/public-suffix/rules.d.ts +1 -1
  158. package/{esm → dist}/server/public-suffix/rules.js +1 -1
  159. package/{esm → dist}/server/redirect-uri.js +5 -4
  160. package/{esm → dist}/server/resource-server.d.ts +11 -12
  161. package/{esm → dist}/server/resource-server.js +12 -14
  162. package/{esm → dist}/server/services/authorization-code.d.ts +5 -5
  163. package/{esm → dist}/server/services/client.d.ts +1 -1
  164. package/{esm → dist}/server/services/device-authorization.d.ts +3 -3
  165. package/{esm → dist}/server/services/token.d.ts +6 -6
  166. package/{esm → dist}/server/services/token.js +3 -1
  167. package/{esm → dist}/server/services/user.d.ts +1 -1
  168. package/{esm → dist}/server/signing-keys.d.ts +1 -1
  169. package/{esm → dist}/server/signing-keys.js +8 -2
  170. package/{esm → dist}/server/utils/hash.js +1 -1
  171. package/{esm → dist}/testing/contract/auth-request-storage.d.ts +1 -1
  172. package/{esm → dist}/testing/contract/auth-request-storage.js +24 -29
  173. package/{esm → dist}/testing/contract/authorization-code.d.ts +6 -6
  174. package/{esm → dist}/testing/contract/authorization-code.js +16 -17
  175. package/{esm → dist}/testing/contract/client.d.ts +4 -4
  176. package/{esm → dist}/testing/contract/client.js +14 -15
  177. package/{esm → dist}/testing/contract/device-authorization.d.ts +6 -6
  178. package/{esm → dist}/testing/contract/device-authorization.js +37 -39
  179. package/{esm → dist}/testing/contract/identity-session.d.ts +6 -1
  180. package/{esm → dist}/testing/contract/identity-session.js +44 -36
  181. package/{esm → dist}/testing/contract/identity-user-store.d.ts +8 -2
  182. package/{esm → dist}/testing/contract/identity-user-store.js +48 -46
  183. package/{esm → dist}/testing/contract/lockout-store.d.ts +1 -1
  184. package/{esm → dist}/testing/contract/lockout-store.js +23 -24
  185. package/{esm → dist}/testing/contract/mfa-store.d.ts +1 -1
  186. package/{esm → dist}/testing/contract/mfa-store.js +53 -54
  187. package/{esm → dist}/testing/contract/mod.d.ts +15 -16
  188. package/{esm → dist}/testing/contract/mod.js +0 -1
  189. package/{esm → dist}/testing/contract/otp-store.d.ts +1 -1
  190. package/{esm → dist}/testing/contract/otp-store.js +33 -34
  191. package/{esm → dist}/testing/contract/rate-limit-store.d.ts +1 -1
  192. package/{esm → dist}/testing/contract/rate-limit-store.js +15 -16
  193. package/{esm → dist}/testing/contract/tenant.js +361 -330
  194. package/{esm → dist}/testing/contract/token-flow-store.d.ts +1 -1
  195. package/{esm → dist}/testing/contract/token-flow-store.js +27 -32
  196. package/{esm → dist}/testing/contract/token-reader.d.ts +3 -3
  197. package/{esm → dist}/testing/contract/token-reader.js +6 -7
  198. package/{esm → dist}/testing/contract/token.d.ts +7 -7
  199. package/{esm → dist}/testing/contract/token.js +48 -53
  200. package/{esm → dist}/testing/contract/user.d.ts +2 -2
  201. package/{esm → dist}/testing/contract/user.js +8 -9
  202. package/{esm → dist}/testing/mod.d.ts +5 -6
  203. package/{esm → dist}/testing/mod.js +2 -3
  204. package/{esm → dist}/testing/server.d.ts +7 -6
  205. package/{esm → dist}/testing/server.js +2 -1
  206. package/{esm → dist}/testing/services.d.ts +11 -11
  207. package/{esm → dist}/testing/services.js +8 -8
  208. package/{esm → dist}/testing/tenant.d.ts +11 -7
  209. package/{esm → dist}/testing/tenant.js +109 -94
  210. package/dist/utils/_constant-time.d.ts +12 -0
  211. package/dist/utils/_constant-time.js +19 -0
  212. package/{esm → dist}/utils/_default-fetch.js +4 -1
  213. package/dist/utils/_delay.d.ts +13 -0
  214. package/dist/utils/_delay.js +28 -0
  215. package/dist/utils/_encoding.d.ts +39 -0
  216. package/dist/utils/_encoding.js +126 -0
  217. package/{esm → dist}/utils/authentication-context.d.ts +1 -1
  218. package/{esm → dist}/utils/crypto.d.ts +2 -3
  219. package/{esm → dist}/utils/crypto.js +3 -4
  220. package/{esm → dist}/utils/pkce.js +1 -1
  221. package/{esm → dist}/utils/text.js +1 -1
  222. package/{esm → dist}/utils/url.d.ts +0 -1
  223. package/{esm → dist}/utils/url.js +0 -1
  224. package/package.json +156 -33
  225. package/esm/_dnt.polyfills.d.ts +0 -31
  226. package/esm/_dnt.polyfills.js +0 -26
  227. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +0 -29
  228. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +0 -47
  229. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +0 -28
  230. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +0 -65
  231. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +0 -16
  232. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +0 -23
  233. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +0 -25
  234. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +0 -30
  235. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +0 -24
  236. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +0 -193
  237. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +0 -36
  238. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +0 -61
  239. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +0 -17
  240. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +0 -27
  241. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +0 -14
  242. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +0 -20
  243. package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +0 -18
  244. package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +0 -23
  245. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +0 -19
  246. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +0 -29
  247. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +0 -19
  248. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +0 -29
  249. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +0 -22
  250. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +0 -52
  251. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +0 -24
  252. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +0 -53
  253. package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +0 -18
  254. package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +0 -28
  255. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +0 -19
  256. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +0 -29
  257. package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +0 -17
  258. package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +0 -26
  259. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +0 -43
  260. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +0 -45
  261. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +0 -26
  262. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +0 -39
  263. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +0 -19
  264. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +0 -29
  265. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +0 -17
  266. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +0 -26
  267. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +0 -22
  268. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +0 -32
  269. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +0 -28
  270. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +0 -177
  271. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +0 -41
  272. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +0 -53
  273. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +0 -23
  274. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +0 -58
  275. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +0 -17
  276. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +0 -26
  277. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +0 -44
  278. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +0 -44
  279. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +0 -14
  280. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +0 -20
  281. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +0 -14
  282. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +0 -20
  283. package/esm/deps/jsr.io/@std/async/1.5.0/delay.d.ts +0 -44
  284. package/esm/deps/jsr.io/@std/async/1.5.0/delay.js +0 -84
  285. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +0 -39
  286. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +0 -61
  287. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.d.ts +0 -22
  288. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.js +0 -51
  289. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.d.ts +0 -34
  290. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.js +0 -192
  291. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.d.ts +0 -34
  292. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.js +0 -113
  293. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.d.ts +0 -3
  294. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.js +0 -13
  295. package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.d.ts +0 -8
  296. package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.js +0 -2
  297. package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.d.ts +0 -1
  298. package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.js +0 -26
  299. package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.d.ts +0 -60
  300. package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.js +0 -152
  301. package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.d.ts +0 -39
  302. package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.js +0 -87
  303. package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.d.ts +0 -39
  304. package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.js +0 -131
  305. package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.d.ts +0 -39
  306. package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.js +0 -82
  307. package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.d.ts +0 -39
  308. package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.js +0 -72
  309. package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.d.ts +0 -38
  310. package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.js +0 -87
  311. package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.d.ts +0 -97
  312. package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.js +0 -99
  313. package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.d.ts +0 -119
  314. package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.js +0 -209
  315. package/esm/deps/jsr.io/@std/http/1.1.3/status.d.ts +0 -343
  316. package/esm/deps/jsr.io/@std/http/1.1.3/status.js +0 -343
  317. package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.d.ts +0 -159
  318. package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.js +0 -223
  319. package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.d.ts +0 -79
  320. package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.js +0 -116
  321. package/esm/deps/jsr.io/@std/internal/1.0.14/diff.d.ts +0 -139
  322. package/esm/deps/jsr.io/@std/internal/1.0.14/diff.js +0 -277
  323. package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.d.ts +0 -98
  324. package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.js +0 -181
  325. package/esm/deps/jsr.io/@std/internal/1.0.14/format.d.ts +0 -29
  326. package/esm/deps/jsr.io/@std/internal/1.0.14/format.js +0 -68
  327. package/esm/deps/jsr.io/@std/internal/1.0.14/styles.d.ts +0 -158
  328. package/esm/deps/jsr.io/@std/internal/1.0.14/styles.js +0 -206
  329. package/esm/deps/jsr.io/@std/internal/1.0.14/types.d.ts +0 -24
  330. package/esm/deps/jsr.io/@std/internal/1.0.14/types.js +0 -3
  331. package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.d.ts +0 -91
  332. package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.js +0 -347
  333. package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.d.ts +0 -382
  334. package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.js +0 -1110
  335. package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.d.ts +0 -363
  336. package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.js +0 -616
  337. package/esm/package.json +0 -3
  338. /package/{esm → dist}/adapters/hono/bff/cookie-prefix.d.ts +0 -0
  339. /package/{esm → dist}/adapters/hono/bff/proxy.d.ts +0 -0
  340. /package/{esm → dist}/client/_http.js +0 -0
  341. /package/{esm → dist}/client/base.js +0 -0
  342. /package/{esm → dist}/client/browser-storage.js +0 -0
  343. /package/{esm → dist}/client/check.d.ts +0 -0
  344. /package/{esm → dist}/client/events.js +0 -0
  345. /package/{esm → dist}/client/storage.d.ts +0 -0
  346. /package/{esm → dist}/client/storage.js +0 -0
  347. /package/{esm → dist}/identity/captcha.d.ts +0 -0
  348. /package/{esm → dist}/identity/captcha.js +0 -0
  349. /package/{esm → dist}/identity/delivery.d.ts +0 -0
  350. /package/{esm → dist}/identity/delivery.js +0 -0
  351. /package/{esm → dist}/identity/errors.d.ts +0 -0
  352. /package/{esm → dist}/identity/errors.js +0 -0
  353. /package/{esm → dist}/identity/events.js +0 -0
  354. /package/{esm → dist}/identity/external/_token-exchange.d.ts +0 -0
  355. /package/{esm → dist}/identity/external/_token-exchange.js +0 -0
  356. /package/{esm → dist}/identity/external/errors.d.ts +0 -0
  357. /package/{esm → dist}/identity/external/errors.js +0 -0
  358. /package/{esm → dist}/identity/external/provider.d.ts +0 -0
  359. /package/{esm → dist}/identity/external/provider.js +0 -0
  360. /package/{esm → dist}/identity/identifier.d.ts +0 -0
  361. /package/{esm → dist}/identity/identifier.js +0 -0
  362. /package/{esm → dist}/identity/lockout.d.ts +0 -0
  363. /package/{esm → dist}/identity/mfa/recovery-codes.d.ts +0 -0
  364. /package/{esm → dist}/identity/mfa/recovery-codes.js +0 -0
  365. /package/{esm → dist}/identity/password-policy.d.ts +0 -0
  366. /package/{esm → dist}/identity/password-policy.js +0 -0
  367. /package/{esm → dist}/identity/password.d.ts +0 -0
  368. /package/{esm → dist}/identity/rate-limit.js +0 -0
  369. /package/{esm → dist}/identity/session.d.ts +0 -0
  370. /package/{esm → dist}/identity/token-flow.d.ts +0 -0
  371. /package/{esm → dist}/models/authentication.d.ts +0 -0
  372. /package/{esm → dist}/models/authentication.js +0 -0
  373. /package/{esm → dist}/models/authorization-code.js +0 -0
  374. /package/{esm → dist}/models/client.d.ts +0 -0
  375. /package/{esm → dist}/models/client.js +0 -0
  376. /package/{esm → dist}/models/device-authorization.js +0 -0
  377. /package/{esm → dist}/models/responses.d.ts +0 -0
  378. /package/{esm → dist}/models/responses.js +0 -0
  379. /package/{esm → dist}/models/scope.d.ts +0 -0
  380. /package/{esm → dist}/models/scope.js +0 -0
  381. /package/{esm → dist}/models/token.js +0 -0
  382. /package/{esm → dist}/react/components/types.js +0 -0
  383. /package/{esm → dist}/react/context.js +0 -0
  384. /package/{esm → dist}/react/provider.js +0 -0
  385. /package/{esm → dist}/react/require-auth.d.ts +0 -0
  386. /package/{esm → dist}/react/use-authorization.js +0 -0
  387. /package/{esm → dist}/server/_clock-skew.d.ts +0 -0
  388. /package/{esm → dist}/server/client-authentication.js +0 -0
  389. /package/{esm → dist}/server/grants/client-credentials.js +0 -0
  390. /package/{esm → dist}/server/grants/password.js +0 -0
  391. /package/{esm → dist}/server/redirect-uri.d.ts +0 -0
  392. /package/{esm → dist}/server/services/authorization-code.js +0 -0
  393. /package/{esm → dist}/server/services/client.js +0 -0
  394. /package/{esm → dist}/server/services/device-authorization.js +0 -0
  395. /package/{esm → dist}/server/services/user.js +0 -0
  396. /package/{esm → dist}/server/utils/hash.d.ts +0 -0
  397. /package/{esm → dist}/testing/contract/_race.d.ts +0 -0
  398. /package/{esm → dist}/testing/contract/_race.js +0 -0
  399. /package/{esm → dist}/testing/contract/tenant.d.ts +0 -0
  400. /package/{esm → dist}/utils/_body.d.ts +0 -0
  401. /package/{esm → dist}/utils/_body.js +0 -0
  402. /package/{esm → dist}/utils/_buffer.d.ts +0 -0
  403. /package/{esm → dist}/utils/_buffer.js +0 -0
  404. /package/{esm → dist}/utils/_default-fetch.d.ts +0 -0
  405. /package/{esm → dist}/utils/_timing-safe.d.ts +0 -0
  406. /package/{esm → dist}/utils/_timing-safe.js +0 -0
  407. /package/{esm → dist}/utils/authentication-context.js +0 -0
  408. /package/{esm → dist}/utils/basic-auth.d.ts +0 -0
  409. /package/{esm → dist}/utils/basic-auth.js +0 -0
  410. /package/{esm → dist}/utils/pkce.d.ts +0 -0
  411. /package/{esm → dist}/utils/text.d.ts +0 -0
@@ -5,8 +5,8 @@
5
5
  * It owns field values, per-field and form-level errors, and the submit
6
6
  * lifecycle, and stays entirely presentation-free: no markup, no styling, no
7
7
  * router or network assumptions. The action is injected as `onSubmit`, so the
8
- * same hook drives a client-side `fetch` in a plain React Router app or a
9
- * router-action submit in Juniper. Reach for it directly when you want to own
8
+ * same hook drives a client-side `fetch` or a React Router action submit.
9
+ * Reach for it directly when you want to own
10
10
  * the markup completely (the "eject to headless" path); otherwise use a
11
11
  * default component, which is built on this hook.
12
12
  *
@@ -100,8 +100,7 @@ export function useAuthForm(options) {
100
100
  return;
101
101
  }
102
102
  const fieldErrors = result?.fieldErrors;
103
- const hasFieldErrors = fieldErrors &&
104
- Object.keys(fieldErrors).length > 0;
103
+ const hasFieldErrors = fieldErrors && Object.keys(fieldErrors).length > 0;
105
104
  if (result?.error || hasFieldErrors) {
106
105
  if (result?.error)
107
106
  setFormError(result.error);
@@ -134,9 +133,7 @@ export function useAuthForm(options) {
134
133
  value: typeof raw === "boolean" ? "" : String(raw ?? ""),
135
134
  onChange: (event) => {
136
135
  const target = event.target;
137
- const next = target.type === "checkbox"
138
- ? target.checked
139
- : target.value;
136
+ const next = target.type === "checkbox" ? target.checked : target.value;
140
137
  setValue(name, next);
141
138
  },
142
139
  "aria-invalid": hasError ? true : undefined,
@@ -14,8 +14,8 @@
14
14
  * @module
15
15
  */
16
16
  import { type ReactNode } from "react";
17
- import type { UserInfoClaims } from "../../client/mod.js";
18
- import type { BaseClassNames } from "./types.js";
17
+ import type { UserInfoClaims } from "../../client/mod.ts";
18
+ import type { BaseClassNames } from "./types.ts";
19
19
  /**
20
20
  * Per-slot class hooks for {@link UserMenu}: the shared {@link BaseClassNames}
21
21
  * `root` plus the menu's own slots.
@@ -54,20 +54,15 @@ export function UserMenu(props) {
54
54
  }, [open]);
55
55
  if (!user)
56
56
  return _jsx(_Fragment, { children: signedOut });
57
- const runLogout = onLogout ?? (async () => {
58
- await logout();
59
- });
57
+ const runLogout = onLogout ??
58
+ (async () => {
59
+ await logout();
60
+ });
60
61
  if (children)
61
62
  return _jsx(_Fragment, { children: children({ user, logout: runLogout }) });
62
- return (_jsxs("div", { ref: rootRef, "data-oauth2-user-menu": "", className: combineClassNames(className, classNames?.root), children: [_jsx("button", { type: "button", "aria-expanded": open, "aria-controls": panelId, onClick: () => setOpen((value) => !value), "data-oauth2-user-trigger": "", className: classNames?.trigger, children: renderUser
63
- ? renderUser(user)
64
- : (_jsx("span", { "data-oauth2-user-name": "", className: classNames?.name, children: displayName(user) })) }), open
65
- ? (_jsxs("div", { id: panelId, "data-oauth2-user-panel": "", className: classNames?.menu, children: [items
66
- ? (_jsx("div", { "data-oauth2-user-items": "", className: classNames?.menuItem, children: items }))
67
- : null, _jsx("button", { type: "button", onClick: () => {
68
- void Promise.resolve(runLogout()).catch((error) => {
69
- console.error("[@udibo/oauth2] logout failed:", error);
70
- });
71
- }, "data-oauth2-logout": "", className: classNames?.logout, children: labels?.logout ?? "Sign out" })] }))
72
- : null] }));
63
+ return (_jsxs("div", { ref: rootRef, "data-oauth2-user-menu": "", className: combineClassNames(className, classNames?.root), children: [_jsx("button", { type: "button", "aria-expanded": open, "aria-controls": panelId, onClick: () => setOpen((value) => !value), "data-oauth2-user-trigger": "", className: classNames?.trigger, children: renderUser ? (renderUser(user)) : (_jsx("span", { "data-oauth2-user-name": "", className: classNames?.name, children: displayName(user) })) }), open ? (_jsxs("div", { id: panelId, "data-oauth2-user-panel": "", className: classNames?.menu, children: [items ? (_jsx("div", { "data-oauth2-user-items": "", className: classNames?.menuItem, children: items })) : null, _jsx("button", { type: "button", onClick: () => {
64
+ void Promise.resolve(runLogout()).catch((error) => {
65
+ console.error("[@udibo/oauth2] logout failed:", error);
66
+ });
67
+ }, "data-oauth2-logout": "", className: classNames?.logout, children: labels?.logout ?? "Sign out" })] })) : null] }));
73
68
  }
@@ -8,7 +8,7 @@
8
8
  * @module
9
9
  */
10
10
  import { type Context } from "react";
11
- import type { OAuth2ClientBase, OAuth2Error, UserInfoClaims } from "../client/mod.js";
11
+ import type { OAuth2ClientBase, OAuth2Error, UserInfoClaims } from "../client/mod.ts";
12
12
  /** Shape exposed by `useOAuth2()`. */
13
13
  export interface OAuth2State {
14
14
  /** Whether a user is currently authenticated. */
@@ -17,10 +17,9 @@
17
17
  *
18
18
  * @module
19
19
  */
20
- import "../_dnt.polyfills.js";
21
- export { OAuth2Context, type OAuth2ContextValue, type OAuth2State, } from "./context.js";
22
- export { OAuth2Provider, type OAuth2ProviderProps } from "./provider.js";
23
- export { useBffClient, useDirectClient, useOAuth2, type UseOAuth2Result, } from "./use-oauth2.js";
24
- export { useAuthorization } from "./use-authorization.js";
25
- export { RequireAuth, type RequireAuthProps } from "./require-auth.js";
26
- export { OAuth2Callback, type OAuth2CallbackProps } from "./callback.js";
20
+ export { OAuth2Context, type OAuth2ContextValue, type OAuth2State, } from "./context.ts";
21
+ export { OAuth2Provider, type OAuth2ProviderProps } from "./provider.tsx";
22
+ export { useBffClient, useDirectClient, useOAuth2, type UseOAuth2Result, } from "./use-oauth2.ts";
23
+ export { useAuthorization } from "./use-authorization.ts";
24
+ export { RequireAuth, type RequireAuthProps } from "./require-auth.tsx";
25
+ export { OAuth2Callback, type OAuth2CallbackProps } from "./callback.tsx";
@@ -17,7 +17,6 @@
17
17
  *
18
18
  * @module
19
19
  */
20
- import "../_dnt.polyfills.js";
21
20
  export { OAuth2Context, } from "./context.js";
22
21
  export { OAuth2Provider } from "./provider.js";
23
22
  export { useBffClient, useDirectClient, useOAuth2, } from "./use-oauth2.js";
@@ -6,8 +6,8 @@
6
6
  * @module
7
7
  */
8
8
  import { type ReactNode } from "react";
9
- import type { OAuth2ClientBase } from "../client/mod.js";
10
- import { type OAuth2State } from "./context.js";
9
+ import type { OAuth2ClientBase } from "../client/mod.ts";
10
+ import { type OAuth2State } from "./context.ts";
11
11
  /** Props for {@link OAuth2Provider}. */
12
12
  export interface OAuth2ProviderProps {
13
13
  /**
@@ -1,4 +1,3 @@
1
- // deno-lint-ignore-file no-window -- browser-only; `window` used only after isBrowser() guards
2
1
  /**
3
2
  * `<RequireAuth>` — gate a subtree behind authentication. If the user is
4
3
  * not authenticated, calls `login({ returnTo })` (the {@link useOAuth2}
@@ -24,8 +23,7 @@ export function RequireAuth(props) {
24
23
  return;
25
24
  if (!isBrowser())
26
25
  return;
27
- const target = returnTo ??
28
- `${window.location.pathname}${window.location.search}`;
26
+ const target = returnTo ?? `${window.location.pathname}${window.location.search}`;
29
27
  login({ returnTo: target }).catch(() => { });
30
28
  }, [isLoading, isAuthenticated, login, returnTo]);
31
29
  if (isLoading || !isAuthenticated)
@@ -42,10 +42,9 @@
42
42
  *
43
43
  * @module
44
44
  */
45
- import "../_dnt.polyfills.js";
46
45
  import { type ReactNode } from "react";
47
- import { type AuthorizationRedirect, type BaseLoginOptions, BffClient, DirectClient, type LoginRedirect, type LogoutRedirect, OAuth2ClientBase, type OAuth2Error, type SessionState, type UserInfoClaims } from "../client/mod.js";
48
- import { type OAuth2State } from "./context.js";
46
+ import { type AuthorizationRedirect, type BaseLoginOptions, BffClient, DirectClient, type LoginRedirect, type LogoutRedirect, OAuth2ClientBase, type OAuth2Error, type SessionState, type UserInfoClaims } from "../client/mod.ts";
47
+ import { type OAuth2State } from "./context.ts";
49
48
  /** Where a mock client starts. */
50
49
  export interface MockOAuth2ClientState {
51
50
  /** Whether the mock starts signed in. Defaults to `user !== null`. */
@@ -43,7 +43,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
43
43
  *
44
44
  * @module
45
45
  */
46
- import "../_dnt.polyfills.js";
47
46
  import { useMemo } from "react";
48
47
  import { BffClient, DirectClient, OAuth2ClientBase, } from "../client/mod.js";
49
48
  import { OAuth2Context } from "./context.js";
@@ -450,7 +449,7 @@ export function MockOAuth2Provider(props) {
450
449
  : client.initialState.isAuthenticated,
451
450
  isLoading: override.isLoading ?? false,
452
451
  user: overrides("user")
453
- ? override.user ?? null
452
+ ? (override.user ?? null)
454
453
  : client.initialState.user,
455
454
  error: override.error ?? null,
456
455
  sessionExpiresIn: override.sessionExpiresIn ?? null,
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @module
7
7
  */
8
- import { type Authorization } from "../models/authorization.js";
8
+ import { type Authorization } from "../models/authorization.ts";
9
9
  /**
10
10
  * The signed-in user's authorization, derived from the session's claims.
11
11
  *
@@ -1,4 +1,11 @@
1
- import { type BaseLoginOptions, BffClient, DirectClient, type LogoutOptions, type OAuth2ClientBase, type OAuth2Error, type UserInfoClaims } from "../client/mod.js";
1
+ /**
2
+ * `useOAuth2()` — the primary React hook for consuming OAuth2 state and
3
+ * driving auth actions, plus the two hooks that narrow the context's client
4
+ * to a concrete transport.
5
+ *
6
+ * @module
7
+ */
8
+ import { type BaseLoginOptions, BffClient, DirectClient, type LogoutOptions, type OAuth2ClientBase, type OAuth2Error, type UserInfoClaims } from "../client/mod.ts";
2
9
  /** Return value of {@link useOAuth2}. */
3
10
  export interface UseOAuth2Result {
4
11
  /** True iff a user is authenticated. */
@@ -1,4 +1,3 @@
1
- // deno-lint-ignore-file no-window -- `login`/`logout` touch `window` only after an isBrowser() guard
2
1
  /**
3
2
  * `useOAuth2()` — the primary React hook for consuming OAuth2 state and
4
3
  * driving auth actions, plus the two hooks that narrow the context's client
@@ -6,7 +6,8 @@
6
6
  */
7
7
  /** Throws `RangeError` unless the leeway is non-negative, finite seconds whose millisecond conversion is finite. */
8
8
  export function assertClockSkewSeconds(clockSkewSeconds) {
9
- if (!Number.isFinite(clockSkewSeconds) || clockSkewSeconds < 0 ||
9
+ if (!Number.isFinite(clockSkewSeconds) ||
10
+ clockSkewSeconds < 0 ||
10
11
  !Number.isFinite(clockSkewSeconds * 1000)) {
11
12
  throw new RangeError("clockSkewSeconds must be non-negative finite seconds with a finite millisecond conversion");
12
13
  }
@@ -19,19 +19,18 @@
19
19
  * @see https://datatracker.ietf.org/doc/html/rfc6749
20
20
  * @module
21
21
  */
22
- import "../_dnt.polyfills.js";
23
- import type { AuthorizeParameters } from "../models/authorization-code.js";
24
- import type { AuthenticationContext } from "../models/authentication.js";
25
- import type { ClientInterface } from "../models/client.js";
26
- import type { Token, TokenResponse } from "../models/token.js";
27
- import type { AuthorizationServerMetadata } from "../models/responses.js";
28
- import type { AbstractScope, BasicScope } from "../models/scope.js";
29
- import type { IsPublicSuffix } from "./redirect-uri.js";
30
- import type { DispatchableGrant } from "./grants/grant.js";
31
- import type { ClientServiceInterface } from "./services/client.js";
32
- import type { TokenServiceInterface } from "./services/token.js";
33
- import { ResourceServer, type ResourceServerOptions, type ResourceServerServices } from "./resource-server.js";
34
- import { type SigningKeyProvider } from "./signing-keys.js";
22
+ import type { AuthorizeParameters } from "../models/authorization-code.ts";
23
+ import type { AuthenticationContext } from "../models/authentication.ts";
24
+ import type { ClientInterface } from "../models/client.ts";
25
+ import type { Token, TokenResponse } from "../models/token.ts";
26
+ import type { AuthorizationServerMetadata } from "../models/responses.ts";
27
+ import type { AbstractScope, BasicScope } from "../models/scope.ts";
28
+ import type { IsPublicSuffix } from "./redirect-uri.ts";
29
+ import type { DispatchableGrant } from "./grants/grant.ts";
30
+ import type { ClientServiceInterface } from "./services/client.ts";
31
+ import type { TokenServiceInterface } from "./services/token.ts";
32
+ import { ResourceServer, type ResourceServerOptions, type ResourceServerServices } from "./resource-server.ts";
33
+ import { type SigningKeyProvider } from "./signing-keys.ts";
35
34
  /** What {@link AuthorizationServer.handleEndSessionRequest} tells the app. */
36
35
  export interface EndSessionContext<Client extends ClientInterface> {
37
36
  /** The logout request itself. */
@@ -784,31 +783,31 @@ export declare class AuthorizationServer<Client extends ClientInterface, User, S
784
783
  * silently forwarding.
785
784
  */
786
785
  export declare function localAuthServerFetch<Client extends ClientInterface, User, S extends AbstractScope>(authServer: AuthorizationServer<Client, User, S>): typeof fetch;
787
- export { AbstractGrant } from "./grants/grant.js";
788
- export type { DispatchableGrant, GrantOptions, GrantServices, } from "./grants/grant.js";
789
- export { AuthorizationCodeGrant } from "./grants/authorization-code.js";
790
- export type { PKCEClientCredentials } from "./grants/authorization-code.js";
791
- export type { AuthorizationCodeGrantOptions, AuthorizationCodeGrantServices, GenerateAuthorizationCodeOptions, } from "./grants/authorization-code.js";
792
- export { ClientCredentialsGrant } from "./grants/client-credentials.js";
793
- export type { ClientCredentialsGrantOptions, ClientCredentialsGrantServices, } from "./grants/client-credentials.js";
794
- export { createJwtAccessTokenGenerator, exportSigningKeyJwk, generateSigningKey, importSigningKeyJwk, RotatingSigningKeyProvider, type RotatingSigningKeyProviderOptions, type SigningKey, type SigningKeyProvider, signJwt, StaticSigningKeyProvider, verifyJwt, type VerifyJwtOptions, } from "./signing-keys.js";
795
- export { RefreshTokenGrant } from "./grants/refresh-token.js";
796
- export type { RefreshTokenGrantOptions, RefreshTokenGrantServices, TokenReuseEvent, } from "./grants/refresh-token.js";
797
- export { PasswordGrant } from "./grants/password.js";
798
- export type { PasswordGrantOptions, PasswordGrantServices, } from "./grants/password.js";
799
- export { DeviceAuthorizationGrant } from "./grants/device-authorization.js";
800
- export type { DeviceAuthorizationGrantOptions, DeviceAuthorizationGrantServices, } from "./grants/device-authorization.js";
801
- export { AbstractTokenService, type AbstractTokenServiceOptions, type TokenServiceInterface, } from "./services/token.js";
802
- export type { ClientServiceInterface } from "./services/client.js";
803
- export { AbstractAuthorizationCodeService, type AbstractAuthorizationCodeServiceOptions, type AuthorizationCodeServiceInterface, } from "./services/authorization-code.js";
804
- export type { DeviceAuthorizationServiceInterface } from "./services/device-authorization.js";
805
- export type { UserServiceInterface } from "./services/user.js";
806
- export type { AuthorizationCode, AuthorizeParameters, } from "../models/authorization-code.js";
807
- export type { DeviceAuthorization } from "../models/device-authorization.js";
808
- export type { AuthorizationServerMetadata, DeviceAuthorizationResponse, ErrorResponse, OAuth2ErrorCode, } from "../models/responses.js";
809
- export { challengeMethods, CODE_VERIFIER_MAX_LENGTH, CODE_VERIFIER_MIN_LENGTH, CODE_VERIFIER_PATTERN, generateCodeChallenge, generateCodeVerifier, generateState, getChallengeMethod, validateCodeChallenge, validateCodeVerifier, verifyCodeChallenge, } from "../utils/pkce.js";
810
- export type { ChallengeMethod, ChallengeMethods } from "../utils/pkce.js";
811
- export { encodeBasicAuth, parseBasicAuth, tryParseBasicAuth, } from "../utils/basic-auth.js";
812
- export type { BasicAuth } from "../utils/basic-auth.js";
813
- export { checkRedirectUriPattern, isRedirectUriPattern, matchRedirectUri, } from "./redirect-uri.js";
814
- export type { IsPublicSuffix, RedirectUriPatternRule, RedirectUriPatternViolation, } from "./redirect-uri.js";
786
+ export { AbstractGrant } from "./grants/grant.ts";
787
+ export type { DispatchableGrant, GrantOptions, GrantServices, } from "./grants/grant.ts";
788
+ export { AuthorizationCodeGrant } from "./grants/authorization-code.ts";
789
+ export type { PKCEClientCredentials } from "./grants/authorization-code.ts";
790
+ export type { AuthorizationCodeGrantOptions, AuthorizationCodeGrantServices, GenerateAuthorizationCodeOptions, } from "./grants/authorization-code.ts";
791
+ export { ClientCredentialsGrant } from "./grants/client-credentials.ts";
792
+ export type { ClientCredentialsGrantOptions, ClientCredentialsGrantServices, } from "./grants/client-credentials.ts";
793
+ export { createJwtAccessTokenGenerator, exportSigningKeyJwk, generateSigningKey, importSigningKeyJwk, RotatingSigningKeyProvider, type RotatingSigningKeyProviderOptions, type SigningKey, type SigningKeyProvider, signJwt, StaticSigningKeyProvider, verifyJwt, type VerifyJwtOptions, } from "./signing-keys.ts";
794
+ export { RefreshTokenGrant } from "./grants/refresh-token.ts";
795
+ export type { RefreshTokenGrantOptions, RefreshTokenGrantServices, TokenReuseEvent, } from "./grants/refresh-token.ts";
796
+ export { PasswordGrant } from "./grants/password.ts";
797
+ export type { PasswordGrantOptions, PasswordGrantServices, } from "./grants/password.ts";
798
+ export { DeviceAuthorizationGrant } from "./grants/device-authorization.ts";
799
+ export type { DeviceAuthorizationGrantOptions, DeviceAuthorizationGrantServices, } from "./grants/device-authorization.ts";
800
+ export { AbstractTokenService, type AbstractTokenServiceOptions, type TokenServiceInterface, } from "./services/token.ts";
801
+ export type { ClientServiceInterface } from "./services/client.ts";
802
+ export { AbstractAuthorizationCodeService, type AbstractAuthorizationCodeServiceOptions, type AuthorizationCodeServiceInterface, } from "./services/authorization-code.ts";
803
+ export type { DeviceAuthorizationServiceInterface } from "./services/device-authorization.ts";
804
+ export type { UserServiceInterface } from "./services/user.ts";
805
+ export type { AuthorizationCode, AuthorizeParameters, } from "../models/authorization-code.ts";
806
+ export type { DeviceAuthorization } from "../models/device-authorization.ts";
807
+ export type { AuthorizationServerMetadata, DeviceAuthorizationResponse, ErrorResponse, OAuth2ErrorCode, } from "../models/responses.ts";
808
+ export { challengeMethods, CODE_VERIFIER_MAX_LENGTH, CODE_VERIFIER_MIN_LENGTH, CODE_VERIFIER_PATTERN, generateCodeChallenge, generateCodeVerifier, generateState, getChallengeMethod, validateCodeChallenge, validateCodeVerifier, verifyCodeChallenge, } from "../utils/pkce.ts";
809
+ export type { ChallengeMethod, ChallengeMethods } from "../utils/pkce.ts";
810
+ export { encodeBasicAuth, parseBasicAuth, tryParseBasicAuth, } from "../utils/basic-auth.ts";
811
+ export type { BasicAuth } from "../utils/basic-auth.ts";
812
+ export { checkRedirectUriPattern, isRedirectUriPattern, matchRedirectUri, } from "./redirect-uri.ts";
813
+ export type { IsPublicSuffix, RedirectUriPatternRule, RedirectUriPatternViolation, } from "./redirect-uri.ts";
@@ -19,7 +19,6 @@
19
19
  * @see https://datatracker.ietf.org/doc/html/rfc6749
20
20
  * @module
21
21
  */
22
- import "../_dnt.polyfills.js";
23
22
  import { snapshotAuthenticationContext } from "../utils/authentication-context.js";
24
23
  import { AccessDeniedError, InvalidRequestError, InvalidTokenError, isOAuth2Error, OAuth2Error, ServerError, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, } from "../errors.js";
25
24
  import { authenticateClientCredentials, extractClientCredentials, } from "./client-authentication.js";
@@ -119,8 +118,7 @@ const AUTHORIZATION_CODE_GRANT_TYPE = "authorization_code";
119
118
  * }
120
119
  * ```
121
120
  */
122
- export const ENDPOINT_PATHS = Object
123
- .fromEntries(ENDPOINT_ENTRIES.map(([key, { path }]) => [key, path]));
121
+ export const ENDPOINT_PATHS = Object.fromEntries(ENDPOINT_ENTRIES.map(([key, { path }]) => [key, path]));
124
122
  /**
125
123
  * The HTTP methods each endpoint in {@link ENDPOINT_PATHS} answers — `POST` for
126
124
  * the token-style endpoints, `GET` for authorize/JWKS/discovery, both for
@@ -261,8 +259,8 @@ export class AuthorizationServer extends ResourceServer {
261
259
  const { issuer } = context;
262
260
  const endpoints = {};
263
261
  for (const [key, { option, path }] of ADVERTISED_ENTRIES) {
264
- endpoints[key] = context[option] ??
265
- (issuer ? `${issuer}${path}` : undefined);
262
+ endpoints[key] =
263
+ context[option] ?? (issuer ? `${issuer}${path}` : undefined);
266
264
  }
267
265
  return endpoints;
268
266
  }
@@ -310,7 +308,7 @@ export class AuthorizationServer extends ResourceServer {
310
308
  headers: {
311
309
  "Content-Type": "application/json;charset=UTF-8",
312
310
  "Cache-Control": "no-store",
313
- "Pragma": "no-cache",
311
+ Pragma: "no-cache",
314
312
  },
315
313
  });
316
314
  }
@@ -380,8 +378,7 @@ export class AuthorizationServer extends ResourceServer {
380
378
  this.#assertSingletonParameters(body, parameters);
381
379
  }
382
380
  async #readBody(request, options = {}) {
383
- const bytes = await readBoundedBody(request, this.#maxBodyBytes, options)
384
- .catch((cause) => {
381
+ const bytes = await readBoundedBody(request, this.#maxBodyBytes, options).catch((cause) => {
385
382
  throw new InvalidRequestError("request body could not be read", {
386
383
  cause,
387
384
  });
@@ -402,7 +399,9 @@ export class AuthorizationServer extends ResourceServer {
402
399
  const bytes = await this.#readBody(request, { keepReadable: true });
403
400
  const body = await new Response(bytes, {
404
401
  headers: { "content-type": contentType },
405
- }).formData().catch(() => {
402
+ })
403
+ .formData()
404
+ .catch(() => {
406
405
  throw new InvalidRequestError("body must be application/x-www-form-urlencoded");
407
406
  });
408
407
  this.#assertSingletonParameters(body, ["client_id", "client_secret"]);
@@ -432,8 +431,7 @@ export class AuthorizationServer extends ResourceServer {
432
431
  */
433
432
  async handleTokenRequest(request) {
434
433
  try {
435
- const { context, body, client, grant } = await this
436
- .#beginClientAuthenticatedRequest(request, {
434
+ const { context, body, client, grant } = await this.#beginClientAuthenticatedRequest(request, {
437
435
  grantFromBody: (body) => this.#grantFromBody(body),
438
436
  validateBody: (body) => this.#assertTokenSingletonParameters(body),
439
437
  });
@@ -473,7 +471,7 @@ export class AuthorizationServer extends ResourceServer {
473
471
  }
474
472
  async #oidcClaims(user, scope, authenticationContext) {
475
473
  return {
476
- ...(await this.#userClaims?.(user, scope, snapshotAuthenticationContext(authenticationContext)) ?? {}),
474
+ ...((await this.#userClaims?.(user, scope, snapshotAuthenticationContext(authenticationContext))) ?? {}),
477
475
  sub: this.#subjectOf(user),
478
476
  };
479
477
  }
@@ -609,12 +607,12 @@ export class AuthorizationServer extends ResourceServer {
609
607
  try {
610
608
  const params = await this.#endSessionParameters(request);
611
609
  const client = await this.#resolveEndSessionClient(request, params);
612
- const result = await endSession({
610
+ const result = (await endSession({
613
611
  request,
614
612
  client,
615
613
  subject: params.subject,
616
614
  logoutHint: params.logoutHint,
617
- }) ?? {};
615
+ })) ?? {};
618
616
  const headers = new Headers(result.refused ? undefined : result.headers);
619
617
  const authorized = result.refused
620
618
  ? undefined
@@ -638,7 +636,9 @@ export class AuthorizationServer extends ResourceServer {
638
636
  const idTokenHint = params.get("id_token_hint");
639
637
  const hint = idTokenHint ? await this.#readIdTokenHint(idTokenHint) : null;
640
638
  const clientId = params.get("client_id");
641
- if (clientId && hint && hint.audiences.length > 0 &&
639
+ if (clientId &&
640
+ hint &&
641
+ hint.audiences.length > 0 &&
642
642
  !hint.audiences.includes(clientId)) {
643
643
  throw new InvalidRequestError("client_id does not match the audience of id_token_hint");
644
644
  }
@@ -675,7 +675,7 @@ export class AuthorizationServer extends ResourceServer {
675
675
  return null;
676
676
  const { services } = await this.authorizationContext(request);
677
677
  try {
678
- return await services.clientService.get(params.clientId) ?? null;
678
+ return (await services.clientService.get(params.clientId)) ?? null;
679
679
  }
680
680
  catch {
681
681
  return null;
@@ -802,8 +802,7 @@ export class AuthorizationServer extends ResourceServer {
802
802
  const { searchParams } = redirectUrl;
803
803
  searchParams.set("error", error.extensions.error ?? "server_error");
804
804
  // Use exposedMessage, never raw error.message, so 5xx server_error detail isn't leaked into the redirect.
805
- const description = error.extensions.error_description ??
806
- error.exposedMessage;
805
+ const description = error.extensions.error_description ?? error.exposedMessage;
807
806
  if (description) {
808
807
  searchParams.set("error_description", description);
809
808
  }
@@ -884,8 +883,7 @@ export class AuthorizationServer extends ResourceServer {
884
883
  const { grant, client, user, requestedScope, authorizedScope, services, handleConsent, } = options;
885
884
  const acceptedScope = await grant.acceptedScope(client, user, requestedScope, services.tokenService);
886
885
  let scope = acceptedScope ?? undefined;
887
- const needsConsent = scope !== undefined &&
888
- !(authorizedScope && authorizedScope.has(scope));
886
+ const needsConsent = scope !== undefined && !(authorizedScope && authorizedScope.has(scope));
889
887
  if (needsConsent && handleConsent) {
890
888
  const consent = await handleConsent(client, scope, user);
891
889
  if (consent instanceof Response)
@@ -940,12 +938,8 @@ export class AuthorizationServer extends ResourceServer {
940
938
  */
941
939
  async handleRevocationRequest(request) {
942
940
  try {
943
- const { context, body, client } = await this
944
- .#beginClientAuthenticatedRequest(request, {
945
- validateBody: (body) => this.#assertSingletonParameters(body, [
946
- "token",
947
- "token_type_hint",
948
- ]),
941
+ const { context, body, client } = await this.#beginClientAuthenticatedRequest(request, {
942
+ validateBody: (body) => this.#assertSingletonParameters(body, ["token", "token_type_hint"]),
949
943
  });
950
944
  const token = body.get("token");
951
945
  if (typeof token !== "string") {
@@ -1027,12 +1021,8 @@ export class AuthorizationServer extends ResourceServer {
1027
1021
  */
1028
1022
  async handleIntrospectionRequest(request) {
1029
1023
  try {
1030
- const { context, body, client } = await this
1031
- .#beginClientAuthenticatedRequest(request, {
1032
- validateBody: (body) => this.#assertSingletonParameters(body, [
1033
- "token",
1034
- "token_type_hint",
1035
- ]),
1024
+ const { context, body, client } = await this.#beginClientAuthenticatedRequest(request, {
1025
+ validateBody: (body) => this.#assertSingletonParameters(body, ["token", "token_type_hint"]),
1036
1026
  });
1037
1027
  const tokenValue = body.get("token");
1038
1028
  if (typeof tokenValue !== "string") {
@@ -1044,9 +1034,10 @@ export class AuthorizationServer extends ResourceServer {
1044
1034
  let response;
1045
1035
  const resolved = await this.#resolveToken(tokenService, tokenValue, hint);
1046
1036
  const expiresAt = resolved && this.#introspectedExpiry(resolved);
1047
- if (!resolved || (expiresAt && expiresAt < new Date()) ||
1037
+ if (!resolved ||
1038
+ (expiresAt && expiresAt < new Date()) ||
1048
1039
  (this.#canIntrospectToken &&
1049
- await this.#canIntrospectToken(client, resolved.token, resolved.tokenType) !== true)) {
1040
+ (await this.#canIntrospectToken(client, resolved.token, resolved.tokenType)) !== true)) {
1050
1041
  response = { active: false };
1051
1042
  }
1052
1043
  else {
@@ -1088,7 +1079,7 @@ export class AuthorizationServer extends ResourceServer {
1088
1079
  headers: {
1089
1080
  "Content-Type": "application/json;charset=UTF-8",
1090
1081
  "Cache-Control": "no-store",
1091
- "Pragma": "no-cache",
1082
+ Pragma: "no-cache",
1092
1083
  },
1093
1084
  });
1094
1085
  }
@@ -1221,16 +1212,13 @@ export class AuthorizationServer extends ResourceServer {
1221
1212
  */
1222
1213
  async handleDeviceAuthorizationRequest(request) {
1223
1214
  try {
1224
- const { context, body, client } = await this
1225
- .#beginClientAuthenticatedRequest(request, {
1215
+ const { context, body, client } = await this.#beginClientAuthenticatedRequest(request, {
1226
1216
  requiredGrantType: DEVICE_AUTHORIZATION_GRANT_TYPE,
1227
1217
  validateBody: (body) => this.#assertSingletonParameters(body, ["scope"]),
1228
1218
  });
1229
1219
  const grant = this.#deviceAuthorizationGrant();
1230
1220
  const scopeText = body.get("scope");
1231
- const scope = typeof scopeText === "string"
1232
- ? grant.parseScope(scopeText)
1233
- : undefined;
1221
+ const scope = typeof scopeText === "string" ? grant.parseScope(scopeText) : undefined;
1234
1222
  // RFC 8628 §3.2 requires a verification_uri the user can visit.
1235
1223
  if (!context.verificationUri) {
1236
1224
  throw new ServerError("verificationUri must be configured for the device authorization " +
@@ -1249,7 +1237,7 @@ export class AuthorizationServer extends ResourceServer {
1249
1237
  headers: {
1250
1238
  "Content-Type": "application/json;charset=UTF-8",
1251
1239
  "Cache-Control": "no-store",
1252
- "Pragma": "no-cache",
1240
+ Pragma: "no-cache",
1253
1241
  },
1254
1242
  });
1255
1243
  }
@@ -1292,7 +1280,9 @@ export class AuthorizationServer extends ResourceServer {
1292
1280
  export function localAuthServerFetch(authServer) {
1293
1281
  return async (input, init) => {
1294
1282
  const request = input instanceof Request
1295
- ? (init ? new Request(input, init) : input)
1283
+ ? init
1284
+ ? new Request(input, init)
1285
+ : input
1296
1286
  : new Request(String(input), init);
1297
1287
  const url = new URL(request.url);
1298
1288
  const path = url.pathname;
@@ -6,8 +6,8 @@
6
6
  * @see https://datatracker.ietf.org/doc/html/rfc6749#section-2.3
7
7
  * @module
8
8
  */
9
- import type { ClientCredentials, ClientInterface } from "../models/client.js";
10
- import type { ClientServiceInterface } from "./services/client.js";
9
+ import type { ClientCredentials, ClientInterface } from "../models/client.ts";
10
+ import type { ClientServiceInterface } from "./services/client.ts";
11
11
  /**
12
12
  * Reads the credentials a request presents: HTTP Basic first (RFC 6749 Section
13
13
  * 2.3.1), then `client_id`/`client_secret` in `body`, the form body the
@@ -3,15 +3,15 @@
3
3
  * RFC 6749 Section 4.1 and RFC 7636.
4
4
  * @module
5
5
  */
6
- import type { AuthorizationCode } from "../../models/authorization-code.js";
7
- import type { AuthenticationContext } from "../../models/authentication.js";
8
- import type { ClientCredentials, ClientInterface } from "../../models/client.js";
9
- import type { Token } from "../../models/token.js";
10
- import type { AbstractScope, BasicScope } from "../../models/scope.js";
11
- import type { ChallengeMethod, ChallengeMethods } from "../../utils/pkce.js";
12
- import type { ClientServiceInterface } from "../services/client.js";
13
- import type { AuthorizationCodeServiceInterface } from "../services/authorization-code.js";
14
- import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.js";
6
+ import type { AuthorizationCode } from "../../models/authorization-code.ts";
7
+ import type { AuthenticationContext } from "../../models/authentication.ts";
8
+ import type { ClientCredentials, ClientInterface } from "../../models/client.ts";
9
+ import type { Token } from "../../models/token.ts";
10
+ import type { AbstractScope, BasicScope } from "../../models/scope.ts";
11
+ import type { ChallengeMethod, ChallengeMethods } from "../../utils/pkce.ts";
12
+ import type { ClientServiceInterface } from "../services/client.ts";
13
+ import type { AuthorizationCodeServiceInterface } from "../services/authorization-code.ts";
14
+ import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.ts";
15
15
  /** Services required by the authorization code grant. */
16
16
  export interface AuthorizationCodeGrantServices<Client extends ClientInterface, User, S extends AbstractScope> extends GrantServices<Client, User, S> {
17
17
  /** Generates, stores, and looks up authorization codes for the exchange. */
@@ -45,8 +45,8 @@ export class AuthorizationCodeGrant extends AbstractGrant {
45
45
  });
46
46
  this.challengeMethods = options.challengeMethods ?? defaultChallengeMethods;
47
47
  this.requirePKCE = options.requirePKCE ?? true;
48
- this.requireClientAuthentication = options.requireClientAuthentication ??
49
- true;
48
+ this.requireClientAuthentication =
49
+ options.requireClientAuthentication ?? true;
50
50
  }
51
51
  /**
52
52
  * Extracts client credentials from a request, carrying the PKCE
@@ -178,8 +178,7 @@ export class AuthorizationCodeGrant extends AbstractGrant {
178
178
  * @see https://datatracker.ietf.org/doc/html/rfc7636#section-4.5
179
179
  */
180
180
  async token(request, client, body) {
181
- const { authorizationCodeService, tokenService } = await this
182
- .resolveServices(request);
181
+ const { authorizationCodeService, tokenService } = await this.resolveServices(request);
183
182
  const code = body.get("code");
184
183
  if (typeof code !== "string") {
185
184
  throw new InvalidRequestError("code parameter required");
@@ -192,7 +191,7 @@ export class AuthorizationCodeGrant extends AbstractGrant {
192
191
  if (!authorizationCode || authorizationCode.expiresAt < new Date()) {
193
192
  throw new InvalidGrantError("invalid code");
194
193
  }
195
- if (!await authorizationCodeService.revoke(authorizationCode)) {
194
+ if (!(await authorizationCodeService.revoke(authorizationCode))) {
196
195
  throw new InvalidGrantError("code already used");
197
196
  }
198
197
  const codeVerifier = body.get("code_verifier");
@@ -200,7 +199,7 @@ export class AuthorizationCodeGrant extends AbstractGrant {
200
199
  if (!validateCodeVerifier(codeVerifier)) {
201
200
  throw new InvalidRequestError("code_verifier must be 43-128 characters using [A-Z] / [a-z] / [0-9] / - / . / _ / ~");
202
201
  }
203
- if (!await this.verifyCode(authorizationCode, codeVerifier)) {
202
+ if (!(await this.verifyCode(authorizationCode, codeVerifier))) {
204
203
  throw new InvalidGrantError("code_verifier verification failed");
205
204
  }
206
205
  }
@@ -3,10 +3,10 @@
3
3
  * RFC 6749 Section 4.4.
4
4
  * @module
5
5
  */
6
- import type { ClientInterface } from "../../models/client.js";
7
- import type { Token } from "../../models/token.js";
8
- import type { AbstractScope, BasicScope } from "../../models/scope.js";
9
- import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.js";
6
+ import type { ClientInterface } from "../../models/client.ts";
7
+ import type { Token } from "../../models/token.ts";
8
+ import type { AbstractScope, BasicScope } from "../../models/scope.ts";
9
+ import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.ts";
10
10
  /** Services required by the client credentials grant. */
11
11
  export type ClientCredentialsGrantServices<Client extends ClientInterface, User, S extends AbstractScope> = GrantServices<Client, User, S>;
12
12
  /**