@c9up/warden 0.1.26 → 0.2.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 (41) hide show
  1. package/dist/WardenProvider.d.ts +1 -0
  2. package/dist/WardenProvider.d.ts.map +1 -1
  3. package/dist/WardenProvider.js +16 -2
  4. package/dist/WardenProvider.js.map +1 -1
  5. package/dist/mfa/OtpProvider.d.ts +39 -1
  6. package/dist/mfa/OtpProvider.d.ts.map +1 -1
  7. package/dist/mfa/OtpProvider.js +97 -5
  8. package/dist/mfa/OtpProvider.js.map +1 -1
  9. package/dist/mfa/WebauthnProvider.d.ts +60 -10
  10. package/dist/mfa/WebauthnProvider.d.ts.map +1 -1
  11. package/dist/mfa/WebauthnProvider.js +207 -47
  12. package/dist/mfa/WebauthnProvider.js.map +1 -1
  13. package/dist/native.d.ts.map +1 -1
  14. package/dist/native.js +7 -23
  15. package/dist/native.js.map +1 -1
  16. package/dist/quasar.d.ts +6 -9
  17. package/dist/quasar.d.ts.map +1 -1
  18. package/dist/quasar.js +17 -47
  19. package/dist/quasar.js.map +1 -1
  20. package/dist/services/main.d.ts +10 -0
  21. package/dist/services/main.d.ts.map +1 -1
  22. package/dist/services/main.js +12 -0
  23. package/dist/services/main.js.map +1 -1
  24. package/dist/vendor/nativeBinary.d.ts +43 -0
  25. package/dist/vendor/nativeBinary.d.ts.map +1 -0
  26. package/dist/vendor/nativeBinary.js +99 -0
  27. package/dist/vendor/nativeBinary.js.map +1 -0
  28. package/dist/vendor/quasarConnection.d.ts +35 -0
  29. package/dist/vendor/quasarConnection.d.ts.map +1 -0
  30. package/dist/vendor/quasarConnection.js +62 -0
  31. package/dist/vendor/quasarConnection.js.map +1 -0
  32. package/index.win32-x64-msvc.node +0 -0
  33. package/package.json +1 -1
  34. package/src/WardenProvider.ts +18 -2
  35. package/src/mfa/OtpProvider.ts +133 -6
  36. package/src/mfa/WebauthnProvider.ts +289 -71
  37. package/src/native.ts +7 -25
  38. package/src/quasar.ts +18 -64
  39. package/src/services/main.ts +13 -0
  40. package/src/vendor/nativeBinary.ts +110 -0
  41. package/src/vendor/quasarConnection.ts +129 -0
@@ -18,23 +18,104 @@
18
18
  import { randomBytes } from "node:crypto";
19
19
  import { WardenError } from "../errors.js";
20
20
  import { base64urlToBuffer, bufferToBase64url, coseToKeyObject, decodeCbor, parseAuthenticatorData, sha256, verifyWebauthnSignature, } from "./webauthn-codec.js";
21
+ /**
22
+ * Run a parse of attacker-supplied bytes, turning a throw into "invalid".
23
+ *
24
+ * A truncated attestation, a malformed COSE key or authenticator data that
25
+ * stops mid-structure are INPUT errors — `CBOR: item starts past the end of the
26
+ * buffer` reaching the caller is a 500 for a bad request, and a 500 tells
27
+ * whoever sent it that they reached something which did not expect them.
28
+ *
29
+ * Deliberately narrow: only the decoding and the signature check go through
30
+ * here. A store that cannot be read is infrastructure, and reporting an outage
31
+ * as "not verified" would let a database failure read as a failed login.
32
+ */
33
+ function parsePayload(parse) {
34
+ try {
35
+ return parse();
36
+ }
37
+ catch {
38
+ return null;
39
+ }
40
+ }
21
41
  export class MemoryWebauthnChallengeStore {
22
42
  #store = new Map();
23
43
  #ttlMs;
24
- /** @param ttlMs Server-side challenge lifetime. Default 5 min. */
25
- constructor(ttlMs = 300_000) {
44
+ /**
45
+ * @param ttlMs Server-side challenge lifetime. Default 5 min.
46
+ * @param maxEntries How many pending ceremonies this process will hold.
47
+ * Sweeping removes only EXPIRED entries, so a flood of still-valid ones
48
+ * grew the map without a ceiling. Default 10 000.
49
+ */
50
+ constructor(ttlMs = 300_000, maxEntries = 10_000) {
51
+ // A TTL of Infinity or NaN is not a TTL: the challenge never expires,
52
+ // against a contract that says it MUST be time-bound — and an unconsumed
53
+ // challenge left live indefinitely is exactly the replay window the
54
+ // expiry exists to close.
55
+ if (!Number.isInteger(ttlMs) || ttlMs < 1) {
56
+ throw new WardenError("E_WARDEN_STORE_TTL_INVALID", `ttlMs must be a positive integer, got ${String(ttlMs)}.`, {
57
+ hint: "Give the ceremony a lifetime in milliseconds — the default is 300000 (5 min).",
58
+ });
59
+ }
26
60
  this.#ttlMs = ttlMs;
61
+ // A ceiling of 0, a negative, NaN or Infinity is not a ceiling: the
62
+ // first two refuse every write and the last two disable the bound this
63
+ // exists to provide, silently. A caller asking for one of those means
64
+ // something, and none of the meanings is what would have happened.
65
+ if (!Number.isInteger(maxEntries) || maxEntries < 1) {
66
+ throw new WardenError("E_WARDEN_STORE_LIMIT_INVALID", `maxEntries must be a positive integer, got ${String(maxEntries)}.`, {
67
+ hint: "Pass the number of pending entries this process may hold — the default is 10_000.",
68
+ });
69
+ }
70
+ this.#maxEntries = maxEntries;
71
+ }
72
+ /**
73
+ * Size at which the next sweep runs, doubling each time.
74
+ *
75
+ * Entries only ever left when their state was reused or taken, so a
76
+ * ceremony nobody finished — a passkey prompt dismissed, which happens all
77
+ * day — stayed for the life of the process. Sweeping on write bounds it
78
+ * without a timer, which would hold the event loop open and need a disposal
79
+ * contract this store does not have.
80
+ */
81
+ #sweepAt = 64;
82
+ #maxEntries;
83
+ async save(state, ceremony) {
84
+ if (this.#store.size >= this.#maxEntries && !this.#store.has(state)) {
85
+ this.#sweep();
86
+ }
87
+ if (this.#store.size >= this.#maxEntries && !this.#store.has(state)) {
88
+ // Refused rather than evicted: making room by dropping someone
89
+ // else's pending ceremony is how a flood locks a real user out.
90
+ throw new WardenError("E_WARDEN_WEBAUTHN_STORE_FULL", `The in-memory WebAuthn challenge store is full (${this.#maxEntries} pending ceremonies).`, {
91
+ hint: "Rate-limit the endpoint that starts a ceremony, or move to a persistent store with its own TTL.",
92
+ });
93
+ }
94
+ this.#store.set(state, {
95
+ ...ceremony,
96
+ expiresAt: Date.now() + this.#ttlMs,
97
+ });
98
+ if (this.#store.size > this.#sweepAt)
99
+ this.#sweep();
27
100
  }
28
- async save(state, challenge) {
29
- this.#store.set(state, { challenge, expiresAt: Date.now() + this.#ttlMs });
101
+ /** Drop everything already expired. */
102
+ #sweep() {
103
+ const now = Date.now();
104
+ for (const [state, entry] of this.#store) {
105
+ if (entry.expiresAt < now)
106
+ this.#store.delete(state);
107
+ }
108
+ this.#sweepAt = Math.max(64, this.#store.size * 2);
30
109
  }
31
110
  async take(state) {
32
111
  const entry = this.#store.get(state);
33
112
  this.#store.delete(state); // single-use regardless of freshness
34
- if (!entry || entry.expiresAt < Date.now()) {
113
+ // `<=`, not `<`: an entry whose deadline is exactly now has expired.
114
+ // Strictly-less left it valid for the remainder of that millisecond.
115
+ if (!entry || entry.expiresAt <= Date.now()) {
35
116
  return null;
36
117
  }
37
- return entry.challenge;
118
+ return { challenge: entry.challenge, userId: entry.userId };
38
119
  }
39
120
  }
40
121
  export class MemoryWebauthnCredentialStore {
@@ -48,11 +129,24 @@ export class MemoryWebauthnCredentialStore {
48
129
  async findByUser(userId) {
49
130
  return [...this.#store.values()].filter((p) => p.userId === userId);
50
131
  }
51
- async updateCounter(id, counter) {
132
+ /**
133
+ * Atomic here for free: a synchronous read, compare and write with no
134
+ * `await` between them cannot be interleaved on a single-threaded runtime.
135
+ * Written as one block on purpose — an `await` inside would silently
136
+ * reintroduce the race this exists to close.
137
+ */
138
+ async advanceCounter(id, expected, next) {
52
139
  const p = this.#store.get(id);
53
- if (p) {
54
- this.#store.set(id, { ...p, counter });
55
- }
140
+ if (!p || p.counter !== expected)
141
+ return false;
142
+ // Defence in depth: this method ADVANCES. A caller that has already
143
+ // decided the assertion is good can still have decided it wrongly, and
144
+ // a store that writes whatever it is handed turns one bad decision into
145
+ // a permanently disarmed counter.
146
+ if (next < expected)
147
+ return false;
148
+ this.#store.set(id, { ...p, counter: next });
149
+ return true;
56
150
  }
57
151
  }
58
152
  const DEFAULT_ALGS = [-7, -257, -8];
@@ -116,7 +210,9 @@ export class WebauthnProvider {
116
210
  },
117
211
  };
118
212
  const state = randomBytes(16).toString("hex");
119
- await this.#challenges.save(state, challenge);
213
+ // The identity travels WITH the challenge. Stored apart, `finish` had to
214
+ // trust whatever `userId` the caller handed back.
215
+ await this.#challenges.save(state, { challenge, userId: user.id });
120
216
  return { options, state };
121
217
  }
122
218
  /**
@@ -124,35 +220,65 @@ export class WebauthnProvider {
124
220
  * the stored challenge and persist the new passkey on success.
125
221
  */
126
222
  async finishRegistration(state, userId, response) {
127
- const expectedChallenge = await this.#challenges.take(state);
128
- if (!expectedChallenge) {
129
- return { verified: false };
130
- }
131
- if (!this.#validClientData(response.response.clientDataJSON, "webauthn.create", expectedChallenge)) {
223
+ const ceremony = await this.#challenges.take(state);
224
+ if (!ceremony) {
132
225
  return { verified: false };
133
226
  }
134
- const attestation = decodeCbor(base64urlToBuffer(response.response.attestationObject)).value;
135
- if (!(attestation instanceof Map)) {
227
+ // The passkey is registered for the user who STARTED the ceremony, not
228
+ // for whoever the caller names now. A mismatch is an integration reading
229
+ // the id back from the request, or a session that changed between the
230
+ // two steps; either way it would attach a working credential to the
231
+ // wrong account, so it is refused rather than resolved in someone's
232
+ // favour.
233
+ if (ceremony.userId !== undefined && ceremony.userId !== userId) {
136
234
  return { verified: false };
137
235
  }
138
- const authDataRaw = attestation.get("authData");
139
- if (!Buffer.isBuffer(authDataRaw)) {
236
+ if (!this.#validClientData(response.response.clientDataJSON, "webauthn.create", ceremony.challenge)) {
140
237
  return { verified: false };
141
238
  }
142
- const authData = parseAuthenticatorData(authDataRaw);
143
- if (!this.#validAuthenticator(authData) ||
144
- !authData.cosePublicKey ||
145
- !authData.cosePublicKeyBytes ||
146
- !authData.credentialId) {
239
+ // The payload is attacker-supplied: a truncated attestation, a malformed
240
+ // COSE key or authenticator data that stops mid-structure are INPUT
241
+ // errors, and this method promises `{ verified: false }` for an invalid
242
+ // response. Letting the decoder's exception out turned a bad request
243
+ // into a 500 — and a 500 tells whoever sent it that they reached
244
+ // something that did not expect them.
245
+ //
246
+ // Only the parsing is wrapped: a store that cannot be read is
247
+ // infrastructure, and swallowing that would report "not verified" for an
248
+ // outage.
249
+ const parsed = parsePayload(() => {
250
+ const attestation = decodeCbor(base64urlToBuffer(response.response.attestationObject)).value;
251
+ if (!(attestation instanceof Map))
252
+ return null;
253
+ const authDataRaw = attestation.get("authData");
254
+ if (!Buffer.isBuffer(authDataRaw))
255
+ return null;
256
+ const authData = parseAuthenticatorData(authDataRaw);
257
+ if (!this.#validAuthenticator(authData) ||
258
+ !authData.cosePublicKey ||
259
+ !authData.cosePublicKeyBytes ||
260
+ !authData.credentialId) {
261
+ return null;
262
+ }
263
+ // The narrowing is carried OUT of the closure: the guard above proved
264
+ // these three are present, and the caller cannot see that through an
265
+ // object literal typed from `authData` alone.
266
+ return {
267
+ credentialId: authData.credentialId,
268
+ publicKeyBytes: authData.cosePublicKeyBytes,
269
+ signCount: authData.signCount,
270
+ alg: coseToKeyObject(authData.cosePublicKey).alg,
271
+ };
272
+ });
273
+ if (parsed === null) {
147
274
  return { verified: false };
148
275
  }
149
- const { alg } = coseToKeyObject(authData.cosePublicKey);
150
276
  await this.#credentials.save({
151
- id: bufferToBase64url(authData.credentialId),
277
+ id: bufferToBase64url(parsed.credentialId),
152
278
  userId,
153
- publicKey: bufferToBase64url(authData.cosePublicKeyBytes),
154
- alg,
155
- counter: authData.signCount,
279
+ publicKey: bufferToBase64url(parsed.publicKeyBytes),
280
+ alg: parsed.alg,
281
+ counter: parsed.signCount,
156
282
  transports: response.response.transports,
157
283
  });
158
284
  return { verified: true };
@@ -178,7 +304,10 @@ export class WebauthnProvider {
178
304
  : undefined,
179
305
  };
180
306
  const state = randomBytes(16).toString("hex");
181
- await this.#challenges.save(state, challenge);
307
+ // `userId` is optional here: a usernameless login is named by the
308
+ // credential itself. When it IS given, storing it lets `finish` refuse an
309
+ // assertion from someone else's passkey.
310
+ await this.#challenges.save(state, { challenge, userId });
182
311
  return { options, state };
183
312
  }
184
313
  /**
@@ -187,36 +316,67 @@ export class WebauthnProvider {
187
316
  * Returns the owning `userId` on success.
188
317
  */
189
318
  async finishAuthentication(state, response) {
190
- const expectedChallenge = await this.#challenges.take(state);
191
- if (!expectedChallenge) {
319
+ const ceremony = await this.#challenges.take(state);
320
+ if (!ceremony) {
192
321
  return { verified: false };
193
322
  }
194
- if (!this.#validClientData(response.response.clientDataJSON, "webauthn.get", expectedChallenge)) {
323
+ if (!this.#validClientData(response.response.clientDataJSON, "webauthn.get", ceremony.challenge)) {
195
324
  return { verified: false };
196
325
  }
197
326
  const stored = await this.#credentials.findById(response.id);
198
327
  if (!stored) {
199
328
  return { verified: false };
200
329
  }
201
- const authDataRaw = base64urlToBuffer(response.response.authenticatorData);
202
- const authData = parseAuthenticatorData(authDataRaw);
203
- if (!this.#validAuthenticator(authData)) {
330
+ // When the ceremony named a user, the asserted credential has to be
331
+ // theirs. `allowCredentials` is a HINT the browser may ignore and an
332
+ // attacker simply will: without this, a login started for one account
333
+ // could be completed with a passkey belonging to another.
334
+ if (ceremony.userId !== undefined && stored.userId !== ceremony.userId) {
335
+ return { verified: false };
336
+ }
337
+ // Same reasoning as registration: the payload is attacker-supplied, and
338
+ // this method promises `{ verified: false }` for an invalid one. Only
339
+ // the parsing and the signature check are wrapped — a store failure is
340
+ // infrastructure and must not be reported as "not verified".
341
+ const checked = parsePayload(() => {
342
+ const authDataRaw = base64urlToBuffer(response.response.authenticatorData);
343
+ const authData = parseAuthenticatorData(authDataRaw);
344
+ if (!this.#validAuthenticator(authData))
345
+ return null;
346
+ // Signed payload = authenticatorData ‖ SHA-256(clientDataJSON).
347
+ const clientHash = sha256(base64urlToBuffer(response.response.clientDataJSON));
348
+ const signedData = Buffer.concat([authDataRaw, clientHash]);
349
+ const { key } = coseToKeyObject(expectCoseMap(base64urlToBuffer(stored.publicKey)));
350
+ const ok = verifyWebauthnSignature(stored.alg, key, signedData, base64urlToBuffer(response.response.signature));
351
+ return ok ? { authData } : null;
352
+ });
353
+ if (checked === null) {
204
354
  return { verified: false };
205
355
  }
206
- // Signed payload = authenticatorData ‖ SHA-256(clientDataJSON).
207
- const clientHash = sha256(base64urlToBuffer(response.response.clientDataJSON));
208
- const signedData = Buffer.concat([authDataRaw, clientHash]);
209
- const { key } = coseToKeyObject(expectCoseMap(base64urlToBuffer(stored.publicKey)));
210
- const ok = verifyWebauthnSignature(stored.alg, key, signedData, base64urlToBuffer(response.response.signature));
211
- if (!ok) {
356
+ const { authData } = checked;
357
+ // Replay guard, as the spec words it: run the comparison when EITHER
358
+ // counter is nonzero, then refuse anything that does not strictly
359
+ // advance. Authenticators that always report 0 — many platform passkeys
360
+ // — stay exempt, because that is the case where both sides are zero.
361
+ //
362
+ // The guard used to test the incoming counter alone, so a credential
363
+ // sitting at 42 accepted an assertion reporting 0 and then WROTE 0
364
+ // back. That is worse than admitting one assertion: it erases the
365
+ // stored counter, and with it the clone detection for every assertion
366
+ // after it.
367
+ if ((authData.signCount !== 0 || stored.counter !== 0) &&
368
+ authData.signCount <= stored.counter) {
212
369
  return { verified: false };
213
370
  }
214
- // Replay guard: a non-zero counter must strictly advance. Authenticators
215
- // that always report 0 (e.g. many platform passkeys) are exempt.
216
- if (authData.signCount !== 0 && authData.signCount <= stored.counter) {
371
+ // The write is what decides. Comparing here and writing unconditionally
372
+ // let a second assertion that read the same old counter also pass, and
373
+ // whichever wrote last set the stored value — possibly backwards.
374
+ // Refusing when the counter has moved under us costs a legitimate user
375
+ // one retry and costs a clone the whole attack.
376
+ const advanced = await this.#credentials.advanceCounter(stored.id, stored.counter, authData.signCount);
377
+ if (!advanced) {
217
378
  return { verified: false };
218
379
  }
219
- await this.#credentials.updateCounter(stored.id, authData.signCount);
220
380
  return { verified: true, userId: stored.userId };
221
381
  }
222
382
  /** Validate clientDataJSON: type, challenge match, and origin allow-list. */
@@ -1 +1 @@
1
- {"version":3,"file":"WebauthnProvider.js","sourceRoot":"","sources":["../../src/mfa/WebauthnProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACN,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Aa,CAAC,KAAa;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;IACxC,IAAI,CAAC,CAAC,OAAO,YAAY,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,WAAW,CAAC,oBAAoB,EAAE,8BAA8B,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,uBAAuB,CAAC,CAAC;AAalE,2CAA2C;AAC3C,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,kFAAkF;AAClF,wBAAgB,YAAY,IAAI,YAAY,GAAG,SAAS,CAEvD"}
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,uBAAuB,CAAC,CAAC;AASlE,2CAA2C;AAC3C,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,kFAAkF;AAClF,wBAAgB,YAAY,IAAI,YAAY,GAAG,SAAS,CAEvD"}
package/dist/native.js CHANGED
@@ -5,29 +5,13 @@
5
5
  * other consumer) throws `E_WARDEN_NAPI_REQUIRED` at use time. Password
6
6
  * hashing is the sole responsibility of `@c9up/sigil` (story 40.1).
7
7
  */
8
- import { createRequire } from "node:module";
9
- import { dirname, join } from "node:path";
10
- import { arch, platform } from "node:process";
11
- import { fileURLToPath } from "node:url";
12
- const nodeRequire = createRequire(import.meta.url);
13
- const currentDir = dirname(fileURLToPath(import.meta.url));
14
- const platformMap = {
15
- "linux-x64": "linux-x64-gnu",
16
- "linux-arm64": "linux-arm64-gnu",
17
- "darwin-x64": "darwin-x64",
18
- "darwin-arm64": "darwin-arm64",
19
- "win32-x64": "win32-x64-msvc",
20
- };
21
- let native;
22
- try {
23
- const suffix = platformMap[`${platform}-${arch}`];
24
- if (suffix) {
25
- native = nodeRequire(join(currentDir, `../index.${suffix}.node`));
26
- }
27
- }
28
- catch {
29
- // Binary not available — JwtStrategy will throw E_WARDEN_NAPI_REQUIRED at use time.
30
- }
8
+ import { loadNativeBinary } from "./vendor/nativeBinary.js";
9
+ // Absent is not an error here: `JwtStrategy` throws E_WARDEN_NAPI_REQUIRED at
10
+ // use time, which names what the caller was trying to do. The loader reports
11
+ // what happened and this decides — the platform table itself is shared, since
12
+ // a package that misses a new target fails only on that platform.
13
+ const attempt = loadNativeBinary();
14
+ const native = attempt.loaded ? attempt.binary : undefined;
31
15
  /** Whether the Rust NAPI engine loaded. */
32
16
  export function isNativeAvailable() {
33
17
  return native !== undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE3D,MAAM,WAAW,GAA2B;IAC3C,WAAW,EAAE,eAAe;IAC5B,aAAa,EAAE,iBAAiB;IAChC,YAAY,EAAE,YAAY;IAC1B,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,gBAAgB;CAC7B,CAAC;AAWF,IAAI,MAAgC,CAAC;AAErC,IAAI,CAAC;IACJ,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;IAClD,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC,CAAC;IACnE,CAAC;AACF,CAAC;AAAC,MAAM,CAAC;IACR,oFAAoF;AACrF,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,iBAAiB;IAChC,OAAO,MAAM,KAAK,SAAS,CAAC;AAC7B,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,YAAY;IAC3B,OAAO,MAAM,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAW5D,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,kEAAkE;AAClE,MAAM,OAAO,GAAG,gBAAgB,EAAgB,CAAC;AACjD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAE3D,2CAA2C;AAC3C,MAAM,UAAU,iBAAiB;IAChC,OAAO,MAAM,KAAK,SAAS,CAAC;AAC7B,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,YAAY;IAC3B,OAAO,MAAM,CAAC;AACf,CAAC"}
package/dist/quasar.d.ts CHANGED
@@ -1,18 +1,15 @@
1
1
  /**
2
2
  * Resolving a Redis connection by name, from `@c9up/quasar`.
3
3
  *
4
- * Warden does not depend on quasar: it is an optional peer, and this module
5
- * never imports it statically. The specifier is built at runtime so the
6
- * TypeScript build stays free of it too — a hard type import would make echo
7
- * unbuildable for anyone whose blacklist is in memory.
8
- *
9
- * The shape is checked before use rather than asserted, the same way warden
10
- * duck-types its host framework.
4
+ * The loading, the shape check and the messages are the same in every package
5
+ * that offers a Redis-backed option, so they are vendored rather than written
6
+ * again: `src/vendor/quasarConnection.ts`, generated from one source. What is
7
+ * specific to this package — the commands it issues, and what it does with
8
+ * them — stays here, because that is the part a reader needs.
11
9
  */
12
10
  import type { RedisLikeClient } from "./RedisBlacklistDriver.js";
13
11
  /**
14
- * A resolver for `new RedisBlacklistDriver(quasarConnection())` — quasar is
15
- * loaded on the first revocation check, not at config time.
12
+ * A resolver — quasar is loaded on first use, not at config time.
16
13
  */
17
14
  export declare function quasarConnection(name?: string): () => Promise<RedisLikeClient>;
18
15
  //# sourceMappingURL=quasar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quasar.d.ts","sourceRoot":"","sources":["../src/quasar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AA4BjE;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,CAAC,EAAE,MAAM,GACX,MAAM,OAAO,CAAC,eAAe,CAAC,CA+BhC"}
1
+ {"version":3,"file":"quasar.d.ts","sourceRoot":"","sources":["../src/quasar.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAOjE;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,CAAC,EAAE,MAAM,GACX,MAAM,OAAO,CAAC,eAAe,CAAC,CAShC"}
package/dist/quasar.js CHANGED
@@ -1,56 +1,26 @@
1
1
  /**
2
2
  * Resolving a Redis connection by name, from `@c9up/quasar`.
3
3
  *
4
- * Warden does not depend on quasar: it is an optional peer, and this module
5
- * never imports it statically. The specifier is built at runtime so the
6
- * TypeScript build stays free of it too — a hard type import would make echo
7
- * unbuildable for anyone whose blacklist is in memory.
8
- *
9
- * The shape is checked before use rather than asserted, the same way warden
10
- * duck-types its host framework.
4
+ * The loading, the shape check and the messages are the same in every package
5
+ * that offers a Redis-backed option, so they are vendored rather than written
6
+ * again: `src/vendor/quasarConnection.ts`, generated from one source. What is
7
+ * specific to this package — the commands it issues, and what it does with
8
+ * them — stays here, because that is the part a reader needs.
11
9
  */
12
- function isConnectionSource(value) {
13
- return (typeof value === "object" &&
14
- value !== null &&
15
- typeof Reflect.get(value, "connection") === "function");
16
- }
17
- function isRedisLikeClient(value) {
18
- if (typeof value !== "object" || value === null)
19
- return false;
20
- // The commands this driver actually issues — the whole of `RedisLikeClient`.
21
- // A connection missing one would fail on the first revocation, far from the
22
- // cause. Nothing more: the driver documents itself as needing only `set`
23
- // with an "EX" ttl and `exists`, so demanding sets or key scans here would
24
- // reject a client that works perfectly well.
25
- const required = ["set", "exists"];
26
- return required.every((name) => typeof Reflect.get(value, name) === "function");
27
- }
10
+ import { quasarConnection as loadQuasarConnection } from "./vendor/quasarConnection.js";
11
+ // Only what the driver documents itself as needing: `set` with an "EX" ttl,
12
+ // and `exists`. Demanding key scans here would reject a client that works.
13
+ const REQUIRED = ["set", "exists"];
28
14
  /**
29
- * A resolver for `new RedisBlacklistDriver(quasarConnection())` — quasar is
30
- * loaded on the first revocation check, not at config time.
15
+ * A resolver — quasar is loaded on first use, not at config time.
31
16
  */
32
17
  export function quasarConnection(name) {
33
- return async () => {
34
- const specifier = "@c9up/quasar/services/main";
35
- let loaded;
36
- try {
37
- loaded = await import(/* @vite-ignore */ specifier);
38
- }
39
- catch (cause) {
40
- throw new Error(`Warden: the "${name ?? "default"}" blacklist asks for a quasar connection, but @c9up/quasar is not installed.\n` +
41
- " pnpm add @c9up/quasar", { cause });
42
- }
43
- const manager = isConnectionSource(loaded)
44
- ? loaded
45
- : Reflect.get(Object(loaded), "default");
46
- if (!isConnectionSource(manager)) {
47
- throw new Error("Warden: @c9up/quasar/services/main did not expose a connection() manager");
48
- }
49
- const connection = manager.connection(name);
50
- if (!isRedisLikeClient(connection)) {
51
- throw new Error(`Warden: quasar connection "${name ?? "default"}" does not carry the commands this blacklist needs`);
52
- }
53
- return connection;
54
- };
18
+ return async () => loadQuasarConnection({
19
+ pkg: "warden",
20
+ name,
21
+ required: REQUIRED,
22
+ what: "the token blacklist",
23
+ raise: (_reason, message, cause) => new Error(message, { cause }),
24
+ });
55
25
  }
56
26
  //# sourceMappingURL=quasar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"quasar.js","sourceRoot":"","sources":["../src/quasar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,SAAS,kBAAkB,CAAC,KAAc;IACzC,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,UAAU,CACtD,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,6EAA6E;IAC7E,4EAA4E;IAC5E,yEAAyE;IACzE,2EAA2E;IAC3E,6CAA6C;IAC7C,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACnC,OAAO,QAAQ,CAAC,KAAK,CACpB,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,UAAU,CACxD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC/B,IAAa;IAEb,OAAO,KAAK,IAAI,EAAE;QACjB,MAAM,SAAS,GAAG,4BAA4B,CAAC;QAC/C,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACJ,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACd,gBAAgB,IAAI,IAAI,SAAS,gFAAgF;gBAChH,yBAAyB,EAC1B,EAAE,KAAK,EAAE,CACT,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC;YACzC,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CACd,0EAA0E,CAC1E,CAAC;QACH,CAAC;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACd,8BAA8B,IAAI,IAAI,SAAS,oDAAoD,CACnG,CAAC;QACH,CAAC;QACD,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"quasar.js","sourceRoot":"","sources":["../src/quasar.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAExF,4EAA4E;AAC5E,2EAA2E;AAC3E,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,IAAa;IAEb,OAAO,KAAK,IAAI,EAAE,CACjB,oBAAoB,CAAkB;QACrC,GAAG,EAAE,QAAQ;QACb,IAAI;QACJ,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC;KACjE,CAAC,CAAC;AACL,CAAC"}
@@ -14,6 +14,16 @@ import type { AuthManager } from "../AuthManager.js";
14
14
  export declare function setAuth(value: AuthManager): void;
15
15
  /** @internal Read the singleton (or `undefined` pre-boot). */
16
16
  export declare function getAuth(): AuthManager | undefined;
17
+ /**
18
+ * @internal Release the singleton, so a shut-down application does not leave a
19
+ * dead AuthManager reachable through `services/main`.
20
+ *
21
+ * The caller checks ownership first (`getAuth() === mine`). Two applications in
22
+ * one process share this module, and the one shutting down must not clear a
23
+ * manager the other has since installed — for auth, that would leave the
24
+ * survivor authenticating against nothing, or throwing on every guarded route.
25
+ */
26
+ export declare function clearAuth(): void;
17
27
  declare const auth: AuthManager;
18
28
  export default auth;
19
29
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/services/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,+DAA+D;AAC/D,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAEhD;AAED,8DAA8D;AAC9D,wBAAgB,OAAO,IAAI,WAAW,GAAG,SAAS,CAEjD;AAED,QAAA,MAAM,IAAI,EAAE,WAWV,CAAC;AAEH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/services/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,+DAA+D;AAC/D,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAEhD;AAED,8DAA8D;AAC9D,wBAAgB,OAAO,IAAI,WAAW,GAAG,SAAS,CAEjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,QAAA,MAAM,IAAI,EAAE,WAWV,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -18,6 +18,18 @@ export function setAuth(value) {
18
18
  export function getAuth() {
19
19
  return instance;
20
20
  }
21
+ /**
22
+ * @internal Release the singleton, so a shut-down application does not leave a
23
+ * dead AuthManager reachable through `services/main`.
24
+ *
25
+ * The caller checks ownership first (`getAuth() === mine`). Two applications in
26
+ * one process share this module, and the one shutting down must not clear a
27
+ * manager the other has since installed — for auth, that would leave the
28
+ * survivor authenticating against nothing, or throwing on every guarded route.
29
+ */
30
+ export function clearAuth() {
31
+ instance = undefined;
32
+ }
21
33
  const auth = new Proxy({}, {
22
34
  get(_target, prop) {
23
35
  if (!instance) {
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/services/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,IAAI,QAAiC,CAAC;AAEtC,+DAA+D;AAC/D,MAAM,UAAU,OAAO,CAAC,KAAkB;IACzC,QAAQ,GAAG,KAAK,CAAC;AAClB,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,OAAO;IACtB,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,MAAM,IAAI,GAAgB,IAAI,KAAK,CAAC,EAAiB,EAAE;IACtD,GAAG,CAAC,OAAO,EAAE,IAAI;QAChB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACd,4EAA4E;gBAC3E,2EAA2E,CAC5E,CAAC;QACH,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QACpD,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACnE,CAAC;CACD,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/services/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,IAAI,QAAiC,CAAC;AAEt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