@authup/server-core 1.0.0-beta.51 → 1.0.0-beta.53

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 (1000) hide show
  1. package/dist/adapters/database/data-source/options/module.d.ts.map +1 -1
  2. package/dist/adapters/database/data-source/options/module.mjs +20 -8
  3. package/dist/adapters/database/data-source/options/module.mjs.map +1 -1
  4. package/dist/adapters/database/domains/client/entity.d.ts +6 -2
  5. package/dist/adapters/database/domains/client/entity.d.ts.map +1 -1
  6. package/dist/adapters/database/domains/client/entity.mjs +33 -4
  7. package/dist/adapters/database/domains/client/entity.mjs.map +1 -1
  8. package/dist/adapters/database/domains/client-permission/entity.mjs +2 -2
  9. package/dist/adapters/database/domains/consent/entity.d.ts +20 -0
  10. package/dist/adapters/database/domains/consent/entity.d.ts.map +1 -0
  11. package/dist/adapters/database/domains/consent/entity.mjs +110 -0
  12. package/dist/adapters/database/domains/consent/entity.mjs.map +1 -0
  13. package/dist/adapters/database/domains/consent/index.d.ts +3 -0
  14. package/dist/adapters/database/domains/consent/index.d.ts.map +1 -0
  15. package/dist/adapters/database/domains/consent/index.mjs +6 -0
  16. package/dist/adapters/database/domains/consent/subscriber.d.ts +6 -0
  17. package/dist/adapters/database/domains/consent/subscriber.d.ts.map +1 -0
  18. package/dist/adapters/database/domains/consent/subscriber.mjs +45 -0
  19. package/dist/adapters/database/domains/consent/subscriber.mjs.map +1 -0
  20. package/dist/adapters/database/domains/constants.d.ts +1 -0
  21. package/dist/adapters/database/domains/constants.d.ts.map +1 -1
  22. package/dist/adapters/database/domains/constants.mjs +1 -0
  23. package/dist/adapters/database/domains/constants.mjs.map +1 -1
  24. package/dist/adapters/database/domains/event/entity.d.ts +22 -0
  25. package/dist/adapters/database/domains/event/entity.d.ts.map +1 -0
  26. package/dist/adapters/database/domains/event/entity.mjs +174 -0
  27. package/dist/adapters/database/domains/event/entity.mjs.map +1 -0
  28. package/dist/adapters/database/domains/event/index.d.ts +2 -0
  29. package/dist/adapters/database/domains/event/index.d.ts.map +1 -0
  30. package/dist/adapters/database/domains/event/index.mjs +5 -0
  31. package/dist/adapters/database/domains/identity-provider-account/entity.mjs +2 -2
  32. package/dist/adapters/database/domains/index.d.ts +5 -0
  33. package/dist/adapters/database/domains/index.d.ts.map +1 -1
  34. package/dist/adapters/database/domains/index.mjs +26 -15
  35. package/dist/adapters/database/domains/key/entity.d.ts +7 -3
  36. package/dist/adapters/database/domains/key/entity.d.ts.map +1 -1
  37. package/dist/adapters/database/domains/key/entity.mjs +35 -10
  38. package/dist/adapters/database/domains/key/entity.mjs.map +1 -1
  39. package/dist/adapters/database/domains/permission-policy/entity.mjs +2 -2
  40. package/dist/adapters/database/domains/policy/repository.d.ts.map +1 -1
  41. package/dist/adapters/database/domains/policy/repository.mjs +3 -3
  42. package/dist/adapters/database/domains/policy/repository.mjs.map +1 -1
  43. package/dist/adapters/database/domains/robot-permission/entity.mjs +2 -2
  44. package/dist/adapters/database/domains/role/repository.mjs +1 -1
  45. package/dist/adapters/database/domains/role-permission/entity.mjs +2 -2
  46. package/dist/adapters/database/domains/session/entity.d.ts +3 -1
  47. package/dist/adapters/database/domains/session/entity.d.ts.map +1 -1
  48. package/dist/adapters/database/domains/session/entity.mjs +13 -1
  49. package/dist/adapters/database/domains/session/entity.mjs.map +1 -1
  50. package/dist/adapters/database/domains/session-token/entity.d.ts +17 -0
  51. package/dist/adapters/database/domains/session-token/entity.d.ts.map +1 -0
  52. package/dist/adapters/database/domains/session-token/entity.mjs +95 -0
  53. package/dist/adapters/database/domains/session-token/entity.mjs.map +1 -0
  54. package/dist/adapters/database/domains/session-token/index.d.ts +2 -0
  55. package/dist/adapters/database/domains/session-token/index.d.ts.map +1 -0
  56. package/dist/adapters/database/domains/session-token/index.mjs +5 -0
  57. package/dist/adapters/database/domains/trust-anchor/entity.d.ts +13 -0
  58. package/dist/adapters/database/domains/trust-anchor/entity.d.ts.map +1 -0
  59. package/dist/adapters/database/domains/trust-anchor/entity.mjs +55 -0
  60. package/dist/adapters/database/domains/trust-anchor/entity.mjs.map +1 -0
  61. package/dist/adapters/database/domains/trust-anchor/index.d.ts +2 -0
  62. package/dist/adapters/database/domains/trust-anchor/index.d.ts.map +1 -0
  63. package/dist/adapters/database/domains/trust-anchor/index.mjs +5 -0
  64. package/dist/adapters/database/domains/user-authenticator/entity.d.ts +20 -0
  65. package/dist/adapters/database/domains/user-authenticator/entity.d.ts.map +1 -0
  66. package/dist/adapters/database/domains/user-authenticator/entity.mjs +98 -0
  67. package/dist/adapters/database/domains/user-authenticator/entity.mjs.map +1 -0
  68. package/dist/adapters/database/domains/user-authenticator/index.d.ts +2 -0
  69. package/dist/adapters/database/domains/user-authenticator/index.d.ts.map +1 -0
  70. package/dist/adapters/database/domains/user-authenticator/index.mjs +5 -0
  71. package/dist/adapters/database/domains/user-permission/entity.mjs +1 -1
  72. package/dist/adapters/database/errors/driver.d.ts +14 -0
  73. package/dist/adapters/database/errors/driver.d.ts.map +1 -0
  74. package/dist/adapters/database/errors/driver.mjs +32 -0
  75. package/dist/adapters/database/errors/driver.mjs.map +1 -0
  76. package/dist/adapters/database/errors/index.d.ts +1 -0
  77. package/dist/adapters/database/errors/index.d.ts.map +1 -1
  78. package/dist/adapters/database/errors/index.mjs +2 -1
  79. package/dist/adapters/database/index.mjs +18 -11
  80. package/dist/adapters/database/migrations/mysql/1783325495597-Default.d.ts +28 -0
  81. package/dist/adapters/database/migrations/mysql/1783325495597-Default.d.ts.map +1 -0
  82. package/dist/adapters/database/migrations/mysql/1783325495597-Default.mjs +85 -0
  83. package/dist/adapters/database/migrations/mysql/1783325495597-Default.mjs.map +1 -0
  84. package/dist/adapters/database/migrations/mysql/1783769340000-Default.d.ts +50 -0
  85. package/dist/adapters/database/migrations/mysql/1783769340000-Default.d.ts.map +1 -0
  86. package/dist/adapters/database/migrations/mysql/1783769340000-Default.mjs +320 -0
  87. package/dist/adapters/database/migrations/mysql/1783769340000-Default.mjs.map +1 -0
  88. package/dist/adapters/database/migrations/postgres/1783325495597-Default.d.ts +28 -0
  89. package/dist/adapters/database/migrations/postgres/1783325495597-Default.d.ts.map +1 -0
  90. package/dist/adapters/database/migrations/postgres/1783325495597-Default.mjs +79 -0
  91. package/dist/adapters/database/migrations/postgres/1783325495597-Default.mjs.map +1 -0
  92. package/dist/adapters/database/migrations/postgres/1783769340000-Default.d.ts +50 -0
  93. package/dist/adapters/database/migrations/postgres/1783769340000-Default.d.ts.map +1 -0
  94. package/dist/adapters/database/migrations/postgres/1783769340000-Default.mjs +310 -0
  95. package/dist/adapters/database/migrations/postgres/1783769340000-Default.mjs.map +1 -0
  96. package/dist/adapters/database/subscriber/module.d.ts +1 -1
  97. package/dist/adapters/database/subscriber/module.d.ts.map +1 -1
  98. package/dist/adapters/database/subscriber/module.mjs +8 -6
  99. package/dist/adapters/database/subscriber/module.mjs.map +1 -1
  100. package/dist/adapters/http/adapters/index.mjs +3 -1
  101. package/dist/adapters/http/adapters/oauth2/authorization/module.d.ts +4 -1
  102. package/dist/adapters/http/adapters/oauth2/authorization/module.d.ts.map +1 -1
  103. package/dist/adapters/http/adapters/oauth2/authorization/module.mjs +28 -2
  104. package/dist/adapters/http/adapters/oauth2/authorization/module.mjs.map +1 -1
  105. package/dist/adapters/http/adapters/oauth2/authorization/types.d.ts +9 -1
  106. package/dist/adapters/http/adapters/oauth2/authorization/types.d.ts.map +1 -1
  107. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts +5 -1
  108. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts.map +1 -1
  109. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs +30 -4
  110. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs.map +1 -1
  111. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.d.ts +4 -3
  112. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.d.ts.map +1 -1
  113. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs +15 -5
  114. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs.map +1 -1
  115. package/dist/adapters/http/adapters/oauth2/grant-types/index.mjs +3 -1
  116. package/dist/adapters/http/adapters/oauth2/grant-types/password.d.ts +38 -2
  117. package/dist/adapters/http/adapters/oauth2/grant-types/password.d.ts.map +1 -1
  118. package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs +123 -8
  119. package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs.map +1 -1
  120. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts +4 -1
  121. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts.map +1 -1
  122. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs +25 -5
  123. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs.map +1 -1
  124. package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts +16 -3
  125. package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts.map +1 -1
  126. package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.d.ts +5 -0
  127. package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.d.ts.map +1 -0
  128. package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.mjs +18 -0
  129. package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.mjs.map +1 -0
  130. package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.d.ts +2 -0
  131. package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.d.ts.map +1 -1
  132. package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.mjs +3 -1
  133. package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.d.ts +9 -0
  134. package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.d.ts.map +1 -0
  135. package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.mjs +21 -0
  136. package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.mjs.map +1 -0
  137. package/dist/adapters/http/adapters/oauth2/index.mjs +3 -1
  138. package/dist/adapters/http/controllers/entities/client/module.mjs +2 -2
  139. package/dist/adapters/http/controllers/entities/client-permission/module.mjs +1 -1
  140. package/dist/adapters/http/controllers/entities/client-role/module.mjs +1 -1
  141. package/dist/adapters/http/controllers/entities/client-scope/module.mjs +1 -1
  142. package/dist/adapters/http/controllers/entities/consent/index.d.ts +2 -0
  143. package/dist/adapters/http/controllers/entities/consent/index.d.ts.map +1 -0
  144. package/dist/adapters/http/controllers/entities/consent/index.mjs +5 -0
  145. package/dist/adapters/http/controllers/entities/consent/module.d.ts +15 -0
  146. package/dist/adapters/http/controllers/entities/consent/module.d.ts.map +1 -0
  147. package/dist/adapters/http/controllers/entities/consent/module.mjs +82 -0
  148. package/dist/adapters/http/controllers/entities/consent/module.mjs.map +1 -0
  149. package/dist/adapters/http/controllers/entities/event/index.d.ts +2 -0
  150. package/dist/adapters/http/controllers/entities/event/index.d.ts.map +1 -0
  151. package/dist/adapters/http/controllers/entities/event/index.mjs +5 -0
  152. package/dist/adapters/http/controllers/entities/event/module.d.ts +14 -0
  153. package/dist/adapters/http/controllers/entities/event/module.d.ts.map +1 -0
  154. package/dist/adapters/http/controllers/entities/event/module.mjs +68 -0
  155. package/dist/adapters/http/controllers/entities/event/module.mjs.map +1 -0
  156. package/dist/adapters/http/controllers/entities/identity-provide-role/module.mjs +1 -1
  157. package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts +4 -1
  158. package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts.map +1 -1
  159. package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +40 -11
  160. package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
  161. package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts +3 -1
  162. package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts.map +1 -1
  163. package/dist/adapters/http/controllers/entities/index.d.ts +6 -0
  164. package/dist/adapters/http/controllers/entities/index.d.ts.map +1 -1
  165. package/dist/adapters/http/controllers/entities/index.mjs +13 -1
  166. package/dist/adapters/http/controllers/entities/key/index.d.ts +2 -0
  167. package/dist/adapters/http/controllers/entities/key/index.d.ts.map +1 -0
  168. package/dist/adapters/http/controllers/entities/key/index.mjs +5 -0
  169. package/dist/adapters/http/controllers/entities/key/module.d.ts +17 -0
  170. package/dist/adapters/http/controllers/entities/key/module.d.ts.map +1 -0
  171. package/dist/adapters/http/controllers/entities/key/module.mjs +122 -0
  172. package/dist/adapters/http/controllers/entities/key/module.mjs.map +1 -0
  173. package/dist/adapters/http/controllers/entities/permission/module.mjs +1 -1
  174. package/dist/adapters/http/controllers/entities/permission-policy/module.mjs +1 -1
  175. package/dist/adapters/http/controllers/entities/policy/module.mjs +1 -1
  176. package/dist/adapters/http/controllers/entities/policy/utils/validation.mjs +1 -1
  177. package/dist/adapters/http/controllers/entities/realm/module.d.ts +2 -0
  178. package/dist/adapters/http/controllers/entities/realm/module.d.ts.map +1 -1
  179. package/dist/adapters/http/controllers/entities/realm/module.mjs +26 -8
  180. package/dist/adapters/http/controllers/entities/realm/module.mjs.map +1 -1
  181. package/dist/adapters/http/controllers/entities/robot/module.mjs +2 -2
  182. package/dist/adapters/http/controllers/entities/robot-permission/module.mjs +1 -1
  183. package/dist/adapters/http/controllers/entities/robot-role/module.mjs +1 -1
  184. package/dist/adapters/http/controllers/entities/role/module.mjs +1 -1
  185. package/dist/adapters/http/controllers/entities/role-attribute/module.mjs +1 -1
  186. package/dist/adapters/http/controllers/entities/role-permission/module.mjs +1 -1
  187. package/dist/adapters/http/controllers/entities/scope/module.mjs +1 -1
  188. package/dist/adapters/http/controllers/entities/session/index.d.ts +2 -0
  189. package/dist/adapters/http/controllers/entities/session/index.d.ts.map +1 -0
  190. package/dist/adapters/http/controllers/entities/session/index.mjs +5 -0
  191. package/dist/adapters/http/controllers/entities/session/module.d.ts +16 -0
  192. package/dist/adapters/http/controllers/entities/session/module.d.ts.map +1 -0
  193. package/dist/adapters/http/controllers/entities/session/module.mjs +102 -0
  194. package/dist/adapters/http/controllers/entities/session/module.mjs.map +1 -0
  195. package/dist/adapters/http/controllers/entities/trust-anchor/index.d.ts +2 -0
  196. package/dist/adapters/http/controllers/entities/trust-anchor/index.d.ts.map +1 -0
  197. package/dist/adapters/http/controllers/entities/trust-anchor/index.mjs +5 -0
  198. package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts +17 -0
  199. package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts.map +1 -0
  200. package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs +120 -0
  201. package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs.map +1 -0
  202. package/dist/adapters/http/controllers/entities/user/module.mjs +2 -2
  203. package/dist/adapters/http/controllers/entities/user-attribute/module.mjs +1 -1
  204. package/dist/adapters/http/controllers/entities/user-authenticator/index.d.ts +2 -0
  205. package/dist/adapters/http/controllers/entities/user-authenticator/index.d.ts.map +1 -0
  206. package/dist/adapters/http/controllers/entities/user-authenticator/index.mjs +5 -0
  207. package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts +21 -0
  208. package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts.map +1 -0
  209. package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs +154 -0
  210. package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs.map +1 -0
  211. package/dist/adapters/http/controllers/entities/user-permission/module.mjs +1 -1
  212. package/dist/adapters/http/controllers/entities/user-role/module.mjs +1 -1
  213. package/dist/adapters/http/controllers/index.mjs +9 -1
  214. package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.d.ts +2 -0
  215. package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.d.ts.map +1 -0
  216. package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.mjs +5 -0
  217. package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.d.ts +46 -0
  218. package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.d.ts.map +1 -0
  219. package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs +132 -0
  220. package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs.map +1 -0
  221. package/dist/adapters/http/controllers/workflows/authorize/module.d.ts.map +1 -1
  222. package/dist/adapters/http/controllers/workflows/authorize/module.mjs +55 -14
  223. package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
  224. package/dist/adapters/http/controllers/workflows/authorize/types.d.ts +23 -4
  225. package/dist/adapters/http/controllers/workflows/authorize/types.d.ts.map +1 -1
  226. package/dist/adapters/http/controllers/workflows/index.d.ts +2 -0
  227. package/dist/adapters/http/controllers/workflows/index.d.ts.map +1 -1
  228. package/dist/adapters/http/controllers/workflows/index.mjs +5 -1
  229. package/dist/adapters/http/controllers/workflows/jwks/handlers/read.d.ts.map +1 -1
  230. package/dist/adapters/http/controllers/workflows/jwks/handlers/read.mjs +28 -14
  231. package/dist/adapters/http/controllers/workflows/jwks/handlers/read.mjs.map +1 -1
  232. package/dist/adapters/http/controllers/workflows/jwks/module.d.ts.map +1 -1
  233. package/dist/adapters/http/controllers/workflows/jwks/module.mjs +28 -14
  234. package/dist/adapters/http/controllers/workflows/jwks/module.mjs.map +1 -1
  235. package/dist/adapters/http/controllers/workflows/logout/index.d.ts +3 -0
  236. package/dist/adapters/http/controllers/workflows/logout/index.d.ts.map +1 -0
  237. package/dist/adapters/http/controllers/workflows/logout/index.mjs +5 -0
  238. package/dist/adapters/http/controllers/workflows/logout/module.d.ts +14 -0
  239. package/dist/adapters/http/controllers/workflows/logout/module.d.ts.map +1 -0
  240. package/dist/adapters/http/controllers/workflows/logout/module.mjs +101 -0
  241. package/dist/adapters/http/controllers/workflows/logout/module.mjs.map +1 -0
  242. package/dist/adapters/http/controllers/workflows/logout/types.d.ts +9 -0
  243. package/dist/adapters/http/controllers/workflows/logout/types.d.ts.map +1 -0
  244. package/dist/adapters/http/controllers/workflows/status/module.mjs +1 -1
  245. package/dist/adapters/http/controllers/workflows/token/module.d.ts +2 -1
  246. package/dist/adapters/http/controllers/workflows/token/module.d.ts.map +1 -1
  247. package/dist/adapters/http/controllers/workflows/token/module.mjs +35 -8
  248. package/dist/adapters/http/controllers/workflows/token/module.mjs.map +1 -1
  249. package/dist/adapters/http/controllers/workflows/token/types.d.ts +17 -3
  250. package/dist/adapters/http/controllers/workflows/token/types.d.ts.map +1 -1
  251. package/dist/adapters/http/index.mjs +28 -14
  252. package/dist/adapters/http/middleware/built-in/assets.mjs +1 -1
  253. package/dist/adapters/http/middleware/built-in/authorization/module.d.ts +13 -0
  254. package/dist/adapters/http/middleware/built-in/authorization/module.d.ts.map +1 -1
  255. package/dist/adapters/http/middleware/built-in/authorization/module.mjs +54 -2
  256. package/dist/adapters/http/middleware/built-in/authorization/module.mjs.map +1 -1
  257. package/dist/adapters/http/middleware/built-in/authorization/types.d.ts +2 -0
  258. package/dist/adapters/http/middleware/built-in/authorization/types.d.ts.map +1 -1
  259. package/dist/adapters/http/middleware/built-in/index.mjs +3 -3
  260. package/dist/adapters/http/middleware/built-in/logger.d.ts +1 -0
  261. package/dist/adapters/http/middleware/built-in/logger.d.ts.map +1 -1
  262. package/dist/adapters/http/middleware/built-in/logger.mjs +23 -2
  263. package/dist/adapters/http/middleware/built-in/logger.mjs.map +1 -1
  264. package/dist/adapters/http/middleware/built-in/prometheus.d.ts +12 -1
  265. package/dist/adapters/http/middleware/built-in/prometheus.d.ts.map +1 -1
  266. package/dist/adapters/http/middleware/built-in/prometheus.mjs +75 -6
  267. package/dist/adapters/http/middleware/built-in/prometheus.mjs.map +1 -1
  268. package/dist/adapters/http/middleware/built-in/realm-resolver/module.d.ts.map +1 -1
  269. package/dist/adapters/http/middleware/built-in/realm-resolver/module.mjs +3 -8
  270. package/dist/adapters/http/middleware/built-in/realm-resolver/module.mjs.map +1 -1
  271. package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts +2 -2
  272. package/dist/adapters/http/middleware/built-in/ui-http-client.mjs +2 -2
  273. package/dist/adapters/http/middleware/built-in/ui-http-client.mjs.map +1 -1
  274. package/dist/adapters/http/middleware/index.mjs +3 -3
  275. package/dist/adapters/http/request/client-certificate.d.ts +5 -0
  276. package/dist/adapters/http/request/client-certificate.d.ts.map +1 -0
  277. package/dist/adapters/http/request/client-certificate.mjs +88 -0
  278. package/dist/adapters/http/request/client-certificate.mjs.map +1 -0
  279. package/dist/adapters/http/request/constants.d.ts +1 -0
  280. package/dist/adapters/http/request/constants.d.ts.map +1 -1
  281. package/dist/adapters/http/request/constants.mjs +6 -1
  282. package/dist/adapters/http/request/constants.mjs.map +1 -1
  283. package/dist/adapters/http/request/event-context.d.ts +19 -0
  284. package/dist/adapters/http/request/event-context.d.ts.map +1 -0
  285. package/dist/adapters/http/request/event-context.mjs +37 -0
  286. package/dist/adapters/http/request/event-context.mjs.map +1 -0
  287. package/dist/adapters/http/request/helpers/index.d.ts +2 -0
  288. package/dist/adapters/http/request/helpers/index.d.ts.map +1 -1
  289. package/dist/adapters/http/request/helpers/index.mjs +3 -1
  290. package/dist/adapters/http/request/helpers/mfa-login-ticket.d.ts +16 -0
  291. package/dist/adapters/http/request/helpers/mfa-login-ticket.d.ts.map +1 -0
  292. package/dist/adapters/http/request/helpers/mfa-login-ticket.mjs +15 -0
  293. package/dist/adapters/http/request/helpers/mfa-login-ticket.mjs.map +1 -0
  294. package/dist/adapters/http/request/helpers/session-id.d.ts +9 -0
  295. package/dist/adapters/http/request/helpers/session-id.d.ts.map +1 -0
  296. package/dist/adapters/http/request/helpers/session-id.mjs +19 -0
  297. package/dist/adapters/http/request/helpers/session-id.mjs.map +1 -0
  298. package/dist/adapters/http/request/index.d.ts +3 -0
  299. package/dist/adapters/http/request/index.d.ts.map +1 -1
  300. package/dist/adapters/http/request/index.mjs +6 -2
  301. package/dist/adapters/http/request/permission/module.d.ts.map +1 -1
  302. package/dist/adapters/http/request/permission/module.mjs +4 -2
  303. package/dist/adapters/http/request/permission/module.mjs.map +1 -1
  304. package/dist/adapters/http/request/types.d.ts +3 -0
  305. package/dist/adapters/http/request/types.d.ts.map +1 -0
  306. package/dist/adapters/http/ui/index.d.ts +1 -0
  307. package/dist/adapters/http/ui/index.d.ts.map +1 -1
  308. package/dist/adapters/http/ui/index.mjs +2 -1
  309. package/dist/adapters/http/ui/internal-http-client.d.ts +22 -0
  310. package/dist/adapters/http/ui/internal-http-client.d.ts.map +1 -0
  311. package/dist/adapters/http/ui/internal-http-client.mjs +52 -0
  312. package/dist/adapters/http/ui/internal-http-client.mjs.map +1 -0
  313. package/dist/adapters/http/ui/render.d.ts.map +1 -1
  314. package/dist/adapters/http/ui/render.mjs +5 -2
  315. package/dist/adapters/http/ui/render.mjs.map +1 -1
  316. package/dist/adapters/http/ui/types.d.ts +12 -0
  317. package/dist/adapters/http/ui/types.d.ts.map +1 -1
  318. package/dist/app/index.mjs +11 -5
  319. package/dist/app/modules/authentication/repositories/session.d.ts +5 -2
  320. package/dist/app/modules/authentication/repositories/session.d.ts.map +1 -1
  321. package/dist/app/modules/authentication/repositories/session.mjs +63 -0
  322. package/dist/app/modules/authentication/repositories/session.mjs.map +1 -1
  323. package/dist/app/modules/components/module.d.ts.map +1 -1
  324. package/dist/app/modules/components/module.mjs +22 -2
  325. package/dist/app/modules/components/module.mjs.map +1 -1
  326. package/dist/app/modules/config/constants.d.ts +18 -0
  327. package/dist/app/modules/config/constants.d.ts.map +1 -1
  328. package/dist/app/modules/config/constants.mjs +18 -0
  329. package/dist/app/modules/config/constants.mjs.map +1 -1
  330. package/dist/app/modules/config/normalize.d.ts.map +1 -1
  331. package/dist/app/modules/config/normalize.mjs +36 -3
  332. package/dist/app/modules/config/normalize.mjs.map +1 -1
  333. package/dist/app/modules/config/read/env.d.ts.map +1 -1
  334. package/dist/app/modules/config/read/env.mjs +65 -0
  335. package/dist/app/modules/config/read/env.mjs.map +1 -1
  336. package/dist/app/modules/config/types.d.ts +132 -2
  337. package/dist/app/modules/config/types.d.ts.map +1 -1
  338. package/dist/app/modules/config/validator.d.ts.map +1 -1
  339. package/dist/app/modules/config/validator.mjs +21 -0
  340. package/dist/app/modules/config/validator.mjs.map +1 -1
  341. package/dist/app/modules/database/constants.d.ts +3 -0
  342. package/dist/app/modules/database/constants.d.ts.map +1 -1
  343. package/dist/app/modules/database/constants.mjs +3 -1
  344. package/dist/app/modules/database/constants.mjs.map +1 -1
  345. package/dist/app/modules/database/index.mjs +7 -3
  346. package/dist/app/modules/database/module.d.ts +2 -0
  347. package/dist/app/modules/database/module.d.ts.map +1 -1
  348. package/dist/app/modules/database/module.mjs +51 -7
  349. package/dist/app/modules/database/module.mjs.map +1 -1
  350. package/dist/app/modules/database/repositories/client/repository.d.ts.map +1 -1
  351. package/dist/app/modules/database/repositories/client/repository.mjs +18 -10
  352. package/dist/app/modules/database/repositories/client/repository.mjs.map +1 -1
  353. package/dist/app/modules/database/repositories/event/index.d.ts.map +1 -0
  354. package/dist/app/modules/database/repositories/event/index.mjs +5 -0
  355. package/dist/app/modules/database/repositories/event/repository.d.ts +15 -0
  356. package/dist/app/modules/database/repositories/event/repository.d.ts.map +1 -0
  357. package/dist/app/modules/database/repositories/event/repository.mjs +113 -0
  358. package/dist/app/modules/database/repositories/event/repository.mjs.map +1 -0
  359. package/dist/app/modules/database/repositories/helpers.d.ts +13 -0
  360. package/dist/app/modules/database/repositories/helpers.d.ts.map +1 -1
  361. package/dist/app/modules/database/repositories/helpers.mjs +16 -1
  362. package/dist/app/modules/database/repositories/helpers.mjs.map +1 -1
  363. package/dist/app/modules/database/repositories/identity-provider/repository.d.ts.map +1 -1
  364. package/dist/app/modules/database/repositories/identity-provider/repository.mjs +8 -8
  365. package/dist/app/modules/database/repositories/identity-provider/repository.mjs.map +1 -1
  366. package/dist/app/modules/database/repositories/index.d.ts +4 -0
  367. package/dist/app/modules/database/repositories/index.d.ts.map +1 -1
  368. package/dist/app/modules/database/repositories/index.mjs +9 -1
  369. package/dist/app/modules/database/repositories/key/index.d.ts +2 -0
  370. package/dist/app/modules/database/repositories/key/index.d.ts.map +1 -0
  371. package/dist/app/modules/database/repositories/key/index.mjs +5 -0
  372. package/dist/app/modules/database/repositories/key/repository.d.ts +50 -0
  373. package/dist/app/modules/database/repositories/key/repository.d.ts.map +1 -0
  374. package/dist/app/modules/database/repositories/key/repository.mjs +273 -0
  375. package/dist/app/modules/database/repositories/key/repository.mjs.map +1 -0
  376. package/dist/app/modules/database/repositories/permission/repository.d.ts.map +1 -1
  377. package/dist/app/modules/database/repositories/permission/repository.mjs +4 -3
  378. package/dist/app/modules/database/repositories/permission/repository.mjs.map +1 -1
  379. package/dist/app/modules/database/repositories/permission-provider/module.mjs +1 -1
  380. package/dist/app/modules/database/repositories/policy/repository.d.ts.map +1 -1
  381. package/dist/app/modules/database/repositories/policy/repository.mjs +4 -3
  382. package/dist/app/modules/database/repositories/policy/repository.mjs.map +1 -1
  383. package/dist/app/modules/database/repositories/realm/repository.d.ts +1 -0
  384. package/dist/app/modules/database/repositories/realm/repository.d.ts.map +1 -1
  385. package/dist/app/modules/database/repositories/realm/repository.mjs +14 -1
  386. package/dist/app/modules/database/repositories/realm/repository.mjs.map +1 -1
  387. package/dist/app/modules/database/repositories/robot/repository.d.ts.map +1 -1
  388. package/dist/app/modules/database/repositories/robot/repository.mjs +8 -6
  389. package/dist/app/modules/database/repositories/robot/repository.mjs.map +1 -1
  390. package/dist/app/modules/database/repositories/role/repository.d.ts.map +1 -1
  391. package/dist/app/modules/database/repositories/role/repository.mjs +4 -3
  392. package/dist/app/modules/database/repositories/role/repository.mjs.map +1 -1
  393. package/dist/app/modules/database/repositories/role-attribute/repository.d.ts.map +1 -1
  394. package/dist/app/modules/database/repositories/role-attribute/repository.mjs +2 -1
  395. package/dist/app/modules/database/repositories/role-attribute/repository.mjs.map +1 -1
  396. package/dist/app/modules/database/repositories/scope/repository.d.ts.map +1 -1
  397. package/dist/app/modules/database/repositories/scope/repository.mjs +4 -3
  398. package/dist/app/modules/database/repositories/scope/repository.mjs.map +1 -1
  399. package/dist/app/modules/database/repositories/trust-anchor/index.d.ts +2 -0
  400. package/dist/app/modules/database/repositories/trust-anchor/index.d.ts.map +1 -0
  401. package/dist/app/modules/database/repositories/trust-anchor/index.mjs +5 -0
  402. package/dist/app/modules/database/repositories/trust-anchor/repository.d.ts +24 -0
  403. package/dist/app/modules/database/repositories/trust-anchor/repository.d.ts.map +1 -0
  404. package/dist/app/modules/database/repositories/trust-anchor/repository.mjs +113 -0
  405. package/dist/app/modules/database/repositories/trust-anchor/repository.mjs.map +1 -0
  406. package/dist/app/modules/database/repositories/user/repository.d.ts.map +1 -1
  407. package/dist/app/modules/database/repositories/user/repository.mjs +8 -5
  408. package/dist/app/modules/database/repositories/user/repository.mjs.map +1 -1
  409. package/dist/app/modules/database/repositories/user-attribute/repository.d.ts.map +1 -1
  410. package/dist/app/modules/database/repositories/user-attribute/repository.mjs +2 -1
  411. package/dist/app/modules/database/repositories/user-attribute/repository.mjs.map +1 -1
  412. package/dist/app/modules/database/repositories/user-authenticator/index.d.ts +2 -0
  413. package/dist/app/modules/database/repositories/user-authenticator/index.d.ts.map +1 -0
  414. package/dist/app/modules/database/repositories/user-authenticator/index.mjs +5 -0
  415. package/dist/app/modules/database/repositories/user-authenticator/repository.d.ts +19 -0
  416. package/dist/app/modules/database/repositories/user-authenticator/repository.d.ts.map +1 -0
  417. package/dist/app/modules/database/repositories/user-authenticator/repository.mjs +92 -0
  418. package/dist/app/modules/database/repositories/user-authenticator/repository.mjs.map +1 -0
  419. package/dist/app/modules/http/constants.d.ts +4 -2
  420. package/dist/app/modules/http/constants.d.ts.map +1 -1
  421. package/dist/app/modules/http/constants.mjs +4 -2
  422. package/dist/app/modules/http/constants.mjs.map +1 -1
  423. package/dist/app/modules/http/module.d.ts +18 -0
  424. package/dist/app/modules/http/module.d.ts.map +1 -1
  425. package/dist/app/modules/http/module.mjs +48 -0
  426. package/dist/app/modules/http/module.mjs.map +1 -1
  427. package/dist/app/modules/http/modules/controller.d.ts +18 -3
  428. package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
  429. package/dist/app/modules/http/modules/controller.mjs +236 -23
  430. package/dist/app/modules/http/modules/controller.mjs.map +1 -1
  431. package/dist/app/modules/http/modules/middleware.d.ts +1 -0
  432. package/dist/app/modules/http/modules/middleware.d.ts.map +1 -1
  433. package/dist/app/modules/http/modules/middleware.mjs +11 -5
  434. package/dist/app/modules/http/modules/middleware.mjs.map +1 -1
  435. package/dist/app/modules/identity/module.mjs +2 -2
  436. package/dist/app/modules/index.d.ts +1 -0
  437. package/dist/app/modules/index.d.ts.map +1 -1
  438. package/dist/app/modules/index.mjs +13 -6
  439. package/dist/app/modules/mail/module.d.ts.map +1 -1
  440. package/dist/app/modules/mail/module.mjs +2 -1
  441. package/dist/app/modules/mail/module.mjs.map +1 -1
  442. package/dist/app/modules/metrics/constants.d.ts +4 -0
  443. package/dist/app/modules/metrics/constants.d.ts.map +1 -0
  444. package/dist/app/modules/metrics/constants.mjs +10 -0
  445. package/dist/app/modules/metrics/constants.mjs.map +1 -0
  446. package/dist/app/modules/metrics/index.d.ts +3 -0
  447. package/dist/app/modules/metrics/index.d.ts.map +1 -0
  448. package/dist/app/modules/metrics/index.mjs +6 -0
  449. package/dist/app/modules/metrics/prom.d.ts +15 -0
  450. package/dist/app/modules/metrics/prom.d.ts.map +1 -0
  451. package/dist/app/modules/metrics/prom.mjs +42 -0
  452. package/dist/app/modules/metrics/prom.mjs.map +1 -0
  453. package/dist/app/modules/oauth2/constants.d.ts +10 -2
  454. package/dist/app/modules/oauth2/constants.d.ts.map +1 -1
  455. package/dist/app/modules/oauth2/constants.mjs +8 -1
  456. package/dist/app/modules/oauth2/constants.mjs.map +1 -1
  457. package/dist/app/modules/oauth2/module.d.ts.map +1 -1
  458. package/dist/app/modules/oauth2/module.mjs +33 -8
  459. package/dist/app/modules/oauth2/module.mjs.map +1 -1
  460. package/dist/app/modules/oauth2/repositories/consent/index.d.ts +2 -0
  461. package/dist/app/modules/oauth2/repositories/consent/index.d.ts.map +1 -0
  462. package/dist/app/modules/oauth2/repositories/consent/index.mjs +5 -0
  463. package/dist/app/modules/oauth2/repositories/consent/repository.d.ts +20 -0
  464. package/dist/app/modules/oauth2/repositories/consent/repository.d.ts.map +1 -0
  465. package/dist/app/modules/oauth2/repositories/consent/repository.mjs +116 -0
  466. package/dist/app/modules/oauth2/repositories/consent/repository.mjs.map +1 -0
  467. package/dist/app/modules/oauth2/repositories/index.d.ts +2 -1
  468. package/dist/app/modules/oauth2/repositories/index.d.ts.map +1 -1
  469. package/dist/app/modules/oauth2/repositories/index.mjs +5 -3
  470. package/dist/app/modules/oauth2/repositories/session-token/index.d.ts +2 -0
  471. package/dist/app/modules/oauth2/repositories/session-token/index.d.ts.map +1 -0
  472. package/dist/app/modules/oauth2/repositories/session-token/index.mjs +5 -0
  473. package/dist/app/modules/oauth2/repositories/session-token/repository.d.ts +17 -0
  474. package/dist/app/modules/oauth2/repositories/session-token/repository.d.ts.map +1 -0
  475. package/dist/app/modules/oauth2/repositories/session-token/repository.mjs +63 -0
  476. package/dist/app/modules/oauth2/repositories/session-token/repository.mjs.map +1 -0
  477. package/dist/app/modules/oauth2/repositories/token/repository.d.ts +1 -0
  478. package/dist/app/modules/oauth2/repositories/token/repository.d.ts.map +1 -1
  479. package/dist/app/modules/oauth2/repositories/token/repository.mjs +8 -0
  480. package/dist/app/modules/oauth2/repositories/token/repository.mjs.map +1 -1
  481. package/dist/app/modules/provisioning/module.d.ts.map +1 -1
  482. package/dist/app/modules/provisioning/module.mjs +16 -5
  483. package/dist/app/modules/provisioning/module.mjs.map +1 -1
  484. package/dist/app/modules/provisioning/sources/default/module.d.ts.map +1 -1
  485. package/dist/app/modules/provisioning/sources/default/module.mjs +23 -7
  486. package/dist/app/modules/provisioning/sources/default/module.mjs.map +1 -1
  487. package/dist/app/modules/provisioning/sources/file/module.d.ts.map +1 -1
  488. package/dist/app/modules/provisioning/sources/file/module.mjs +12 -1
  489. package/dist/app/modules/provisioning/sources/file/module.mjs.map +1 -1
  490. package/dist/cli/commands/migration.d.ts.map +1 -1
  491. package/dist/cli/commands/migration.mjs +12 -4
  492. package/dist/cli/commands/migration.mjs.map +1 -1
  493. package/dist/components/event-cleaner/index.d.ts +2 -0
  494. package/dist/components/event-cleaner/index.d.ts.map +1 -0
  495. package/dist/components/event-cleaner/index.mjs +5 -0
  496. package/dist/components/event-cleaner/module.d.ts +5 -0
  497. package/dist/components/event-cleaner/module.d.ts.map +1 -0
  498. package/dist/components/event-cleaner/module.mjs +30 -0
  499. package/dist/components/event-cleaner/module.mjs.map +1 -0
  500. package/dist/components/index.d.ts +1 -0
  501. package/dist/components/index.d.ts.map +1 -1
  502. package/dist/components/index.mjs +3 -1
  503. package/dist/components/oauth2-cleaner/module.d.ts +2 -1
  504. package/dist/components/oauth2-cleaner/module.d.ts.map +1 -1
  505. package/dist/components/oauth2-cleaner/module.mjs +11 -3
  506. package/dist/components/oauth2-cleaner/module.mjs.map +1 -1
  507. package/dist/core/authentication/credential/entities/client/module.d.ts +1 -1
  508. package/dist/core/authentication/credential/entities/client/module.d.ts.map +1 -1
  509. package/dist/core/authentication/credential/entities/client/module.mjs +2 -1
  510. package/dist/core/authentication/credential/entities/client/module.mjs.map +1 -1
  511. package/dist/core/authentication/entities/client/module.mjs +2 -2
  512. package/dist/core/authentication/entities/client/module.mjs.map +1 -1
  513. package/dist/core/authentication/index.d.ts +1 -0
  514. package/dist/core/authentication/index.d.ts.map +1 -1
  515. package/dist/core/authentication/index.mjs +4 -1
  516. package/dist/core/authentication/login-throttle/index.d.ts +3 -0
  517. package/dist/core/authentication/login-throttle/index.d.ts.map +1 -0
  518. package/dist/core/authentication/login-throttle/index.mjs +5 -0
  519. package/dist/core/authentication/login-throttle/service.d.ts +13 -0
  520. package/dist/core/authentication/login-throttle/service.d.ts.map +1 -0
  521. package/dist/core/authentication/login-throttle/service.mjs +33 -0
  522. package/dist/core/authentication/login-throttle/service.mjs.map +1 -0
  523. package/dist/core/authentication/login-throttle/types.d.ts +34 -0
  524. package/dist/core/authentication/login-throttle/types.d.ts.map +1 -0
  525. package/dist/core/authentication/login-throttle/types.mjs +4 -0
  526. package/dist/core/authentication/session/index.mjs +2 -1
  527. package/dist/core/authentication/session/module.d.ts +2 -0
  528. package/dist/core/authentication/session/module.d.ts.map +1 -1
  529. package/dist/core/authentication/session/module.mjs +7 -0
  530. package/dist/core/authentication/session/module.mjs.map +1 -1
  531. package/dist/core/authentication/session/types.d.ts +40 -0
  532. package/dist/core/authentication/session/types.d.ts.map +1 -1
  533. package/dist/core/authentication/session/types.mjs +18 -1
  534. package/dist/core/authentication/session/types.mjs.map +1 -0
  535. package/dist/core/client-certificate/index.d.ts +3 -0
  536. package/dist/core/client-certificate/index.d.ts.map +1 -0
  537. package/dist/core/client-certificate/index.mjs +5 -0
  538. package/dist/core/client-certificate/module.d.ts +18 -0
  539. package/dist/core/client-certificate/module.d.ts.map +1 -0
  540. package/dist/core/client-certificate/module.mjs +195 -0
  541. package/dist/core/client-certificate/module.mjs.map +1 -0
  542. package/dist/core/client-certificate/types.d.ts +22 -0
  543. package/dist/core/client-certificate/types.d.ts.map +1 -0
  544. package/dist/core/client-certificate/types.mjs +4 -0
  545. package/dist/core/entities/client/service.d.ts.map +1 -1
  546. package/dist/core/entities/client/service.mjs +15 -7
  547. package/dist/core/entities/client/service.mjs.map +1 -1
  548. package/dist/core/entities/client/web-client.d.ts +5 -3
  549. package/dist/core/entities/client/web-client.d.ts.map +1 -1
  550. package/dist/core/entities/client/web-client.mjs +11 -6
  551. package/dist/core/entities/client/web-client.mjs.map +1 -1
  552. package/dist/core/entities/consent/index.d.ts +3 -0
  553. package/dist/core/entities/consent/index.d.ts.map +1 -0
  554. package/dist/core/entities/consent/index.mjs +6 -0
  555. package/dist/core/entities/consent/service.d.ts +19 -0
  556. package/dist/core/entities/consent/service.d.ts.map +1 -0
  557. package/dist/core/entities/consent/service.mjs +122 -0
  558. package/dist/core/entities/consent/service.mjs.map +1 -0
  559. package/dist/core/entities/consent/types.d.ts +97 -0
  560. package/dist/core/entities/consent/types.d.ts.map +1 -0
  561. package/dist/core/entities/consent/types.mjs +25 -0
  562. package/dist/core/entities/consent/types.mjs.map +1 -0
  563. package/dist/core/entities/event/constants.d.ts +7 -0
  564. package/dist/core/entities/event/constants.d.ts.map +1 -0
  565. package/dist/core/entities/event/constants.mjs +13 -0
  566. package/dist/core/entities/event/constants.mjs.map +1 -0
  567. package/dist/core/entities/event/diff.d.ts +20 -0
  568. package/dist/core/entities/event/diff.d.ts.map +1 -0
  569. package/dist/core/entities/event/diff.mjs +45 -0
  570. package/dist/core/entities/event/diff.mjs.map +1 -0
  571. package/dist/core/entities/event/entity-event-handler.d.ts +19 -0
  572. package/dist/core/entities/event/entity-event-handler.d.ts.map +1 -0
  573. package/dist/core/entities/event/entity-event-handler.mjs +100 -0
  574. package/dist/core/entities/event/entity-event-handler.mjs.map +1 -0
  575. package/dist/core/entities/event/index.d.ts +7 -0
  576. package/dist/core/entities/event/index.d.ts.map +1 -0
  577. package/dist/core/entities/event/index.mjs +9 -0
  578. package/dist/core/entities/event/sanitize.d.ts +2 -0
  579. package/dist/core/entities/event/sanitize.d.ts.map +1 -0
  580. package/dist/core/entities/event/sanitize.mjs +83 -0
  581. package/dist/core/entities/event/sanitize.mjs.map +1 -0
  582. package/dist/core/entities/event/service.d.ts +22 -0
  583. package/dist/core/entities/event/service.d.ts.map +1 -0
  584. package/dist/core/entities/event/service.mjs +169 -0
  585. package/dist/core/entities/event/service.mjs.map +1 -0
  586. package/dist/core/entities/event/types.d.ts +124 -0
  587. package/dist/core/entities/event/types.d.ts.map +1 -0
  588. package/dist/core/entities/event/types.mjs +4 -0
  589. package/dist/core/entities/identity-provider-role-mapping/service.mjs +2 -2
  590. package/dist/core/entities/identity-provider-role-mapping/service.mjs.map +1 -1
  591. package/dist/core/entities/index.d.ts +6 -0
  592. package/dist/core/entities/index.d.ts.map +1 -1
  593. package/dist/core/entities/index.mjs +22 -1
  594. package/dist/core/entities/key/index.d.ts +3 -0
  595. package/dist/core/entities/key/index.d.ts.map +1 -0
  596. package/dist/core/entities/key/index.mjs +5 -0
  597. package/dist/core/entities/key/service.d.ts +55 -0
  598. package/dist/core/entities/key/service.d.ts.map +1 -0
  599. package/dist/core/entities/key/service.mjs +301 -0
  600. package/dist/core/entities/key/service.mjs.map +1 -0
  601. package/dist/core/entities/key/types.d.ts +33 -0
  602. package/dist/core/entities/key/types.d.ts.map +1 -0
  603. package/dist/core/entities/key/types.mjs +4 -0
  604. package/dist/core/entities/permission/service.mjs +3 -3
  605. package/dist/core/entities/permission/service.mjs.map +1 -1
  606. package/dist/core/entities/policy/service.mjs +4 -4
  607. package/dist/core/entities/policy/service.mjs.map +1 -1
  608. package/dist/core/entities/realm/service.d.ts +3 -0
  609. package/dist/core/entities/realm/service.d.ts.map +1 -1
  610. package/dist/core/entities/realm/service.mjs +6 -3
  611. package/dist/core/entities/realm/service.mjs.map +1 -1
  612. package/dist/core/entities/realm/types.d.ts +9 -0
  613. package/dist/core/entities/realm/types.d.ts.map +1 -1
  614. package/dist/core/entities/role/service.mjs +2 -2
  615. package/dist/core/entities/role/service.mjs.map +1 -1
  616. package/dist/core/entities/role-attribute/service.mjs +3 -3
  617. package/dist/core/entities/role-attribute/service.mjs.map +1 -1
  618. package/dist/core/entities/session/index.d.ts +3 -0
  619. package/dist/core/entities/session/index.d.ts.map +1 -0
  620. package/dist/core/entities/session/index.mjs +5 -0
  621. package/dist/core/entities/session/service.d.ts +27 -0
  622. package/dist/core/entities/session/service.d.ts.map +1 -0
  623. package/dist/core/entities/session/service.mjs +154 -0
  624. package/dist/core/entities/session/service.mjs.map +1 -0
  625. package/dist/core/entities/session/types.d.ts +48 -0
  626. package/dist/core/entities/session/types.d.ts.map +1 -0
  627. package/dist/core/entities/session/types.mjs +4 -0
  628. package/dist/core/entities/trust-anchor/index.d.ts +3 -0
  629. package/dist/core/entities/trust-anchor/index.d.ts.map +1 -0
  630. package/dist/core/entities/trust-anchor/index.mjs +5 -0
  631. package/dist/core/entities/trust-anchor/service.d.ts +33 -0
  632. package/dist/core/entities/trust-anchor/service.d.ts.map +1 -0
  633. package/dist/core/entities/trust-anchor/service.mjs +175 -0
  634. package/dist/core/entities/trust-anchor/service.mjs.map +1 -0
  635. package/dist/core/entities/trust-anchor/types.d.ts +14 -0
  636. package/dist/core/entities/trust-anchor/types.d.ts.map +1 -0
  637. package/dist/core/entities/trust-anchor/types.mjs +4 -0
  638. package/dist/core/entities/user/service.d.ts +1 -0
  639. package/dist/core/entities/user/service.d.ts.map +1 -1
  640. package/dist/core/entities/user/service.mjs +3 -3
  641. package/dist/core/entities/user/service.mjs.map +1 -1
  642. package/dist/core/entities/user-attribute/service.mjs +4 -4
  643. package/dist/core/entities/user-attribute/service.mjs.map +1 -1
  644. package/dist/core/entities/user-authenticator/constants.d.ts +26 -0
  645. package/dist/core/entities/user-authenticator/constants.d.ts.map +1 -0
  646. package/dist/core/entities/user-authenticator/constants.mjs +32 -0
  647. package/dist/core/entities/user-authenticator/constants.mjs.map +1 -0
  648. package/dist/core/entities/user-authenticator/helpers.d.ts +10 -0
  649. package/dist/core/entities/user-authenticator/helpers.d.ts.map +1 -0
  650. package/dist/core/entities/user-authenticator/helpers.mjs +35 -0
  651. package/dist/core/entities/user-authenticator/helpers.mjs.map +1 -0
  652. package/dist/core/entities/user-authenticator/index.d.ts +6 -0
  653. package/dist/core/entities/user-authenticator/index.d.ts.map +1 -0
  654. package/dist/core/entities/user-authenticator/index.mjs +9 -0
  655. package/dist/core/entities/user-authenticator/service.d.ts +89 -0
  656. package/dist/core/entities/user-authenticator/service.d.ts.map +1 -0
  657. package/dist/core/entities/user-authenticator/service.mjs +709 -0
  658. package/dist/core/entities/user-authenticator/service.mjs.map +1 -0
  659. package/dist/core/entities/user-authenticator/types.d.ts +221 -0
  660. package/dist/core/entities/user-authenticator/types.d.ts.map +1 -0
  661. package/dist/core/entities/user-authenticator/types.mjs +15 -0
  662. package/dist/core/entities/user-authenticator/types.mjs.map +1 -0
  663. package/dist/core/entities/user-authenticator/webauthn.d.ts +28 -0
  664. package/dist/core/entities/user-authenticator/webauthn.d.ts.map +1 -0
  665. package/dist/core/entities/user-authenticator/webauthn.mjs +88 -0
  666. package/dist/core/entities/user-authenticator/webauthn.mjs.map +1 -0
  667. package/dist/core/identity/index.mjs +2 -1
  668. package/dist/core/identity/password-recovery/disabled.d.ts +2 -2
  669. package/dist/core/identity/password-recovery/disabled.d.ts.map +1 -1
  670. package/dist/core/identity/password-recovery/disabled.mjs +2 -2
  671. package/dist/core/identity/password-recovery/disabled.mjs.map +1 -1
  672. package/dist/core/identity/password-recovery/email-verification-required.d.ts +2 -2
  673. package/dist/core/identity/password-recovery/email-verification-required.d.ts.map +1 -1
  674. package/dist/core/identity/password-recovery/email-verification-required.mjs +2 -2
  675. package/dist/core/identity/password-recovery/email-verification-required.mjs.map +1 -1
  676. package/dist/core/identity/password-recovery/service.d.ts +2 -1
  677. package/dist/core/identity/password-recovery/service.d.ts.map +1 -1
  678. package/dist/core/identity/password-recovery/service.mjs +27 -4
  679. package/dist/core/identity/password-recovery/service.mjs.map +1 -1
  680. package/dist/core/identity/password-recovery/token-expired.d.ts +2 -2
  681. package/dist/core/identity/password-recovery/token-expired.d.ts.map +1 -1
  682. package/dist/core/identity/password-recovery/token-expired.mjs +2 -2
  683. package/dist/core/identity/password-recovery/token-expired.mjs.map +1 -1
  684. package/dist/core/identity/password-recovery/types.d.ts +3 -1
  685. package/dist/core/identity/password-recovery/types.d.ts.map +1 -1
  686. package/dist/core/identity/permission/checker/service.d.ts.map +1 -1
  687. package/dist/core/identity/permission/checker/service.mjs +6 -5
  688. package/dist/core/identity/permission/checker/service.mjs.map +1 -1
  689. package/dist/core/identity/permission/index.d.ts +1 -0
  690. package/dist/core/identity/permission/index.d.ts.map +1 -1
  691. package/dist/core/identity/permission/index.mjs +2 -1
  692. package/dist/core/identity/policy/checker/service.d.ts.map +1 -1
  693. package/dist/core/identity/policy/checker/service.mjs +7 -6
  694. package/dist/core/identity/policy/checker/service.mjs.map +1 -1
  695. package/dist/core/identity/provider/authentication/presets/facebook.d.ts.map +1 -1
  696. package/dist/core/identity/provider/authentication/presets/facebook.mjs +2 -1
  697. package/dist/core/identity/provider/authentication/presets/facebook.mjs.map +1 -1
  698. package/dist/core/identity/provider/authentication/presets/github.d.ts.map +1 -1
  699. package/dist/core/identity/provider/authentication/presets/github.mjs +2 -1
  700. package/dist/core/identity/provider/authentication/presets/github.mjs.map +1 -1
  701. package/dist/core/identity/provider/authentication/presets/google.d.ts.map +1 -1
  702. package/dist/core/identity/provider/authentication/presets/google.mjs +2 -1
  703. package/dist/core/identity/provider/authentication/presets/google.mjs.map +1 -1
  704. package/dist/core/identity/provider/authentication/presets/instagram.d.ts.map +1 -1
  705. package/dist/core/identity/provider/authentication/presets/instagram.mjs +2 -1
  706. package/dist/core/identity/provider/authentication/presets/instagram.mjs.map +1 -1
  707. package/dist/core/identity/provider/authentication/presets/paypal.d.ts.map +1 -1
  708. package/dist/core/identity/provider/authentication/presets/paypal.mjs +2 -1
  709. package/dist/core/identity/provider/authentication/presets/paypal.mjs.map +1 -1
  710. package/dist/core/identity/provider/authentication/protocols/oauth2/module.d.ts.map +1 -1
  711. package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs +7 -2
  712. package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs.map +1 -1
  713. package/dist/core/identity/provider/authentication/protocols/open-id/module.d.ts +2 -0
  714. package/dist/core/identity/provider/authentication/protocols/open-id/module.d.ts.map +1 -1
  715. package/dist/core/identity/provider/authentication/protocols/open-id/module.mjs +5 -0
  716. package/dist/core/identity/provider/authentication/protocols/open-id/module.mjs.map +1 -1
  717. package/dist/core/identity/registration/error.d.ts +2 -2
  718. package/dist/core/identity/registration/error.d.ts.map +1 -1
  719. package/dist/core/identity/registration/error.mjs +2 -2
  720. package/dist/core/identity/registration/error.mjs.map +1 -1
  721. package/dist/core/identity/registration/service.d.ts +2 -1
  722. package/dist/core/identity/registration/service.d.ts.map +1 -1
  723. package/dist/core/identity/registration/service.mjs +35 -10
  724. package/dist/core/identity/registration/service.mjs.map +1 -1
  725. package/dist/core/identity/registration/types.d.ts +3 -1
  726. package/dist/core/identity/registration/types.d.ts.map +1 -1
  727. package/dist/core/identity/resolver/module.d.ts +7 -0
  728. package/dist/core/identity/resolver/module.d.ts.map +1 -1
  729. package/dist/core/identity/resolver/module.mjs +7 -1
  730. package/dist/core/identity/resolver/module.mjs.map +1 -1
  731. package/dist/core/index.d.ts +3 -0
  732. package/dist/core/index.d.ts.map +1 -1
  733. package/dist/core/index.mjs +48 -9
  734. package/dist/core/key/certificate-error.d.ts +10 -0
  735. package/dist/core/key/certificate-error.d.ts.map +1 -0
  736. package/dist/core/key/certificate-error.mjs +19 -0
  737. package/dist/core/key/certificate-error.mjs.map +1 -0
  738. package/dist/core/key/certificate.d.ts +15 -0
  739. package/dist/core/key/certificate.d.ts.map +1 -0
  740. package/dist/core/key/certificate.mjs +72 -0
  741. package/dist/core/key/certificate.mjs.map +1 -0
  742. package/dist/core/key/check.d.ts +3 -0
  743. package/dist/core/key/check.d.ts.map +1 -0
  744. package/dist/core/key/check.mjs +13 -0
  745. package/dist/core/key/check.mjs.map +1 -0
  746. package/dist/core/key/constants.d.ts +10 -0
  747. package/dist/core/key/constants.d.ts.map +1 -0
  748. package/dist/core/key/constants.mjs +15 -0
  749. package/dist/core/key/constants.mjs.map +1 -0
  750. package/dist/core/key/error.d.ts +14 -0
  751. package/dist/core/key/error.d.ts.map +1 -0
  752. package/dist/core/key/error.mjs +23 -0
  753. package/dist/core/key/error.mjs.map +1 -0
  754. package/dist/core/key/index.d.ts +10 -0
  755. package/dist/core/key/index.d.ts.map +1 -0
  756. package/dist/core/key/index.mjs +12 -0
  757. package/dist/core/key/provisioner.d.ts +22 -0
  758. package/dist/core/key/provisioner.d.ts.map +1 -0
  759. package/dist/core/key/provisioner.mjs +30 -0
  760. package/dist/core/key/provisioner.mjs.map +1 -0
  761. package/dist/core/key/realm-cipher.d.ts +20 -0
  762. package/dist/core/key/realm-cipher.d.ts.map +1 -0
  763. package/dist/core/key/realm-cipher.mjs +60 -0
  764. package/dist/core/key/realm-cipher.mjs.map +1 -0
  765. package/dist/core/key/types.d.ts +59 -0
  766. package/dist/core/key/types.d.ts.map +1 -0
  767. package/dist/core/key/types.mjs +4 -0
  768. package/dist/core/key/wrap.d.ts +5 -0
  769. package/dist/core/key/wrap.d.ts.map +1 -0
  770. package/dist/core/key/wrap.mjs +21 -0
  771. package/dist/core/key/wrap.mjs.map +1 -0
  772. package/dist/core/mail/template/registry.d.ts.map +1 -1
  773. package/dist/core/mail/template/registry.mjs +3 -1
  774. package/dist/core/mail/template/registry.mjs.map +1 -1
  775. package/dist/core/mail/template/templates/mfa-email-otp.d.ts +3 -0
  776. package/dist/core/mail/template/templates/mfa-email-otp.d.ts.map +1 -0
  777. package/dist/core/mail/template/templates/mfa-email-otp.mjs +34 -0
  778. package/dist/core/mail/template/templates/mfa-email-otp.mjs.map +1 -0
  779. package/dist/core/mail/template/types.d.ts +6 -1
  780. package/dist/core/mail/template/types.d.ts.map +1 -1
  781. package/dist/core/mail/template/types.mjs +1 -0
  782. package/dist/core/mail/template/types.mjs.map +1 -1
  783. package/dist/core/metrics/index.d.ts +3 -0
  784. package/dist/core/metrics/index.d.ts.map +1 -0
  785. package/dist/core/metrics/index.mjs +5 -0
  786. package/dist/core/metrics/noop.d.ts +8 -0
  787. package/dist/core/metrics/noop.d.ts.map +1 -0
  788. package/dist/core/metrics/noop.mjs +14 -0
  789. package/dist/core/metrics/noop.mjs.map +1 -0
  790. package/dist/core/metrics/types.d.ts +19 -0
  791. package/dist/core/metrics/types.d.ts.map +1 -0
  792. package/dist/core/metrics/types.mjs +4 -0
  793. package/dist/core/oauth2/access-policy/index.d.ts +3 -0
  794. package/dist/core/oauth2/access-policy/index.d.ts.map +1 -0
  795. package/dist/core/oauth2/access-policy/index.mjs +5 -0
  796. package/dist/core/oauth2/access-policy/module.d.ts +12 -0
  797. package/dist/core/oauth2/access-policy/module.d.ts.map +1 -0
  798. package/dist/core/oauth2/access-policy/module.mjs +32 -0
  799. package/dist/core/oauth2/access-policy/module.mjs.map +1 -0
  800. package/dist/core/oauth2/access-policy/types.d.ts +19 -0
  801. package/dist/core/oauth2/access-policy/types.d.ts.map +1 -0
  802. package/dist/core/oauth2/access-policy/types.mjs +4 -0
  803. package/dist/core/oauth2/authorization/code/index.mjs +1 -0
  804. package/dist/core/oauth2/authorization/code/issuer/module.d.ts +0 -1
  805. package/dist/core/oauth2/authorization/code/issuer/module.d.ts.map +1 -1
  806. package/dist/core/oauth2/authorization/code/issuer/module.mjs +9 -7
  807. package/dist/core/oauth2/authorization/code/issuer/module.mjs.map +1 -1
  808. package/dist/core/oauth2/authorization/code/issuer/types.d.ts +17 -3
  809. package/dist/core/oauth2/authorization/code/issuer/types.d.ts.map +1 -1
  810. package/dist/core/oauth2/authorization/code/verifier/module.d.ts.map +1 -1
  811. package/dist/core/oauth2/authorization/code/verifier/module.mjs +1 -0
  812. package/dist/core/oauth2/authorization/code/verifier/module.mjs.map +1 -1
  813. package/dist/core/oauth2/authorization/code/verifier/types.d.ts +1 -0
  814. package/dist/core/oauth2/authorization/code/verifier/types.d.ts.map +1 -1
  815. package/dist/core/oauth2/authorization/code-request/validator.d.ts.map +1 -1
  816. package/dist/core/oauth2/authorization/code-request/validator.mjs +20 -5
  817. package/dist/core/oauth2/authorization/code-request/validator.mjs.map +1 -1
  818. package/dist/core/oauth2/authorization/code-request/verifier/module.d.ts.map +1 -1
  819. package/dist/core/oauth2/authorization/code-request/verifier/module.mjs +14 -11
  820. package/dist/core/oauth2/authorization/code-request/verifier/module.mjs.map +1 -1
  821. package/dist/core/oauth2/authorization/code-request/verifier/types.d.ts +7 -0
  822. package/dist/core/oauth2/authorization/code-request/verifier/types.d.ts.map +1 -1
  823. package/dist/core/oauth2/authorization/helpers.d.ts +11 -1
  824. package/dist/core/oauth2/authorization/helpers.d.ts.map +1 -1
  825. package/dist/core/oauth2/authorization/helpers.mjs +46 -3
  826. package/dist/core/oauth2/authorization/helpers.mjs.map +1 -1
  827. package/dist/core/oauth2/authorization/index.mjs +2 -2
  828. package/dist/core/oauth2/authorization/module.d.ts +15 -7
  829. package/dist/core/oauth2/authorization/module.d.ts.map +1 -1
  830. package/dist/core/oauth2/authorization/module.mjs +100 -37
  831. package/dist/core/oauth2/authorization/module.mjs.map +1 -1
  832. package/dist/core/oauth2/authorization/types.d.ts +51 -7
  833. package/dist/core/oauth2/authorization/types.d.ts.map +1 -1
  834. package/dist/core/oauth2/client/authenticator.d.ts +16 -7
  835. package/dist/core/oauth2/client/authenticator.d.ts.map +1 -1
  836. package/dist/core/oauth2/client/authenticator.mjs +49 -12
  837. package/dist/core/oauth2/client/authenticator.mjs.map +1 -1
  838. package/dist/core/oauth2/client/grant-type.d.ts +9 -0
  839. package/dist/core/oauth2/client/grant-type.d.ts.map +1 -0
  840. package/dist/core/oauth2/client/grant-type.mjs +18 -0
  841. package/dist/core/oauth2/client/grant-type.mjs.map +1 -0
  842. package/dist/core/oauth2/client/index.d.ts +1 -0
  843. package/dist/core/oauth2/client/index.d.ts.map +1 -1
  844. package/dist/core/oauth2/client/index.mjs +2 -1
  845. package/dist/core/oauth2/end-session/index.d.ts +4 -0
  846. package/dist/core/oauth2/end-session/index.d.ts.map +1 -0
  847. package/dist/core/oauth2/end-session/index.mjs +6 -0
  848. package/dist/core/oauth2/end-session/service.d.ts +31 -0
  849. package/dist/core/oauth2/end-session/service.d.ts.map +1 -0
  850. package/dist/core/oauth2/end-session/service.mjs +130 -0
  851. package/dist/core/oauth2/end-session/service.mjs.map +1 -0
  852. package/dist/core/oauth2/end-session/types.d.ts +56 -0
  853. package/dist/core/oauth2/end-session/types.d.ts.map +1 -0
  854. package/dist/core/oauth2/end-session/types.mjs +4 -0
  855. package/dist/core/oauth2/end-session/validator.d.ts +6 -0
  856. package/dist/core/oauth2/end-session/validator.d.ts.map +1 -0
  857. package/dist/core/oauth2/end-session/validator.mjs +23 -0
  858. package/dist/core/oauth2/end-session/validator.mjs.map +1 -0
  859. package/dist/core/oauth2/grant-types/authorize.d.ts +19 -2
  860. package/dist/core/oauth2/grant-types/authorize.d.ts.map +1 -1
  861. package/dist/core/oauth2/grant-types/authorize.mjs +58 -11
  862. package/dist/core/oauth2/grant-types/authorize.mjs.map +1 -1
  863. package/dist/core/oauth2/grant-types/client-credentials.d.ts.map +1 -1
  864. package/dist/core/oauth2/grant-types/client-credentials.mjs +5 -3
  865. package/dist/core/oauth2/grant-types/client-credentials.mjs.map +1 -1
  866. package/dist/core/oauth2/grant-types/identity.d.ts.map +1 -1
  867. package/dist/core/oauth2/grant-types/identity.mjs +10 -3
  868. package/dist/core/oauth2/grant-types/identity.mjs.map +1 -1
  869. package/dist/core/oauth2/grant-types/password.d.ts +9 -0
  870. package/dist/core/oauth2/grant-types/password.d.ts.map +1 -1
  871. package/dist/core/oauth2/grant-types/password.mjs +32 -4
  872. package/dist/core/oauth2/grant-types/password.mjs.map +1 -1
  873. package/dist/core/oauth2/grant-types/refresh-token.d.ts +25 -2
  874. package/dist/core/oauth2/grant-types/refresh-token.d.ts.map +1 -1
  875. package/dist/core/oauth2/grant-types/refresh-token.mjs +71 -9
  876. package/dist/core/oauth2/grant-types/refresh-token.mjs.map +1 -1
  877. package/dist/core/oauth2/grant-types/robot-credentials.d.ts.map +1 -1
  878. package/dist/core/oauth2/grant-types/robot-credentials.mjs +3 -2
  879. package/dist/core/oauth2/grant-types/robot-credentials.mjs.map +1 -1
  880. package/dist/core/oauth2/grant-types/types.d.ts +30 -3
  881. package/dist/core/oauth2/grant-types/types.d.ts.map +1 -1
  882. package/dist/core/oauth2/index.d.ts +4 -1
  883. package/dist/core/oauth2/index.d.ts.map +1 -1
  884. package/dist/core/oauth2/index.mjs +13 -4
  885. package/dist/core/oauth2/mfa-login/index.d.ts +3 -0
  886. package/dist/core/oauth2/mfa-login/index.d.ts.map +1 -0
  887. package/dist/core/oauth2/mfa-login/index.mjs +5 -0
  888. package/dist/core/oauth2/mfa-login/module.d.ts +19 -0
  889. package/dist/core/oauth2/mfa-login/module.d.ts.map +1 -0
  890. package/dist/core/oauth2/mfa-login/module.mjs +109 -0
  891. package/dist/core/oauth2/mfa-login/module.mjs.map +1 -0
  892. package/dist/core/oauth2/mfa-login/types.d.ts +64 -0
  893. package/dist/core/oauth2/mfa-login/types.d.ts.map +1 -0
  894. package/dist/core/oauth2/mfa-login/types.mjs +4 -0
  895. package/dist/core/oauth2/session-token/index.d.ts.map +1 -0
  896. package/dist/core/oauth2/session-token/index.mjs +4 -0
  897. package/dist/core/oauth2/session-token/types.d.ts +70 -0
  898. package/dist/core/oauth2/session-token/types.d.ts.map +1 -0
  899. package/dist/core/oauth2/session-token/types.mjs +4 -0
  900. package/dist/core/oauth2/token/index.mjs +2 -1
  901. package/dist/core/oauth2/token/issuer/access/module.d.ts +3 -1
  902. package/dist/core/oauth2/token/issuer/access/module.d.ts.map +1 -1
  903. package/dist/core/oauth2/token/issuer/access/module.mjs +12 -1
  904. package/dist/core/oauth2/token/issuer/access/module.mjs.map +1 -1
  905. package/dist/core/oauth2/token/issuer/index.d.ts +1 -0
  906. package/dist/core/oauth2/token/issuer/index.d.ts.map +1 -1
  907. package/dist/core/oauth2/token/issuer/index.mjs +3 -1
  908. package/dist/core/oauth2/token/issuer/mfa/index.d.ts +2 -0
  909. package/dist/core/oauth2/token/issuer/mfa/index.d.ts.map +1 -0
  910. package/dist/core/oauth2/token/issuer/mfa/index.mjs +5 -0
  911. package/dist/core/oauth2/token/issuer/mfa/module.d.ts +18 -0
  912. package/dist/core/oauth2/token/issuer/mfa/module.d.ts.map +1 -0
  913. package/dist/core/oauth2/token/issuer/mfa/module.mjs +36 -0
  914. package/dist/core/oauth2/token/issuer/mfa/module.mjs.map +1 -0
  915. package/dist/core/oauth2/token/issuer/open-id/module.d.ts.map +1 -1
  916. package/dist/core/oauth2/token/issuer/open-id/module.mjs +1 -1
  917. package/dist/core/oauth2/token/issuer/open-id/module.mjs.map +1 -1
  918. package/dist/core/oauth2/token/issuer/refresh/module.d.ts +3 -1
  919. package/dist/core/oauth2/token/issuer/refresh/module.d.ts.map +1 -1
  920. package/dist/core/oauth2/token/issuer/refresh/module.mjs +12 -1
  921. package/dist/core/oauth2/token/issuer/refresh/module.mjs.map +1 -1
  922. package/dist/core/oauth2/token/repository/types.d.ts +10 -0
  923. package/dist/core/oauth2/token/repository/types.d.ts.map +1 -1
  924. package/dist/core/oauth2/token/revoker/module.d.ts +3 -1
  925. package/dist/core/oauth2/token/revoker/module.d.ts.map +1 -1
  926. package/dist/core/oauth2/token/revoker/module.mjs +5 -1
  927. package/dist/core/oauth2/token/revoker/module.mjs.map +1 -1
  928. package/dist/core/oauth2/token/signer/module.d.ts +3 -3
  929. package/dist/core/oauth2/token/signer/module.d.ts.map +1 -1
  930. package/dist/core/oauth2/token/signer/module.mjs +5 -6
  931. package/dist/core/oauth2/token/signer/module.mjs.map +1 -1
  932. package/dist/core/oauth2/token/verifier/module.d.ts +3 -3
  933. package/dist/core/oauth2/token/verifier/module.d.ts.map +1 -1
  934. package/dist/core/oauth2/token/verifier/module.mjs +12 -9
  935. package/dist/core/oauth2/token/verifier/module.mjs.map +1 -1
  936. package/dist/core/oauth2/token/verifier/types.d.ts +6 -0
  937. package/dist/core/oauth2/token/verifier/types.d.ts.map +1 -1
  938. package/dist/core/provisioning/entities/client/relations-validator.d.ts.map +1 -1
  939. package/dist/core/provisioning/entities/client/relations-validator.mjs +3 -2
  940. package/dist/core/provisioning/entities/client/relations-validator.mjs.map +1 -1
  941. package/dist/core/provisioning/entities/index.d.ts +1 -0
  942. package/dist/core/provisioning/entities/index.d.ts.map +1 -1
  943. package/dist/core/provisioning/entities/index.mjs +5 -1
  944. package/dist/core/provisioning/entities/permission/index.d.ts +1 -0
  945. package/dist/core/provisioning/entities/permission/index.d.ts.map +1 -1
  946. package/dist/core/provisioning/entities/permission/index.mjs +2 -1
  947. package/dist/core/provisioning/entities/permission/relations-validator.d.ts +6 -0
  948. package/dist/core/provisioning/entities/permission/relations-validator.d.ts.map +1 -0
  949. package/dist/core/provisioning/entities/permission/relations-validator.mjs +17 -0
  950. package/dist/core/provisioning/entities/permission/relations-validator.mjs.map +1 -0
  951. package/dist/core/provisioning/entities/permission/validator.d.ts.map +1 -1
  952. package/dist/core/provisioning/entities/permission/validator.mjs +3 -0
  953. package/dist/core/provisioning/entities/permission/validator.mjs.map +1 -1
  954. package/dist/core/provisioning/entities/policy/index.d.ts +1 -0
  955. package/dist/core/provisioning/entities/policy/index.d.ts.map +1 -1
  956. package/dist/core/provisioning/entities/policy/index.mjs +2 -1
  957. package/dist/core/provisioning/entities/policy/validator.d.ts +6 -0
  958. package/dist/core/provisioning/entities/policy/validator.d.ts.map +1 -0
  959. package/dist/core/provisioning/entities/policy/validator.mjs +26 -0
  960. package/dist/core/provisioning/entities/policy/validator.mjs.map +1 -0
  961. package/dist/core/provisioning/entities/realm/relations-validator.d.ts.map +1 -1
  962. package/dist/core/provisioning/entities/realm/relations-validator.mjs +9 -52
  963. package/dist/core/provisioning/entities/realm/relations-validator.mjs.map +1 -1
  964. package/dist/core/provisioning/entities/role/relations-validator.d.ts.map +1 -1
  965. package/dist/core/provisioning/entities/role/relations-validator.mjs +4 -0
  966. package/dist/core/provisioning/entities/role/relations-validator.mjs.map +1 -1
  967. package/dist/core/provisioning/entities/root/validator.d.ts.map +1 -1
  968. package/dist/core/provisioning/entities/root/validator.mjs +11 -26
  969. package/dist/core/provisioning/entities/root/validator.mjs.map +1 -1
  970. package/dist/core/provisioning/entities/utils.d.ts +10 -0
  971. package/dist/core/provisioning/entities/utils.d.ts.map +1 -0
  972. package/dist/core/provisioning/entities/utils.mjs +29 -0
  973. package/dist/core/provisioning/entities/utils.mjs.map +1 -0
  974. package/dist/core/provisioning/index.mjs +4 -1
  975. package/dist/core/provisioning/synchronizer/base.d.ts.map +1 -1
  976. package/dist/core/provisioning/synchronizer/base.mjs.map +1 -1
  977. package/dist/index.mjs +66 -39
  978. package/dist/swagger.json +6721 -3734
  979. package/dist/ui/client/.vite/ssr-manifest.json +5283 -1233
  980. package/dist/ui/client/assets/index-BmWsoQro.css +2 -0
  981. package/dist/ui/client/assets/{index-Cd3uWit-.js → index-CT0Nq5pA.js} +18 -17
  982. package/dist/ui/client/index.html +2 -2
  983. package/dist/ui/server/assets/{multipart-parser-Dn2Ly9xU.js → multipart-parser-BCMy8Xwv.js} +11 -1
  984. package/dist/ui/server/assets/{multipart-parser-DyM9gi59.js → multipart-parser-BVY8pIV2.js} +11 -1
  985. package/dist/ui/server/server.js +21817 -19132
  986. package/package.json +24 -18
  987. package/dist/app/modules/oauth2/repositories/key/index.d.ts.map +0 -1
  988. package/dist/app/modules/oauth2/repositories/key/index.mjs +0 -5
  989. package/dist/app/modules/oauth2/repositories/key/repository.d.ts +0 -14
  990. package/dist/app/modules/oauth2/repositories/key/repository.d.ts.map +0 -1
  991. package/dist/app/modules/oauth2/repositories/key/repository.mjs +0 -51
  992. package/dist/app/modules/oauth2/repositories/key/repository.mjs.map +0 -1
  993. package/dist/core/oauth2/key/index.d.ts.map +0 -1
  994. package/dist/core/oauth2/key/types.d.ts +0 -16
  995. package/dist/core/oauth2/key/types.d.ts.map +0 -1
  996. package/dist/ui/client/assets/index-DoCTwJ8M.css +0 -2
  997. /package/dist/{core/oauth2/key → adapters/http/controllers/workflows/logout}/types.mjs +0 -0
  998. /package/dist/{core/oauth2/key/index.mjs → adapters/http/request/types.mjs} +0 -0
  999. /package/dist/app/modules/{oauth2/repositories/key → database/repositories/event}/index.d.ts +0 -0
  1000. /package/dist/core/oauth2/{key → session-token}/index.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"service.mjs","names":["BuiltInPolicyType","PermissionError","definePolicyData","BadRequestError","EntityConflictError","EntityNotFoundError","ValidatorGroup","IdentityProviderRoleMappingValidator","PermissionName","JunctionEntityService","IdentityProviderRoleMappingService","ownerRealmKey","repository","roleRepository","identityPermissionProvider","validator","ctx","getMany","query","actor","permissionEvaluator","preEvaluateOneOf","name","IDENTITY_PROVIDER_ROLE_READ","IDENTITY_PROVIDER_READ","IDENTITY_PROVIDER_UPDATE","IDENTITY_PROVIDER_DELETE","findMany","getOne","id","entity","findOneBy","create","data","preEvaluate","IDENTITY_PROVIDER_ROLE_CREATE","validated","run","group","CREATE","validateJoinColumns","existing","provider_id","role_id","provider","provider_realm_id","realm_id","role","role_realm_id","identity","hasPermissions","isSuperset","type","clientId","client_id","message","evaluate","ATTRIBUTES","junctionAttributes","REALM_MATCH","junctionResourceRealm","save","update","IDENTITY_PROVIDER_ROLE_UPDATE","UPDATE","findOneById","merged","merge","delete","IDENTITY_PROVIDER_ROLE_DELETE","entityId","remove"],"sources":["../../../../src/core/entities/identity-provider-role-mapping/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BuiltInPolicyType, PermissionError, definePolicyData } from '@authup/access';\nimport { BadRequestError, EntityConflictError, EntityNotFoundError } from '@authup/errors';\nimport { ValidatorGroup } from '@authup/kit';\nimport { IdentityProviderRoleMappingValidator, PermissionName } from '@authup/core-kit';\nimport type { IdentityProviderRoleMapping, Role } from '@authup/core-kit';\nimport type { ActorContext, EntityRepositoryFindManyResult, IEntityRepository } from '@authup/server-kit';\nimport { JunctionEntityService } from '@authup/server-kit';\nimport type { IIdentityPermissionProvider } from '../../identity/permission/types.ts';\nimport type { IIdentityProviderRoleMappingRepository, IIdentityProviderRoleMappingService } from './types.ts';\n\nexport type IdentityProviderRoleMappingServiceContext = {\n repository: IIdentityProviderRoleMappingRepository;\n roleRepository: IEntityRepository<Role>;\n identityPermissionProvider: IIdentityPermissionProvider;\n};\n\nexport class IdentityProviderRoleMappingService extends JunctionEntityService implements IIdentityProviderRoleMappingService {\n protected readonly ownerRealmKey = 'provider_realm_id';\n\n protected repository: IIdentityProviderRoleMappingRepository;\n\n protected roleRepository: IEntityRepository<Role>;\n\n protected identityPermissionProvider: IIdentityPermissionProvider;\n\n protected validator: IdentityProviderRoleMappingValidator;\n\n constructor(ctx: IdentityProviderRoleMappingServiceContext) {\n super();\n this.repository = ctx.repository;\n this.roleRepository = ctx.roleRepository;\n this.identityPermissionProvider = ctx.identityPermissionProvider;\n this.validator = new IdentityProviderRoleMappingValidator();\n }\n\n async getMany(\n query: Record<string, any>,\n actor: ActorContext,\n ): Promise<EntityRepositoryFindManyResult<IdentityProviderRoleMapping>> {\n await actor.permissionEvaluator.preEvaluateOneOf({\n name: [\n PermissionName.IDENTITY_PROVIDER_ROLE_READ,\n PermissionName.IDENTITY_PROVIDER_READ,\n PermissionName.IDENTITY_PROVIDER_UPDATE,\n PermissionName.IDENTITY_PROVIDER_DELETE,\n ],\n });\n\n return this.repository.findMany(query);\n }\n\n async getOne(\n id: string,\n actor: ActorContext,\n ): Promise<IdentityProviderRoleMapping> {\n await actor.permissionEvaluator.preEvaluateOneOf({\n name: [\n PermissionName.IDENTITY_PROVIDER_ROLE_READ,\n PermissionName.IDENTITY_PROVIDER_READ,\n PermissionName.IDENTITY_PROVIDER_UPDATE,\n PermissionName.IDENTITY_PROVIDER_DELETE,\n ],\n });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<IdentityProviderRoleMapping> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.IDENTITY_PROVIDER_ROLE_CREATE });\n\n const validated = await this.validator.run(data, { group: ValidatorGroup.CREATE });\n\n await this.repository.validateJoinColumns(validated);\n\n const existing = await this.repository.findOneBy({\n provider_id: validated.provider_id,\n role_id: validated.role_id,\n });\n if (existing) {\n throw new EntityConflictError({ entity: 'identity-provider-role-mapping' });\n }\n\n if (validated.provider) {\n validated.provider_realm_id = validated.provider.realm_id;\n }\n\n if (validated.role) {\n validated.role_realm_id = validated.role.realm_id;\n }\n\n if (\n validated.role_realm_id &&\n validated.provider_realm_id &&\n validated.role_realm_id !== validated.provider_realm_id\n ) {\n throw new BadRequestError('It is not possible to map an identity provider to a role of another realm.');\n }\n\n if (validated.role && actor.identity) {\n const hasPermissions = await this.identityPermissionProvider.isSuperset(\n {\n type: actor.identity.type,\n id: actor.identity.data.id,\n },\n {\n type: 'role',\n id: validated.role_id,\n clientId: validated.role.client_id,\n },\n );\n if (!hasPermissions) {\n throw new PermissionError({ message: 'You don\\'t own the required permissions.' });\n }\n }\n\n // Stamp the owner (identity-provider) realm so the realm_scope factor gates cross-realm writes.\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.IDENTITY_PROVIDER_ROLE_CREATE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: this.junctionAttributes(validated),\n [BuiltInPolicyType.REALM_MATCH]: this.junctionResourceRealm(validated),\n }),\n });\n\n let entity = this.repository.create(validated);\n entity = await this.repository.save(entity);\n\n return entity;\n }\n\n async update(\n id: string,\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<IdentityProviderRoleMapping> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.IDENTITY_PROVIDER_ROLE_UPDATE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n const validated = await this.validator.run(data, { group: ValidatorGroup.UPDATE });\n\n await this.repository.validateJoinColumns(validated);\n\n // `role_id` is immutable on update (CREATE-group only in the validator), so the conferred\n // role never changes here — only the attribute-matching criteria do. Still re-verify the\n // actor OWNS that role before letting it edit (e.g. broaden) the mapping, mirroring create()\n // and the permission-junction member gate (#3164): you may not modify a role-conferring\n // mapping for a role you no longer own.\n const role = await this.roleRepository.findOneById(entity.role_id);\n if (role && actor.identity) {\n const hasPermissions = await this.identityPermissionProvider.isSuperset(\n {\n type: actor.identity.type,\n id: actor.identity.data.id,\n },\n {\n type: 'role',\n id: role.id,\n clientId: role.client_id,\n },\n );\n if (!hasPermissions) {\n throw new PermissionError({ message: 'You don\\'t own the required permissions.' });\n }\n }\n\n const merged = this.repository.merge(entity, validated);\n\n // Stamp the owner (identity-provider) realm so the realm_scope factor gates cross-realm writes.\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.IDENTITY_PROVIDER_ROLE_UPDATE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: this.junctionAttributes(merged),\n [BuiltInPolicyType.REALM_MATCH]: this.junctionResourceRealm(merged),\n }),\n });\n\n return this.repository.save(merged);\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n ): Promise<IdentityProviderRoleMapping> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.IDENTITY_PROVIDER_ROLE_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n // Stamp the owner (identity-provider) realm so the realm_scope factor gates cross-realm writes.\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.IDENTITY_PROVIDER_ROLE_DELETE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: this.junctionAttributes(entity),\n [BuiltInPolicyType.REALM_MATCH]: this.junctionResourceRealm(entity),\n }),\n });\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n entity.id = entityId;\n\n return entity;\n }\n}\n"],"mappings":";;;;;;;;;AAuBA,IAAaU,qCAAb,cAAwDD,sBAAAA;CACjCE,gBAAgB;CAEzBC;CAEAC;CAEAC;CAEAC;CAEV,YAAYC,KAAgD;EACxD,MAAK;EACL,KAAKJ,aAAaI,IAAIJ;EACtB,KAAKC,iBAAiBG,IAAIH;EAC1B,KAAKC,6BAA6BE,IAAIF;EACtC,KAAKC,YAAY,IAAIR,qCAAAA;CACzB;CAEA,MAAMU,QACFC,OACAC,OACoE;EACpE,MAAMA,MAAMC,oBAAoBC,iBAAiB,EAC7CC,MAAM;GACFd,eAAee;GACff,eAAegB;GACfhB,eAAeiB;GACfjB,eAAekB;IAEvB,CAAA;EAEA,OAAO,KAAKd,WAAWe,SAAST,KAAAA;CACpC;C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mBQ,MAAAA;KACvDlE,kBAAkB2D,cAAc,KAAKC,sBAAsBM,MAAAA;GAChE,CAAA;EACJ,CAAA;EAEA,OAAO,KAAKtD,WAAWiD,KAAKK,MAAAA;CAChC;CAEA,MAAME,OACFvC,IACAV,OACoC;EACpC,MAAMA,MAAMC,oBAAoBc,YAAY,EAAEZ,MAAMd,eAAe6D,8BAA8B,CAAA;EAEjG,MAAMvC,SAAS,MAAM,KAAKlB,WAAWmB,UAAU,EAAEF,GAAG,CAAA;EACpD,IAAI,CAACC,QACD,MAAM,IAAIzB,oBAAAA;EAId,MAAMc,MAAMC,oBAAoBoC,SAAS;GACrClC,MAAMd,eAAe6D;GACrBpC,MAAM/B,iBAAiB;KAClBF,kBAAkByD,aAAa,KAAKC,mBAAmB5B,MAAAA;KACvD9B,kBAAkB2D,cAAc,KAAKC,sBAAsB9B,MAAAA;GAChE,CAAA;EACJ,CAAA;EAEA,MAAM,EAAED,IAAIyC,aAAaxC;EACzB,MAAM,KAAKlB,WAAW2D,OAAOzC,MAAAA;EAC7BA,OAAOD,KAAKyC;EAEZ,OAAOxC;CACX;AACJ"}
1
+ {"version":3,"file":"service.mjs","names":["BuiltInPolicyType","PermissionError","definePolicyData","EntityConflictError","EntityNotFoundError","ValidationError","ValidatorGroup","IdentityProviderRoleMappingValidator","PermissionName","JunctionEntityService","IdentityProviderRoleMappingService","ownerRealmKey","repository","roleRepository","identityPermissionProvider","validator","ctx","getMany","query","actor","permissionEvaluator","preEvaluateOneOf","name","IDENTITY_PROVIDER_ROLE_READ","IDENTITY_PROVIDER_READ","IDENTITY_PROVIDER_UPDATE","IDENTITY_PROVIDER_DELETE","findMany","getOne","id","entity","findOneBy","create","data","preEvaluate","IDENTITY_PROVIDER_ROLE_CREATE","validated","run","group","CREATE","validateJoinColumns","existing","provider_id","role_id","provider","provider_realm_id","realm_id","role","role_realm_id","identity","hasPermissions","isSuperset","type","clientId","client_id","message","evaluate","ATTRIBUTES","junctionAttributes","REALM_MATCH","junctionResourceRealm","save","update","IDENTITY_PROVIDER_ROLE_UPDATE","UPDATE","findOneById","merged","merge","delete","IDENTITY_PROVIDER_ROLE_DELETE","entityId","remove"],"sources":["../../../../src/core/entities/identity-provider-role-mapping/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BuiltInPolicyType, PermissionError, definePolicyData } from '@authup/access';\nimport { EntityConflictError, EntityNotFoundError, ValidationError } from '@authup/errors';\nimport { ValidatorGroup } from '@authup/kit';\nimport { IdentityProviderRoleMappingValidator, PermissionName } from '@authup/core-kit';\nimport type { IdentityProviderRoleMapping, Role } from '@authup/core-kit';\nimport type { ActorContext, EntityRepositoryFindManyResult, IEntityRepository } from '@authup/server-kit';\nimport { JunctionEntityService } from '@authup/server-kit';\nimport type { IIdentityPermissionProvider } from '../../identity/permission/types.ts';\nimport type { IIdentityProviderRoleMappingRepository, IIdentityProviderRoleMappingService } from './types.ts';\n\nexport type IdentityProviderRoleMappingServiceContext = {\n repository: IIdentityProviderRoleMappingRepository;\n roleRepository: IEntityRepository<Role>;\n identityPermissionProvider: IIdentityPermissionProvider;\n};\n\nexport class IdentityProviderRoleMappingService extends JunctionEntityService implements IIdentityProviderRoleMappingService {\n protected readonly ownerRealmKey = 'provider_realm_id';\n\n protected repository: IIdentityProviderRoleMappingRepository;\n\n protected roleRepository: IEntityRepository<Role>;\n\n protected identityPermissionProvider: IIdentityPermissionProvider;\n\n protected validator: IdentityProviderRoleMappingValidator;\n\n constructor(ctx: IdentityProviderRoleMappingServiceContext) {\n super();\n this.repository = ctx.repository;\n this.roleRepository = ctx.roleRepository;\n this.identityPermissionProvider = ctx.identityPermissionProvider;\n this.validator = new IdentityProviderRoleMappingValidator();\n }\n\n async getMany(\n query: Record<string, any>,\n actor: ActorContext,\n ): Promise<EntityRepositoryFindManyResult<IdentityProviderRoleMapping>> {\n await actor.permissionEvaluator.preEvaluateOneOf({\n name: [\n PermissionName.IDENTITY_PROVIDER_ROLE_READ,\n PermissionName.IDENTITY_PROVIDER_READ,\n PermissionName.IDENTITY_PROVIDER_UPDATE,\n PermissionName.IDENTITY_PROVIDER_DELETE,\n ],\n });\n\n return this.repository.findMany(query);\n }\n\n async getOne(\n id: string,\n actor: ActorContext,\n ): Promise<IdentityProviderRoleMapping> {\n await actor.permissionEvaluator.preEvaluateOneOf({\n name: [\n PermissionName.IDENTITY_PROVIDER_ROLE_READ,\n PermissionName.IDENTITY_PROVIDER_READ,\n PermissionName.IDENTITY_PROVIDER_UPDATE,\n PermissionName.IDENTITY_PROVIDER_DELETE,\n ],\n });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<IdentityProviderRoleMapping> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.IDENTITY_PROVIDER_ROLE_CREATE });\n\n const validated = await this.validator.run(data, { group: ValidatorGroup.CREATE });\n\n await this.repository.validateJoinColumns(validated);\n\n const existing = await this.repository.findOneBy({\n provider_id: validated.provider_id,\n role_id: validated.role_id,\n });\n if (existing) {\n throw new EntityConflictError({ entity: 'identity-provider-role-mapping' });\n }\n\n if (validated.provider) {\n validated.provider_realm_id = validated.provider.realm_id;\n }\n\n if (validated.role) {\n validated.role_realm_id = validated.role.realm_id;\n }\n\n if (\n validated.role_realm_id &&\n validated.provider_realm_id &&\n validated.role_realm_id !== validated.provider_realm_id\n ) {\n throw new ValidationError('It is not possible to map an identity provider to a role of another realm.');\n }\n\n if (validated.role && actor.identity) {\n const hasPermissions = await this.identityPermissionProvider.isSuperset(\n {\n type: actor.identity.type,\n id: actor.identity.data.id,\n },\n {\n type: 'role',\n id: validated.role_id,\n clientId: validated.role.client_id,\n },\n );\n if (!hasPermissions) {\n throw new PermissionError({ message: 'You don\\'t own the required permissions.' });\n }\n }\n\n // Stamp the owner (identity-provider) realm so the realm_scope factor gates cross-realm writes.\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.IDENTITY_PROVIDER_ROLE_CREATE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: this.junctionAttributes(validated),\n [BuiltInPolicyType.REALM_MATCH]: this.junctionResourceRealm(validated),\n }),\n });\n\n let entity = this.repository.create(validated);\n entity = await this.repository.save(entity);\n\n return entity;\n }\n\n async update(\n id: string,\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<IdentityProviderRoleMapping> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.IDENTITY_PROVIDER_ROLE_UPDATE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n const validated = await this.validator.run(data, { group: ValidatorGroup.UPDATE });\n\n await this.repository.validateJoinColumns(validated);\n\n // `role_id` is immutable on update (CREATE-group only in the validator), so the conferred\n // role never changes here — only the attribute-matching criteria do. Still re-verify the\n // actor OWNS that role before letting it edit (e.g. broaden) the mapping, mirroring create()\n // and the permission-junction member gate (#3164): you may not modify a role-conferring\n // mapping for a role you no longer own.\n const role = await this.roleRepository.findOneById(entity.role_id);\n if (role && actor.identity) {\n const hasPermissions = await this.identityPermissionProvider.isSuperset(\n {\n type: actor.identity.type,\n id: actor.identity.data.id,\n },\n {\n type: 'role',\n id: role.id,\n clientId: role.client_id,\n },\n );\n if (!hasPermissions) {\n throw new PermissionError({ message: 'You don\\'t own the required permissions.' });\n }\n }\n\n const merged = this.repository.merge(entity, validated);\n\n // Stamp the owner (identity-provider) realm so the realm_scope factor gates cross-realm writes.\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.IDENTITY_PROVIDER_ROLE_UPDATE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: this.junctionAttributes(merged),\n [BuiltInPolicyType.REALM_MATCH]: this.junctionResourceRealm(merged),\n }),\n });\n\n return this.repository.save(merged);\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n ): Promise<IdentityProviderRoleMapping> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.IDENTITY_PROVIDER_ROLE_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n // Stamp the owner (identity-provider) realm so the realm_scope factor gates cross-realm writes.\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.IDENTITY_PROVIDER_ROLE_DELETE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: this.junctionAttributes(entity),\n [BuiltInPolicyType.REALM_MATCH]: this.junctionResourceRealm(entity),\n }),\n });\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n entity.id = entityId;\n\n return entity;\n }\n}\n"],"mappings":";;;;;;;;;AAuBA,IAAaU,qCAAb,cAAwDD,sBAAAA;CACjCE,gBAAgB;CAEzBC;CAEAC;CAEAC;CAEAC;CAEV,YAAYC,KAAgD;EACxD,MAAK;EACL,KAAKJ,aAAaI,IAAIJ;EACtB,KAAKC,iBAAiBG,IAAIH;EAC1B,KAAKC,6BAA6BE,IAAIF;EACtC,KAAKC,YAAY,IAAIR,qCAAAA;CACzB;CAEA,MAAMU,QACFC,OACAC,OACoE;EACpE,MAAMA,MAAMC,oBAAoBC,iBAAiB,EAC7CC,MAAM;GACFd,eAAee;GACff,eAAegB;GACfhB,eAAeiB;GACfjB,eAAekB;IAEvB,CAAA;EAEA,OAAO,KAAKd,WAAWe,SAAST,KAAAA;CACpC;CAEA,MAAMU,OACFC,IACAV,OACoC;EACpC,MAAMA,MAAMC,oBAAoBC,iBAAiB,EAC7CC,MAAM;GACFd,eAAee;GACff,eAAegB;GACfhB,eAAeiB;GACfjB,eAAekB;IAEvB,CAAA;EAEA,MAAMI,SAAS,MAAM,KAAKlB,WAAWmB,UAAU,EAAEF,GAAG,CAAA;EACpD,IAAI,CAACC,QACD,MAAM,IAAI1B,oBAAAA;EAGd,OAAO0B;CACX;CAEA,MAAME,OACFC,MACAd,OACo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;EACpD,IAAI,CAACC,QACD,MAAM,IAAI1B,oBAAAA;EAId,MAAMe,MAAMC,oBAAoBoC,SAAS;GACrClC,MAAMd,eAAe6D;GACrBpC,MAAM/B,iBAAiB;KAClBF,kBAAkByD,aAAa,KAAKC,mBAAmB5B,MAAAA;KACvD9B,kBAAkB2D,cAAc,KAAKC,sBAAsB9B,MAAAA;GAChE,CAAA;EACJ,CAAA;EAEA,MAAM,EAAED,IAAIyC,aAAaxC;EACzB,MAAM,KAAKlB,WAAW2D,OAAOzC,MAAAA;EAC7BA,OAAOD,KAAKyC;EAEZ,OAAOxC;CACX;AACJ"}
@@ -2,7 +2,10 @@ export * from './client/index.ts';
2
2
  export * from './client-permission/index.ts';
3
3
  export * from './client-role/index.ts';
4
4
  export * from './client-scope/index.ts';
5
+ export * from './consent/index.ts';
6
+ export * from './event/index.ts';
5
7
  export * from './identity-provider/index.ts';
8
+ export * from './key/index.ts';
6
9
  export * from './permission/index.ts';
7
10
  export * from './permission-policy/index.ts';
8
11
  export * from './policy/index.ts';
@@ -14,8 +17,11 @@ export * from './role/index.ts';
14
17
  export * from './role-attribute/index.ts';
15
18
  export * from './role-permission/index.ts';
16
19
  export * from './scope/index.ts';
20
+ export * from './session/index.ts';
21
+ export * from './trust-anchor/index.ts';
17
22
  export * from './user/index.ts';
18
23
  export * from './user-attribute/index.ts';
24
+ export * from './user-authenticator/index.ts';
19
25
  export * from './user-permission/index.ts';
20
26
  export * from './user-role/index.ts';
21
27
  export * from './identity-provider-role-mapping/index.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/entities/index.ts"],"names":[],"mappings":"AAOA,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2CAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/entities/index.ts"],"names":[],"mappings":"AAOA,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2CAA2C,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
+ import { CONSENT_FILTER_KEYS, CONSENT_SCOPE_MAX_LENGTH } from "./consent/types.mjs";
4
5
  import { ClientService } from "./client/service.mjs";
5
6
  import { WebClientProvisioner, buildWebClientAttributes } from "./client/web-client.mjs";
6
7
  import "./client/index.mjs";
@@ -10,6 +11,16 @@ import { ClientRoleService } from "./client-role/service.mjs";
10
11
  import "./client-role/index.mjs";
11
12
  import { ClientScopeService } from "./client-scope/service.mjs";
12
13
  import "./client-scope/index.mjs";
14
+ import { ConsentService } from "./consent/service.mjs";
15
+ import "./consent/index.mjs";
16
+ import { EVENT_LOG_RETENTION_DAYS_DEFAULT } from "./event/constants.mjs";
17
+ import { EVENT_DIFF_SECRET_KEY_REGEX, EVENT_DIFF_VALUE_MAX_LENGTH, buildEntityDiff } from "./event/diff.mjs";
18
+ import { EntityEventHandler } from "./event/entity-event-handler.mjs";
19
+ import { sanitizeEventData } from "./event/sanitize.mjs";
20
+ import { EventService } from "./event/service.mjs";
21
+ import "./event/index.mjs";
22
+ import { KeyService } from "./key/service.mjs";
23
+ import "./key/index.mjs";
13
24
  import { PermissionService } from "./permission/service.mjs";
14
25
  import "./permission/index.mjs";
15
26
  import { PermissionPolicyService } from "./permission-policy/service.mjs";
@@ -32,14 +43,24 @@ import { RolePermissionService } from "./role-permission/service.mjs";
32
43
  import "./role-permission/index.mjs";
33
44
  import { ScopeService } from "./scope/service.mjs";
34
45
  import "./scope/index.mjs";
46
+ import { SessionService } from "./session/service.mjs";
47
+ import "./session/index.mjs";
48
+ import { TrustAnchorService } from "./trust-anchor/service.mjs";
49
+ import "./trust-anchor/index.mjs";
35
50
  import { UserService } from "./user/service.mjs";
36
51
  import "./user/index.mjs";
37
52
  import { UserAttributeService } from "./user-attribute/service.mjs";
38
53
  import "./user-attribute/index.mjs";
54
+ import { USER_AUTHENTICATOR_ATTEMPT_CACHE_PREFIX, USER_AUTHENTICATOR_ATTEMPT_LOCK_FACTOR, USER_AUTHENTICATOR_ATTEMPT_LOCK_MAX, USER_AUTHENTICATOR_ATTEMPT_WINDOW, USER_AUTHENTICATOR_EMAIL_CODE_CACHE_PREFIX, USER_AUTHENTICATOR_EMAIL_CODE_EXPIRES_IN_MINUTES, USER_AUTHENTICATOR_EMAIL_CODE_LENGTH, USER_AUTHENTICATOR_EMAIL_SEND_CACHE_PREFIX, USER_AUTHENTICATOR_EMAIL_SEND_COOLDOWN, USER_AUTHENTICATOR_RECOVERY_CODE_COUNT, USER_AUTHENTICATOR_THROTTLE_CACHE_PREFIX, USER_AUTHENTICATOR_TOTP_ALGORITHM, USER_AUTHENTICATOR_TOTP_DIGITS, USER_AUTHENTICATOR_TOTP_PERIOD, USER_AUTHENTICATOR_VERIFY_LOCK_CACHE_PREFIX, USER_AUTHENTICATOR_VERIFY_LOCK_RENEW_INTERVAL, USER_AUTHENTICATOR_VERIFY_LOCK_TTL, USER_AUTHENTICATOR_WEBAUTHN_AUTH_CACHE_PREFIX, USER_AUTHENTICATOR_WEBAUTHN_CHALLENGE_WINDOW, USER_AUTHENTICATOR_WEBAUTHN_REG_CACHE_PREFIX } from "./user-authenticator/constants.mjs";
55
+ import { generateNumericCode, generateRecoveryCode, guessUserAuthenticatorKindByResponse } from "./user-authenticator/helpers.mjs";
56
+ import { buildWebauthnAuthenticationOptions, buildWebauthnRegistrationOptions, verifyWebauthnAuthentication, verifyWebauthnRegistration } from "./user-authenticator/webauthn.mjs";
57
+ import { UserAuthenticatorService } from "./user-authenticator/service.mjs";
58
+ import { USER_AUTHENTICATOR_FILTER_KEYS } from "./user-authenticator/types.mjs";
59
+ import "./user-authenticator/index.mjs";
39
60
  import { UserPermissionService } from "./user-permission/service.mjs";
40
61
  import "./user-permission/index.mjs";
41
62
  import { UserRoleService } from "./user-role/service.mjs";
42
63
  import "./user-role/index.mjs";
43
64
  import { IdentityProviderRoleMappingService } from "./identity-provider-role-mapping/service.mjs";
44
65
  import "./identity-provider-role-mapping/index.mjs";
45
- export { ClientPermissionService, ClientRoleService, ClientScopeService, ClientService, IdentityProviderRoleMappingService, PermissionPolicyService, PermissionService, PolicyService, RealmService, RobotPermissionService, RobotRoleService, RobotService, RoleAttributeService, RolePermissionService, RoleService, ScopeService, UserAttributeService, UserPermissionService, UserRoleService, UserService, WebClientProvisioner, buildWebClientAttributes };
66
+ export { CONSENT_FILTER_KEYS, CONSENT_SCOPE_MAX_LENGTH, ClientPermissionService, ClientRoleService, ClientScopeService, ClientService, ConsentService, EVENT_DIFF_SECRET_KEY_REGEX, EVENT_DIFF_VALUE_MAX_LENGTH, EVENT_LOG_RETENTION_DAYS_DEFAULT, EntityEventHandler, EventService, IdentityProviderRoleMappingService, KeyService, PermissionPolicyService, PermissionService, PolicyService, RealmService, RobotPermissionService, RobotRoleService, RobotService, RoleAttributeService, RolePermissionService, RoleService, ScopeService, SessionService, TrustAnchorService, USER_AUTHENTICATOR_ATTEMPT_CACHE_PREFIX, USER_AUTHENTICATOR_ATTEMPT_LOCK_FACTOR, USER_AUTHENTICATOR_ATTEMPT_LOCK_MAX, USER_AUTHENTICATOR_ATTEMPT_WINDOW, USER_AUTHENTICATOR_EMAIL_CODE_CACHE_PREFIX, USER_AUTHENTICATOR_EMAIL_CODE_EXPIRES_IN_MINUTES, USER_AUTHENTICATOR_EMAIL_CODE_LENGTH, USER_AUTHENTICATOR_EMAIL_SEND_CACHE_PREFIX, USER_AUTHENTICATOR_EMAIL_SEND_COOLDOWN, USER_AUTHENTICATOR_FILTER_KEYS, USER_AUTHENTICATOR_RECOVERY_CODE_COUNT, USER_AUTHENTICATOR_THROTTLE_CACHE_PREFIX, USER_AUTHENTICATOR_TOTP_ALGORITHM, USER_AUTHENTICATOR_TOTP_DIGITS, USER_AUTHENTICATOR_TOTP_PERIOD, USER_AUTHENTICATOR_VERIFY_LOCK_CACHE_PREFIX, USER_AUTHENTICATOR_VERIFY_LOCK_RENEW_INTERVAL, USER_AUTHENTICATOR_VERIFY_LOCK_TTL, USER_AUTHENTICATOR_WEBAUTHN_AUTH_CACHE_PREFIX, USER_AUTHENTICATOR_WEBAUTHN_CHALLENGE_WINDOW, USER_AUTHENTICATOR_WEBAUTHN_REG_CACHE_PREFIX, UserAttributeService, UserAuthenticatorService, UserPermissionService, UserRoleService, UserService, WebClientProvisioner, buildEntityDiff, buildWebClientAttributes, buildWebauthnAuthenticationOptions, buildWebauthnRegistrationOptions, generateNumericCode, generateRecoveryCode, guessUserAuthenticatorKindByResponse, sanitizeEventData, verifyWebauthnAuthentication, verifyWebauthnRegistration };
@@ -0,0 +1,3 @@
1
+ export * from './service.ts';
2
+ export * from './types.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/key/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { KeyService } from "./service.mjs";
5
+ export { KeyService };
@@ -0,0 +1,55 @@
1
+ import type { Key } from '@authup/core-kit';
2
+ import { EventName, KeyValidator } from '@authup/core-kit';
3
+ import type { ActorContext, EntityRepositoryFindManyResult } from '@authup/server-kit';
4
+ import { AbstractEntityService } from '@authup/server-kit';
5
+ import { JWKType, JWKUse, JWTAlgorithm } from '@authup/specs';
6
+ import type { EventRequestContext, IEventService } from '../event/index.ts';
7
+ import type { IKeyRepository, IKeyService, KeyDeleteOptions } from './types.ts';
8
+ export type KeyServiceContext = {
9
+ repository: IKeyRepository;
10
+ eventService?: IEventService;
11
+ requestContext?: () => EventRequestContext | undefined;
12
+ };
13
+ export declare class KeyService extends AbstractEntityService implements IKeyService {
14
+ protected repository: IKeyRepository;
15
+ protected validator: KeyValidator;
16
+ protected eventService?: IEventService;
17
+ protected requestContext?: () => EventRequestContext | undefined;
18
+ constructor(ctx: KeyServiceContext);
19
+ getMany(query: Record<string, any>, actor: ActorContext): Promise<EntityRepositoryFindManyResult<Key>>;
20
+ getOne(idOrName: string, actor: ActorContext, realmId?: string): Promise<Key>;
21
+ create(data: Record<string, any>, actor: ActorContext): Promise<Key>;
22
+ update(idOrName: string, data: Record<string, any>, actor: ActorContext, realmId?: string): Promise<Key>;
23
+ delete(id: string, actor: ActorContext, options?: KeyDeleteOptions): Promise<Key>;
24
+ /**
25
+ * Metadata-only audit trail for key lifecycle operations (issue #3269) —
26
+ * keys deliberately have no entity subscriber (private material must stay
27
+ * off the realtime/audit bus), so the security-relevant mutations are
28
+ * recorded explicitly. The payload never carries key material.
29
+ */
30
+ protected recordEvent(name: `${EventName}`, entity: Key, actor: ActorContext, data?: Record<string, any>): Promise<void>;
31
+ protected pickAuditFields(entity: Key): Record<string, any>;
32
+ protected generateMaterial(validated: Partial<Key>, use: `${JWKUse}`): Promise<{
33
+ type: `${JWKType}`;
34
+ signatureAlgorithm: `${JWTAlgorithm}` | null;
35
+ decryptionKey: string;
36
+ encryptionKey: string | null;
37
+ }>;
38
+ protected importMaterial(validated: Partial<Key>, use: `${JWKUse}`): Promise<{
39
+ type: `${JWKType}`;
40
+ signatureAlgorithm: `${JWTAlgorithm}` | null;
41
+ decryptionKey: string;
42
+ encryptionKey: string | null;
43
+ }>;
44
+ protected buildAsymmetricOptions(algorithm: `${JWTAlgorithm}`): {
45
+ name: import("@authup/server-kit").CryptoAsymmetricAlgorithm;
46
+ hash: string;
47
+ namedCurve?: undefined;
48
+ } | {
49
+ name: import("@authup/server-kit").CryptoAsymmetricAlgorithm;
50
+ namedCurve: string;
51
+ hash?: undefined;
52
+ };
53
+ protected normalizeMaterial(value: string): string;
54
+ }
55
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/key/service.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAEH,SAAS,EAGT,YAAY,EAEf,MAAM,kBAAkB,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iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAI,MAAM;CAUtD"}
@@ -0,0 +1,301 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { buildEntityDiff } from "../event/diff.mjs";
5
+ import "../event/index.mjs";
6
+ import { assertCertificateMatchesKey, parseCertificateChain } from "../../key/certificate.mjs";
7
+ import { isWrappedKeyMaterial } from "../../key/wrap.mjs";
8
+ import "../../key/index.mjs";
9
+ import { ValidatorGroup, arrayBufferToBase64, base64ToArrayBuffer, createNanoID } from "@authup/kit";
10
+ import { EntityType, EventName, EventScope, KeyStatus, KeyValidator, PermissionName } from "@authup/core-kit";
11
+ import { AbstractEntityService, AsymmetricKey, createAsymmetricKeyPair } from "@authup/server-kit";
12
+ import { BuiltInPolicyType, definePolicyData } from "@authup/access";
13
+ import { EntityConflictError, EntityNotFoundError, ValidationError, isError } from "@authup/errors";
14
+ import { JWKType, JWKUse, JWTAlgorithm } from "@authup/specs";
15
+ import { getRandomValues } from "uncrypto";
16
+ //#region src/core/entities/key/service.ts
17
+ const PERMISSION_NAMES = [
18
+ PermissionName.KEY_READ,
19
+ PermissionName.KEY_UPDATE,
20
+ PermissionName.KEY_DELETE
21
+ ];
22
+ var KeyService = class extends AbstractEntityService {
23
+ repository;
24
+ validator;
25
+ eventService;
26
+ requestContext;
27
+ constructor(ctx) {
28
+ super();
29
+ this.repository = ctx.repository;
30
+ this.validator = new KeyValidator();
31
+ this.eventService = ctx.eventService;
32
+ this.requestContext = ctx.requestContext;
33
+ }
34
+ async getMany(query, actor) {
35
+ await actor.permissionEvaluator.preEvaluateOneOf({ name: PERMISSION_NAMES });
36
+ const { data: entities, meta } = await this.repository.findMany(query);
37
+ const data = [];
38
+ let { total } = meta;
39
+ for (const entity of entities) try {
40
+ await actor.permissionEvaluator.evaluateOneOf({
41
+ name: PERMISSION_NAMES,
42
+ data: definePolicyData({
43
+ [BuiltInPolicyType.ATTRIBUTES]: entity,
44
+ ...this.resourceRealmMatch(entity)
45
+ })
46
+ });
47
+ entity.decryption_key = null;
48
+ data.push(entity);
49
+ } catch {
50
+ total -= 1;
51
+ }
52
+ return {
53
+ data,
54
+ meta: {
55
+ ...meta,
56
+ total
57
+ }
58
+ };
59
+ }
60
+ async getOne(idOrName, actor, realmId) {
61
+ await actor.permissionEvaluator.preEvaluateOneOf({ name: PERMISSION_NAMES });
62
+ const entity = await this.repository.findOneByIdOrName(idOrName, realmId);
63
+ if (!entity) throw new EntityNotFoundError();
64
+ await actor.permissionEvaluator.evaluateOneOf({
65
+ name: PERMISSION_NAMES,
66
+ data: definePolicyData({
67
+ [BuiltInPolicyType.ATTRIBUTES]: entity,
68
+ ...this.resourceRealmMatch(entity)
69
+ })
70
+ });
71
+ entity.decryption_key = null;
72
+ return entity;
73
+ }
74
+ async create(data, actor) {
75
+ await actor.permissionEvaluator.preEvaluate({ name: PermissionName.KEY_CREATE });
76
+ const validated = await this.validator.run(data, { group: ValidatorGroup.CREATE });
77
+ const { use } = validated;
78
+ if (!use) throw new ValidationError("A key use must be specified.");
79
+ await this.repository.validateJoinColumns(validated);
80
+ if (!validated.realm_id && actor.identity) {
81
+ const actorRealmId = this.getActorRealmId(actor);
82
+ if (actorRealmId) validated.realm_id = actorRealmId;
83
+ }
84
+ if (!validated.realm_id) throw new ValidationError("A realm must be specified.");
85
+ await actor.permissionEvaluator.evaluate({
86
+ name: PermissionName.KEY_CREATE,
87
+ data: definePolicyData({
88
+ [BuiltInPolicyType.ATTRIBUTES]: validated,
89
+ ...this.resourceRealmMatch(validated)
90
+ })
91
+ });
92
+ if (!validated.name) validated.name = `${use}-${createNanoID(10)}`;
93
+ await this.repository.checkUniqueness(validated);
94
+ if (typeof validated.priority !== "number") {
95
+ const highest = await this.repository.findHighestPriority(validated.realm_id, use);
96
+ validated.priority = typeof highest === "number" ? highest + 1 : 0;
97
+ }
98
+ if (!validated.status) validated.status = KeyStatus.ACTIVE;
99
+ const certificate = typeof validated.certificate === "string" ? validated.certificate : null;
100
+ if (certificate && (!validated.decryption_key || use !== JWKUse.SIGNATURE)) throw new ValidationError("A certificate requires imported signature key material.");
101
+ const material = validated.decryption_key ? await this.importMaterial(validated, use) : await this.generateMaterial(validated, use);
102
+ if (certificate) {
103
+ if (!material.encryptionKey) throw new ValidationError("A certificate requires imported signature key material.");
104
+ try {
105
+ assertCertificateMatchesKey(parseCertificateChain(certificate), material.encryptionKey);
106
+ } catch (e) {
107
+ throw new ValidationError(isError(e) ? e.message : "The certificate could not be matched against the imported key material.");
108
+ }
109
+ }
110
+ let entity = this.repository.create({
111
+ ...validated,
112
+ type: material.type,
113
+ signature_algorithm: material.signatureAlgorithm,
114
+ decryption_key: material.decryptionKey,
115
+ encryption_key: material.encryptionKey
116
+ });
117
+ entity = await this.repository.save(entity);
118
+ entity.decryption_key = null;
119
+ await this.recordEvent(EventName.CREATED, entity, actor);
120
+ return entity;
121
+ }
122
+ async update(idOrName, data, actor, realmId) {
123
+ await actor.permissionEvaluator.preEvaluate({ name: PermissionName.KEY_UPDATE });
124
+ let entity = await this.repository.findOneByIdOrName(idOrName, realmId);
125
+ if (!entity) throw new EntityNotFoundError();
126
+ const validated = await this.validator.run(data, { group: ValidatorGroup.UPDATE });
127
+ await actor.permissionEvaluator.evaluate({
128
+ name: PermissionName.KEY_UPDATE,
129
+ data: definePolicyData({
130
+ [BuiltInPolicyType.ATTRIBUTES]: {
131
+ ...entity,
132
+ ...validated
133
+ },
134
+ ...this.resourceRealmMatch(entity)
135
+ })
136
+ });
137
+ if (validated.name && validated.name !== entity.name) await this.repository.checkUniqueness({
138
+ name: validated.name,
139
+ realm_id: entity.realm_id
140
+ }, entity);
141
+ const previous = this.pickAuditFields(entity);
142
+ entity = this.repository.merge(entity, validated);
143
+ await this.repository.save(entity);
144
+ entity.decryption_key = null;
145
+ const diff = buildEntityDiff(this.pickAuditFields(entity), previous);
146
+ await this.recordEvent(EventName.UPDATED, entity, actor, { ...Object.keys(diff).length > 0 ? { diff } : {} });
147
+ return entity;
148
+ }
149
+ async delete(id, actor, options = {}) {
150
+ await actor.permissionEvaluator.preEvaluate({ name: PermissionName.KEY_DELETE });
151
+ const entity = await this.repository.findOneBy({ id });
152
+ if (!entity) throw new EntityNotFoundError();
153
+ await actor.permissionEvaluator.evaluate({
154
+ name: PermissionName.KEY_DELETE,
155
+ data: definePolicyData({
156
+ [BuiltInPolicyType.ATTRIBUTES]: entity,
157
+ ...this.resourceRealmMatch(entity)
158
+ })
159
+ });
160
+ if (entity.use === JWKUse.ENCRYPTION && !options.force) {
161
+ const references = await this.repository.countBlobReferences(entity.id);
162
+ if (references > 0) throw new EntityConflictError({
163
+ message: `The encryption key is still referenced by ${references} encrypted secret(s) — deleting it makes them unrecoverable. Repeat with force to crypto-shred them.`,
164
+ data: { references }
165
+ });
166
+ }
167
+ const { id: entityId } = entity;
168
+ await this.repository.remove(entity);
169
+ entity.id = entityId;
170
+ entity.decryption_key = null;
171
+ const forcedCryptoShred = entity.use === JWKUse.ENCRYPTION && !!options.force;
172
+ await this.recordEvent(EventName.DELETED, entity, actor, { ...forcedCryptoShred ? { force: true } : {} });
173
+ return entity;
174
+ }
175
+ /**
176
+ * Metadata-only audit trail for key lifecycle operations (issue #3269) —
177
+ * keys deliberately have no entity subscriber (private material must stay
178
+ * off the realtime/audit bus), so the security-relevant mutations are
179
+ * recorded explicitly. The payload never carries key material.
180
+ */ async recordEvent(name, entity, actor, data = {}) {
181
+ const requestContext = this.requestContext ? this.requestContext() : void 0;
182
+ await this.eventService?.record({
183
+ scope: EventScope.ENTITY,
184
+ name,
185
+ refType: EntityType.KEY,
186
+ refId: entity.id,
187
+ realmId: entity.realm_id ?? null,
188
+ actorType: actor.identity?.type ?? null,
189
+ actorId: actor.identity?.data.id ?? null,
190
+ actorName: actor.identity?.data.name ?? null,
191
+ requestPath: requestContext?.requestPath ?? null,
192
+ requestMethod: requestContext?.requestMethod ?? null,
193
+ requestIpAddress: requestContext?.requestIpAddress ?? null,
194
+ requestUserAgent: requestContext?.requestUserAgent ?? null,
195
+ data: {
196
+ name: entity.name,
197
+ use: entity.use,
198
+ status: entity.status,
199
+ ...data
200
+ }
201
+ });
202
+ }
203
+ pickAuditFields(entity) {
204
+ return {
205
+ name: entity.name,
206
+ priority: entity.priority,
207
+ status: entity.status
208
+ };
209
+ }
210
+ async generateMaterial(validated, use) {
211
+ if (use === JWKUse.ENCRYPTION) {
212
+ if (validated.signature_algorithm) throw new ValidationError("An encryption key can not carry a signature algorithm.");
213
+ const raw = /* @__PURE__ */ new Uint8Array(32);
214
+ getRandomValues(raw);
215
+ return {
216
+ type: JWKType.OCT,
217
+ signatureAlgorithm: null,
218
+ decryptionKey: arrayBufferToBase64(raw.buffer),
219
+ encryptionKey: null
220
+ };
221
+ }
222
+ const algorithm = validated.signature_algorithm ?? JWTAlgorithm.RS256;
223
+ const keyPair = await createAsymmetricKeyPair(this.buildAsymmetricOptions(algorithm));
224
+ return {
225
+ type: algorithm.startsWith("ES") ? JWKType.EC : JWKType.RSA,
226
+ signatureAlgorithm: algorithm,
227
+ decryptionKey: await new AsymmetricKey(keyPair.privateKey).toBase64(),
228
+ encryptionKey: await new AsymmetricKey(keyPair.publicKey).toBase64()
229
+ };
230
+ }
231
+ async importMaterial(validated, use) {
232
+ if (!validated.decryption_key) throw new ValidationError("Importing key material requires its private part (decryption_key).");
233
+ if (isWrappedKeyMaterial(validated.decryption_key.trim())) throw new ValidationError("The imported key material is not valid.");
234
+ const decryptionKey = this.normalizeMaterial(validated.decryption_key);
235
+ if (use === JWKUse.ENCRYPTION) {
236
+ if (validated.signature_algorithm) throw new ValidationError("An encryption key can not carry a signature algorithm.");
237
+ if (validated.encryption_key) throw new ValidationError("An encryption key holds no public part.");
238
+ let byteLength;
239
+ try {
240
+ byteLength = base64ToArrayBuffer(decryptionKey).byteLength;
241
+ } catch {
242
+ throw new ValidationError("The key material is not valid base64.");
243
+ }
244
+ if (byteLength !== 32) throw new ValidationError("The key material must be 32 base64-encoded bytes.");
245
+ return {
246
+ type: JWKType.OCT,
247
+ signatureAlgorithm: null,
248
+ decryptionKey,
249
+ encryptionKey: null
250
+ };
251
+ }
252
+ if (!validated.encryption_key) throw new ValidationError("Importing a signature key requires its public part (encryption_key, SPKI).");
253
+ const encryptionKey = this.normalizeMaterial(validated.encryption_key);
254
+ const algorithm = validated.signature_algorithm ?? JWTAlgorithm.RS256;
255
+ const options = this.buildAsymmetricOptions(algorithm);
256
+ let privateJwk;
257
+ let publicJwk;
258
+ try {
259
+ const privateKey = await AsymmetricKey.fromBase64({
260
+ format: "pkcs8",
261
+ key: decryptionKey,
262
+ options
263
+ });
264
+ const publicKey = await AsymmetricKey.fromBase64({
265
+ format: "spki",
266
+ key: encryptionKey,
267
+ options
268
+ });
269
+ privateJwk = await privateKey.toJWK();
270
+ publicJwk = await publicKey.toJWK();
271
+ } catch {
272
+ throw new ValidationError(`The key material could not be imported for ${algorithm}.`);
273
+ }
274
+ if ([
275
+ "kty",
276
+ "n",
277
+ "e",
278
+ "crv",
279
+ "x",
280
+ "y"
281
+ ].some((component) => publicJwk[component] !== void 0 && publicJwk[component] !== privateJwk[component])) throw new ValidationError("The private and public key material do not form a pair.");
282
+ return {
283
+ type: algorithm.startsWith("ES") ? JWKType.EC : JWKType.RSA,
284
+ signatureAlgorithm: algorithm,
285
+ decryptionKey,
286
+ encryptionKey
287
+ };
288
+ }
289
+ buildAsymmetricOptions(algorithm) {
290
+ if (!/^(RS|ES)(256|384|512)$/.test(algorithm)) throw new ValidationError(`The signature algorithm ${algorithm} is not supported for stored keys.`);
291
+ return AsymmetricKey.buildImportOptionsForJWTAlgorithm(algorithm);
292
+ }
293
+ normalizeMaterial(value) {
294
+ if (value.includes("-----BEGIN")) return value.replace(/-----(BEGIN|END)[^-]+-----/g, "").replace(/\s+/g, "");
295
+ return value.trim();
296
+ }
297
+ };
298
+ //#endregion
299
+ export { KeyService };
300
+
301
+ //# sourceMappingURL=service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.mjs","names":["BuiltInPolicyType","definePolicyData","EntityConflictError","EntityNotFoundError","ValidationError","isError","isRawError","EntityType","EventName","EventScope","KeyStatus","KeyValidator","PermissionName","ValidatorGroup","arrayBufferToBase64","base64ToArrayBuffer","createNanoID","AbstractEntityService","AsymmetricKey","createAsymmetricKeyPair","JWKType","JWKUse","JWTAlgorithm","getRandomValues","buildEntityDiff","assertCertificateMatchesKey","isWrappedKeyMaterial","parseCertificateChain","PERMISSION_NAMES","KEY_READ","KEY_UPDATE","KEY_DELETE","KeyService","repository","validator","eventService","requestContext","ctx","getMany","query","actor","permissionEvaluator","preEvaluateOneOf","name","data","entities","meta","findMany","total","entity","evaluateOneOf","ATTRIBUTES","resourceRealmMatch","decryption_key","push","getOne","idOrName","realmId","findOneByIdOrName","create","preEvaluate","KEY_CREATE","validated","run","group","CREATE","use","validateJoinColumns","realm_id","identity","actorRealmId","getActorRealmId","evaluate","checkUniqueness","priority","highest","findHighestPriority","status","ACTIVE","certificate","SIGNATURE","material","importMaterial","generateMaterial","encryptionKey","chain","e","message","type","signature_algorithm","signatureAlgorithm","decryptionKey","encryption_key","save","recordEvent","CREATED","update","UPDATE","previous","pickAuditFields","merge","diff","UPDATED","Object","keys","length","delete","id","options","findOneBy","ENCRYPTION","force","references","countBlobReferences","entityId","remove","forcedCryptoShred","DELETED","undefined","record","scope","ENTITY","refType","KEY","refId","actorType","actorId","actorName","requestPath","requestMethod","requestIpAddress","requestUserAgent","raw","Uint8Array","OCT","buffer","algorithm","RS256","buildAsymmetricOptions","keyPair","startsWith","EC","RSA","privateKey","toBase64","publicKey","trim","normalizeMaterial","byteLength","privateJwk","publicJwk","fromBase64","format","key","toJWK","components","mismatch","some","component","test","buildImportOptionsForJWTAlgorithm","value","includes","replace"],"sources":["../../../../src/core/entities/key/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BuiltInPolicyType, definePolicyData } from '@authup/access';\nimport {\n EntityConflictError,\n EntityNotFoundError,\n ValidationError,\n isError as isRawError,\n} from '@authup/errors';\nimport type { Key } from '@authup/core-kit';\nimport {\n EntityType,\n EventName,\n EventScope,\n KeyStatus,\n KeyValidator,\n PermissionName,\n} from '@authup/core-kit';\nimport {\n ValidatorGroup,\n arrayBufferToBase64,\n base64ToArrayBuffer,\n createNanoID,\n} from '@authup/kit';\nimport type { ActorContext, EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport { AbstractEntityService, AsymmetricKey, createAsymmetricKeyPair } from '@authup/server-kit';\nimport { JWKType, JWKUse, JWTAlgorithm } from '@authup/specs';\nimport { getRandomValues } from 'uncrypto';\nimport { buildEntityDiff } from '../event/index.ts';\nimport type { EventRequestContext, IEventService } from '../event/index.ts';\nimport { assertCertificateMatchesKey, isWrappedKeyMaterial, parseCertificateChain } from '../../key/index.ts';\nimport type { IKeyRepository, IKeyService, KeyDeleteOptions } from './types.ts';\n\nexport type KeyServiceContext = {\n repository: IKeyRepository;\n eventService?: IEventService;\n requestContext?: () => EventRequestContext | undefined;\n};\n\nconst PERMISSION_NAMES = [\n PermissionName.KEY_READ,\n PermissionName.KEY_UPDATE,\n PermissionName.KEY_DELETE,\n];\n\nexport class KeyService extends AbstractEntityService implements IKeyService {\n protected repository: IKeyRepository;\n\n protected validator: KeyValidator;\n\n protected eventService?: IEventService;\n\n protected requestContext?: () => EventRequestContext | undefined;\n\n constructor(ctx: KeyServiceContext) {\n super();\n this.repository = ctx.repository;\n this.validator = new KeyValidator();\n this.eventService = ctx.eventService;\n this.requestContext = ctx.requestContext;\n }\n\n async getMany(\n query: Record<string, any>,\n actor: ActorContext,\n ): Promise<EntityRepositoryFindManyResult<Key>> {\n await actor.permissionEvaluator.preEvaluateOneOf({ name: PERMISSION_NAMES });\n\n const { data: entities, meta } = await this.repository.findMany(query);\n\n const data: Key[] = [];\n let { total } = meta;\n\n for (const entity of entities) {\n try {\n await actor.permissionEvaluator.evaluateOneOf({\n name: PERMISSION_NAMES,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: entity,\n ...this.resourceRealmMatch(entity),\n }),\n });\n // Belt-and-braces: the read projection never selects private\n // material, but null it explicitly so no future adapter change\n // can leak it onto a read surface (cf. authentik CVE-2024-42490).\n entity.decryption_key = null;\n data.push(entity);\n } catch {\n total -= 1;\n }\n }\n\n return {\n data,\n meta: {\n ...meta,\n total,\n },\n };\n }\n\n async getOne(\n idOrName: string,\n actor: ActorContext,\n realmId?: string,\n ): Promise<Key> {\n await actor.permissionEvaluator.preEvaluateOneOf({ name: PERMISSION_NAMES });\n\n const entity = await this.repository.findOneByIdOrName(idOrName, realmId);\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n await actor.permissionEvaluator.evaluateOneOf({\n name: PERMISSION_NAMES,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: entity,\n ...this.resourceRealmMatch(entity),\n }),\n });\n\n // Belt-and-braces null of private material (see getMany).\n entity.decryption_key = null;\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Key> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.KEY_CREATE });\n\n const validated = await this.validator.run(data, { group: ValidatorGroup.CREATE });\n const { use } = validated;\n if (!use) {\n throw new ValidationError('A key use must be specified.');\n }\n\n await this.repository.validateJoinColumns(validated);\n\n if (!validated.realm_id && actor.identity) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realm_id = actorRealmId;\n }\n }\n\n // keys are realm-bound infrastructure — no global (null realm) keys\n // via the API.\n if (!validated.realm_id) {\n throw new ValidationError('A realm must be specified.');\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.KEY_CREATE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: validated,\n ...this.resourceRealmMatch(validated),\n }),\n });\n\n if (!validated.name) {\n validated.name = `${use}-${createNanoID(10)}`;\n }\n\n await this.repository.checkUniqueness(validated);\n\n if (typeof validated.priority !== 'number') {\n const highest = await this.repository.findHighestPriority(validated.realm_id, use);\n // generate doubles as rotate: a new key outranks the current one.\n validated.priority = typeof highest === 'number' ? highest + 1 : 0;\n }\n\n if (!validated.status) {\n validated.status = KeyStatus.ACTIVE;\n }\n\n const certificate = typeof validated.certificate === 'string' ? validated.certificate : null;\n if (certificate && (!validated.decryption_key || use !== JWKUse.SIGNATURE)) {\n throw new ValidationError('A certificate requires imported signature key material.');\n }\n\n const material = validated.decryption_key ?\n await this.importMaterial(validated, use) :\n await this.generateMaterial(validated, use);\n\n if (certificate) {\n if (!material.encryptionKey) {\n throw new ValidationError('A certificate requires imported signature key material.');\n }\n\n try {\n const chain = parseCertificateChain(certificate);\n assertCertificateMatchesKey(chain, material.encryptionKey);\n } catch (e) {\n throw new ValidationError(\n isRawError(e) ?\n e.message :\n 'The certificate could not be matched against the imported key material.',\n );\n }\n }\n\n let entity = this.repository.create({\n ...validated,\n type: material.type,\n signature_algorithm: material.signatureAlgorithm,\n decryption_key: material.decryptionKey,\n encryption_key: material.encryptionKey,\n });\n\n entity = await this.repository.save(entity);\n\n // private material never leaves the server — the response carries\n // metadata + public part only (authentik CVE-2024-42490).\n entity.decryption_key = null;\n\n await this.recordEvent(EventName.CREATED, entity, actor);\n\n return entity;\n }\n\n async update(\n idOrName: string,\n data: Record<string, any>,\n actor: ActorContext,\n realmId?: string,\n ): Promise<Key> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.KEY_UPDATE });\n\n let entity = await this.repository.findOneByIdOrName(idOrName, realmId);\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n // only name / priority / status are mounted for UPDATE — material,\n // use, type and realm are immutable.\n const validated = await this.validator.run(data, { group: ValidatorGroup.UPDATE });\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.KEY_UPDATE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: {\n ...entity,\n ...validated,\n },\n ...this.resourceRealmMatch(entity),\n }),\n });\n\n if (validated.name && validated.name !== entity.name) {\n await this.repository.checkUniqueness({\n name: validated.name,\n realm_id: entity.realm_id,\n }, entity);\n }\n\n const previous = this.pickAuditFields(entity);\n\n entity = this.repository.merge(entity, validated);\n await this.repository.save(entity);\n\n entity.decryption_key = null;\n\n const diff = buildEntityDiff(this.pickAuditFields(entity), previous);\n await this.recordEvent(EventName.UPDATED, entity, actor, { ...(Object.keys(diff).length > 0 ? { diff } : {}) });\n\n return entity;\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n options: KeyDeleteOptions = {},\n ): Promise<Key> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.KEY_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.KEY_DELETE,\n data: definePolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: entity,\n ...this.resourceRealmMatch(entity),\n }),\n });\n\n if (entity.use === JWKUse.ENCRYPTION && !options.force) {\n const references = await this.repository.countBlobReferences(entity.id);\n if (references > 0) {\n throw new EntityConflictError({\n message: `The encryption key is still referenced by ${references} encrypted secret(s) — ` +\n 'deleting it makes them unrecoverable. Repeat with force to crypto-shred them.',\n data: { references },\n });\n }\n }\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n entity.id = entityId;\n entity.decryption_key = null;\n\n // force only carries crypto-shred semantics for encryption keys — a\n // sig-key delete with a stray force flag must not read as a shred.\n const forcedCryptoShred = entity.use === JWKUse.ENCRYPTION && !!options.force;\n await this.recordEvent(EventName.DELETED, entity, actor, { ...(forcedCryptoShred ? { force: true } : {}) });\n\n return entity;\n }\n\n // ------------------------------------------------------------------\n\n /**\n * Metadata-only audit trail for key lifecycle operations (issue #3269) —\n * keys deliberately have no entity subscriber (private material must stay\n * off the realtime/audit bus), so the security-relevant mutations are\n * recorded explicitly. The payload never carries key material.\n */\n protected async recordEvent(\n name: `${EventName}`,\n entity: Key,\n actor: ActorContext,\n data: Record<string, any> = {},\n ): Promise<void> {\n const requestContext = this.requestContext ?\n this.requestContext() :\n undefined;\n\n await this.eventService?.record({\n scope: EventScope.ENTITY,\n name,\n refType: EntityType.KEY,\n refId: entity.id,\n realmId: entity.realm_id ?? null,\n actorType: actor.identity?.type ?? null,\n actorId: actor.identity?.data.id ?? null,\n actorName: actor.identity?.data.name ?? null,\n requestPath: requestContext?.requestPath ?? null,\n requestMethod: requestContext?.requestMethod ?? null,\n requestIpAddress: requestContext?.requestIpAddress ?? null,\n requestUserAgent: requestContext?.requestUserAgent ?? null,\n data: {\n name: entity.name,\n use: entity.use,\n status: entity.status,\n ...data,\n },\n });\n }\n\n protected pickAuditFields(entity: Key): Record<string, any> {\n return {\n name: entity.name,\n priority: entity.priority,\n status: entity.status,\n };\n }\n\n protected async generateMaterial(\n validated: Partial<Key>,\n use: `${JWKUse}`,\n ) : Promise<{\n type: `${JWKType}`,\n signatureAlgorithm: `${JWTAlgorithm}` | null,\n decryptionKey: string,\n encryptionKey: string | null,\n }> {\n if (use === JWKUse.ENCRYPTION) {\n if (validated.signature_algorithm) {\n throw new ValidationError('An encryption key can not carry a signature algorithm.');\n }\n\n const raw = new Uint8Array(32);\n getRandomValues(raw);\n\n return {\n type: JWKType.OCT,\n signatureAlgorithm: null,\n decryptionKey: arrayBufferToBase64(raw.buffer),\n encryptionKey: null,\n };\n }\n\n const algorithm = validated.signature_algorithm ?? JWTAlgorithm.RS256;\n const options = this.buildAsymmetricOptions(algorithm);\n\n const keyPair = await createAsymmetricKeyPair(options);\n\n return {\n type: algorithm.startsWith('ES') ? JWKType.EC : JWKType.RSA,\n signatureAlgorithm: algorithm,\n decryptionKey: await new AsymmetricKey(keyPair.privateKey).toBase64(),\n encryptionKey: await new AsymmetricKey(keyPair.publicKey).toBase64(),\n };\n }\n\n protected async importMaterial(\n validated: Partial<Key>,\n use: `${JWKUse}`,\n ) : Promise<{\n type: `${JWKType}`,\n signatureAlgorithm: `${JWTAlgorithm}` | null,\n decryptionKey: string,\n encryptionKey: string | null,\n }> {\n if (!validated.decryption_key) {\n throw new ValidationError('Importing key material requires its private part (decryption_key).');\n }\n\n // Reject material masquerading as an at-rest KEK-wrapped blob — it\n // would be treated as wrapped on the next read (and, with a KEK,\n // fail GCM authentication).\n if (isWrappedKeyMaterial(validated.decryption_key.trim())) {\n throw new ValidationError('The imported key material is not valid.');\n }\n\n const decryptionKey = this.normalizeMaterial(validated.decryption_key);\n\n if (use === JWKUse.ENCRYPTION) {\n if (validated.signature_algorithm) {\n throw new ValidationError('An encryption key can not carry a signature algorithm.');\n }\n\n if (validated.encryption_key) {\n throw new ValidationError('An encryption key holds no public part.');\n }\n\n let byteLength : number;\n try {\n byteLength = base64ToArrayBuffer(decryptionKey).byteLength;\n } catch {\n throw new ValidationError('The key material is not valid base64.');\n }\n\n if (byteLength !== 32) {\n throw new ValidationError('The key material must be 32 base64-encoded bytes.');\n }\n\n return {\n type: JWKType.OCT,\n signatureAlgorithm: null,\n decryptionKey,\n encryptionKey: null,\n };\n }\n\n if (!validated.encryption_key) {\n throw new ValidationError('Importing a signature key requires its public part (encryption_key, SPKI).');\n }\n\n const encryptionKey = this.normalizeMaterial(validated.encryption_key);\n const algorithm = validated.signature_algorithm ?? JWTAlgorithm.RS256;\n const options = this.buildAsymmetricOptions(algorithm);\n\n let privateJwk : JsonWebKey;\n let publicJwk : JsonWebKey;\n\n try {\n const privateKey = await AsymmetricKey.fromBase64({\n format: 'pkcs8',\n key: decryptionKey,\n options,\n });\n const publicKey = await AsymmetricKey.fromBase64({\n format: 'spki',\n key: encryptionKey,\n options,\n });\n\n privateJwk = await privateKey.toJWK();\n publicJwk = await publicKey.toJWK();\n } catch {\n throw new ValidationError(`The key material could not be imported for ${algorithm}.`);\n }\n\n // the public components (RSA: n/e, EC: crv/x/y) must agree — a\n // private key paired with a foreign public part would publish a\n // wrong JWKS entry and break verification of every token it signs.\n const components : (keyof JsonWebKey)[] = ['kty', 'n', 'e', 'crv', 'x', 'y'];\n const mismatch = components.some(\n (component) => publicJwk[component] !== undefined &&\n publicJwk[component] !== privateJwk[component],\n );\n if (mismatch) {\n throw new ValidationError('The private and public key material do not form a pair.');\n }\n\n return {\n type: algorithm.startsWith('ES') ? JWKType.EC : JWKType.RSA,\n signatureAlgorithm: algorithm,\n decryptionKey,\n encryptionKey,\n };\n }\n\n protected buildAsymmetricOptions(algorithm: `${JWTAlgorithm}`) {\n if (!/^(RS|ES)(256|384|512)$/.test(algorithm)) {\n throw new ValidationError(`The signature algorithm ${algorithm} is not supported for stored keys.`);\n }\n\n return AsymmetricKey.buildImportOptionsForJWTAlgorithm(algorithm);\n }\n\n protected normalizeMaterial(value: string) : string {\n if (value.includes('-----BEGIN')) {\n // PEM body IS base64 DER — strip armor + whitespace.\n return value\n .replace(/-----(BEGIN|END)[^-]+-----/g, '')\n .replace(/\\s+/g, '');\n }\n\n return value.trim();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM4B,mBAAmB;CACrBhB,eAAeiB;CACfjB,eAAekB;CACflB,eAAemB;;AAGnB,IAAaC,aAAb,cAAgCf,sBAAAA;CAClBgB;CAEAC;CAEAC;CAEAC;CAEV,YAAYC,KAAwB;EAChC,MAAK;EACL,KAAKJ,aAAaI,IAAIJ;EACtB,KAAKC,YAAY,IAAIvB,aAAAA;EACrB,KAAKwB,eAAeE,IAAIF;EACxB,KAAKC,iBAAiBC,IAAID;CAC9B;CAEA,MAAME,QACFC,OACAC,OAC4C;EAC5C,MAAMA,MAAMC,oBAAoBC,iBAAiB,EAAEC,MAAMf,iBAAiB,CAAA;EAE1E,MAAM,EAAEgB,MAAMC,UAAUC,SAAS,MAAM,KAAKb,WAAWc,SAASR,KAAAA;EAEhE,MAAMK,OAAc,CAAA;EACpB,IAAI,EAAEI,UAAUF;EAEhB,KAAK,MAAMG,UAAUJ,UACjB,IAAI;GACA,MAAML,MAAMC,oBAAoBS,cAAc;IAC1CP,MAAMf;IACNgB,MA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MAAK;EACrC,QAAQ;GACJ,MAAM,IAAItJ,gBAAgB,8CAA8CoI,UAAU,EAAE;EACxF;EAUA,IAJiBmB;GAD0B;GAAO;GAAK;GAAK;GAAO;GAAK;EACvDA,CAAAA,CAAWE,MACvBC,cAAcR,UAAUQ,eAAexC,KAAAA,KACpCgC,UAAUQ,eAAeT,WAAWS,UAExCF,GACA,MAAM,IAAIxJ,gBAAgB,yDAAA;EAG9B,OAAO;GACHoF,MAAMgD,UAAUI,WAAW,IAAA,IAAQxH,QAAQyH,KAAKzH,QAAQ0H;GACxDpD,oBAAoB8C;GACpB7C;GACAP;EACJ;CACJ;CAEUsD,uBAAuBF,WAA8B;EAC3D,IAAI,CAAC,yBAAyBuB,KAAKvB,SAAAA,GAC/B,MAAM,IAAIpI,gBAAgB,2BAA2BoI,UAAU,mCAAmC;EAGtG,OAAOtH,cAAc8I,kCAAkCxB,SAAAA;CAC3D;CAEUW,kBAAkBc,OAAwB;EAChD,IAAIA,MAAMC,SAAS,YAAA,GAEf,OAAOD,MACFE,QAAQ,+BAA+B,EAAA,CAAA,CACvCA,QAAQ,QAAQ,EAAA;EAGzB,OAAOF,MAAMf,KAAI;CACrB;AACJ"}
@@ -0,0 +1,33 @@
1
+ import type { Key } from '@authup/core-kit';
2
+ import type { ActorContext, EntityRepositoryFindManyResult, IEntityRepository } from '@authup/server-kit';
3
+ export interface IKeyRepository extends IEntityRepository<Key> {
4
+ checkUniqueness(data: Partial<Key>, existing?: Key): Promise<void>;
5
+ /**
6
+ * Count cipher blobs (v1.<key_id>.…) still referencing the key —
7
+ * today the MFA authenticator seeds; plan-070 consumers extend this.
8
+ * Deleting a referenced enc key crypto-shreds those blobs.
9
+ *
10
+ * @param keyId
11
+ */
12
+ countBlobReferences(keyId: string): Promise<number>;
13
+ /**
14
+ * Highest priority currently assigned for (realm, use) — create
15
+ * defaults to max + 1 so "generate" doubles as "rotate".
16
+ */
17
+ findHighestPriority(realmId: string, use: string): Promise<number | null>;
18
+ }
19
+ export type KeyDeleteOptions = {
20
+ /**
21
+ * Delete an enc key even while cipher blobs still reference it
22
+ * (crypto-shreds them).
23
+ */
24
+ force?: boolean;
25
+ };
26
+ export interface IKeyService {
27
+ getMany(query: Record<string, any>, actor: ActorContext): Promise<EntityRepositoryFindManyResult<Key>>;
28
+ getOne(idOrName: string, actor: ActorContext, realmId?: string): Promise<Key>;
29
+ create(data: Record<string, any>, actor: ActorContext): Promise<Key>;
30
+ update(idOrName: string, data: Record<string, any>, actor: ActorContext, realmId?: string): Promise<Key>;
31
+ delete(id: string, actor: ActorContext, options?: KeyDeleteOptions): Promise<Key>;
32
+ }
33
+ //# sourceMappingURL=types.d.ts.map