@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
@@ -8,12 +8,12 @@
8
8
  * @see https://datatracker.ietf.org/doc/html/rfc8628
9
9
  * @module
10
10
  */
11
- import type { ClientInterface } from "../../models/client.js";
12
- import type { Token } from "../../models/token.js";
13
- import type { AbstractScope, BasicScope } from "../../models/scope.js";
14
- import type { DeviceAuthorization } from "../../models/device-authorization.js";
15
- import type { DeviceAuthorizationServiceInterface } from "../services/device-authorization.js";
16
- import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.js";
11
+ import type { ClientInterface } from "../../models/client.ts";
12
+ import type { Token } from "../../models/token.ts";
13
+ import type { AbstractScope, BasicScope } from "../../models/scope.ts";
14
+ import type { DeviceAuthorization } from "../../models/device-authorization.ts";
15
+ import type { DeviceAuthorizationServiceInterface } from "../services/device-authorization.ts";
16
+ import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.ts";
17
17
  /**
18
18
  * Services required by the device authorization grant.
19
19
  */
@@ -95,8 +95,7 @@ export class DeviceAuthorizationGrant extends AbstractGrant {
95
95
  * @see https://datatracker.ietf.org/doc/html/rfc8628#section-3.5
96
96
  */
97
97
  async token(request, client, body) {
98
- const { deviceAuthorizationService, tokenService } = await this
99
- .resolveServices(request);
98
+ const { deviceAuthorizationService, tokenService } = await this.resolveServices(request);
100
99
  const deviceCode = body.get("device_code");
101
100
  if (typeof deviceCode !== "string") {
102
101
  throw new InvalidRequestError("device_code parameter required");
@@ -130,7 +129,7 @@ export class DeviceAuthorizationGrant extends AbstractGrant {
130
129
  throw new AuthorizationPendingError("authorization request is pending user approval");
131
130
  }
132
131
  const { user, scope } = authorization;
133
- if (!await deviceAuthorizationService.revoke(authorization)) {
132
+ if (!(await deviceAuthorizationService.revoke(authorization))) {
134
133
  throw new InvalidGrantError("device_code already used");
135
134
  }
136
135
  const token = await this.generateToken(client, user, scope, tokenService);
@@ -143,7 +142,8 @@ export class DeviceAuthorizationGrant extends AbstractGrant {
143
142
  catch (error) {
144
143
  let stillStored;
145
144
  try {
146
- stillStored = await deviceAuthorizationService.getByDeviceCode(deviceCode);
145
+ stillStored =
146
+ await deviceAuthorizationService.getByDeviceCode(deviceCode);
147
147
  }
148
148
  catch {
149
149
  throw error;
@@ -16,13 +16,13 @@
16
16
  * @see https://datatracker.ietf.org/doc/html/rfc6749#section-4
17
17
  * @module
18
18
  */
19
- import type { ClientCredentials, ClientInterface } from "../../models/client.js";
20
- import type { RefreshToken, Token } from "../../models/token.js";
21
- import type { AuthenticationContext } from "../../models/authentication.js";
22
- import type { AbstractScope, ScopeConstructor } from "../../models/scope.js";
23
- import { BasicScope } from "../../models/scope.js";
24
- import type { ClientServiceInterface } from "../services/client.js";
25
- import type { TokenServiceInterface } from "../services/token.js";
19
+ import type { ClientCredentials, ClientInterface } from "../../models/client.ts";
20
+ import type { RefreshToken, Token } from "../../models/token.ts";
21
+ import type { AuthenticationContext } from "../../models/authentication.ts";
22
+ import type { AbstractScope, ScopeConstructor } from "../../models/scope.ts";
23
+ import { BasicScope } from "../../models/scope.ts";
24
+ import type { ClientServiceInterface } from "../services/client.ts";
25
+ import type { TokenServiceInterface } from "../services/token.ts";
26
26
  /**
27
27
  * The core services every grant needs: client lookup/authentication and token
28
28
  * storage. Each grant defines its own services interface by extending this with
@@ -38,8 +38,8 @@ export class AbstractGrant {
38
38
  /** Creates a grant from the shared {@linkcode GrantOptions}. */
39
39
  constructor(options) {
40
40
  this.allowRefreshToken = options.allowRefreshToken ?? false;
41
- this.Scope = options.Scope ??
42
- BasicScope;
41
+ this.Scope =
42
+ options.Scope ?? BasicScope;
43
43
  this.#resolve = options.resolve;
44
44
  }
45
45
  /** The services this grant needs for `request`, from its `resolve` option. */
@@ -148,12 +148,12 @@ export class AbstractGrant {
148
148
  if (refreshTokenExpiresAt) {
149
149
  withRefresh.refreshTokenExpiresAt = refreshTokenExpiresAt;
150
150
  }
151
- const newFamilyExpiresAt = await tokenService
152
- .refreshTokenFamilyExpiresAt?.(client, user, familyCreatedAt, scope);
151
+ const newFamilyExpiresAt = await tokenService.refreshTokenFamilyExpiresAt?.(client, user, familyCreatedAt, scope);
153
152
  if (newFamilyExpiresAt) {
154
- ceiling = ceiling && ceiling < newFamilyExpiresAt
155
- ? ceiling
156
- : newFamilyExpiresAt;
153
+ ceiling =
154
+ ceiling && ceiling < newFamilyExpiresAt
155
+ ? ceiling
156
+ : newFamilyExpiresAt;
157
157
  }
158
158
  result = withRefresh;
159
159
  }
@@ -17,11 +17,11 @@
17
17
  * @see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-2.4
18
18
  * @module
19
19
  */
20
- import type { ClientInterface } from "../../models/client.js";
21
- import type { Token } from "../../models/token.js";
22
- import type { AbstractScope, BasicScope } from "../../models/scope.js";
23
- import type { UserServiceInterface } from "../services/user.js";
24
- import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.js";
20
+ import type { ClientInterface } from "../../models/client.ts";
21
+ import type { Token } from "../../models/token.ts";
22
+ import type { AbstractScope, BasicScope } from "../../models/scope.ts";
23
+ import type { UserServiceInterface } from "../services/user.ts";
24
+ import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.ts";
25
25
  /** Services required by the password grant. */
26
26
  export interface PasswordGrantServices<Client extends ClientInterface, User, S extends AbstractScope> extends GrantServices<Client, User, S> {
27
27
  /** Authenticates the resource owner by username and password. */
@@ -3,10 +3,10 @@
3
3
  * RFC 6749 Section 6.
4
4
  * @module
5
5
  */
6
- import type { ClientInterface } from "../../models/client.js";
7
- import type { RefreshToken } 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 { RefreshToken } 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 refresh token grant. */
11
11
  export type RefreshTokenGrantServices<Client extends ClientInterface, User, S extends AbstractScope> = GrantServices<Client, User, S>;
12
12
  /**
@@ -92,8 +92,7 @@ export class RefreshTokenGrant extends AbstractGrant {
92
92
  nextScope = requestedScope;
93
93
  }
94
94
  }
95
- const familyExpiresAt = currentToken.familyCreatedAt &&
96
- tokenService.refreshTokenFamilyExpiresAt
95
+ const familyExpiresAt = currentToken.familyCreatedAt && tokenService.refreshTokenFamilyExpiresAt
97
96
  ? await tokenService.refreshTokenFamilyExpiresAt(client, user, currentToken.familyCreatedAt, nextScope)
98
97
  : undefined;
99
98
  if (familyExpiresAt && familyExpiresAt.getTime() <= Date.now()) {
@@ -109,10 +108,10 @@ export class RefreshTokenGrant extends AbstractGrant {
109
108
  };
110
109
  // A rotation stays in its ancestor's family so replaying any rotated-out
111
110
  // member revokes the whole chain.
112
- nextRefreshToken.familyId = currentToken.familyId ??
113
- nextRefreshToken.familyId;
114
- nextRefreshToken.familyCreatedAt = currentToken.familyCreatedAt ??
115
- nextRefreshToken.familyCreatedAt;
111
+ nextRefreshToken.familyId =
112
+ currentToken.familyId ?? nextRefreshToken.familyId;
113
+ nextRefreshToken.familyCreatedAt =
114
+ currentToken.familyCreatedAt ?? nextRefreshToken.familyCreatedAt;
116
115
  if (familyExpiresAt) {
117
116
  this.capAtFamilyExpiry(nextRefreshToken, familyExpiresAt);
118
117
  }
@@ -9,11 +9,11 @@
9
9
  * @see https://datatracker.ietf.org/doc/html/rfc7662
10
10
  * @module
11
11
  */
12
- import type { ClientInterface } from "../models/client.js";
13
- import type { AbstractScope, ScopeConstructor } from "../models/scope.js";
14
- import { BasicScope } from "../models/scope.js";
15
- import type { IntrospectionResponse, Token } from "../models/token.js";
16
- import type { TokenReaderInterface } from "./services/token.js";
12
+ import type { ClientInterface } from "../models/client.ts";
13
+ import type { AbstractScope, ScopeConstructor } from "../models/scope.ts";
14
+ import { BasicScope } from "../models/scope.ts";
15
+ import type { IntrospectionResponse, Token } from "../models/token.ts";
16
+ import type { TokenReaderInterface } from "./services/token.ts";
17
17
  /**
18
18
  * Options for configuring the introspection token reader.
19
19
  *
@@ -71,8 +71,8 @@ export class IntrospectionTokenReader {
71
71
  this.introspectionEndpoint = options.introspectionEndpoint;
72
72
  this.clientId = options.clientId;
73
73
  this.clientSecret = options.clientSecret;
74
- this.Scope = options.Scope ??
75
- BasicScope;
74
+ this.Scope =
75
+ options.Scope ?? BasicScope;
76
76
  this.getClient = options.getClient;
77
77
  this.getUser = options.getUser;
78
78
  this.fetchTimeoutMs = options.fetchTimeoutMs ?? 5_000;
@@ -138,7 +138,7 @@ export class IntrospectionTokenReader {
138
138
  method: "POST",
139
139
  headers: {
140
140
  "Content-Type": "application/x-www-form-urlencoded",
141
- "Authorization": encodeBasicAuth(this.clientId, this.clientSecret),
141
+ Authorization: encodeBasicAuth(this.clientId, this.clientSecret),
142
142
  },
143
143
  body: new URLSearchParams({ token: accessToken }),
144
144
  signal: packageDeadlineSignal(controller.signal),
@@ -154,7 +154,7 @@ export class IntrospectionTokenReader {
154
154
  : new ServerError(`token introspection failed (HTTP ${response.status})`);
155
155
  }
156
156
  try {
157
- return await response.json();
157
+ return (await response.json());
158
158
  }
159
159
  catch (cause) {
160
160
  throw controller.signal.aborted
@@ -12,11 +12,11 @@
12
12
  * @see https://datatracker.ietf.org/doc/html/rfc7517
13
13
  * @module
14
14
  */
15
- import type { ClientInterface } from "../models/client.js";
16
- import type { AbstractScope, ScopeConstructor } from "../models/scope.js";
17
- import { BasicScope } from "../models/scope.js";
18
- import type { Token } from "../models/token.js";
19
- import type { TokenReaderInterface } from "./services/token.js";
15
+ import type { ClientInterface } from "../models/client.ts";
16
+ import type { AbstractScope, ScopeConstructor } from "../models/scope.ts";
17
+ import { BasicScope } from "../models/scope.ts";
18
+ import type { Token } from "../models/token.ts";
19
+ import type { TokenReaderInterface } from "./services/token.ts";
20
20
  /**
21
21
  * Claims of a validated JWT access token, as defined by RFC 9068 §2.2.
22
22
  *
@@ -255,8 +255,8 @@ export class JwksTokenReader {
255
255
  this.#cacheMaxAgeMs = options.cacheMaxAgeMs ?? 600_000;
256
256
  this.#minFetchIntervalMs = options.minFetchIntervalMs ?? 30_000;
257
257
  this.#fetchTimeoutMs = options.fetchTimeoutMs ?? 5_000;
258
- this.#Scope = options.Scope ??
259
- BasicScope;
258
+ this.#Scope =
259
+ options.Scope ?? BasicScope;
260
260
  this.#getClient = options.getClient;
261
261
  this.#getUser = options.getUser;
262
262
  this.#customFetch = options.fetch;
@@ -437,7 +437,7 @@ export class JwksTokenReader {
437
437
  }
438
438
  }
439
439
  async #load() {
440
- const jwksUri = this.#jwksUri ?? await this.#discoverJwksUri();
440
+ const jwksUri = this.#jwksUri ?? (await this.#discoverJwksUri());
441
441
  const body = await this.#fetchJson(jwksUri, "jwks");
442
442
  if (!isRecord(body) || !Array.isArray(body.keys)) {
443
443
  throw new ServerError("jwks response has no `keys` array");
@@ -484,7 +484,7 @@ export class JwksTokenReader {
484
484
  let response;
485
485
  try {
486
486
  response = await fetchImpl(url, {
487
- headers: { "Accept": "application/json" },
487
+ headers: { Accept: "application/json" },
488
488
  signal: packageDeadlineSignal(controller.signal),
489
489
  });
490
490
  }
@@ -8,16 +8,15 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- import "../_dnt.polyfills.js";
12
- export type { ClientCredentials, ClientInterface } from "../models/client.js";
13
- export type { AuthenticationContext } from "../models/authentication.js";
14
- export type { IntrospectionResponse, RefreshToken, Token, TokenResponse, } from "../models/token.js";
15
- export { AbstractScope, BasicScope } from "../models/scope.js";
16
- export type { ScopeConstructor } from "../models/scope.js";
17
- export { Authorization, authorizationFromClaims, } from "../models/authorization.js";
18
- export type { AuthorizationFailure, AuthorizationInit, OrganizationContext, RequireConditions, } from "../models/authorization.js";
19
- export { AccessDeniedError, AuthorizationPendingError, ExpiredTokenError, InsufficientPermissionsError, InsufficientScopeError, InvalidClientError, InvalidGrantError, InvalidRequestError, InvalidScopeError, InvalidTokenError, isOAuth2Error, OAuth2Error, ServerError, SlowDownError, TemporarilyUnavailableError, toOAuth2Error, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, } from "../errors.js";
20
- export type { OAuth2ErrorClass, OAuth2ProblemDetailsExtensions, } from "../errors.js";
21
- export type { TokenReaderInterface } from "./services/token.js";
22
- export { checkRedirectUriPattern, isRedirectUriPattern, matchRedirectUri, } from "./redirect-uri.js";
23
- export type { IsPublicSuffix, RedirectUriPatternRule, RedirectUriPatternViolation, } from "./redirect-uri.js";
11
+ export type { ClientCredentials, ClientInterface } from "../models/client.ts";
12
+ export type { AuthenticationContext } from "../models/authentication.ts";
13
+ export type { IntrospectionResponse, RefreshToken, Token, TokenResponse, } from "../models/token.ts";
14
+ export { AbstractScope, BasicScope } from "../models/scope.ts";
15
+ export type { ScopeConstructor } from "../models/scope.ts";
16
+ export { Authorization, authorizationFromClaims, } from "../models/authorization.ts";
17
+ export type { AuthorizationFailure, AuthorizationInit, OrganizationContext, RequireConditions, } from "../models/authorization.ts";
18
+ export { AccessDeniedError, AuthorizationPendingError, ExpiredTokenError, InsufficientPermissionsError, InsufficientScopeError, InvalidClientError, InvalidGrantError, InvalidRequestError, InvalidScopeError, InvalidTokenError, isOAuth2Error, OAuth2Error, ServerError, SlowDownError, TemporarilyUnavailableError, toOAuth2Error, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, } from "../errors.ts";
19
+ export type { OAuth2ErrorClass, OAuth2ProblemDetailsExtensions, } from "../errors.ts";
20
+ export type { TokenReaderInterface } from "./services/token.ts";
21
+ export { checkRedirectUriPattern, isRedirectUriPattern, matchRedirectUri, } from "./redirect-uri.ts";
22
+ export type { IsPublicSuffix, RedirectUriPatternRule, RedirectUriPatternViolation, } from "./redirect-uri.ts";
@@ -8,7 +8,6 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- import "../_dnt.polyfills.js";
12
11
  export { AbstractScope, BasicScope } from "../models/scope.js";
13
12
  export { Authorization, authorizationFromClaims, } from "../models/authorization.js";
14
13
  export { AccessDeniedError, AuthorizationPendingError, ExpiredTokenError, InsufficientPermissionsError, InsufficientScopeError, InvalidClientError, InvalidGrantError, InvalidRequestError, InvalidScopeError, InvalidTokenError, isOAuth2Error, OAuth2Error, ServerError, SlowDownError, TemporarilyUnavailableError, toOAuth2Error, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, } from "../errors.js";
@@ -26,13 +26,12 @@
26
26
  * wildcard must not straddle (`github.io`, `vercel.app`, `blob.core.windows.net`)
27
27
  * is listed there and nowhere else.
28
28
  *
29
- * Regenerate it with `deno task psl:update`; `deno task psl:check` fails when
29
+ * Regenerate it with `pnpm psl:update`; `pnpm psl:check` fails when
30
30
  * the snapshot has drifted from publicsuffix.org and runs on a schedule in CI.
31
31
  *
32
32
  * @module
33
33
  */
34
- import "../../_dnt.polyfills.js";
35
- import { publicSuffixListInfo } from "./rules.js";
34
+ import { publicSuffixListInfo } from "./rules.ts";
36
35
  export { publicSuffixListInfo };
37
36
  /**
38
37
  * Whether a domain is a public suffix — a name others register *under* rather
@@ -26,12 +26,11 @@
26
26
  * wildcard must not straddle (`github.io`, `vercel.app`, `blob.core.windows.net`)
27
27
  * is listed there and nowhere else.
28
28
  *
29
- * Regenerate it with `deno task psl:update`; `deno task psl:check` fails when
29
+ * Regenerate it with `pnpm psl:update`; `pnpm psl:check` fails when
30
30
  * the snapshot has drifted from publicsuffix.org and runs on a schedule in CI.
31
31
  *
32
32
  * @module
33
33
  */
34
- import "../../_dnt.polyfills.js";
35
34
  import { PUBLIC_SUFFIX_RULES, publicSuffixListInfo } from "./rules.js";
36
35
  export { publicSuffixListInfo };
37
36
  let rules;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The ICANN + private Public Suffix List, generated by
3
- * `deno task psl:update`. **Do not edit by hand.**
3
+ * `pnpm psl:update`. **Do not edit by hand.**
4
4
  *
5
5
  * @module
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The ICANN + private Public Suffix List, generated by
3
- * `deno task psl:update`. **Do not edit by hand.**
3
+ * `pnpm psl:update`. **Do not edit by hand.**
4
4
  *
5
5
  * @module
6
6
  */
@@ -172,13 +172,13 @@ function matchesLoopback(registration, redirectUri) {
172
172
  }
173
173
  if (!LOOPBACK_HOSTNAMES.has(registeredUrl.hostname))
174
174
  return false;
175
- return registeredUrl.protocol === url.protocol &&
175
+ return (registeredUrl.protocol === url.protocol &&
176
176
  registeredUrl.hostname === url.hostname &&
177
177
  registeredUrl.username === url.username &&
178
178
  registeredUrl.password === url.password &&
179
179
  registeredUrl.pathname === url.pathname &&
180
180
  registeredUrl.search === url.search &&
181
- registeredUrl.hash === url.hash;
181
+ registeredUrl.hash === url.hash);
182
182
  }
183
183
  function matchesPattern(pattern, redirectUri, isPublicSuffix) {
184
184
  if (checkRedirectUriPattern(pattern, isPublicSuffix) !== null)
@@ -220,8 +220,9 @@ function matchesPattern(pattern, redirectUri, isPublicSuffix) {
220
220
  }
221
221
  const [prefix, suffix] = patternLabels[0].split("*");
222
222
  const label = labels[0];
223
- return label.length >= prefix.length + suffix.length &&
224
- label.startsWith(prefix) && label.endsWith(suffix);
223
+ return (label.length >= prefix.length + suffix.length &&
224
+ label.startsWith(prefix) &&
225
+ label.endsWith(suffix));
225
226
  }
226
227
  /**
227
228
  * Find the registered redirect URI that authorizes a requested `redirect_uri`.
@@ -6,14 +6,13 @@
6
6
  * @see https://datatracker.ietf.org/doc/html/rfc6750
7
7
  * @module
8
8
  */
9
- import "../_dnt.polyfills.js";
10
- import type { ClientInterface } from "../models/client.js";
11
- import type { Token } from "../models/token.js";
12
- import type { AbstractScope, ScopeConstructor } from "../models/scope.js";
13
- import { BasicScope } from "../models/scope.js";
14
- import { type OAuth2Error } from "../errors.js";
15
- import { type Authorization, type RequireConditions } from "../models/authorization.js";
16
- import type { TokenReaderInterface } from "./services/token.js";
9
+ import type { ClientInterface } from "../models/client.ts";
10
+ import type { Token } from "../models/token.ts";
11
+ import type { AbstractScope, ScopeConstructor } from "../models/scope.ts";
12
+ import { BasicScope } from "../models/scope.ts";
13
+ import { type OAuth2Error } from "../errors.ts";
14
+ import { type Authorization, type RequireConditions } from "../models/authorization.ts";
15
+ import type { TokenReaderInterface } from "./services/token.ts";
17
16
  /** Bearer token regex pattern. */
18
17
  export declare const BEARER_TOKEN: RegExp;
19
18
  /** Services required by the resource server. */
@@ -300,7 +299,7 @@ export declare class ResourceServer<Client extends ClientInterface, User, S exte
300
299
  */
301
300
  assertScope(granted: S | null | undefined, requiredScope: S | string): void;
302
301
  }
303
- export { IntrospectionTokenReader } from "./introspection-token-reader.js";
304
- export type { IntrospectionTokenReaderOptions } from "./introspection-token-reader.js";
305
- export { JwksTokenReader } from "./jwks-token-reader.js";
306
- export type { JwksTokenReaderOptions, JwtAccessTokenClaims, } from "./jwks-token-reader.js";
302
+ export { IntrospectionTokenReader } from "./introspection-token-reader.ts";
303
+ export type { IntrospectionTokenReaderOptions } from "./introspection-token-reader.ts";
304
+ export { JwksTokenReader } from "./jwks-token-reader.ts";
305
+ export type { JwksTokenReaderOptions, JwtAccessTokenClaims, } from "./jwks-token-reader.ts";
@@ -6,7 +6,6 @@
6
6
  * @see https://datatracker.ietf.org/doc/html/rfc6750
7
7
  * @module
8
8
  */
9
- import "../_dnt.polyfills.js";
10
9
  import { BasicScope } from "../models/scope.js";
11
10
  import { AccessDeniedError, InsufficientPermissionsError, InsufficientScopeError, InvalidTokenError, toOAuth2Error, } from "../errors.js";
12
11
  import { authorizationFromClaims, } from "../models/authorization.js";
@@ -106,8 +105,8 @@ export class ResourceServer {
106
105
  * overflows when converted to milliseconds.
107
106
  */
108
107
  constructor(options) {
109
- this.Scope = options.Scope ??
110
- BasicScope;
108
+ this.Scope =
109
+ options.Scope ?? BasicScope;
111
110
  this.realm = options.realm ?? "Service";
112
111
  this.clockSkewSeconds = options.clockSkewSeconds ?? 0;
113
112
  this.errorFormat = options.errorFormat ?? "oauth2";
@@ -135,9 +134,11 @@ export class ResourceServer {
135
134
  * @see https://datatracker.ietf.org/doc/html/rfc6750#section-3
136
135
  */
137
136
  buildWwwAuthenticate(error, requiredScope) {
138
- const quote = (value) =>
139
- // deno-lint-ignore no-control-regex
140
- value.replace(/[\x00-\x1f\x7f]/g, "").replace(/\\/g, "\\\\").replace(/"/g, '\\"');
137
+ const quote = (value) => value
138
+ // oxlint-disable-next-line no-control-regex
139
+ .replace(/[\x00-\x1f\x7f]/g, "")
140
+ .replace(/\\/g, "\\\\")
141
+ .replace(/"/g, '\\"');
141
142
  const parts = [`realm="${quote(this.realm)}"`];
142
143
  const code = error?.extensions.error;
143
144
  if (error && code && CHALLENGE_ERROR_CODES.has(code)) {
@@ -150,7 +151,8 @@ export class ResourceServer {
150
151
  parts.push(`scope="${quote(requiredScope)}"`);
151
152
  }
152
153
  else if (error instanceof InsufficientScopeError) {
153
- const scope = error.extensions.requiredScope;
154
+ const scope = error.extensions
155
+ .requiredScope;
154
156
  if (scope) {
155
157
  parts.push(`scope="${quote(scope)}"`);
156
158
  }
@@ -185,8 +187,7 @@ export class ResourceServer {
185
187
  const body = {
186
188
  error: oauth2Error.extensions.error ?? "server_error",
187
189
  };
188
- const description = oauth2Error.extensions.error_description ??
189
- oauth2Error.exposedMessage;
190
+ const description = oauth2Error.extensions.error_description ?? oauth2Error.exposedMessage;
190
191
  if (description) {
191
192
  body.error_description = description;
192
193
  }
@@ -296,8 +297,7 @@ export class ResourceServer {
296
297
  throw new InvalidTokenError("invalid access token");
297
298
  }
298
299
  if (token.accessTokenExpiresAt) {
299
- const deadline = token.accessTokenExpiresAt.getTime() +
300
- this.clockSkewSeconds * 1000;
300
+ const deadline = token.accessTokenExpiresAt.getTime() + this.clockSkewSeconds * 1000;
301
301
  if (deadline < Date.now()) {
302
302
  throw new InvalidTokenError("access token has expired");
303
303
  }
@@ -358,9 +358,7 @@ export class ResourceServer {
358
358
  }
359
359
  const failure = context.authorization.unmet(conditions);
360
360
  if (failure) {
361
- const required = failure.required === true
362
- ? "an active organization"
363
- : failure.required;
361
+ const required = failure.required === true ? "an active organization" : failure.required;
364
362
  throw new InsufficientPermissionsError(`${FAILURE_LABELS[failure.kind]}: ${required}`);
365
363
  }
366
364
  }
@@ -2,11 +2,11 @@
2
2
  * Authorization code service interface and abstract implementation.
3
3
  * @module
4
4
  */
5
- import type { AuthorizationCode } from "../../models/authorization-code.js";
6
- import type { ClientInterface } from "../../models/client.js";
7
- import type { AbstractScope, BasicScope } from "../../models/scope.js";
8
- import type { ClientServiceInterface } from "./client.js";
9
- import type { UserServiceInterface } from "./user.js";
5
+ import type { AuthorizationCode } from "../../models/authorization-code.ts";
6
+ import type { ClientInterface } from "../../models/client.ts";
7
+ import type { AbstractScope, BasicScope } from "../../models/scope.ts";
8
+ import type { ClientServiceInterface } from "./client.ts";
9
+ import type { UserServiceInterface } from "./user.ts";
10
10
  /**
11
11
  * Service interface for authorization code management.
12
12
  */
@@ -1,4 +1,4 @@
1
- import type { ClientInterface } from "../../models/client.js";
1
+ import type { ClientInterface } from "../../models/client.ts";
2
2
  /**
3
3
  * Service interface for client management.
4
4
  */
@@ -4,9 +4,9 @@
4
4
  * @see https://datatracker.ietf.org/doc/html/rfc8628
5
5
  * @module
6
6
  */
7
- import type { ClientInterface } from "../../models/client.js";
8
- import type { DeviceAuthorization } from "../../models/device-authorization.js";
9
- import type { AbstractScope } from "../../models/scope.js";
7
+ import type { ClientInterface } from "../../models/client.ts";
8
+ import type { DeviceAuthorization } from "../../models/device-authorization.ts";
9
+ import type { AbstractScope } from "../../models/scope.ts";
10
10
  /**
11
11
  * Service interface for managing device authorizations.
12
12
  *
@@ -1,9 +1,9 @@
1
- import type { ClientInterface } from "../../models/client.js";
2
- import type { AuthenticationContext } from "../../models/authentication.js";
3
- import type { RefreshToken, Token } from "../../models/token.js";
4
- import type { AbstractScope, BasicScope } from "../../models/scope.js";
5
- import type { ClientServiceInterface } from "./client.js";
6
- import type { UserServiceInterface } from "./user.js";
1
+ import type { ClientInterface } from "../../models/client.ts";
2
+ import type { AuthenticationContext } from "../../models/authentication.ts";
3
+ import type { RefreshToken, Token } from "../../models/token.ts";
4
+ import type { AbstractScope, BasicScope } from "../../models/scope.ts";
5
+ import type { ClientServiceInterface } from "./client.ts";
6
+ import type { UserServiceInterface } from "./user.ts";
7
7
  /**
8
8
  * Minimal interface for reading/validating tokens.
9
9
  *
@@ -73,6 +73,8 @@ export class AbstractTokenService {
73
73
  * configured. Override to cap per client instead of service-wide.
74
74
  */
75
75
  refreshTokenFamilyExpiresAt(_client, _user, familyCreatedAt, _scope) {
76
- return Promise.resolve(this.refreshTokenMaxLifetime == null ? undefined : new Date(familyCreatedAt.getTime() + this.refreshTokenMaxLifetime * 1000));
76
+ return Promise.resolve(this.refreshTokenMaxLifetime == null
77
+ ? undefined
78
+ : new Date(familyCreatedAt.getTime() + this.refreshTokenMaxLifetime * 1000));
77
79
  }
78
80
  }
@@ -26,4 +26,4 @@ export interface UserServiceInterface<User> {
26
26
  * `@udibo/oauth2/identity` for the work-factor constants and the
27
27
  * `PasswordIdentityService` that records them on the credential.
28
28
  */
29
- export { generateSalt, hashPassword, verifyPassword, } from "../../identity/password.js";
29
+ export { generateSalt, hashPassword, verifyPassword, } from "../../identity/password.ts";
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * @module
13
13
  */
14
- import type { AuthenticationContext } from "../models/authentication.js";
14
+ import type { AuthenticationContext } from "../models/authentication.ts";
15
15
  /** A ready-to-use signing key: private half signs, public JWK is published. */
16
16
  export interface SigningKey {
17
17
  /** Key id, stamped into JWS headers and the JWKS entry. */
@@ -148,7 +148,12 @@ export async function importSigningKeyJwk(jwk) {
148
148
  * the primitive behind id_tokens and JWT access tokens.
149
149
  */
150
150
  export async function signJwt(key, payload, header = {}) {
151
- const signingInput = `${encodeSegment({ alg: key.alg, typ: "JWT", kid: key.kid, ...header })}.${encodeSegment(payload)}`;
151
+ const signingInput = `${encodeSegment({
152
+ alg: key.alg,
153
+ typ: "JWT",
154
+ kid: key.kid,
155
+ ...header,
156
+ })}.${encodeSegment(payload)}`;
152
157
  const signature = await crypto.subtle.sign(ES256_SIGN_PARAMS, key.privateKey, encoder.encode(signingInput));
153
158
  return `${signingInput}.${base64urlEncode(new Uint8Array(signature))}`;
154
159
  }
@@ -173,7 +178,8 @@ export async function verifyJwt(jwt, publicJwk, options = {}) {
173
178
  return undefined;
174
179
  const payload = JSON.parse(decoder.decode(base64urlDecode(payloadPart)));
175
180
  if (!options.ignoreExpiration &&
176
- typeof payload.exp === "number" && payload.exp * 1000 <= Date.now()) {
181
+ typeof payload.exp === "number" &&
182
+ payload.exp * 1000 <= Date.now()) {
177
183
  return undefined;
178
184
  }
179
185
  return payload;
@@ -2,7 +2,7 @@
2
2
  * Hashing utilities for secure token and secret storage.
3
3
  * @module
4
4
  */
5
- import { encodeHex } from "../../deps/jsr.io/@std/encoding/1.0.11/hex.js";
5
+ import { encodeHex } from "../../utils/_encoding.js";
6
6
  /** Hashes a high-entropy string (UUID, token, secret) using SHA-256. */
7
7
  export async function sha256Hash(value) {
8
8
  const data = new TextEncoder().encode(value);
@@ -38,7 +38,7 @@
38
38
  *
39
39
  * @module
40
40
  */
41
- import type { AuthRequestStorage } from "../../client/storage.js";
41
+ import type { AuthRequestStorage } from "../../client/storage.ts";
42
42
  /** Options for {@link runAuthRequestStorageContractTests}. */
43
43
  export interface AuthRequestStorageContractOptions {
44
44
  /**