@rapidrest/auth 1.0.0-beta.1

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 (201) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -0
  3. package/dist/lib/auth/BasicStrategy.js +82 -0
  4. package/dist/lib/auth/BasicStrategy.js.map +1 -0
  5. package/dist/lib/auth/FIDO2Strategy.js +179 -0
  6. package/dist/lib/auth/FIDO2Strategy.js.map +1 -0
  7. package/dist/lib/auth/MFAStrategy.js +219 -0
  8. package/dist/lib/auth/MFAStrategy.js.map +1 -0
  9. package/dist/lib/auth/OIDCStrategy.js +397 -0
  10. package/dist/lib/auth/OIDCStrategy.js.map +1 -0
  11. package/dist/lib/auth/OTPStrategy.js +143 -0
  12. package/dist/lib/auth/OTPStrategy.js.map +1 -0
  13. package/dist/lib/auth/PasskeyStrategy.js +185 -0
  14. package/dist/lib/auth/PasskeyStrategy.js.map +1 -0
  15. package/dist/lib/auth/TOTPStrategy.js +84 -0
  16. package/dist/lib/auth/TOTPStrategy.js.map +1 -0
  17. package/dist/lib/auth/index.js +10 -0
  18. package/dist/lib/auth/index.js.map +1 -0
  19. package/dist/lib/auth/shared.js +431 -0
  20. package/dist/lib/auth/shared.js.map +1 -0
  21. package/dist/lib/auth/types.js +12 -0
  22. package/dist/lib/auth/types.js.map +1 -0
  23. package/dist/lib/index.js +4 -0
  24. package/dist/lib/index.js.map +1 -0
  25. package/dist/lib/models/index.js +2 -0
  26. package/dist/lib/models/index.js.map +1 -0
  27. package/dist/lib/models/mongo/AliasMongo.js +77 -0
  28. package/dist/lib/models/mongo/AliasMongo.js.map +1 -0
  29. package/dist/lib/models/mongo/ProfileMongo.js +99 -0
  30. package/dist/lib/models/mongo/ProfileMongo.js.map +1 -0
  31. package/dist/lib/models/mongo/SecretMongo.js +71 -0
  32. package/dist/lib/models/mongo/SecretMongo.js.map +1 -0
  33. package/dist/lib/models/mongo/UserMongo.js +71 -0
  34. package/dist/lib/models/mongo/UserMongo.js.map +1 -0
  35. package/dist/lib/models/mongo/index.js +5 -0
  36. package/dist/lib/models/mongo/index.js.map +1 -0
  37. package/dist/lib/models/mongo.js +2 -0
  38. package/dist/lib/models/mongo.js.map +1 -0
  39. package/dist/lib/models/sql/AliasSQL.js +77 -0
  40. package/dist/lib/models/sql/AliasSQL.js.map +1 -0
  41. package/dist/lib/models/sql/ProfileSQL.js +99 -0
  42. package/dist/lib/models/sql/ProfileSQL.js.map +1 -0
  43. package/dist/lib/models/sql/SecretSQL.js +71 -0
  44. package/dist/lib/models/sql/SecretSQL.js.map +1 -0
  45. package/dist/lib/models/sql/UserSQL.js +68 -0
  46. package/dist/lib/models/sql/UserSQL.js.map +1 -0
  47. package/dist/lib/models/sql/index.js +5 -0
  48. package/dist/lib/models/sql/index.js.map +1 -0
  49. package/dist/lib/models/sql.js +2 -0
  50. package/dist/lib/models/sql.js.map +1 -0
  51. package/dist/lib/models/types.js +35 -0
  52. package/dist/lib/models/types.js.map +1 -0
  53. package/dist/lib/mongo.js +3 -0
  54. package/dist/lib/mongo.js.map +1 -0
  55. package/dist/lib/routes/BaseAliasRoute.js +10 -0
  56. package/dist/lib/routes/BaseAliasRoute.js.map +1 -0
  57. package/dist/lib/routes/BaseAuthBasicRoute.js +132 -0
  58. package/dist/lib/routes/BaseAuthBasicRoute.js.map +1 -0
  59. package/dist/lib/routes/BaseAuthFIDO2Route.js +191 -0
  60. package/dist/lib/routes/BaseAuthFIDO2Route.js.map +1 -0
  61. package/dist/lib/routes/BaseAuthMFARoute.js +310 -0
  62. package/dist/lib/routes/BaseAuthMFARoute.js.map +1 -0
  63. package/dist/lib/routes/BaseAuthOIDCRoute.js +231 -0
  64. package/dist/lib/routes/BaseAuthOIDCRoute.js.map +1 -0
  65. package/dist/lib/routes/BaseAuthOTPRoute.js +214 -0
  66. package/dist/lib/routes/BaseAuthOTPRoute.js.map +1 -0
  67. package/dist/lib/routes/BaseAuthPasskeyRoute.js +182 -0
  68. package/dist/lib/routes/BaseAuthPasskeyRoute.js.map +1 -0
  69. package/dist/lib/routes/BaseAuthTOTPRoute.js +133 -0
  70. package/dist/lib/routes/BaseAuthTOTPRoute.js.map +1 -0
  71. package/dist/lib/routes/BaseProfileRoute.js +10 -0
  72. package/dist/lib/routes/BaseProfileRoute.js.map +1 -0
  73. package/dist/lib/routes/BaseSecretRoute.js +399 -0
  74. package/dist/lib/routes/BaseSecretRoute.js.map +1 -0
  75. package/dist/lib/routes/BaseUserRoute.js +10 -0
  76. package/dist/lib/routes/BaseUserRoute.js.map +1 -0
  77. package/dist/lib/routes/UserUtils.js +78 -0
  78. package/dist/lib/routes/UserUtils.js.map +1 -0
  79. package/dist/lib/routes/index.js +13 -0
  80. package/dist/lib/routes/index.js.map +1 -0
  81. package/dist/lib/routes/mongo/BaseAliasRouteMongo.js +20 -0
  82. package/dist/lib/routes/mongo/BaseAliasRouteMongo.js.map +1 -0
  83. package/dist/lib/routes/mongo/BaseAuthBasicRouteMongo.js +14 -0
  84. package/dist/lib/routes/mongo/BaseAuthBasicRouteMongo.js.map +1 -0
  85. package/dist/lib/routes/mongo/BaseAuthFIDO2RouteMongo.js +14 -0
  86. package/dist/lib/routes/mongo/BaseAuthFIDO2RouteMongo.js.map +1 -0
  87. package/dist/lib/routes/mongo/BaseAuthMFARouteMongo.js +14 -0
  88. package/dist/lib/routes/mongo/BaseAuthMFARouteMongo.js.map +1 -0
  89. package/dist/lib/routes/mongo/BaseAuthOIDCRouteMongo.js +11 -0
  90. package/dist/lib/routes/mongo/BaseAuthOIDCRouteMongo.js.map +1 -0
  91. package/dist/lib/routes/mongo/BaseAuthOTPRouteMongo.js +14 -0
  92. package/dist/lib/routes/mongo/BaseAuthOTPRouteMongo.js.map +1 -0
  93. package/dist/lib/routes/mongo/BaseAuthPasskeyRouteMongo.js +14 -0
  94. package/dist/lib/routes/mongo/BaseAuthPasskeyRouteMongo.js.map +1 -0
  95. package/dist/lib/routes/mongo/BaseAuthTOTPRouteMongo.js +14 -0
  96. package/dist/lib/routes/mongo/BaseAuthTOTPRouteMongo.js.map +1 -0
  97. package/dist/lib/routes/mongo/BaseProfileRouteMongo.js +20 -0
  98. package/dist/lib/routes/mongo/BaseProfileRouteMongo.js.map +1 -0
  99. package/dist/lib/routes/mongo/BaseSecretRouteMongo.js +20 -0
  100. package/dist/lib/routes/mongo/BaseSecretRouteMongo.js.map +1 -0
  101. package/dist/lib/routes/mongo/BaseUserRouteMongo.js +20 -0
  102. package/dist/lib/routes/mongo/BaseUserRouteMongo.js.map +1 -0
  103. package/dist/lib/routes/mongo/index.js +12 -0
  104. package/dist/lib/routes/mongo/index.js.map +1 -0
  105. package/dist/lib/routes/mongo.js +2 -0
  106. package/dist/lib/routes/mongo.js.map +1 -0
  107. package/dist/lib/routes/sql/BaseAliasRouteSQL.js +20 -0
  108. package/dist/lib/routes/sql/BaseAliasRouteSQL.js.map +1 -0
  109. package/dist/lib/routes/sql/BaseAuthBasicRouteSQL.js +14 -0
  110. package/dist/lib/routes/sql/BaseAuthBasicRouteSQL.js.map +1 -0
  111. package/dist/lib/routes/sql/BaseAuthFIDO2RouteSQL.js +14 -0
  112. package/dist/lib/routes/sql/BaseAuthFIDO2RouteSQL.js.map +1 -0
  113. package/dist/lib/routes/sql/BaseAuthMFARouteSQL.js +14 -0
  114. package/dist/lib/routes/sql/BaseAuthMFARouteSQL.js.map +1 -0
  115. package/dist/lib/routes/sql/BaseAuthOIDCRouteSQL.js +11 -0
  116. package/dist/lib/routes/sql/BaseAuthOIDCRouteSQL.js.map +1 -0
  117. package/dist/lib/routes/sql/BaseAuthOTPRouteSQL.js +14 -0
  118. package/dist/lib/routes/sql/BaseAuthOTPRouteSQL.js.map +1 -0
  119. package/dist/lib/routes/sql/BaseAuthPasskeyRouteSQL.js +14 -0
  120. package/dist/lib/routes/sql/BaseAuthPasskeyRouteSQL.js.map +1 -0
  121. package/dist/lib/routes/sql/BaseAuthTOTPRouteSQL.js +14 -0
  122. package/dist/lib/routes/sql/BaseAuthTOTPRouteSQL.js.map +1 -0
  123. package/dist/lib/routes/sql/BaseProfileRouteSQL.js +20 -0
  124. package/dist/lib/routes/sql/BaseProfileRouteSQL.js.map +1 -0
  125. package/dist/lib/routes/sql/BaseSecretRouteSQL.js +20 -0
  126. package/dist/lib/routes/sql/BaseSecretRouteSQL.js.map +1 -0
  127. package/dist/lib/routes/sql/BaseUserRouteSQL.js +20 -0
  128. package/dist/lib/routes/sql/BaseUserRouteSQL.js.map +1 -0
  129. package/dist/lib/routes/sql/index.js +12 -0
  130. package/dist/lib/routes/sql/index.js.map +1 -0
  131. package/dist/lib/routes/sql.js +2 -0
  132. package/dist/lib/routes/sql.js.map +1 -0
  133. package/dist/lib/sql.js +3 -0
  134. package/dist/lib/sql.js.map +1 -0
  135. package/dist/types/auth/BasicStrategy.d.ts +39 -0
  136. package/dist/types/auth/FIDO2Strategy.d.ts +85 -0
  137. package/dist/types/auth/MFAStrategy.d.ts +110 -0
  138. package/dist/types/auth/OIDCStrategy.d.ts +188 -0
  139. package/dist/types/auth/OTPStrategy.d.ts +88 -0
  140. package/dist/types/auth/PasskeyStrategy.d.ts +81 -0
  141. package/dist/types/auth/TOTPStrategy.d.ts +49 -0
  142. package/dist/types/auth/index.d.ts +9 -0
  143. package/dist/types/auth/shared.d.ts +136 -0
  144. package/dist/types/auth/types.d.ts +127 -0
  145. package/dist/types/index.d.ts +3 -0
  146. package/dist/types/models/index.d.ts +1 -0
  147. package/dist/types/models/mongo/AliasMongo.d.ts +15 -0
  148. package/dist/types/models/mongo/ProfileMongo.d.ts +17 -0
  149. package/dist/types/models/mongo/SecretMongo.d.ts +14 -0
  150. package/dist/types/models/mongo/UserMongo.d.ts +14 -0
  151. package/dist/types/models/mongo/index.d.ts +4 -0
  152. package/dist/types/models/mongo.d.ts +1 -0
  153. package/dist/types/models/sql/AliasSQL.d.ts +15 -0
  154. package/dist/types/models/sql/ProfileSQL.d.ts +17 -0
  155. package/dist/types/models/sql/SecretSQL.d.ts +14 -0
  156. package/dist/types/models/sql/UserSQL.d.ts +14 -0
  157. package/dist/types/models/sql/index.d.ts +4 -0
  158. package/dist/types/models/sql.d.ts +1 -0
  159. package/dist/types/models/types.d.ts +136 -0
  160. package/dist/types/mongo.d.ts +2 -0
  161. package/dist/types/routes/BaseAliasRoute.d.ts +7 -0
  162. package/dist/types/routes/BaseAuthBasicRoute.d.ts +27 -0
  163. package/dist/types/routes/BaseAuthFIDO2Route.d.ts +50 -0
  164. package/dist/types/routes/BaseAuthMFARoute.d.ts +61 -0
  165. package/dist/types/routes/BaseAuthOIDCRoute.d.ts +33 -0
  166. package/dist/types/routes/BaseAuthOTPRoute.d.ts +53 -0
  167. package/dist/types/routes/BaseAuthPasskeyRoute.d.ts +41 -0
  168. package/dist/types/routes/BaseAuthTOTPRoute.d.ts +38 -0
  169. package/dist/types/routes/BaseProfileRoute.d.ts +7 -0
  170. package/dist/types/routes/BaseSecretRoute.d.ts +89 -0
  171. package/dist/types/routes/BaseUserRoute.d.ts +7 -0
  172. package/dist/types/routes/UserUtils.d.ts +21 -0
  173. package/dist/types/routes/index.d.ts +12 -0
  174. package/dist/types/routes/mongo/BaseAliasRouteMongo.d.ts +4 -0
  175. package/dist/types/routes/mongo/BaseAuthBasicRouteMongo.d.ts +7 -0
  176. package/dist/types/routes/mongo/BaseAuthFIDO2RouteMongo.d.ts +7 -0
  177. package/dist/types/routes/mongo/BaseAuthMFARouteMongo.d.ts +7 -0
  178. package/dist/types/routes/mongo/BaseAuthOIDCRouteMongo.d.ts +7 -0
  179. package/dist/types/routes/mongo/BaseAuthOTPRouteMongo.d.ts +7 -0
  180. package/dist/types/routes/mongo/BaseAuthPasskeyRouteMongo.d.ts +7 -0
  181. package/dist/types/routes/mongo/BaseAuthTOTPRouteMongo.d.ts +7 -0
  182. package/dist/types/routes/mongo/BaseProfileRouteMongo.d.ts +4 -0
  183. package/dist/types/routes/mongo/BaseSecretRouteMongo.d.ts +4 -0
  184. package/dist/types/routes/mongo/BaseUserRouteMongo.d.ts +4 -0
  185. package/dist/types/routes/mongo/index.d.ts +11 -0
  186. package/dist/types/routes/mongo.d.ts +1 -0
  187. package/dist/types/routes/sql/BaseAliasRouteSQL.d.ts +4 -0
  188. package/dist/types/routes/sql/BaseAuthBasicRouteSQL.d.ts +7 -0
  189. package/dist/types/routes/sql/BaseAuthFIDO2RouteSQL.d.ts +7 -0
  190. package/dist/types/routes/sql/BaseAuthMFARouteSQL.d.ts +7 -0
  191. package/dist/types/routes/sql/BaseAuthOIDCRouteSQL.d.ts +7 -0
  192. package/dist/types/routes/sql/BaseAuthOTPRouteSQL.d.ts +7 -0
  193. package/dist/types/routes/sql/BaseAuthPasskeyRouteSQL.d.ts +7 -0
  194. package/dist/types/routes/sql/BaseAuthTOTPRouteSQL.d.ts +7 -0
  195. package/dist/types/routes/sql/BaseProfileRouteSQL.d.ts +4 -0
  196. package/dist/types/routes/sql/BaseSecretRouteSQL.d.ts +4 -0
  197. package/dist/types/routes/sql/BaseUserRouteSQL.d.ts +4 -0
  198. package/dist/types/routes/sql/index.d.ts +11 -0
  199. package/dist/types/routes/sql.d.ts +1 -0
  200. package/dist/types/sql.d.ts +2 -0
  201. package/package.json +138 -0
@@ -0,0 +1,399 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ ///////////////////////////////////////////////////////////////////////////////
14
+ // Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
15
+ ///////////////////////////////////////////////////////////////////////////////
16
+ import { ApiErrors, DocDecorators, ModelRoute, RepoUtils, RouteDecorators, } from "@rapidrest/service-core";
17
+ import { SecretType } from "../models/types.js";
18
+ import { ApiError, ObjectDecorators } from "@rapidrest/core";
19
+ import { generatePasskeyRegistrationOptions, generateTOTPURI, importArgon2, importOTPLib, isPasskeyRegistrationResponse, isValidTOTPSecret, verifyPasskeyRegistrationResponse, } from "../auth/shared.js";
20
+ const { Config } = ObjectDecorators;
21
+ const { Description, Returns, Summary } = DocDecorators;
22
+ const { Delete, Get, Head, Param, Post, Query, Request, Response, User, Validate } = RouteDecorators;
23
+ /**
24
+ * @author Jean-Philippe Steinmetz
25
+ */
26
+ export class BaseSecretRoute extends ModelRoute {
27
+ constructor() {
28
+ super(...arguments);
29
+ this.repoUtilsClass = RepoUtils;
30
+ /**
31
+ * The relying party configuration used for validating and generating passkey (WebAuthn) registration data.
32
+ */
33
+ this.passkeyConfig = {
34
+ rpName: "rapidrest",
35
+ rpID: "rapidrest",
36
+ origin: "http://localhost:3000",
37
+ };
38
+ /**
39
+ * The relying party configuration used for validating and generating FIDO2 hardware security key
40
+ * (WebAuthn) registration data. Kept separate from `passkeyConfig` since a hardware key deployment
41
+ * commonly wants a different `authenticatorAttachment`/`residentKey` policy — a hardware key is
42
+ * typically registered as a `"cross-platform"`, non-discoverable credential tied to a known
43
+ * account, rather than a discoverable, possibly-synced passkey.
44
+ */
45
+ this.fido2Config = {
46
+ rpName: "rapidrest",
47
+ rpID: "rapidrest",
48
+ origin: "http://localhost:3000",
49
+ authenticatorAttachment: "cross-platform",
50
+ residentKey: "discouraged",
51
+ };
52
+ /**
53
+ * The issuer configuration used for validating and generating TOTP (RFC 6238) registration data.
54
+ */
55
+ this.totpConfig = {
56
+ issuer: "rapidrest",
57
+ digits: 6,
58
+ period: 30,
59
+ algorithm: "sha1",
60
+ epochTolerance: [5, 0],
61
+ };
62
+ }
63
+ /**
64
+ * Removes the `data` property from the secret(s) to protect sensitive information.
65
+ */
66
+ cleanData(obj) {
67
+ const objs = Array.isArray(obj) ? obj : [obj];
68
+ for (const obj of objs) {
69
+ delete obj.data;
70
+ }
71
+ }
72
+ async count(params, query, res, user) {
73
+ return super.doCount({ params, query, res, user });
74
+ }
75
+ async validateCreate(obj, req, user) {
76
+ const objs = Array.isArray(obj) ? obj : [obj];
77
+ for (const obj of objs) {
78
+ switch (obj.type) {
79
+ case SecretType.FIDO2:
80
+ await this.validateWebAuthnCreate(obj, req, this.fido2Config);
81
+ break;
82
+ case SecretType.PASSKEY:
83
+ await this.validateWebAuthnCreate(obj, req, this.passkeyConfig);
84
+ break;
85
+ case SecretType.PASSWORD:
86
+ {
87
+ if (typeof obj.data === "string") {
88
+ const argon = await importArgon2();
89
+ obj.data = await argon.hash(obj.data);
90
+ }
91
+ else {
92
+ throw new ApiError(ApiErrors.INVALID_REQUEST, 400, "A secret of type 'password' must specify string data.");
93
+ }
94
+ }
95
+ break;
96
+ case SecretType.TOTP:
97
+ await this.validateTOTPCreate(obj);
98
+ break;
99
+ }
100
+ }
101
+ }
102
+ /**
103
+ * Verifies a client-submitted WebAuthn `RegistrationResponseJSON` (as produced by
104
+ * `navigator.credentials.create()` using the options from `generatePasskeyRegistrationOptions()`) against
105
+ * the challenge stored in the session, and replaces `obj.data` with the resulting `StoredPasskeyCredential`.
106
+ *
107
+ * Shared by both `passkey` and `fido2` secrets — the two differ only in relying party configuration
108
+ * (see `passkeyConfig`/`fido2Config`) and which `SecretType` they're persisted under, not in the
109
+ * underlying WebAuthn ceremony.
110
+ *
111
+ * Per the WebAuthn registration ceremony (https://www.w3.org/TR/webauthn-2/#sctn-registering-a-new-credential),
112
+ * the credential ID must be unique across all accounts known to this relying party. Rather than duplicate that
113
+ * check here, the credential ID is used directly as this secret's own `uid` so that `ModelRoute`'s existing
114
+ * create-time identifier check rejects the request should the ID already be registered to any account. This
115
+ * also lets a login ceremony, which only has the credential ID to go on, look the secret up directly by its
116
+ * primary key (see `BaseAuthPasskeyRoute`/`BaseAuthFIDO2Route`'s `getCredentialById`/`updateCredentialCounter`).
117
+ *
118
+ * @param obj The secret being created. Its `data` property must be a `RegistrationResponseJSON`.
119
+ * @param req The source HTTP request, used to retrieve the challenge stored in the session by a prior call to
120
+ * `generatePasskeyRegistrationOptions()`.
121
+ * @param config The relying party configuration to verify the response against.
122
+ */
123
+ async validateWebAuthnCreate(obj, req, config) {
124
+ if (!req.session) {
125
+ throw new Error("This secret type requires session support. Configure the `session` config " +
126
+ "block so the session middleware is registered.");
127
+ }
128
+ if (!req.session.challenge) {
129
+ throw new ApiError(ApiErrors.INVALID_REQUEST, 400, "No WebAuthn registration ceremony in progress for this session.");
130
+ }
131
+ if (typeof obj.userUid !== "string" || obj.userUid.length === 0) {
132
+ throw new ApiError(ApiErrors.INVALID_REQUEST, 400, "This secret type must specify a 'userUid'.");
133
+ }
134
+ // The challenge is single-use regardless of outcome — cleared as soon as it's read, before
135
+ // verification is even attempted.
136
+ const expectedChallenge = req.session.challenge;
137
+ delete req.session.challenge;
138
+ if (!isPasskeyRegistrationResponse(obj.data)) {
139
+ throw new ApiError(ApiErrors.INVALID_REQUEST, 400, "This secret type must specify a valid WebAuthn registration response.");
140
+ }
141
+ const result = await verifyPasskeyRegistrationResponse(config, expectedChallenge, obj.data);
142
+ if (!result.verified || !result.registrationInfo) {
143
+ throw new ApiError(ApiErrors.INVALID_REQUEST, 400, "WebAuthn registration could not be verified.");
144
+ }
145
+ const { credential } = result.registrationInfo;
146
+ const storedCredential = {
147
+ id: credential.id,
148
+ uid: obj.userUid,
149
+ publicKey: credential.publicKey,
150
+ counter: credential.counter,
151
+ transports: credential.transports,
152
+ };
153
+ obj.uid = credential.id;
154
+ obj.data = storedCredential;
155
+ }
156
+ /**
157
+ * Validates (or generates) the secret for a new `totp` secret per RFC 6238/RFC 4226.
158
+ *
159
+ * The client may either bring their own Base32-encoded secret (e.g. one generated on a
160
+ * different server for migration purposes) or, more commonly, omit `data` entirely and have one
161
+ * generated here. Either way, the secret's token parameters (`digits`/`period`/`algorithm`) are
162
+ * captured onto the stored `TOTPSecret` alongside it, rather than left to always defer to
163
+ * `totpConfig`, so verification keeps working for this secret even if the configured defaults
164
+ * change later.
165
+ *
166
+ * @param obj The secret being created. If `data` is a string, it's used as the caller-supplied
167
+ * secret; otherwise a new one is generated.
168
+ */
169
+ async validateTOTPCreate(obj) {
170
+ const { generateSecret } = await importOTPLib();
171
+ let secret;
172
+ if (obj.data !== undefined) {
173
+ if (typeof obj.data !== "string" || !(await isValidTOTPSecret(obj.data))) {
174
+ throw new ApiError(ApiErrors.INVALID_REQUEST, 400, "A secret of type 'totp' must be a Base32-encoded string of at least 128 bits.");
175
+ }
176
+ secret = obj.data;
177
+ }
178
+ else {
179
+ secret = generateSecret();
180
+ }
181
+ const totpSecret = {
182
+ secret,
183
+ digits: this.totpConfig.digits,
184
+ period: this.totpConfig.period,
185
+ algorithm: this.totpConfig.algorithm,
186
+ epochTolerance: this.totpConfig.epochTolerance,
187
+ };
188
+ obj.data = totpSecret;
189
+ }
190
+ /**
191
+ * Begins a WebAuthn registration ceremony for the authenticated user: generates a set of
192
+ * `PublicKeyCredentialCreationOptions` (RFC/spec compliant per https://www.w3.org/TR/webauthn-2/), scoped
193
+ * to exclude any credentials of the given type the user already has registered, and stores the challenge
194
+ * in the session for verification by `validateWebAuthnCreate()` once the client completes the ceremony
195
+ * and submits a new secret of that type. Shared by both the `passkey` and `fido2` registration endpoints.
196
+ *
197
+ * @param req The source HTTP request. Used to persist the generated challenge in the session.
198
+ * @param user The authenticated user the new credential will be associated with.
199
+ * @param type The secret type being registered — `passkey` or `fido2`.
200
+ * @param config The relying party configuration to generate options with.
201
+ */
202
+ async beginWebAuthnRegistration(req, user, type, config) {
203
+ if (!this.repoUtils) {
204
+ throw new Error("repoUtils is not set.");
205
+ }
206
+ const existing = await this.repoUtils.find({ type, userUid: user.uid }, { ignoreACL: true, user });
207
+ const excludeCredentials = existing.map((secret) => {
208
+ const credential = secret.data;
209
+ return { id: credential.id, transports: credential.transports };
210
+ });
211
+ return await generatePasskeyRegistrationOptions(config, req, { id: user.uid, name: user.uid }, excludeCredentials);
212
+ }
213
+ async passkeyRegistrationOptions(req, user) {
214
+ if (!user) {
215
+ throw new ApiError(ApiErrors.AUTH_REQUIRED, 401, "Authentication is required to register a passkey.");
216
+ }
217
+ return this.beginWebAuthnRegistration(req, user, SecretType.PASSKEY, this.passkeyConfig);
218
+ }
219
+ async fido2RegistrationOptions(req, user) {
220
+ if (!user) {
221
+ throw new ApiError(ApiErrors.AUTH_REQUIRED, 401, "Authentication is required to register a FIDO2 security key.");
222
+ }
223
+ return this.beginWebAuthnRegistration(req, user, SecretType.FIDO2, this.fido2Config);
224
+ }
225
+ async create(obj, req, user) {
226
+ const result = await super.doCreate(obj, { req, user });
227
+ // Selectively clean data from certain types of secrets. Some secret types require the data needs to be
228
+ // returned back to the client.
229
+ const objs = Array.isArray(result) ? result : [result];
230
+ for (const obj of objs) {
231
+ if ([SecretType.FIDO2, SecretType.PASSKEY, SecretType.PASSWORD].includes(obj.type)) {
232
+ delete obj.data;
233
+ }
234
+ else if (obj.type === SecretType.TOTP && obj.data) {
235
+ // The `otpauth://` provisioning URI is derived from the persisted secret rather than
236
+ // stored itself, so it's computed fresh here for the response only.
237
+ obj.data.uri = await generateTOTPURI(this.totpConfig, obj.userUid, obj.data);
238
+ }
239
+ }
240
+ return result;
241
+ }
242
+ async delete(id, version, purge, req, user) {
243
+ return super.doDelete(id, { user, req, version, purge: purge === "true" });
244
+ }
245
+ async exists(id, query, res, user) {
246
+ return super.doExists(id, { query, res, user });
247
+ }
248
+ async find(params, query, user) {
249
+ const results = await super.doFind({ params, query, user });
250
+ this.cleanData(results);
251
+ return results;
252
+ }
253
+ async findById(id, query, user) {
254
+ const result = await super.doFindById(id, { query, user });
255
+ if (result) {
256
+ this.cleanData(result);
257
+ }
258
+ return result;
259
+ }
260
+ async truncate(params, query, user) {
261
+ return super.doTruncate({ params, query, user });
262
+ }
263
+ }
264
+ __decorate([
265
+ Config("auth:passkey"),
266
+ __metadata("design:type", Object)
267
+ ], BaseSecretRoute.prototype, "passkeyConfig", void 0);
268
+ __decorate([
269
+ Config("auth:fido2"),
270
+ __metadata("design:type", Object)
271
+ ], BaseSecretRoute.prototype, "fido2Config", void 0);
272
+ __decorate([
273
+ Config("auth:totp"),
274
+ __metadata("design:type", Object)
275
+ ], BaseSecretRoute.prototype, "totpConfig", void 0);
276
+ __decorate([
277
+ Summary("Count secrets"),
278
+ Description("Returns the total count of secrets in the datastore based on the given criteria " +
279
+ "in the header as `Content-Length`."),
280
+ Returns([null]),
281
+ Head(),
282
+ __param(0, Param()),
283
+ __param(1, Query()),
284
+ __param(2, Response),
285
+ __param(3, User),
286
+ __metadata("design:type", Function),
287
+ __metadata("design:paramtypes", [Object, Object, Object, Object]),
288
+ __metadata("design:returntype", Promise)
289
+ ], BaseSecretRoute.prototype, "count", null);
290
+ __decorate([
291
+ __param(1, Request),
292
+ __param(2, User),
293
+ __metadata("design:type", Function),
294
+ __metadata("design:paramtypes", [Object, Object, Object]),
295
+ __metadata("design:returntype", Promise)
296
+ ], BaseSecretRoute.prototype, "validateCreate", null);
297
+ __decorate([
298
+ Summary("Generate Passkey Registration Options"),
299
+ Description("Begins a WebAuthn passkey registration ceremony for the authenticated user and returns the " +
300
+ "`PublicKeyCredentialCreationOptions` to pass to `navigator.credentials.create()`. Submit the " +
301
+ "resulting attestation response as the `data` of a new `passkey` secret to finish the ceremony."),
302
+ Returns([Object]),
303
+ Get("/passkey/register"),
304
+ __param(0, Request),
305
+ __param(1, User),
306
+ __metadata("design:type", Function),
307
+ __metadata("design:paramtypes", [Object, Object]),
308
+ __metadata("design:returntype", Promise)
309
+ ], BaseSecretRoute.prototype, "passkeyRegistrationOptions", null);
310
+ __decorate([
311
+ Summary("Generate FIDO2 Registration Options"),
312
+ Description("Begins a WebAuthn registration ceremony for the authenticated user's FIDO2 hardware security key and " +
313
+ "returns the `PublicKeyCredentialCreationOptions` to pass to `navigator.credentials.create()`. Submit " +
314
+ "the resulting attestation response as the `data` of a new `fido2` secret to finish the ceremony."),
315
+ Returns([Object]),
316
+ Get("/fido2/register"),
317
+ __param(0, Request),
318
+ __param(1, User),
319
+ __metadata("design:type", Function),
320
+ __metadata("design:paramtypes", [Object, Object]),
321
+ __metadata("design:returntype", Promise)
322
+ ], BaseSecretRoute.prototype, "fido2RegistrationOptions", null);
323
+ __decorate([
324
+ Summary("Create Secret(s)"),
325
+ Description("Create a new Secret."),
326
+ Returns([Object]),
327
+ Post(),
328
+ Validate("validateCreate"),
329
+ __param(1, Request),
330
+ __param(2, User),
331
+ __metadata("design:type", Function),
332
+ __metadata("design:paramtypes", [Object, Object, Object]),
333
+ __metadata("design:returntype", Promise)
334
+ ], BaseSecretRoute.prototype, "create", null);
335
+ __decorate([
336
+ Summary("Delete secret by ID"),
337
+ Description("Deletes the secret from the service."),
338
+ Returns([null]),
339
+ Delete("/:id"),
340
+ __param(0, Param("id")),
341
+ __param(1, Query("version")),
342
+ __param(2, Query("purge")),
343
+ __param(3, Request),
344
+ __param(4, User),
345
+ __metadata("design:type", Function),
346
+ __metadata("design:paramtypes", [String, Object, Object, Object, Object]),
347
+ __metadata("design:returntype", Promise)
348
+ ], BaseSecretRoute.prototype, "delete", null);
349
+ __decorate([
350
+ Summary("Exists"),
351
+ Description("Returns the total count of secrets in the datastore based on the given criteria " +
352
+ "in the header as `Content-Length`."),
353
+ Returns([null]),
354
+ Head("/:id"),
355
+ __param(0, Param("id")),
356
+ __param(1, Query()),
357
+ __param(2, Response),
358
+ __param(3, User),
359
+ __metadata("design:type", Function),
360
+ __metadata("design:paramtypes", [String, Object, Object, Object]),
361
+ __metadata("design:returntype", Promise)
362
+ ], BaseSecretRoute.prototype, "exists", null);
363
+ __decorate([
364
+ Summary("Find All Secrets"),
365
+ Description("Returns all Secrets from the system that the user has access to."),
366
+ Returns([[Array, Object]]),
367
+ Get(),
368
+ __param(0, Param()),
369
+ __param(1, Query()),
370
+ __param(2, User),
371
+ __metadata("design:type", Function),
372
+ __metadata("design:paramtypes", [Object, Object, Object]),
373
+ __metadata("design:returntype", Promise)
374
+ ], BaseSecretRoute.prototype, "find", null);
375
+ __decorate([
376
+ Summary("Find Secret by ID"),
377
+ Description("Returns a single Secret from the system that the user has access to."),
378
+ Returns([Object]),
379
+ Get("/:id"),
380
+ __param(0, Param("id")),
381
+ __param(1, Query()),
382
+ __param(2, User),
383
+ __metadata("design:type", Function),
384
+ __metadata("design:paramtypes", [String, Object, Object]),
385
+ __metadata("design:returntype", Promise)
386
+ ], BaseSecretRoute.prototype, "findById", null);
387
+ __decorate([
388
+ Summary("Truncate Secrets"),
389
+ Description("Deletes all Secrets from the datastore that the user has access to."),
390
+ Returns([null]),
391
+ Delete(),
392
+ __param(0, Param()),
393
+ __param(1, Query()),
394
+ __param(2, User),
395
+ __metadata("design:type", Function),
396
+ __metadata("design:paramtypes", [Object, Object, Object]),
397
+ __metadata("design:returntype", Promise)
398
+ ], BaseSecretRoute.prototype, "truncate", null);
399
+ //# sourceMappingURL=BaseSecretRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseSecretRoute.js","sourceRoot":"","sources":["../../../src/routes/BaseSecretRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,+EAA+E;AAC/E,OAAO,EACH,SAAS,EACT,aAAa,EAGb,UAAU,EACV,SAAS,EACT,eAAe,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAW,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EACH,kCAAkC,EAClC,eAAe,EACf,YAAY,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;IAChB,WAAA,KAAK,CAAC,OAAO,CAAC,CAAA;IACd,WAAA,OAAO,CAAA;IACP,WAAA,IAAI,CAAA;;;;6CAGR;AASY;IAPZ,OAAO,CAAC,QAAQ,CAAC;IACjB,WAAW,CACR,kFAAkF;QAC9E,oCAAoC,CAC3C;IACA,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IACf,IAAI,CAAC,MAAM,CAAC;IAER,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;IACX,WAAA,KAAK,EAAE,CAAA;IACP,WAAA,QAAQ,CAAA;IACR,WAAA,IAAI,CAAA;;;;6CAGR;AAMY;IAJZ,OAAO,CAAC,kBAAkB,CAAC;IAC3B,WAAW,CAAC,kEAAkE,CAAC;IAC/E,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1B,GAAG,EAAE;IACa,WAAA,KAAK,EAAE,CAAA;IAAe,WAAA,KAAK,EAAE,CAAA;IAAc,WAAA,IAAI,CAAA;;;;2CAIjE;AAMY;IAJZ,OAAO,CAAC,mBAAmB,CAAC;IAC5B,WAAW,CAAC,sEAAsE,CAAC;IACnF,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IACjB,GAAG,CAAC,MAAM,CAAC;IACW,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;IAAc,WAAA,KAAK,EAAE,CAAA;IAAc,WAAA,IAAI,CAAA;;;;+CAMxE;AAMY;IAJZ,OAAO,CAAC,kBAAkB,CAAC;IAC3B,WAAW,CAAC,qEAAqE,CAAC;IAClF,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IACf,MAAM,EAAE;IACc,WAAA,KAAK,EAAE,CAAA;IAAe,WAAA,KAAK,EAAE,CAAA;IAAc,WAAA,IAAI,CAAA;;;;+CAErE"}
@@ -0,0 +1,10 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
3
+ ///////////////////////////////////////////////////////////////////////////////
4
+ import { CRUDRoute } from "@rapidrest/service-core";
5
+ /**
6
+ * @author Jean-Philippe Steinmetz
7
+ */
8
+ export class BaseUserRoute extends CRUDRoute {
9
+ }
10
+ //# sourceMappingURL=BaseUserRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseUserRoute.js","sourceRoot":"","sources":["../../../src/routes/BaseUserRoute.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,+EAA+E;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD;;GAEG;AACH,MAAM,OAAgB,aAA8B,SAAQ,SAAY;CAAG"}
@@ -0,0 +1,78 @@
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
+ ////////////////////////////////////////////////////////////////////////////////
11
+ // Copyright (C) 2026 Jean-Philippe Steinmetz
12
+ ////////////////////////////////////////////////////////////////////////////////
13
+ import { ObjectFactory, RepoUtils } from "@rapidrest/service-core";
14
+ import { ObjectDecorators } from "@rapidrest/core";
15
+ const { Init, Inject } = ObjectDecorators;
16
+ /**
17
+ * Utility class for working with persisted `User` objects in the database.
18
+ */
19
+ export class UserUtils {
20
+ constructor(userClass, aliasClass) {
21
+ this.aliasClass = aliasClass;
22
+ this.userClass = userClass;
23
+ }
24
+ async init() {
25
+ if (!this.objectFactory) {
26
+ throw new Error("objectFactory is not set.");
27
+ }
28
+ if (!this.aliasRepo) {
29
+ this.aliasRepo = await this.objectFactory.newInstance(RepoUtils, {
30
+ name: `${RepoUtils.name}:${this.aliasClass.name}`,
31
+ args: [this.aliasClass],
32
+ });
33
+ }
34
+ if (!this.userRepo) {
35
+ this.userRepo = await this.objectFactory.newInstance(RepoUtils, {
36
+ name: `${RepoUtils.name}:${this.userClass.name}`,
37
+ args: [this.userClass],
38
+ });
39
+ }
40
+ }
41
+ /**
42
+ * Performs a look up of the user with the given id. The id may be one of: the user's `uid` or an `Alias`.
43
+ *
44
+ * @param id The unique id of the user to lookup.
45
+ * @returns The `User` if found, otherwise `undefined`.
46
+ */
47
+ async lookup(id) {
48
+ if (!this.aliasRepo) {
49
+ throw new Error("aliasRepo is not set.");
50
+ }
51
+ if (!this.userRepo) {
52
+ throw new Error("userRepo is not set.");
53
+ }
54
+ // First let's try the id as the User `uid`.
55
+ let user = await this.userRepo.findOne(id, { ignoreACL: true });
56
+ if (user) {
57
+ return user;
58
+ }
59
+ // Okay, now let's try looking up the id as an Alias (by its uid or alias value) and resolve
60
+ // the user that it belongs to.
61
+ const alias = await this.aliasRepo.findOne(id, { ignoreACL: true });
62
+ if (alias) {
63
+ user = await this.userRepo.findOne(alias.userUid, { ignoreACL: true });
64
+ }
65
+ return user;
66
+ }
67
+ }
68
+ __decorate([
69
+ Inject(ObjectFactory),
70
+ __metadata("design:type", ObjectFactory)
71
+ ], UserUtils.prototype, "objectFactory", void 0);
72
+ __decorate([
73
+ Init,
74
+ __metadata("design:type", Function),
75
+ __metadata("design:paramtypes", []),
76
+ __metadata("design:returntype", Promise)
77
+ ], UserUtils.prototype, "init", null);
78
+ //# sourceMappingURL=UserUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserUtils.js","sourceRoot":"","sources":["../../../src/routes/UserUtils.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gFAAgF;AAChF,6CAA6C;AAC7C,gFAAgF;A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AC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC5C,CAAC;QAED,4CAA4C;QAC5C,IAAI,IAAI,GAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/E,IAAI,IAAI,EAAE,CAAC;YACP,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,4FAA4F;QAC5F,+BAA+B;QAC/B,MAAM,KAAK,GAAkB,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnF,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3E,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAzDa;IADT,MAAM,CAAC,aAAa,CAAC;8BACI,aAAa;gDAAC;AAQxB;IADf,IAAI;;;;qCAmBJ"}
@@ -0,0 +1,13 @@
1
+ export * from "./BaseAliasRoute.js";
2
+ export * from "./BaseAuthBasicRoute.js";
3
+ export * from "./BaseAuthFIDO2Route.js";
4
+ export * from "./BaseAuthMFARoute.js";
5
+ export * from "./BaseAuthOIDCRoute.js";
6
+ export * from "./BaseAuthOTPRoute.js";
7
+ export * from "./BaseAuthPasskeyRoute.js";
8
+ export * from "./BaseAuthTOTPRoute.js";
9
+ export * from "./BaseProfileRoute.js";
10
+ export * from "./BaseSecretRoute.js";
11
+ export * from "./BaseUserRoute.js";
12
+ export * from "./UserUtils.js";
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,20 @@
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
+ ///////////////////////////////////////////////////////////////////////////////
8
+ // Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
9
+ ///////////////////////////////////////////////////////////////////////////////
10
+ import { RouteDecorators } from "@rapidrest/service-core";
11
+ import { AliasMongo } from "../../mongo.js";
12
+ import { BaseAliasRoute } from "../BaseAliasRoute.js";
13
+ const { Model } = RouteDecorators;
14
+ let BaseAliasRouteMongo = class BaseAliasRouteMongo extends BaseAliasRoute {
15
+ };
16
+ BaseAliasRouteMongo = __decorate([
17
+ Model(AliasMongo)
18
+ ], BaseAliasRouteMongo);
19
+ export { BaseAliasRouteMongo };
20
+ //# sourceMappingURL=BaseAliasRouteMongo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseAliasRouteMongo.js","sourceRoot":"","sources":["../../../../src/routes/mongo/BaseAliasRouteMongo.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,+EAA+E;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC;AAG3B,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,cAA0B;CAAG,CAAA;AAAzD,mBAAmB;IAD/B,KAAK,CAAC,UAAU,CAAC;GACL,mBAAmB,CAAsC"}
@@ -0,0 +1,14 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
3
+ ///////////////////////////////////////////////////////////////////////////////
4
+ import { AliasMongo, SecretMongo, UserMongo } from "../../mongo.js";
5
+ import { BaseAuthBasicRoute } from "../BaseAuthBasicRoute.js";
6
+ export class BaseAuthBasicRouteMongo extends BaseAuthBasicRoute {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.aliasClass = AliasMongo;
10
+ this.secretClass = SecretMongo;
11
+ this.userClass = UserMongo;
12
+ }
13
+ }
14
+ //# sourceMappingURL=BaseAuthBasicRouteMongo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseAuthBasicRouteMongo.js","sourceRoot":"","sources":["../../../../src/routes/mongo/BaseAuthBasicRouteMongo.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,+EAA+E;AAC/E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,OAAgB,uBAAwB,SAAQ,kBAAsD;IAA5G;;QACc,eAAU,GAAQ,UAAU,CAAC;QAC7B,gBAAW,GAAQ,WAAW,CAAC;QAC/B,cAAS,GAAQ,SAAS,CAAC;IACzC,CAAC;CAAA"}
@@ -0,0 +1,14 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
3
+ ///////////////////////////////////////////////////////////////////////////////
4
+ import { AliasMongo, SecretMongo, UserMongo } from "../../mongo.js";
5
+ import { BaseAuthFIDO2Route } from "../BaseAuthFIDO2Route.js";
6
+ export class BaseAuthFIDO2RouteMongo extends BaseAuthFIDO2Route {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.aliasClass = AliasMongo;
10
+ this.secretClass = SecretMongo;
11
+ this.userClass = UserMongo;
12
+ }
13
+ }
14
+ //# sourceMappingURL=BaseAuthFIDO2RouteMongo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseAuthFIDO2RouteMongo.js","sourceRoot":"","sources":["../../../../src/routes/mongo/BaseAuthFIDO2RouteMongo.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,+EAA+E;AAC/E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,OAAgB,uBAAwB,SAAQ,kBAAsD;IAA5G;;QACc,eAAU,GAAQ,UAAU,CAAC;QAC7B,gBAAW,GAAQ,WAAW,CAAC;QAC/B,cAAS,GAAQ,SAAS,CAAC;IACzC,CAAC;CAAA"}
@@ -0,0 +1,14 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
3
+ ///////////////////////////////////////////////////////////////////////////////
4
+ import { AliasMongo, SecretMongo, UserMongo } from "../../mongo.js";
5
+ import { BaseAuthMFARoute } from "../BaseAuthMFARoute.js";
6
+ export class BaseAuthMFARouteMongo extends BaseAuthMFARoute {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.aliasClass = AliasMongo;
10
+ this.secretClass = SecretMongo;
11
+ this.userClass = UserMongo;
12
+ }
13
+ }
14
+ //# sourceMappingURL=BaseAuthMFARouteMongo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseAuthMFARouteMongo.js","sourceRoot":"","sources":["../../../../src/routes/mongo/BaseAuthMFARouteMongo.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,+EAA+E;AAC/E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,OAAgB,qBAAsB,SAAQ,gBAAoD;IAAxG;;QACc,eAAU,GAAQ,UAAU,CAAC;QAC7B,gBAAW,GAAQ,WAAW,CAAC;QAC/B,cAAS,GAAQ,SAAS,CAAC;IACzC,CAAC;CAAA"}
@@ -0,0 +1,11 @@
1
+ import { AliasMongo, ProfileMongo, UserMongo } from "../../mongo.js";
2
+ import { BaseAuthOIDCRoute } from "../BaseAuthOIDCRoute.js";
3
+ export class BaseAuthOIDCRouteMongo extends BaseAuthOIDCRoute {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.aliasClass = AliasMongo;
7
+ this.profileClass = ProfileMongo;
8
+ this.userClass = UserMongo;
9
+ }
10
+ }
11
+ //# sourceMappingURL=BaseAuthOIDCRouteMongo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseAuthOIDCRouteMongo.js","sourceRoot":"","sources":["../../../../src/routes/mongo/BaseAuthOIDCRouteMongo.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAgB,sBAAuB,SAAQ,iBAAsD;IAA3G;;QACc,eAAU,GAAQ,UAAU,CAAC;QAC7B,iBAAY,GAAQ,YAAY,CAAC;QACjC,cAAS,GAAQ,SAAS,CAAC;IACzC,CAAC;CAAA"}