@spinajs/authn-orm 0.0.0-stage → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +84 -2
  2. package/lib/cjs/audit/db-audit-sink.d.ts +11 -0
  3. package/lib/cjs/audit/db-audit-sink.d.ts.map +1 -0
  4. package/lib/cjs/audit/db-audit-sink.js +73 -0
  5. package/lib/cjs/audit/db-audit-sink.js.map +1 -0
  6. package/lib/cjs/audit/index.d.ts +2 -0
  7. package/lib/cjs/audit/index.d.ts.map +1 -0
  8. package/lib/cjs/audit/index.js +6 -0
  9. package/lib/cjs/audit/index.js.map +1 -0
  10. package/lib/cjs/identity.d.ts +6 -0
  11. package/lib/cjs/identity.d.ts.map +1 -0
  12. package/lib/cjs/identity.js +27 -0
  13. package/lib/cjs/identity.js.map +1 -0
  14. package/lib/cjs/index.d.ts +10 -0
  15. package/lib/cjs/index.d.ts.map +1 -0
  16. package/lib/cjs/index.js +26 -0
  17. package/lib/cjs/index.js.map +1 -0
  18. package/lib/cjs/links/db-link-store.d.ts +13 -0
  19. package/lib/cjs/links/db-link-store.d.ts.map +1 -0
  20. package/lib/cjs/links/db-link-store.js +88 -0
  21. package/lib/cjs/links/db-link-store.js.map +1 -0
  22. package/lib/cjs/links/index.d.ts +2 -0
  23. package/lib/cjs/links/index.d.ts.map +1 -0
  24. package/lib/cjs/links/index.js +6 -0
  25. package/lib/cjs/links/index.js.map +1 -0
  26. package/lib/cjs/mfa/cipher.d.ts +18 -0
  27. package/lib/cjs/mfa/cipher.d.ts.map +1 -0
  28. package/lib/cjs/mfa/cipher.js +81 -0
  29. package/lib/cjs/mfa/cipher.js.map +1 -0
  30. package/lib/cjs/mfa/db-mfa-enrolments.d.ts +14 -0
  31. package/lib/cjs/mfa/db-mfa-enrolments.d.ts.map +1 -0
  32. package/lib/cjs/mfa/db-mfa-enrolments.js +43 -0
  33. package/lib/cjs/mfa/db-mfa-enrolments.js.map +1 -0
  34. package/lib/cjs/mfa/db-mfa-store.d.ts +51 -0
  35. package/lib/cjs/mfa/db-mfa-store.d.ts.map +1 -0
  36. package/lib/cjs/mfa/db-mfa-store.js +190 -0
  37. package/lib/cjs/mfa/db-mfa-store.js.map +1 -0
  38. package/lib/cjs/mfa/index.d.ts +4 -0
  39. package/lib/cjs/mfa/index.d.ts.map +1 -0
  40. package/lib/cjs/mfa/index.js +20 -0
  41. package/lib/cjs/mfa/index.js.map +1 -0
  42. package/lib/cjs/migrations/AuthnInitial_2026_10_02_00_00_00.d.ts +10 -0
  43. package/lib/cjs/migrations/AuthnInitial_2026_10_02_00_00_00.d.ts.map +1 -0
  44. package/lib/cjs/migrations/AuthnInitial_2026_10_02_00_00_00.js +98 -0
  45. package/lib/cjs/migrations/AuthnInitial_2026_10_02_00_00_00.js.map +1 -0
  46. package/lib/cjs/migrations/index.d.ts +2 -0
  47. package/lib/cjs/migrations/index.d.ts.map +1 -0
  48. package/lib/cjs/migrations/index.js +18 -0
  49. package/lib/cjs/migrations/index.js.map +1 -0
  50. package/lib/cjs/models/AuthnAudit.d.ts +18 -0
  51. package/lib/cjs/models/AuthnAudit.d.ts.map +1 -0
  52. package/lib/cjs/models/AuthnAudit.js +30 -0
  53. package/lib/cjs/models/AuthnAudit.js.map +1 -0
  54. package/lib/cjs/models/AuthnIdentity.d.ts +16 -0
  55. package/lib/cjs/models/AuthnIdentity.d.ts.map +1 -0
  56. package/lib/cjs/models/AuthnIdentity.js +39 -0
  57. package/lib/cjs/models/AuthnIdentity.js.map +1 -0
  58. package/lib/cjs/models/AuthnMfa.d.ts +16 -0
  59. package/lib/cjs/models/AuthnMfa.d.ts.map +1 -0
  60. package/lib/cjs/models/AuthnMfa.js +39 -0
  61. package/lib/cjs/models/AuthnMfa.js.map +1 -0
  62. package/lib/cjs/models/AuthnNonce.d.ts +7 -0
  63. package/lib/cjs/models/AuthnNonce.d.ts.map +1 -0
  64. package/lib/cjs/models/AuthnNonce.js +30 -0
  65. package/lib/cjs/models/AuthnNonce.js.map +1 -0
  66. package/lib/cjs/models/AuthnRecoveryCode.d.ts +10 -0
  67. package/lib/cjs/models/AuthnRecoveryCode.d.ts.map +1 -0
  68. package/lib/cjs/models/AuthnRecoveryCode.js +30 -0
  69. package/lib/cjs/models/AuthnRecoveryCode.js.map +1 -0
  70. package/lib/cjs/models/AuthnSecret.d.ts +13 -0
  71. package/lib/cjs/models/AuthnSecret.d.ts.map +1 -0
  72. package/lib/cjs/models/AuthnSecret.js +38 -0
  73. package/lib/cjs/models/AuthnSecret.js.map +1 -0
  74. package/lib/cjs/models/AuthnThrottle.d.ts +10 -0
  75. package/lib/cjs/models/AuthnThrottle.d.ts.map +1 -0
  76. package/lib/cjs/models/AuthnThrottle.js +38 -0
  77. package/lib/cjs/models/AuthnThrottle.js.map +1 -0
  78. package/lib/cjs/models/index.d.ts +9 -0
  79. package/lib/cjs/models/index.d.ts.map +1 -0
  80. package/lib/cjs/models/index.js +25 -0
  81. package/lib/cjs/models/index.js.map +1 -0
  82. package/lib/cjs/models/time.d.ts +4 -0
  83. package/lib/cjs/models/time.d.ts.map +1 -0
  84. package/lib/cjs/models/time.js +19 -0
  85. package/lib/cjs/models/time.js.map +1 -0
  86. package/lib/cjs/nonces/index.d.ts +2 -0
  87. package/lib/cjs/nonces/index.d.ts.map +1 -0
  88. package/lib/cjs/nonces/index.js +18 -0
  89. package/lib/cjs/nonces/index.js.map +1 -0
  90. package/lib/cjs/nonces/nonce-store.d.ts +11 -0
  91. package/lib/cjs/nonces/nonce-store.d.ts.map +1 -0
  92. package/lib/cjs/nonces/nonce-store.js +77 -0
  93. package/lib/cjs/nonces/nonce-store.js.map +1 -0
  94. package/lib/cjs/package.json +1 -0
  95. package/lib/cjs/secrets/db-secret-store.d.ts +25 -0
  96. package/lib/cjs/secrets/db-secret-store.d.ts.map +1 -0
  97. package/lib/cjs/secrets/db-secret-store.js +99 -0
  98. package/lib/cjs/secrets/db-secret-store.js.map +1 -0
  99. package/lib/cjs/secrets/index.d.ts +2 -0
  100. package/lib/cjs/secrets/index.d.ts.map +1 -0
  101. package/lib/cjs/secrets/index.js +6 -0
  102. package/lib/cjs/secrets/index.js.map +1 -0
  103. package/lib/cjs/support/sql.d.ts +16 -0
  104. package/lib/cjs/support/sql.d.ts.map +1 -0
  105. package/lib/cjs/support/sql.js +50 -0
  106. package/lib/cjs/support/sql.js.map +1 -0
  107. package/lib/cjs/support/values.d.ts +7 -0
  108. package/lib/cjs/support/values.d.ts.map +1 -0
  109. package/lib/cjs/support/values.js +8 -0
  110. package/lib/cjs/support/values.js.map +1 -0
  111. package/lib/cjs/throttle/db-throttle-store.d.ts +79 -0
  112. package/lib/cjs/throttle/db-throttle-store.d.ts.map +1 -0
  113. package/lib/cjs/throttle/db-throttle-store.js +231 -0
  114. package/lib/cjs/throttle/db-throttle-store.js.map +1 -0
  115. package/lib/cjs/throttle/db-throttle.d.ts +77 -0
  116. package/lib/cjs/throttle/db-throttle.d.ts.map +1 -0
  117. package/lib/cjs/throttle/db-throttle.js +192 -0
  118. package/lib/cjs/throttle/db-throttle.js.map +1 -0
  119. package/lib/cjs/throttle/index.d.ts +6 -0
  120. package/lib/cjs/throttle/index.d.ts.map +1 -0
  121. package/lib/cjs/throttle/index.js +8 -0
  122. package/lib/cjs/throttle/index.js.map +1 -0
  123. package/lib/mjs/audit/db-audit-sink.d.ts +11 -0
  124. package/lib/mjs/audit/db-audit-sink.d.ts.map +1 -0
  125. package/lib/mjs/audit/db-audit-sink.js +70 -0
  126. package/lib/mjs/audit/db-audit-sink.js.map +1 -0
  127. package/lib/mjs/audit/index.d.ts +2 -0
  128. package/lib/mjs/audit/index.d.ts.map +1 -0
  129. package/lib/mjs/audit/index.js +2 -0
  130. package/lib/mjs/audit/index.js.map +1 -0
  131. package/lib/mjs/identity.d.ts +6 -0
  132. package/lib/mjs/identity.d.ts.map +1 -0
  133. package/lib/mjs/identity.js +23 -0
  134. package/lib/mjs/identity.js.map +1 -0
  135. package/lib/mjs/index.d.ts +10 -0
  136. package/lib/mjs/index.d.ts.map +1 -0
  137. package/lib/mjs/index.js +10 -0
  138. package/lib/mjs/index.js.map +1 -0
  139. package/lib/mjs/links/db-link-store.d.ts +13 -0
  140. package/lib/mjs/links/db-link-store.d.ts.map +1 -0
  141. package/lib/mjs/links/db-link-store.js +85 -0
  142. package/lib/mjs/links/db-link-store.js.map +1 -0
  143. package/lib/mjs/links/index.d.ts +2 -0
  144. package/lib/mjs/links/index.d.ts.map +1 -0
  145. package/lib/mjs/links/index.js +2 -0
  146. package/lib/mjs/links/index.js.map +1 -0
  147. package/lib/mjs/mfa/cipher.d.ts +18 -0
  148. package/lib/mjs/mfa/cipher.d.ts.map +1 -0
  149. package/lib/mjs/mfa/cipher.js +76 -0
  150. package/lib/mjs/mfa/cipher.js.map +1 -0
  151. package/lib/mjs/mfa/db-mfa-enrolments.d.ts +14 -0
  152. package/lib/mjs/mfa/db-mfa-enrolments.d.ts.map +1 -0
  153. package/lib/mjs/mfa/db-mfa-enrolments.js +40 -0
  154. package/lib/mjs/mfa/db-mfa-enrolments.js.map +1 -0
  155. package/lib/mjs/mfa/db-mfa-store.d.ts +51 -0
  156. package/lib/mjs/mfa/db-mfa-store.d.ts.map +1 -0
  157. package/lib/mjs/mfa/db-mfa-store.js +187 -0
  158. package/lib/mjs/mfa/db-mfa-store.js.map +1 -0
  159. package/lib/mjs/mfa/index.d.ts +4 -0
  160. package/lib/mjs/mfa/index.d.ts.map +1 -0
  161. package/lib/mjs/mfa/index.js +4 -0
  162. package/lib/mjs/mfa/index.js.map +1 -0
  163. package/lib/mjs/migrations/AuthnInitial_2026_10_02_00_00_00.d.ts +10 -0
  164. package/lib/mjs/migrations/AuthnInitial_2026_10_02_00_00_00.d.ts.map +1 -0
  165. package/lib/mjs/migrations/AuthnInitial_2026_10_02_00_00_00.js +95 -0
  166. package/lib/mjs/migrations/AuthnInitial_2026_10_02_00_00_00.js.map +1 -0
  167. package/lib/mjs/migrations/index.d.ts +2 -0
  168. package/lib/mjs/migrations/index.d.ts.map +1 -0
  169. package/lib/mjs/migrations/index.js +2 -0
  170. package/lib/mjs/migrations/index.js.map +1 -0
  171. package/lib/mjs/models/AuthnAudit.d.ts +18 -0
  172. package/lib/mjs/models/AuthnAudit.d.ts.map +1 -0
  173. package/lib/mjs/models/AuthnAudit.js +27 -0
  174. package/lib/mjs/models/AuthnAudit.js.map +1 -0
  175. package/lib/mjs/models/AuthnIdentity.d.ts +16 -0
  176. package/lib/mjs/models/AuthnIdentity.d.ts.map +1 -0
  177. package/lib/mjs/models/AuthnIdentity.js +36 -0
  178. package/lib/mjs/models/AuthnIdentity.js.map +1 -0
  179. package/lib/mjs/models/AuthnMfa.d.ts +16 -0
  180. package/lib/mjs/models/AuthnMfa.d.ts.map +1 -0
  181. package/lib/mjs/models/AuthnMfa.js +36 -0
  182. package/lib/mjs/models/AuthnMfa.js.map +1 -0
  183. package/lib/mjs/models/AuthnNonce.d.ts +7 -0
  184. package/lib/mjs/models/AuthnNonce.d.ts.map +1 -0
  185. package/lib/mjs/models/AuthnNonce.js +27 -0
  186. package/lib/mjs/models/AuthnNonce.js.map +1 -0
  187. package/lib/mjs/models/AuthnRecoveryCode.d.ts +10 -0
  188. package/lib/mjs/models/AuthnRecoveryCode.d.ts.map +1 -0
  189. package/lib/mjs/models/AuthnRecoveryCode.js +27 -0
  190. package/lib/mjs/models/AuthnRecoveryCode.js.map +1 -0
  191. package/lib/mjs/models/AuthnSecret.d.ts +13 -0
  192. package/lib/mjs/models/AuthnSecret.d.ts.map +1 -0
  193. package/lib/mjs/models/AuthnSecret.js +35 -0
  194. package/lib/mjs/models/AuthnSecret.js.map +1 -0
  195. package/lib/mjs/models/AuthnThrottle.d.ts +10 -0
  196. package/lib/mjs/models/AuthnThrottle.d.ts.map +1 -0
  197. package/lib/mjs/models/AuthnThrottle.js +35 -0
  198. package/lib/mjs/models/AuthnThrottle.js.map +1 -0
  199. package/lib/mjs/models/index.d.ts +9 -0
  200. package/lib/mjs/models/index.d.ts.map +1 -0
  201. package/lib/mjs/models/index.js +9 -0
  202. package/lib/mjs/models/index.js.map +1 -0
  203. package/lib/mjs/models/time.d.ts +4 -0
  204. package/lib/mjs/models/time.d.ts.map +1 -0
  205. package/lib/mjs/models/time.js +16 -0
  206. package/lib/mjs/models/time.js.map +1 -0
  207. package/lib/mjs/nonces/index.d.ts +2 -0
  208. package/lib/mjs/nonces/index.d.ts.map +1 -0
  209. package/lib/mjs/nonces/index.js +2 -0
  210. package/lib/mjs/nonces/index.js.map +1 -0
  211. package/lib/mjs/nonces/nonce-store.d.ts +11 -0
  212. package/lib/mjs/nonces/nonce-store.d.ts.map +1 -0
  213. package/lib/mjs/nonces/nonce-store.js +72 -0
  214. package/lib/mjs/nonces/nonce-store.js.map +1 -0
  215. package/lib/mjs/package.json +1 -0
  216. package/lib/mjs/secrets/db-secret-store.d.ts +25 -0
  217. package/lib/mjs/secrets/db-secret-store.d.ts.map +1 -0
  218. package/lib/mjs/secrets/db-secret-store.js +96 -0
  219. package/lib/mjs/secrets/db-secret-store.js.map +1 -0
  220. package/lib/mjs/secrets/index.d.ts +2 -0
  221. package/lib/mjs/secrets/index.d.ts.map +1 -0
  222. package/lib/mjs/secrets/index.js +2 -0
  223. package/lib/mjs/secrets/index.js.map +1 -0
  224. package/lib/mjs/support/sql.d.ts +16 -0
  225. package/lib/mjs/support/sql.d.ts.map +1 -0
  226. package/lib/mjs/support/sql.js +41 -0
  227. package/lib/mjs/support/sql.js.map +1 -0
  228. package/lib/mjs/support/values.d.ts +7 -0
  229. package/lib/mjs/support/values.d.ts.map +1 -0
  230. package/lib/mjs/support/values.js +5 -0
  231. package/lib/mjs/support/values.js.map +1 -0
  232. package/lib/mjs/throttle/db-throttle-store.d.ts +79 -0
  233. package/lib/mjs/throttle/db-throttle-store.d.ts.map +1 -0
  234. package/lib/mjs/throttle/db-throttle-store.js +227 -0
  235. package/lib/mjs/throttle/db-throttle-store.js.map +1 -0
  236. package/lib/mjs/throttle/db-throttle.d.ts +77 -0
  237. package/lib/mjs/throttle/db-throttle.d.ts.map +1 -0
  238. package/lib/mjs/throttle/db-throttle.js +189 -0
  239. package/lib/mjs/throttle/db-throttle.js.map +1 -0
  240. package/lib/mjs/throttle/index.d.ts +6 -0
  241. package/lib/mjs/throttle/index.d.ts.map +1 -0
  242. package/lib/mjs/throttle/index.js +3 -0
  243. package/lib/mjs/throttle/index.js.map +1 -0
  244. package/lib/tsconfig.cjs.tsbuildinfo +1 -0
  245. package/lib/tsconfig.mjs.tsbuildinfo +1 -0
  246. package/package.json +89 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnAudit.js","sourceRoot":"","sources":["../../../src/models/AuthnAudit.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI1B,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,SAAqB;CA2BpD,CAAA;AAzBQ;IADN,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;sCACjB;AAGX;IADN,EAAE,EAAE;8BACM,QAAQ;sCAAC;AALT,UAAU;IAFtB,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,aAAa,CAAC;GACR,UAAU,CA2BtB"}
@@ -0,0 +1,16 @@
1
+ import { ModelBase } from '@spinajs/orm';
2
+ import { DateTime } from 'luxon';
3
+ /** A link from an external subject to an identity (design §22.16). */
4
+ export declare class AuthnIdentity extends ModelBase<AuthnIdentity> {
5
+ id: string;
6
+ identity_type: string;
7
+ identity_id: string;
8
+ provider: string;
9
+ subject: string;
10
+ email?: string | null;
11
+ email_verified: boolean;
12
+ attributes?: string | null;
13
+ linked_at: DateTime;
14
+ last_used_at?: DateTime;
15
+ }
16
+ //# sourceMappingURL=AuthnIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnIdentity.d.ts","sourceRoot":"","sources":["../../../src/models/AuthnIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,SAAS,EAAW,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,sEAAsE;AACtE,qBAEa,aAAc,SAAQ,SAAS,CAAC,aAAa,CAAC;IAElD,EAAE,EAAE,MAAM,CAAC;IAEX,aAAa,EAAE,MAAM,CAAC;IAEtB,WAAW,EAAE,MAAM,CAAC;IAEpB,QAAQ,EAAE,MAAM,CAAC;IAEjB,OAAO,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,cAAc,EAAE,OAAO,CAAC;IAExB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,SAAS,EAAE,QAAQ,CAAC;IAIpB,YAAY,CAAC,EAAE,QAAQ,CAAC;CAChC"}
@@ -0,0 +1,36 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Bool, Connection, DateTime as DT, Model, ModelBase, Primary } from '@spinajs/orm';
11
+ import { DateTime } from 'luxon';
12
+ /** A link from an external subject to an identity (design §22.16). */
13
+ let AuthnIdentity = class AuthnIdentity extends ModelBase {
14
+ };
15
+ __decorate([
16
+ Primary({ generated: 'assigned' }),
17
+ __metadata("design:type", String)
18
+ ], AuthnIdentity.prototype, "id", void 0);
19
+ __decorate([
20
+ Bool(),
21
+ __metadata("design:type", Boolean)
22
+ ], AuthnIdentity.prototype, "email_verified", void 0);
23
+ __decorate([
24
+ DT(),
25
+ __metadata("design:type", DateTime)
26
+ ], AuthnIdentity.prototype, "linked_at", void 0);
27
+ __decorate([
28
+ DT(),
29
+ __metadata("design:type", DateTime)
30
+ ], AuthnIdentity.prototype, "last_used_at", void 0);
31
+ AuthnIdentity = __decorate([
32
+ Connection('default'),
33
+ Model('authn_identity')
34
+ ], AuthnIdentity);
35
+ export { AuthnIdentity };
36
+ //# sourceMappingURL=AuthnIdentity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnIdentity.js","sourceRoot":"","sources":["../../../src/models/AuthnIdentity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,sEAAsE;AAG/D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,SAAwB;CAyB1D,CAAA;AAvBQ;IADN,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;yCACjB;AAaX;IADN,IAAI,EAAE;;qDACwB;AAKxB;IADN,EAAE,EAAE;8BACa,QAAQ;gDAAC;AAIpB;IADN,EAAE,EAAE;8BACiB,QAAQ;mDAAC;AAxBpB,aAAa;IAFzB,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,gBAAgB,CAAC;GACX,aAAa,CAyBzB"}
@@ -0,0 +1,16 @@
1
+ import { ModelBase } from '@spinajs/orm';
2
+ import { DateTime } from 'luxon';
3
+ /** One MFA step of an identity; the primary key is (identity, step). */
4
+ export declare class AuthnMfa extends ModelBase<AuthnMfa> {
5
+ identity: string;
6
+ step: string;
7
+ secret_enc: string;
8
+ /** Hex SHA-256 of `secret_enc`: `confirm` compares this, since TEXT is not comparable on MSSQL and case-blind on MySQL. */
9
+ secret_hash: string;
10
+ key_id: string;
11
+ confirmed_at?: DateTime;
12
+ /** Postgres returns bigint as a string. */
13
+ last_step?: number | string | null;
14
+ created_at: DateTime;
15
+ }
16
+ //# sourceMappingURL=AuthnMfa.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnMfa.d.ts","sourceRoot":"","sources":["../../../src/models/AuthnMfa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,SAAS,EAAW,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,wEAAwE;AACxE,qBAEa,QAAS,SAAQ,SAAS,CAAC,QAAQ,CAAC;IAExC,QAAQ,EAAE,MAAM,CAAC;IAGjB,IAAI,EAAE,MAAM,CAAC;IAEb,UAAU,EAAE,MAAM,CAAC;IAE1B,2HAA2H;IACpH,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,MAAM,CAAC;IAIf,YAAY,CAAC,EAAE,QAAQ,CAAC;IAE/B,2CAA2C;IACpC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAGnC,UAAU,EAAE,QAAQ,CAAC;CAC7B"}
@@ -0,0 +1,36 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Connection, DateTime as DT, Model, ModelBase, Primary } from '@spinajs/orm';
11
+ import { DateTime } from 'luxon';
12
+ /** One MFA step of an identity; the primary key is (identity, step). */
13
+ let AuthnMfa = class AuthnMfa extends ModelBase {
14
+ };
15
+ __decorate([
16
+ Primary({ generated: 'assigned' }),
17
+ __metadata("design:type", String)
18
+ ], AuthnMfa.prototype, "identity", void 0);
19
+ __decorate([
20
+ Primary({ generated: 'assigned' }),
21
+ __metadata("design:type", String)
22
+ ], AuthnMfa.prototype, "step", void 0);
23
+ __decorate([
24
+ DT(),
25
+ __metadata("design:type", DateTime)
26
+ ], AuthnMfa.prototype, "confirmed_at", void 0);
27
+ __decorate([
28
+ DT(),
29
+ __metadata("design:type", DateTime)
30
+ ], AuthnMfa.prototype, "created_at", void 0);
31
+ AuthnMfa = __decorate([
32
+ Connection('default'),
33
+ Model('authn_mfa')
34
+ ], AuthnMfa);
35
+ export { AuthnMfa };
36
+ //# sourceMappingURL=AuthnMfa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnMfa.js","sourceRoot":"","sources":["../../../src/models/AuthnMfa.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,wEAAwE;AAGjE,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,SAAmB;CAuBhD,CAAA;AArBQ;IADN,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;0CACX;AAGjB;IADN,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;sCACf;AAWb;IADN,EAAE,EAAE;8BACiB,QAAQ;8CAAC;AAMxB;IADN,EAAE,EAAE;8BACc,QAAQ;4CAAC;AAtBjB,QAAQ;IAFpB,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,WAAW,CAAC;GACN,QAAQ,CAuBpB"}
@@ -0,0 +1,7 @@
1
+ import { ModelBase } from '@spinajs/orm';
2
+ import { DateTime } from 'luxon';
3
+ export declare class AuthnNonce extends ModelBase<AuthnNonce> {
4
+ k: string;
5
+ expires_at: DateTime;
6
+ }
7
+ //# sourceMappingURL=AuthnNonce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnNonce.d.ts","sourceRoot":"","sources":["../../../src/models/AuthnNonce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,SAAS,EAAW,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,qBAEa,UAAW,SAAQ,SAAS,CAAC,UAAU,CAAC;IAE5C,CAAC,EAAE,MAAM,CAAC;IAGV,UAAU,EAAE,QAAQ,CAAC;CAC7B"}
@@ -0,0 +1,27 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Connection, DateTime as DT, Model, ModelBase, Primary } from '@spinajs/orm';
11
+ import { DateTime } from 'luxon';
12
+ let AuthnNonce = class AuthnNonce extends ModelBase {
13
+ };
14
+ __decorate([
15
+ Primary({ generated: 'assigned' }),
16
+ __metadata("design:type", String)
17
+ ], AuthnNonce.prototype, "k", void 0);
18
+ __decorate([
19
+ DT(),
20
+ __metadata("design:type", DateTime)
21
+ ], AuthnNonce.prototype, "expires_at", void 0);
22
+ AuthnNonce = __decorate([
23
+ Connection('default'),
24
+ Model('authn_nonce')
25
+ ], AuthnNonce);
26
+ export { AuthnNonce };
27
+ //# sourceMappingURL=AuthnNonce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnNonce.js","sourceRoot":"","sources":["../../../src/models/AuthnNonce.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI1B,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,SAAqB;CAMpD,CAAA;AAJQ;IADN,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;qCAClB;AAGV;IADN,EAAE,EAAE;8BACc,QAAQ;8CAAC;AALjB,UAAU;IAFtB,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,aAAa,CAAC;GACR,UAAU,CAMtB"}
@@ -0,0 +1,10 @@
1
+ import { ModelBase } from '@spinajs/orm';
2
+ import { DateTime } from 'luxon';
3
+ export declare class AuthnRecoveryCode extends ModelBase<AuthnRecoveryCode> {
4
+ id: string;
5
+ identity: string;
6
+ /** Hex SHA-256 of the raw code. */
7
+ code_hash: string;
8
+ used_at?: DateTime;
9
+ }
10
+ //# sourceMappingURL=AuthnRecoveryCode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnRecoveryCode.d.ts","sourceRoot":"","sources":["../../../src/models/AuthnRecoveryCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,SAAS,EAAW,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,qBAEa,iBAAkB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAE1D,EAAE,EAAE,MAAM,CAAC;IAEX,QAAQ,EAAE,MAAM,CAAC;IAExB,mCAAmC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAIlB,OAAO,CAAC,EAAE,QAAQ,CAAC;CAC3B"}
@@ -0,0 +1,27 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Connection, DateTime as DT, Model, ModelBase, Primary } from '@spinajs/orm';
11
+ import { DateTime } from 'luxon';
12
+ let AuthnRecoveryCode = class AuthnRecoveryCode extends ModelBase {
13
+ };
14
+ __decorate([
15
+ Primary({ generated: 'assigned' }),
16
+ __metadata("design:type", String)
17
+ ], AuthnRecoveryCode.prototype, "id", void 0);
18
+ __decorate([
19
+ DT(),
20
+ __metadata("design:type", DateTime)
21
+ ], AuthnRecoveryCode.prototype, "used_at", void 0);
22
+ AuthnRecoveryCode = __decorate([
23
+ Connection('default'),
24
+ Model('authn_recovery_code')
25
+ ], AuthnRecoveryCode);
26
+ export { AuthnRecoveryCode };
27
+ //# sourceMappingURL=AuthnRecoveryCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnRecoveryCode.js","sourceRoot":"","sources":["../../../src/models/AuthnRecoveryCode.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI1B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,SAA4B;CAYlE,CAAA;AAVQ;IADN,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;6CACjB;AASX;IADN,EAAE,EAAE;8BACY,QAAQ;kDAAC;AAXf,iBAAiB;IAF7B,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,qBAAqB,CAAC;GAChB,iBAAiB,CAY7B"}
@@ -0,0 +1,13 @@
1
+ import { ModelBase } from '@spinajs/orm';
2
+ import { DateTime } from 'luxon';
3
+ export declare class AuthnSecret extends ModelBase<AuthnSecret> {
4
+ id: string;
5
+ identity: string;
6
+ purpose: string;
7
+ /** Hex SHA-256 of the raw secret. */
8
+ secret_hash: string;
9
+ expires_at: DateTime;
10
+ used_at?: DateTime;
11
+ created_at: DateTime;
12
+ }
13
+ //# sourceMappingURL=AuthnSecret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnSecret.d.ts","sourceRoot":"","sources":["../../../src/models/AuthnSecret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,SAAS,EAAW,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,qBAEa,WAAY,SAAQ,SAAS,CAAC,WAAW,CAAC;IAE9C,EAAE,EAAE,MAAM,CAAC;IAEX,QAAQ,EAAE,MAAM,CAAC;IAEjB,OAAO,EAAE,MAAM,CAAC;IAEvB,qCAAqC;IAC9B,WAAW,EAAE,MAAM,CAAC;IAGpB,UAAU,EAAE,QAAQ,CAAC;IAIrB,OAAO,CAAC,EAAE,QAAQ,CAAC;IAGnB,UAAU,EAAE,QAAQ,CAAC;CAC7B"}
@@ -0,0 +1,35 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Connection, DateTime as DT, Model, ModelBase, Primary } from '@spinajs/orm';
11
+ import { DateTime } from 'luxon';
12
+ let AuthnSecret = class AuthnSecret extends ModelBase {
13
+ };
14
+ __decorate([
15
+ Primary({ generated: 'assigned' }),
16
+ __metadata("design:type", String)
17
+ ], AuthnSecret.prototype, "id", void 0);
18
+ __decorate([
19
+ DT(),
20
+ __metadata("design:type", DateTime)
21
+ ], AuthnSecret.prototype, "expires_at", void 0);
22
+ __decorate([
23
+ DT(),
24
+ __metadata("design:type", DateTime)
25
+ ], AuthnSecret.prototype, "used_at", void 0);
26
+ __decorate([
27
+ DT(),
28
+ __metadata("design:type", DateTime)
29
+ ], AuthnSecret.prototype, "created_at", void 0);
30
+ AuthnSecret = __decorate([
31
+ Connection('default'),
32
+ Model('authn_secret')
33
+ ], AuthnSecret);
34
+ export { AuthnSecret };
35
+ //# sourceMappingURL=AuthnSecret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnSecret.js","sourceRoot":"","sources":["../../../src/models/AuthnSecret.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI1B,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,SAAsB;CAoBtD,CAAA;AAlBQ;IADN,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;uCACjB;AAUX;IADN,EAAE,EAAE;8BACc,QAAQ;+CAAC;AAIrB;IADN,EAAE,EAAE;8BACY,QAAQ;4CAAC;AAGnB;IADN,EAAE,EAAE;8BACc,QAAQ;+CAAC;AAnBjB,WAAW;IAFvB,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,cAAc,CAAC;GACT,WAAW,CAoBvB"}
@@ -0,0 +1,10 @@
1
+ import { ModelBase } from '@spinajs/orm';
2
+ import { DateTime } from 'luxon';
3
+ export declare class AuthnThrottle extends ModelBase<AuthnThrottle> {
4
+ k: string;
5
+ attempts: number;
6
+ last_attempt_at: DateTime;
7
+ next_allowed_at: DateTime;
8
+ updated_at: DateTime;
9
+ }
10
+ //# sourceMappingURL=AuthnThrottle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnThrottle.d.ts","sourceRoot":"","sources":["../../../src/models/AuthnThrottle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,SAAS,EAAW,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,qBAEa,aAAc,SAAQ,SAAS,CAAC,aAAa,CAAC;IAElD,CAAC,EAAE,MAAM,CAAC;IAEV,QAAQ,EAAE,MAAM,CAAC;IAGjB,eAAe,EAAE,QAAQ,CAAC;IAG1B,eAAe,EAAE,QAAQ,CAAC;IAG1B,UAAU,EAAE,QAAQ,CAAC;CAC7B"}
@@ -0,0 +1,35 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Connection, DateTime as DT, Model, ModelBase, Primary } from '@spinajs/orm';
11
+ import { DateTime } from 'luxon';
12
+ let AuthnThrottle = class AuthnThrottle extends ModelBase {
13
+ };
14
+ __decorate([
15
+ Primary({ generated: 'assigned' }),
16
+ __metadata("design:type", String)
17
+ ], AuthnThrottle.prototype, "k", void 0);
18
+ __decorate([
19
+ DT(),
20
+ __metadata("design:type", DateTime)
21
+ ], AuthnThrottle.prototype, "last_attempt_at", void 0);
22
+ __decorate([
23
+ DT(),
24
+ __metadata("design:type", DateTime)
25
+ ], AuthnThrottle.prototype, "next_allowed_at", void 0);
26
+ __decorate([
27
+ DT(),
28
+ __metadata("design:type", DateTime)
29
+ ], AuthnThrottle.prototype, "updated_at", void 0);
30
+ AuthnThrottle = __decorate([
31
+ Connection('default'),
32
+ Model('authn_throttle')
33
+ ], AuthnThrottle);
34
+ export { AuthnThrottle };
35
+ //# sourceMappingURL=AuthnThrottle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthnThrottle.js","sourceRoot":"","sources":["../../../src/models/AuthnThrottle.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI1B,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,SAAwB;CAc1D,CAAA;AAZQ;IADN,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;;wCAClB;AAKV;IADN,EAAE,EAAE;8BACmB,QAAQ;sDAAC;AAG1B;IADN,EAAE,EAAE;8BACmB,QAAQ;sDAAC;AAG1B;IADN,EAAE,EAAE;8BACc,QAAQ;iDAAC;AAbjB,aAAa;IAFzB,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,gBAAgB,CAAC;GACX,aAAa,CAczB"}
@@ -0,0 +1,9 @@
1
+ export * from './AuthnAudit.js';
2
+ export * from './AuthnIdentity.js';
3
+ export * from './AuthnMfa.js';
4
+ export * from './AuthnNonce.js';
5
+ export * from './AuthnRecoveryCode.js';
6
+ export * from './AuthnSecret.js';
7
+ export * from './AuthnThrottle.js';
8
+ export * from './time.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './AuthnAudit.js';
2
+ export * from './AuthnIdentity.js';
3
+ export * from './AuthnMfa.js';
4
+ export * from './AuthnNonce.js';
5
+ export * from './AuthnRecoveryCode.js';
6
+ export * from './AuthnSecret.js';
7
+ export * from './AuthnThrottle.js';
8
+ export * from './time.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { DateTime } from 'luxon';
2
+ /** The instant of a datetime as a driver returns it or as text read with a cast; text without an offset is UTC. */
3
+ export declare function readInstant(v: DateTime | Date | string | null | undefined): Date | undefined;
4
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/models/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,mHAAmH;AACnH,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAY5F"}
@@ -0,0 +1,16 @@
1
+ import { DateTime } from 'luxon';
2
+ /** The instant of a datetime as a driver returns it or as text read with a cast; text without an offset is UTC. */
3
+ export function readInstant(v) {
4
+ if (v === null || v === undefined) {
5
+ return undefined;
6
+ }
7
+ if (v instanceof Date) {
8
+ return new Date(v.getTime());
9
+ }
10
+ if (typeof v === 'string') {
11
+ const sql = DateTime.fromSQL(v, { zone: 'utc' });
12
+ return (sql.isValid ? sql : DateTime.fromISO(v, { zone: 'utc' })).toJSDate();
13
+ }
14
+ return v.toJSDate();
15
+ }
16
+ //# sourceMappingURL=time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../../../src/models/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,mHAAmH;AACnH,MAAM,UAAU,WAAW,CAAC,CAA8C;IACxE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QACtB,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC/E,CAAC;IACD,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './nonce-store.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nonces/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './nonce-store.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nonces/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { NonceStore } from '@spinajs/authn/contracts';
2
+ export { NonceStore } from '@spinajs/authn/contracts';
3
+ export { MemoryNonceStore } from '@spinajs/authn/nonces';
4
+ /** `authn_nonce`: the primary key makes a claim atomic across processes; an expired row is taken over with a conditional update. */
5
+ export declare class DbNonceStore extends NonceStore {
6
+ private readonly purgeDue;
7
+ claim(key: string, expiresAt: Date, now: Date): Promise<boolean>;
8
+ /** Deletes up to one batch of expired keys; returns how many went. */
9
+ purge(now?: Date): Promise<number>;
10
+ }
11
+ //# sourceMappingURL=nonce-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce-store.d.ts","sourceRoot":"","sources":["../../../src/nonces/nonce-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAOtD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAazD,oIAAoI;AACpI,qBAEa,YAAa,SAAQ,UAAU;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IAEzC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAuB5E;IAED,sEAAsE;IACzD,KAAK,CAAC,GAAG,GAAE,IAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ1D;CACF"}
@@ -0,0 +1,72 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { NonceStore } from '@spinajs/authn/contracts';
8
+ import { Injectable, PerChildInstance } from '@spinajs/di';
9
+ import { UniqueViolation, everyNthCall, ormReady } from '@spinajs/orm';
10
+ import { AuthnNonce } from '../models/AuthnNonce.js';
11
+ import { checkedMs, checkedText, instant } from '../support/sql.js';
12
+ export { NonceStore } from '@spinajs/authn/contracts';
13
+ export { MemoryNonceStore } from '@spinajs/authn/nonces';
14
+ const KEY_MAX = 160;
15
+ const PURGE_EVERY = 64;
16
+ const PURGE_BATCH = 500;
17
+ /** A miss after a duplicate means a purge removed the row in between; a few retries cover that. */
18
+ const MAX_TRIES = 8;
19
+ function checkClaim(key, expiresAt, now, owner) {
20
+ checkedText(key, KEY_MAX, `${owner}.claim: key`);
21
+ return { expiresMs: checkedMs(expiresAt, `${owner}.claim: expiresAt`), nowMs: checkedMs(now, `${owner}.claim: now`) };
22
+ }
23
+ /** `authn_nonce`: the primary key makes a claim atomic across processes; an expired row is taken over with a conditional update. */
24
+ let DbNonceStore = class DbNonceStore extends NonceStore {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.purgeDue = everyNthCall(PURGE_EVERY);
28
+ }
29
+ async claim(key, expiresAt, now) {
30
+ const { expiresMs, nowMs } = checkClaim(key, expiresAt, now, 'DbNonceStore');
31
+ await ormReady();
32
+ if (this.purgeDue()) {
33
+ await this.purge(now);
34
+ }
35
+ const t = instant(nowMs);
36
+ const expires = instant(expiresMs);
37
+ for (let i = 0; i < MAX_TRIES; i++) {
38
+ try {
39
+ await AuthnNonce.insert({ k: key, expires_at: expires });
40
+ return true;
41
+ }
42
+ catch (err) {
43
+ if (!(err instanceof UniqueViolation))
44
+ throw err;
45
+ }
46
+ if ((await AuthnNonce.update({ expires_at: expires }).where('k', key).where('expires_at', '<=', t)).RowsAffected === 1) {
47
+ return true;
48
+ }
49
+ const live = await AuthnNonce.query().columns(['k']).where('k', key).where('expires_at', '>', t);
50
+ if (live.length > 0)
51
+ return false;
52
+ }
53
+ return false;
54
+ }
55
+ /** Deletes up to one batch of expired keys; returns how many went. */
56
+ async purge(now = new Date()) {
57
+ const ms = checkedMs(now, 'DbNonceStore.purge: now');
58
+ await ormReady();
59
+ const t = instant(ms);
60
+ // MSSQL pages with OFFSET … FETCH, which needs an ORDER BY.
61
+ const keys = (await AuthnNonce.query().columns(['k']).where('expires_at', '<=', t).orderBy('k').take(PURGE_BATCH)).map((r) => r.k);
62
+ if (keys.length === 0)
63
+ return 0;
64
+ return (await AuthnNonce.destroy().whereIn('k', keys).where('expires_at', '<=', t)).RowsAffected;
65
+ }
66
+ };
67
+ DbNonceStore = __decorate([
68
+ PerChildInstance(),
69
+ Injectable(NonceStore)
70
+ ], DbNonceStore);
71
+ export { DbNonceStore };
72
+ //# sourceMappingURL=nonce-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce-store.js","sourceRoot":"","sources":["../../../src/nonces/nonce-store.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,25 @@
1
+ import { SecretStore } from '@spinajs/authn/contracts';
2
+ import type { IdentityRef } from '@spinajs/authn/contracts';
3
+ import type { DateTime } from 'luxon';
4
+ /**
5
+ * `authn_secret`: single-use secrets stored as the hex SHA-256 of the raw value only (SR-09). The raw secret is
6
+ * 32 random bytes as base64url (43 chars). Times are taken in Node at call time (F7); the claim of `redeem`
7
+ * decides expiry and single use in SQL against that time (D10).
8
+ *
9
+ * Two parallel `issue` calls for one identity and purpose may both leave a live row: each deletes, then inserts.
10
+ */
11
+ export declare class DbSecretStore extends SecretStore {
12
+ private readonly purgeDue;
13
+ issue(identity: IdentityRef, purpose: string, ttlSeconds: number): Promise<string>;
14
+ /**
15
+ * Looks the row up by the hash of `raw`, so no stored value is compared with the input in Node. The lookup
16
+ * also matches identity and purpose; the claim succeeds for exactly one caller.
17
+ */
18
+ redeem(identity: IdentityRef, purpose: string, raw: string): Promise<boolean>;
19
+ /** Deletes up to one batch of spent and expired rows; returns how many went. */
20
+ purge(now?: Date): Promise<number>;
21
+ /** @internal An early exit only: the claim's SQL guard decides. */
22
+ protected liveInNode(expiresAt: DateTime | null | undefined, nowMs: number): boolean;
23
+ private purgeNowAndThen;
24
+ }
25
+ //# sourceMappingURL=db-secret-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-secret-store.d.ts","sourceRoot":"","sources":["../../../src/secrets/db-secret-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAatC;;;;;;GAMG;AACH,qBAEa,aAAc,SAAQ,WAAW;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IAEzC,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY9F;IAED;;;OAGG;IACU,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBzF;IAED,gFAAgF;IACnE,KAAK,CAAC,GAAG,GAAE,IAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAW1D;IAED,mEAAmE;IACnE,SAAS,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnF;YAEa,eAAe;CAK9B"}