@voltro/plugin-auth 0.87.0 → 0.88.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 (44) hide show
  1. package/CHANGELOG.md +169 -6
  2. package/THIRD-PARTY-NOTICES.md +3 -1346
  3. package/dist/admission.js +1 -2
  4. package/dist/appUserStore.js +1 -2
  5. package/dist/authExtensions.js +1 -2
  6. package/dist/csrf.js +1 -2
  7. package/dist/emailVerification.js +1 -2
  8. package/dist/guestClient.js +1 -2
  9. package/dist/guestCredential.js +1 -2
  10. package/dist/guestPasswordUpgrade.js +1 -2
  11. package/dist/guestPlugin.js +1 -2
  12. package/dist/guestSchema.js +1 -2
  13. package/dist/guestSecrets.js +1 -2
  14. package/dist/guestService.js +1 -2
  15. package/dist/handlers.js +1 -2
  16. package/dist/impersonation.js +1 -2
  17. package/dist/invitations.js +1 -2
  18. package/dist/mail.js +1 -2
  19. package/dist/memberships.js +1 -2
  20. package/dist/native/guestStorage.js +1 -2
  21. package/dist/native.js +1 -2
  22. package/dist/nativeRoutes.js +1 -2
  23. package/dist/overlayPlugin.js +1 -2
  24. package/dist/passkeyHandlers.js +1 -2
  25. package/dist/password.js +1 -2
  26. package/dist/plugin.js +1 -2
  27. package/dist/postgresUserStore.js +1 -2
  28. package/dist/revocation.js +1 -2
  29. package/dist/schema.js +1 -2
  30. package/dist/session.js +1 -2
  31. package/dist/sessionFamily.js +1 -2
  32. package/dist/sessionRegistry.js +1 -2
  33. package/dist/signedClaims.js +1 -2
  34. package/dist/strategy.js +1 -2
  35. package/dist/subjectGuard.js +1 -2
  36. package/dist/tokens.js +1 -2
  37. package/dist/totp.js +1 -2
  38. package/dist/userStore.js +1 -2
  39. package/dist/web/guestStorage.js +1 -2
  40. package/dist/web/passkeyClient.js +1 -2
  41. package/dist/web/requireAuth.js +1 -2
  42. package/dist/web/subjectContext.js +1 -2
  43. package/dist/webauthn.js +1 -2
  44. package/package.json +4 -4
package/dist/admission.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { Effect as e } from "effect";
2
- //#region src/admission.ts
2
+ // src/admission.ts
3
3
  var t = (t, n, r = { store: void 0 }) => {
4
4
  if (t === void 0) return e.succeed(null);
5
5
  let i = t(n, r);
6
6
  return e.isEffect(i) ? i : e.promise(() => i);
7
7
  };
8
- //#endregion
9
8
  export { t as decideAdmission };
@@ -1,6 +1,6 @@
1
1
  import { memoryUserStore as e } from "./userStore.js";
2
2
  import { postgresUserStore as t } from "./postgresUserStore.js";
3
- //#region src/appUserStore.ts
3
+ // src/appUserStore.ts
4
4
  var n = (n = {}) => ({ sql: r }) => r === void 0 ? e() : r.onDialectOrElse({
5
5
  pg: () => t(r, n),
6
6
  orElse: () => {
@@ -15,5 +15,4 @@ var n = (n = {}) => ({ sql: r }) => r === void 0 ? e() : r.onDialectOrElse({
15
15
  return i.apply(r, [...t]);
16
16
  };
17
17
  } });
18
- //#endregion
19
18
  export { n as appUserStore, r as deferredUserStore };
@@ -1,9 +1,8 @@
1
1
  import { guestAuthPlugin as e } from "./guestPlugin.js";
2
2
  import { overlayAuthPlugin as t } from "./overlayPlugin.js";
3
- //#region src/authExtensions.ts
3
+ // src/authExtensions.ts
4
4
  var n = {
5
5
  guest: e,
6
6
  overlay: t
7
7
  };
8
- //#endregion
9
8
  export { n as auth };
package/dist/csrf.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHmac as e, randomBytes as t, timingSafeEqual as n } from "node:crypto";
2
- //#region src/csrf.ts
2
+ // src/csrf.ts
3
3
  var r = "voltro:csrf", i = "x-csrf-token", a = (e) => e.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), o = (e) => {
4
4
  let t = e.replace(/-/g, "+").replace(/_/g, "/") + "=".repeat((4 - e.length % 4) % 4);
5
5
  return Buffer.from(t, "base64");
@@ -18,5 +18,4 @@ var r = "voltro:csrf", i = "x-csrf-token", a = (e) => e.toString("base64").repla
18
18
  let i = Buffer.from(e), a = Buffer.from(t);
19
19
  return i.length !== a.length || !n(i, a) ? !1 : l(e, r);
20
20
  };
21
- //#endregion
22
21
  export { r as CSRF_COOKIE_NAME, i as CSRF_HEADER_NAME, l as isCsrfTokenWellFormed, c as issueCsrfToken, u as verifyCsrf };
@@ -1,7 +1,7 @@
1
1
  import { newAuthId as e } from "./userStore.js";
2
2
  import { hashToken as t, mintToken as n } from "./tokens.js";
3
3
  import { Effect as r } from "effect";
4
- //#region src/emailVerification.ts
4
+ // src/emailVerification.ts
5
5
  var i = 60, a = "email_not_verified", o = "emailVerified", s = (e) => e?.policy ?? "off", c = (e) => s(e) !== "off", l = (e, t) => {
6
6
  if (e.emailVerifiedAt != null) return !0;
7
7
  let n = t?.exemptAccountsCreatedBefore;
@@ -60,5 +60,4 @@ var i = 60, a = "email_not_verified", o = "emailVerified", s = (e) => e?.policy
60
60
  verified: !0
61
61
  })) : f(401, { error: "invalid or expired token" });
62
62
  });
63
- //#endregion
64
63
  export { a as EMAIL_NOT_VERIFIED_CODE, o as EMAIL_VERIFIED_METADATA_KEY, i as EMAIL_VERIFY_RESEND_COOLDOWN_S, c as emailVerificationActive, d as emailVerificationGuard, g as handleEmailVerifyConfirm, h as handleEmailVerifyRequest, u as isEmailVerified, m as sendEmailVerification, l as userEmailVerified };
@@ -1,5 +1,5 @@
1
1
  import { parseGuestCredential as e } from "./guestCredential.js";
2
- //#region src/guestClient.ts
2
+ // src/guestClient.ts
3
3
  var t = class extends Error {
4
4
  code;
5
5
  status;
@@ -233,5 +233,4 @@ var t = class extends Error {
233
233
  }
234
234
  };
235
235
  };
236
- //#endregion
237
236
  export { t as GuestClientError, o as createGuestClient };
@@ -1,4 +1,4 @@
1
- //#region src/guestCredential.ts
1
+ // src/guestCredential.ts
2
2
  var e = (e) => {
3
3
  if (typeof e != "string" || e.length > 512) return null;
4
4
  let [t, n, r, i] = e.split(".");
@@ -8,5 +8,4 @@ var e = (e) => {
8
8
  secret: r
9
9
  };
10
10
  };
11
- //#endregion
12
11
  export { e as parseGuestCredential };
@@ -7,7 +7,7 @@ import { runSubjectGuards as a } from "./subjectGuard.js";
7
7
  import { issueUserSession as o } from "./handlers.js";
8
8
  import { Effect as s } from "effect";
9
9
  import { and as c, eq as l } from "@voltro/database";
10
- //#region src/guestPasswordUpgrade.ts
10
+ // src/guestPasswordUpgrade.ts
11
11
  var u = (e, t, n) => ({
12
12
  table: e,
13
13
  predicate: l(t, n),
@@ -81,5 +81,4 @@ var u = (e, t, n) => ({
81
81
  };
82
82
  }).pipe(s.catch((e) => s.succeed(e.code === "upgrade_conflict" ? d(409, "email_taken", "email already registered") : e.code === "credential_rejected" ? d(401, "guest_rejected", "guest credential rejected") : d(503, "unavailable", "upgrade unavailable"))));
83
83
  }).pipe(s.catch(() => s.succeed(d(500, "upgrade_failed", "upgrade failed"))));
84
- //#endregion
85
84
  export { f as completeGuestPasswordUpgrade };
@@ -7,7 +7,7 @@ import { sessionsTable as u } from "./schema.js";
7
7
  import { Duration as d, Effect as f, Result as p } from "effect";
8
8
  import { buildSetCookie as m, noteSigningLifetime as h, readCookie as g, readSessionValue as _, verifySessionKeyed as v } from "@voltro/protocol/session";
9
9
  import { definePlugin as y } from "@voltro/protocol";
10
- //#region src/guestPlugin.ts
10
+ // src/guestPlugin.ts
11
11
  var b = (e, t, n = {}) => ({
12
12
  status: e,
13
13
  body: JSON.stringify(t),
@@ -162,5 +162,4 @@ var b = (e, t, n = {}) => ({
162
162
  } }
163
163
  };
164
164
  };
165
- //#endregion
166
165
  export { x as guestAuthPlugin };
@@ -1,5 +1,5 @@
1
1
  import { boolean as e, id as t, integer as n, table as r, text as i, timestamp as a } from "@voltro/database";
2
- //#region src/guestSchema.ts
2
+ // src/guestSchema.ts
3
3
  var o = r("authGuests", {
4
4
  id: t(),
5
5
  tenantId: i(),
@@ -16,5 +16,4 @@ var o = r("authGuests", {
16
16
  expiresAt: a(),
17
17
  createdAt: a()
18
18
  }).index(["guestId"]).index(["tenantId"]), c = [o, s];
19
- //#endregion
20
19
  export { s as authGuestDevicesTable, o as authGuestsTable, c as guestTables };
@@ -1,10 +1,9 @@
1
1
  import { sessionSecretsOf as e } from "./session.js";
2
2
  import { assertProductionSessionSecret as t } from "@voltro/protocol/session";
3
- //#region src/guestSecrets.ts
3
+ // src/guestSecrets.ts
4
4
  var n = (n) => {
5
5
  let r = e(n);
6
6
  for (let e of [r.current, ...r.previous ? [r.previous] : []]) t({ VOLTRO_SESSION_SECRET: e.secret });
7
7
  return n;
8
8
  };
9
- //#endregion
10
9
  export { n as validateGuestSecrets };
@@ -6,7 +6,7 @@ import { createHash as a, randomBytes as o, timingSafeEqual as s } from "node:cr
6
6
  import { Data as c, Effect as l } from "effect";
7
7
  import { noteSigningLifetime as u } from "@voltro/protocol/session";
8
8
  import { and as d, eq as f } from "@voltro/database";
9
- //#region src/guestService.ts
9
+ // src/guestService.ts
10
10
  var p = class extends c.TaggedError("GuestAuthError") {}, m = "authGuests", h = "authGuestDevices", g = 86400, _ = () => new p({ code: "credential_rejected" }), v = (e) => a("sha256").update(e).digest("hex"), y = (e) => e instanceof Date ? e.getTime() : typeof e == "string" ? Date.parse(e) : NaN, b = (e, t) => ({
11
11
  table: e,
12
12
  predicate: t,
@@ -220,5 +220,4 @@ var p = class extends c.TaggedError("GuestAuthError") {}, m = "authGuests", h =
220
220
  })
221
221
  };
222
222
  };
223
- //#endregion
224
223
  export { p as GuestAuthError, T as dataStoreGuestAuth };
package/dist/handlers.js CHANGED
@@ -11,7 +11,7 @@ import { Effect as E } from "effect";
11
11
  import { buildSetCookie as D } from "@voltro/protocol/session";
12
12
  import { writeTenantSelection as O } from "@voltro/database";
13
13
  import { selectSubjectTenant as k } from "@voltro/protocol";
14
- //#region src/handlers.ts
14
+ // src/handlers.ts
15
15
  var A = 5, j = 900, M = 900, N = (e) => e.email ?? `user:${e.id}`, P = (e) => ({
16
16
  maxAttempts: e.lockout?.maxAttempts ?? A,
17
17
  windowMs: (e.lockout?.windowSeconds ?? j) * 1e3,
@@ -333,5 +333,4 @@ var A = 5, j = 900, M = 900, N = (e) => e.email ?? `user:${e.id}`, P = (e) => ({
333
333
  joinedAt: e.joinedAt.toISOString()
334
334
  })) });
335
335
  });
336
- //#endregion
337
336
  export { v as MFA_PENDING_TTL_S, F as configSessionSecrets, I as configSigningKey, H as guardSubject, Z as handleCsrf, se as handleListMemberships, re as handleListSessions, ee as handleMagicLinkConsume, $ as handleMagicLinkRequest, q as handleMfaEnrollStart, J as handleMfaEnrollVerify, Y as handleMfaRegenerateRecoveryCodes, X as handleMfaUnenroll, W as handleMfaVerify, ne as handlePasswordResetConfirm, te as handlePasswordResetRequest, ae as handleRevokeAllOtherSessions, ie as handleRevokeSession, U as handleSignIn, K as handleSignOut, G as handleSignUp, oe as handleSwitchTenant, V as issueUserSession };
@@ -2,7 +2,7 @@ import { isSessionCredentialLiveFor as e } from "./sessionFamily.js";
2
2
  import { newAuthId as t, subjectFromUser as n } from "./userStore.js";
3
3
  import { Effect as r } from "effect";
4
4
  import { IMPERSONATION_METADATA_KEY as i, rawImpersonationMark as a } from "@voltro/protocol";
5
- //#region src/impersonation.ts
5
+ // src/impersonation.ts
6
6
  var o = 900, s = [
7
7
  "/mfa/enroll/start",
8
8
  "/mfa/enroll/verify",
@@ -172,5 +172,4 @@ var o = 900, s = [
172
172
  subject: g.subject
173
173
  }, { setCookie: g.setCookie });
174
174
  });
175
- //#endregion
176
175
  export { o as IMPERSONATION_DEFAULT_DURATION_S, s as IMPERSONATION_FORBIDDEN_SUBPATHS, m as handleImpersonationStart, h as handleImpersonationStop, d as impersonationAuditRedactor, l as impersonationOf, u as isImpersonated };
@@ -2,7 +2,7 @@ import { newAuthId as e } from "./userStore.js";
2
2
  import { decideAdmission as t } from "./admission.js";
3
3
  import { hashToken as n, mintSecret as r } from "./tokens.js";
4
4
  import { Effect as i } from "effect";
5
- //#region src/invitations.ts
5
+ // src/invitations.ts
6
6
  var a = 604800, o = 500, s = [
7
7
  "owner",
8
8
  "admin",
@@ -183,5 +183,4 @@ var a = 604800, o = 500, s = [
183
183
  role: m.role
184
184
  })) : f(409, { error: "account_exists" });
185
185
  });
186
- //#endregion
187
186
  export { c as DEFAULT_INVITER_ROLES, s as DEFAULT_ROLE_RANK, o as INVITATION_MAX_PENDING, a as INVITATION_TTL_S, u as defaultCanGrantRole, x as handleAcceptInvitation, S as handleAcceptInvitationWithSignUp, _ as handleCreateInvitation, v as handleListInvitations, b as handlePreviewInvitation, y as handleRevokeInvitation };
package/dist/mail.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { Effect as e } from "effect";
2
- //#region src/mail.ts
2
+ // src/mail.ts
3
3
  var t = (t) => (n) => e.runPromise(t.send({
4
4
  to: n.to,
5
5
  subject: n.subject,
6
6
  html: n.html,
7
7
  text: n.text
8
8
  }).pipe(e.asVoid, e.orElseSucceed(() => void 0)));
9
- //#endregion
10
9
  export { t as mailSender };
@@ -1,8 +1,7 @@
1
1
  import { Effect as e } from "effect";
2
- //#region src/memberships.ts
2
+ // src/memberships.ts
3
3
  var t = (t) => async (n) => n.type === "user" ? (await e.runPromise(t.listMemberships(n.id))).map((e) => ({
4
4
  tenantId: e.tenantId,
5
5
  role: e.role
6
6
  })) : [];
7
- //#endregion
8
7
  export { t as authMemberships };
@@ -1,5 +1,5 @@
1
1
  import { GuestClientError as e } from "../guestClient.js";
2
- //#region src/native/guestStorage.ts
2
+ // src/native/guestStorage.ts
3
3
  var t = /* @__PURE__ */ new Set([
4
4
  "keychain",
5
5
  "keystore",
@@ -37,5 +37,4 @@ var t = /* @__PURE__ */ new Set([
37
37
  remove: () => a(() => r.store.delete(i))
38
38
  };
39
39
  };
40
- //#endregion
41
40
  export { r as nativeGuestStore };
package/dist/native.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { GuestClientError as e, createGuestClient as t } from "./guestClient.js";
2
2
  import { nativeGuestStore as n } from "./native/guestStorage.js";
3
3
  import { SESSION_HEADER_NAME as r } from "@voltro/protocol";
4
- //#region src/native/index.ts
4
+ // src/native/index.ts
5
5
  var i = (e) => {
6
6
  let t = "";
7
7
  for (let n of e) t += String.fromCharCode(n);
@@ -91,5 +91,4 @@ var i = (e) => {
91
91
  ...e.fetch === void 0 ? {} : { fetch: e.fetch }
92
92
  });
93
93
  };
94
- //#endregion
95
94
  export { e as GuestClientError, u as NativeExchangeError, c as beginNativeLogin, t as createGuestClient, d as exchangeNativeCode, s as nativeCodeChallenge, n as nativeGuestStore, l as parseNativeCallback, p as probeNativeSession, m as runNativeLogin, f as sessionHeaders };
@@ -4,7 +4,7 @@ import { signAuthClaims as i, verifyAuthClaims as a } from "./signedClaims.js";
4
4
  import { createHash as o, randomBytes as s } from "node:crypto";
5
5
  import { Effect as c } from "effect";
6
6
  import { buildSetCookie as l, readCookie as u } from "@voltro/protocol/session";
7
- //#region src/nativeRoutes.ts
7
+ // src/nativeRoutes.ts
8
8
  var d = "voltro:native", f = 600, p = "/login", m = (e) => e.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), h = (e) => m(o("sha256").update(e, "ascii").digest()), g = (e, t) => t.includes(e), _ = (e, t) => {
9
9
  let n = new URLSearchParams(t).toString();
10
10
  return `${e}${e.includes("?") ? "&" : "?"}${n}`;
@@ -105,5 +105,4 @@ var d = "voltro:native", f = 600, p = "/login", m = (e) => e.toString("base64").
105
105
  subject: p.subject
106
106
  });
107
107
  });
108
- //#endregion
109
108
  export { d as NATIVE_PENDING_COOKIE, w as handleNativeAuthorize, E as handleNativeComplete, D as handleNativeExchange, g as isAllowedRedirectUri, C as nativeLoginRedirect, h as s256 };
@@ -7,7 +7,7 @@ import { createCipheriv as o, createDecipheriv as s, createHash as c, hkdfSync a
7
7
  import { Duration as d, Effect as f } from "effect";
8
8
  import { SESSION_COOKIE_NAME as p, SESSION_HEADER_NAME as m, buildSetCookie as h, resolveSessionSecrets as g, verifySessionKeyed as _ } from "@voltro/protocol/session";
9
9
  import { definePlugin as v } from "@voltro/protocol";
10
- //#region src/overlayPlugin.ts
10
+ // src/overlayPlugin.ts
11
11
  var y = "overlay-code", b = "authTokens", x = 60, S = 300, C = (e, t) => ({
12
12
  status: e,
13
13
  body: JSON.stringify(t),
@@ -163,5 +163,4 @@ var y = "overlay-code", b = "authTokens", x = 60, S = 300, C = (e, t) => ({
163
163
  })
164
164
  });
165
165
  };
166
- //#endregion
167
166
  export { y as OVERLAY_TOKEN_PURPOSE, k as allowedOverlayPage, j as overlayAuthPlugin };
@@ -3,7 +3,7 @@ import { newAuthId as t, subjectFromUser as n } from "./userStore.js";
3
3
  import { configSessionSecrets as r, guardSubject as i } from "./handlers.js";
4
4
  import { generateChallenge as a, verifyAssertion as o, verifyRegistration as s } from "./webauthn.js";
5
5
  import { Effect as c } from "effect";
6
- //#region src/passkeyHandlers.ts
6
+ // src/passkeyHandlers.ts
7
7
  var l = (e, t, n = {}) => ({
8
8
  status: e,
9
9
  body: JSON.stringify(t),
@@ -158,5 +158,4 @@ var l = (e, t, n = {}) => ({
158
158
  subject: C
159
159
  }, { setCookie: w.setCookie });
160
160
  });
161
- //#endregion
162
161
  export { f as dataStoreChallengeStore, g as handlePasskeyAssertOptions, _ as handlePasskeyAssertVerify, m as handlePasskeyRegisterOptions, h as handlePasskeyRegisterVerify, d as memoryChallengeStore };
package/dist/password.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { randomBytes as e, scrypt as t, timingSafeEqual as n } from "node:crypto";
2
2
  import { Data as r, Effect as i } from "effect";
3
- //#region src/password.ts
3
+ // src/password.ts
4
4
  var a = 32768, o = 8, s = 1, c = 32, l = 16, u = (e, t) => 128 * e * t * 2, d = 268435456, f = class extends r.TaggedError("PasswordEmptyError") {}, p = class extends r.TaggedError("PasswordHashError") {}, m = (e, n, r, a) => i.callback((o) => {
5
5
  t(e, n, r, {
6
6
  ...a,
@@ -71,5 +71,4 @@ var a = 32768, o = 8, s = 1, c = 32, l = 16, u = (e, t) => 128 * e * t * 2, d =
71
71
  rehash: n
72
72
  } : { valid: !0 };
73
73
  });
74
- //#endregion
75
74
  export { f as PasswordEmptyError, p as PasswordHashError, h as hashPassword, y as needsRehash, v as parseScryptParams, g as verifyPassword, b as verifyPasswordWithRehash };
package/dist/plugin.js CHANGED
@@ -16,7 +16,7 @@ import { Effect as j } from "effect";
16
16
  import { SESSION_HEADER_NAME as we, readCookie as Te } from "@voltro/protocol/session";
17
17
  import { registerRetention as M, retentionTtlMsFromEnv as N } from "@voltro/database";
18
18
  import { definePlugin as Ee } from "@voltro/protocol";
19
- //#region src/plugin.ts
19
+ // src/plugin.ts
20
20
  var P = (e) => e.filter(F).map((e) => e.auth.sessionStrategy), F = (e) => typeof e.auth == "object" && e.auth !== null && typeof e.auth.sessionStrategy == "object", De = "/auth", Oe = (e) => {
21
21
  let t = Buffer.from(e.rawBody).toString("utf8");
22
22
  if (!t) return {};
@@ -515,5 +515,4 @@ var P = (e) => e.filter(F).map((e) => e.auth.sessionStrategy), F = (e) => typeof
515
515
  example: "30000"
516
516
  }
517
517
  ];
518
- //#endregion
519
518
  export { B as authRoutesPlugin, P as getAuthSessionStrategies };
@@ -1,6 +1,6 @@
1
1
  import { UserAlreadyExistsError as e, UserNotFoundError as t, newAuthId as n } from "./userStore.js";
2
2
  import { Effect as r } from "effect";
3
- //#region src/postgresUserStore.ts
3
+ // src/postgresUserStore.ts
4
4
  var i = (e) => {
5
5
  let t = e;
6
6
  for (let e = 0; typeof t == "object" && t && e < 6; e++) {
@@ -471,5 +471,4 @@ var i = (e) => {
471
471
  }).pipe(r.asVoid, $("clear", void 0))
472
472
  };
473
473
  };
474
- //#endregion
475
474
  export { o as postgresUserStore };
@@ -1,6 +1,6 @@
1
1
  import { isSessionCredentialLiveFor as e } from "./sessionFamily.js";
2
2
  import { Effect as t } from "effect";
3
- //#region src/revocation.ts
3
+ // src/revocation.ts
4
4
  var n = 3e4, r = 1e4, i = (e) => {
5
5
  if (typeof e != "object" || !e) throw TypeError("Session revocation options must be an object.");
6
6
  if ("isLive" in e || "isLiveFor" in e || "invalidate" in e || Reflect.ownKeys(e).some((e) => typeof e != "string" || ![
@@ -46,5 +46,4 @@ var n = 3e4, r = 1e4, i = (e) => {
46
46
  })
47
47
  };
48
48
  };
49
- //#endregion
50
49
  export { a as makeSessionRevocationChecker, i as validateSessionRevocationOptions };
package/dist/schema.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { authGuestDevicesTable as e, authGuestsTable as t, guestTables as n } from "./guestSchema.js";
2
2
  import { id as r, integer as i, table as a, text as o, timestamp as s } from "@voltro/database";
3
- //#region src/schema/index.ts
3
+ // src/schema/index.ts
4
4
  var c = a("users", {
5
5
  id: r(),
6
6
  email: o().nullable(),
@@ -104,5 +104,4 @@ var c = a("users", {
104
104
  g,
105
105
  _
106
106
  ];
107
- //#endregion
108
107
  export { e as authGuestDevicesTable, t as authGuestsTable, v as authTables, d as authTokensTable, n as guestTables, _ as impersonationGrantsTable, g as invitationsTable, h as loginAttemptsTable, u as membershipsTable, m as passkeyChallengesTable, f as passkeysTable, p as recoveryCodesTable, l as sessionsTable, c as usersTable };
package/dist/session.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_SESSION_KID as e, buildSetCookie as t, readCookie as n, readSessionValue as r, resolveOptionalSessionSecrets as i, resolveSessionSecret as a, resolveSessionSecrets as o, signSession as s, timingSafeStringEqual as c, verifySessionKeyed as l } from "@voltro/protocol/session";
2
- //#region src/session.ts
2
+ // src/session.ts
3
3
  var u = "voltro:session", d = 604800, f = a, p = o, m = (e) => typeof e == "string" ? e : e.current, h = (t) => {
4
4
  if (typeof t != "string") return t;
5
5
  let n = i(), r = {
@@ -40,5 +40,4 @@ var u = "voltro:session", d = 604800, f = a, p = o, m = (e) => typeof e == "stri
40
40
  ...e.domain ? { domain: e.domain } : {},
41
41
  path: "/"
42
42
  });
43
- //#endregion
44
43
  export { u as SESSION_COOKIE_NAME, b as clearSessionCookie, g as issueSession, _ as readSession, y as readSessionFromHeaders, v as readSessionKeyed, f as resolveSessionSecret, p as resolveSessionSecrets, h as sessionSecretsOf };
@@ -1,4 +1,4 @@
1
- //#region src/sessionFamily.ts
1
+ // src/sessionFamily.ts
2
2
  var e = (e) => {
3
3
  if (typeof e.id != "string" || e.id.length === 0 || typeof e.userId != "string" || e.userId.length === 0) return null;
4
4
  let t = e.familyId ?? e.id;
@@ -11,5 +11,4 @@ var e = (e) => {
11
11
  for (let n of e) typeof n.id == "string" && n.id.length !== 0 && t.set(n.id, t.has(n.id) ? null : n);
12
12
  return t;
13
13
  }, r = (e, t, n, r) => e !== null && typeof t == "string" && t.length > 0 && typeof n == "string" && n.length > 0 && Number.isFinite(r) && e.id === t && e.userId === n && e.rotatedAt == null && e.expiresAt instanceof Date && Number.isFinite(e.expiresAt.getTime()) && e.expiresAt.getTime() > r;
14
- //#endregion
15
14
  export { t as hasOwnedSessionFamily, n as indexSessionFamilies, r as isSessionCredentialLiveFor, e as sessionFamilyId };
@@ -3,7 +3,7 @@ import { hasOwnedSessionFamily as t, indexSessionFamilies as n, sessionFamilyId
3
3
  import { newAuthId as i } from "./userStore.js";
4
4
  import { Effect as a } from "effect";
5
5
  import { and as o, columnRef as s, eq as c, isNull as l, or as u } from "@voltro/database";
6
- //#region src/sessionRegistry.ts
6
+ // src/sessionRegistry.ts
7
7
  var d = "sessions", f = 604800, p = (e) => ({
8
8
  ...e,
9
9
  expiresAt: new Date(e.expiresAt),
@@ -129,5 +129,4 @@ var d = "sessions", f = 604800, p = (e) => ({
129
129
  let { transaction: c, ...l } = i;
130
130
  return T(C(e, { transaction: "existing" }), t, r, l, a.root.id);
131
131
  }) : null;
132
- //#endregion
133
132
  export { C as dataStoreSessionRegistry, E as issueRegisteredSession, y as lockRegisteredSession, D as rotateRegisteredSession, w as withSessionId };
@@ -1,5 +1,5 @@
1
1
  import { createHmac as e, timingSafeEqual as t } from "node:crypto";
2
- //#region src/signedClaims.ts
2
+ // src/signedClaims.ts
3
3
  var n = (t, n, r) => e("sha256", n).update(`${r}:${t}`).digest(), r = (e, t, r) => {
4
4
  if (t.length < 32 || typeof e.exp != "number" || !Number.isSafeInteger(e.exp)) throw Error("Auth handoff requires a project signing key and whole-second expiry");
5
5
  let i = Buffer.from(JSON.stringify(e), "utf8").toString("base64url");
@@ -20,5 +20,4 @@ var n = (t, n, r) => e("sha256", n).update(`${r}:${t}`).digest(), r = (e, t, r)
20
20
  return null;
21
21
  }
22
22
  };
23
- //#endregion
24
23
  export { r as signAuthClaims, i as verifyAuthClaims };
package/dist/strategy.js CHANGED
@@ -3,7 +3,7 @@ import { makeSessionRevocationChecker as t, validateSessionRevocationOptions as
3
3
  import { sessionIdOfSubject as r } from "./userStore.js";
4
4
  import { Effect as i } from "effect";
5
5
  import { readSessionValue as a, resolveSessionSecret as o, verifySessionKeyed as s } from "@voltro/protocol/session";
6
- //#region src/strategy.ts
6
+ // src/strategy.ts
7
7
  var c = (e) => typeof e == "object" && !!e && "isLiveFor" in e && typeof e.isLiveFor == "function" && "invalidate" in e && typeof e.invalidate == "function" && typeof e.ttlMs == "number" && Number.isFinite(e.ttlMs) && e.ttlMs >= 0, l = (e) => e.revocation && c(e.revocation) ? e.revocation : (e.revocation !== void 0 && n(e.revocation), e.store ? t(e.store, e.revocation ?? {}) : null), u = (n = {}) => {
8
8
  let u = n.cookieName ?? "voltro:session", f = l(n), p = n.revocation && !c(n.revocation) ? n.revocation : {}, m = /* @__PURE__ */ new WeakMap(), h = (e) => {
9
9
  if (f) return f;
@@ -65,5 +65,4 @@ var c = (e) => typeof e == "object" && !!e && "isLiveFor" in e && typeof e.isLiv
65
65
  }
66
66
  };
67
67
  };
68
- //#endregion
69
68
  export { u as voltroPasswordStrategy };
@@ -1,5 +1,5 @@
1
1
  import { Effect as e } from "effect";
2
- //#region src/subjectGuard.ts
2
+ // src/subjectGuard.ts
3
3
  var t = { ok: !0 }, n = (n, r) => e.gen(function* () {
4
4
  for (let e of n) {
5
5
  let t = yield* e(r);
@@ -7,5 +7,4 @@ var t = { ok: !0 }, n = (n, r) => e.gen(function* () {
7
7
  }
8
8
  return t;
9
9
  });
10
- //#endregion
11
10
  export { n as runSubjectGuards };
package/dist/tokens.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHash as e, randomBytes as t } from "node:crypto";
2
- //#region src/tokens.ts
2
+ // src/tokens.ts
3
3
  var n = 900, r = 3600, i = 86400, a = 300, o = 300, s = {
4
4
  "magic-link": 900,
5
5
  "password-reset": r,
@@ -17,5 +17,4 @@ var n = 900, r = 3600, i = 86400, a = 300, o = 300, s = {
17
17
  ...u(t ?? s[e]),
18
18
  purpose: e
19
19
  });
20
- //#endregion
21
20
  export { i as EMAIL_VERIFY_TTL_S, n as MAGIC_LINK_TTL_S, a as MFA_PENDING_TTL_S, o as NATIVE_CODE_TTL_S, r as PASSWORD_RESET_TTL_S, l as hashToken, u as mintSecret, d as mintToken };
package/dist/totp.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createHmac as e, randomBytes as t, timingSafeEqual as n } from "node:crypto";
2
2
  import { Data as r, Effect as i } from "effect";
3
- //#region src/totp.ts
3
+ // src/totp.ts
4
4
  var a = 30, o = 6, s = 20, c = "sha1", l = 1, u = class extends r.TaggedError("TotpVerifyError") {}, d = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", f = (e) => {
5
5
  let t = 0, n = 0, r = "";
6
6
  for (let i of e) for (n = n << 8 | i, t += 8; t >= 5;) r += d[n >>> t - 5 & 31], t -= 5;
@@ -51,5 +51,4 @@ var a = 30, o = 6, s = 20, c = "sha1", l = 1, u = class extends r.TaggedError("T
51
51
  }
52
52
  return n;
53
53
  };
54
- //#endregion
55
54
  export { u as TotpVerifyError, b as generateRecoveryCodes, v as generateTotpCode, g as generateTotpSecret, _ as otpauthUrl, y as verifyTotpCode };
package/dist/userStore.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { hasOwnedSessionFamily as e, indexSessionFamilies as t, sessionFamilyId as n } from "./sessionFamily.js";
2
2
  import { Data as r, Effect as i } from "effect";
3
3
  import { generateId as a } from "@voltro/database";
4
- //#region src/userStore.ts
4
+ // src/userStore.ts
5
5
  var o = class extends r.TaggedError("UserAlreadyExistsError") {}, s = class extends r.TaggedError("UserNotFoundError") {}, c = (e) => a({
6
6
  kind: "typeid",
7
7
  prefix: e
@@ -288,5 +288,4 @@ var o = class extends r.TaggedError("UserAlreadyExistsError") {}, s = class exte
288
288
  let t = e.metadata?.memberships;
289
289
  return Array.isArray(t) ? t.filter((e) => typeof e == "object" && !!e && typeof e.tenantId == "string" && typeof e.role == "string") : [];
290
290
  };
291
- //#endregion
292
291
  export { o as UserAlreadyExistsError, s as UserNotFoundError, l as memoryUserStore, c as newAuthId, d as sessionIdOfSubject, u as subjectFromUser, f as subjectMemberships };
@@ -1,4 +1,4 @@
1
- //#region src/web/guestStorage.ts
1
+ // src/web/guestStorage.ts
2
2
  var e = (e) => {
3
3
  if (!e.trim()) throw Error("Guest storage requires an app namespace");
4
4
  let t = (t, n) => new Promise((r, i) => {
@@ -43,5 +43,4 @@ var e = (e) => {
43
43
  }
44
44
  };
45
45
  };
46
- //#endregion
47
46
  export { e as indexedDbGuestStore };
@@ -1,4 +1,4 @@
1
- //#region src/web/passkeyClient.ts
1
+ // src/web/passkeyClient.ts
2
2
  var e = (e) => {
3
3
  let t = new Uint8Array(e), n = "";
4
4
  for (let e of t) n += String.fromCharCode(e);
@@ -74,5 +74,4 @@ var e = (e) => {
74
74
  if (!p.ok) throw Error(`passkey sign-in failed: ${String(p.error)}`);
75
75
  return { subject: p.subject };
76
76
  };
77
- //#endregion
78
77
  export { n as isPasskeySupported, i as registerPasskey, a as signInWithPasskey };
@@ -1,9 +1,8 @@
1
1
  import { useOptionalSubject as e } from "./subjectContext.js";
2
2
  import { Fragment as t, jsx as n } from "react/jsx-runtime";
3
- //#region src/web/requireAuth.tsx
3
+ // src/web/requireAuth.tsx
4
4
  var r = ({ children: r, fallback: i }) => {
5
5
  let a = e();
6
6
  return a ? typeof r == "function" ? /* @__PURE__ */ n(t, { children: r(a) }) : /* @__PURE__ */ n(t, { children: r }) : /* @__PURE__ */ n(t, { children: i });
7
7
  };
8
- //#endregion
9
8
  export { r as RequireAuth };
@@ -1,6 +1,6 @@
1
1
  import { createContext as e, useContext as t } from "react";
2
2
  import { jsx as n } from "react/jsx-runtime";
3
- //#region src/web/subjectContext.tsx
3
+ // src/web/subjectContext.tsx
4
4
  var r = e(null), i = ({ subject: e, children: t }) => /* @__PURE__ */ n(r.Provider, {
5
5
  value: e,
6
6
  children: t
@@ -9,5 +9,4 @@ var r = e(null), i = ({ subject: e, children: t }) => /* @__PURE__ */ n(r.Provid
9
9
  if (!e) throw Error("useSubject() called without a signed-in user. Use useOptionalSubject() or wrap the consumer in <RequireAuth>.");
10
10
  return e;
11
11
  }, o = () => t(r);
12
- //#endregion
13
12
  export { i as SubjectProvider, o as useOptionalSubject, a as useSubject };
package/dist/webauthn.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHash as e, createPublicKey as t, createVerify as n, randomBytes as r, timingSafeEqual as i, verify as a } from "node:crypto";
2
- //#region src/webauthn.ts
2
+ // src/webauthn.ts
3
3
  var o = (e) => {
4
4
  let t = e.replace(/-/g, "+").replace(/_/g, "/") + "=".repeat((4 - e.length % 4) % 4);
5
5
  return Buffer.from(t, "base64");
@@ -314,5 +314,4 @@ var o = (e) => {
314
314
  let n = Buffer.from(e), r = Buffer.from(t);
315
315
  return n.length === r.length && i(n, r);
316
316
  }, D = () => s(r(32));
317
- //#endregion
318
317
  export { D as generateChallenge, w as verifyAssertion, C as verifyRegistration };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-auth",
3
- "version": "0.87.0",
3
+ "version": "0.88.0",
4
4
  "description": "Authentication primitives: password hashing, session creation, schema mixin + tables. Pairs with the `auth` app template for the UI; both independently usable. Server-side only (uses node:crypto).",
5
5
  "keywords": [
6
6
  "voltro",
@@ -88,11 +88,11 @@
88
88
  "node": ">=24.0.0"
89
89
  },
90
90
  "dependencies": {
91
- "@voltro/database": "0.87.0",
92
- "@voltro/protocol": "0.87.0"
91
+ "@voltro/database": "0.88.0",
92
+ "@voltro/protocol": "0.88.0"
93
93
  },
94
94
  "peerDependencies": {
95
- "effect": "4.0.1",
95
+ "effect": "4.1.0",
96
96
  "react": "^19.0.0"
97
97
  },
98
98
  "peerDependenciesMeta": {