@voltro/plugin-auth 0.37.0 → 0.39.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.
- package/CHANGELOG.md +316 -0
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +10 -10
- package/dist/password.js +1 -1
- package/dist/{plugin-BZm5Semm.js → plugin-CPcpSSf9.js} +286 -286
- package/dist/plugin.js +1 -1
- package/dist/session.js +1 -1
- package/dist/{strategy-Bty6_XUj.js → strategy-MP_KxNuA.js} +9 -9
- package/dist/strategy.js +1 -1
- package/dist/tokens.js +1 -1
- package/dist/web.js +2 -2
- package/dist/webauthn.js +1 -1
- package/package.json +3 -3
package/dist/plugin.js
CHANGED
package/dist/session.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_SESSION_KID as e, buildSetCookie as t, readCookie as n, resolveOptionalSessionSecrets as r, resolveSessionSecret as i, resolveSessionSecrets as a, signSession as o, timingSafeStringEqual as s, verifySessionKeyed as c } from "@voltro/protocol/session";
|
|
2
2
|
//#region src/session.ts
|
|
3
|
-
var l = "voltro:session", u =
|
|
3
|
+
var l = "voltro:session", u = 604800, d = i, f = a, p = (e) => typeof e == "string" ? e : e.current, m = (t) => {
|
|
4
4
|
if (typeof t != "string") return t;
|
|
5
5
|
let n = r(), i = {
|
|
6
6
|
kid: n && s(n.current.secret, t) ? n.current.kid : e,
|
|
@@ -143,7 +143,7 @@ var s = 3e4, c = 1e4, l = (e, t = {}) => {
|
|
|
143
143
|
}),
|
|
144
144
|
latestToken: (e, t) => n.sync(() => {
|
|
145
145
|
let n = null;
|
|
146
|
-
for (let r of o) r.userId
|
|
146
|
+
for (let r of o) r.userId === e && r.purpose === t && (n === null || r.createdAt.getTime() > n.createdAt.getTime()) && (n = r);
|
|
147
147
|
return n;
|
|
148
148
|
}),
|
|
149
149
|
insertInvitation: (e) => n.sync(() => {
|
|
@@ -294,26 +294,26 @@ var s = 3e4, c = 1e4, l = (e, t = {}) => {
|
|
|
294
294
|
resolve: (c) => {
|
|
295
295
|
let l = r(c.headers.cookie, o);
|
|
296
296
|
if (!l) return { kind: "skip" };
|
|
297
|
-
let u =
|
|
298
|
-
if (!
|
|
297
|
+
let u = e(t.secret ?? i()), d = a(l, u);
|
|
298
|
+
if (!d) return {
|
|
299
299
|
kind: "failed",
|
|
300
300
|
reason: "voltro session cookie failed verification"
|
|
301
301
|
};
|
|
302
|
-
let
|
|
302
|
+
let f = b(d.subject, "voltro-password");
|
|
303
303
|
if (!s) return {
|
|
304
304
|
kind: "matched",
|
|
305
|
-
subject:
|
|
305
|
+
subject: f
|
|
306
306
|
};
|
|
307
|
-
let
|
|
308
|
-
return
|
|
307
|
+
let p = h(f);
|
|
308
|
+
return p ? n.runPromise(s.isLive(p)).then((e) => e ? {
|
|
309
309
|
kind: "matched",
|
|
310
|
-
subject:
|
|
310
|
+
subject: f
|
|
311
311
|
} : {
|
|
312
312
|
kind: "failed",
|
|
313
313
|
reason: "voltro session revoked"
|
|
314
314
|
}) : {
|
|
315
315
|
kind: "matched",
|
|
316
|
-
subject:
|
|
316
|
+
subject: f
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
319
|
};
|
package/dist/strategy.js
CHANGED
package/dist/tokens.js
CHANGED
package/dist/web.js
CHANGED
|
@@ -52,7 +52,7 @@ var i = e(null), a = ({ subject: e, children: t }) => /* @__PURE__ */ r(i.Provid
|
|
|
52
52
|
userVerification: "preferred",
|
|
53
53
|
residentKey: "preferred"
|
|
54
54
|
},
|
|
55
|
-
timeout:
|
|
55
|
+
timeout: 3e5
|
|
56
56
|
} });
|
|
57
57
|
if (!c) throw Error("credential creation was cancelled");
|
|
58
58
|
let p = c.response, m = typeof p.getAuthenticatorData == "function" ? p.getAuthenticatorData() : /* @__PURE__ */ new ArrayBuffer(0), h = await f(`${n}/passkey/register/verify`, {
|
|
@@ -73,7 +73,7 @@ var i = e(null), a = ({ subject: e, children: t }) => /* @__PURE__ */ r(i.Provid
|
|
|
73
73
|
id: u(e.id)
|
|
74
74
|
})),
|
|
75
75
|
userVerification: "preferred",
|
|
76
|
-
timeout:
|
|
76
|
+
timeout: 3e5
|
|
77
77
|
} });
|
|
78
78
|
if (!s) throw Error("assertion was cancelled");
|
|
79
79
|
let c = s.response, p = await f(`${n}/passkey/assert/verify`, {
|
package/dist/webauthn.js
CHANGED
|
@@ -287,7 +287,7 @@ var o = (e) => {
|
|
|
287
287
|
error: "unsupported-key"
|
|
288
288
|
};
|
|
289
289
|
let a = Buffer.concat([n, c(o(e.clientDataJSON))]), s = o(e.signature);
|
|
290
|
-
return T(i.key, i.alg, a, s) ?
|
|
290
|
+
return T(i.key, i.alg, a, s) ? (r.signCount !== 0 || e.storedCounter !== 0) && r.signCount <= e.storedCounter ? {
|
|
291
291
|
ok: !1,
|
|
292
292
|
error: "counter-replay"
|
|
293
293
|
} : {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.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",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@effect/sql": "^0.52.0",
|
|
82
|
-
"@voltro/database": "0.
|
|
83
|
-
"@voltro/protocol": "0.
|
|
82
|
+
"@voltro/database": "0.39.0",
|
|
83
|
+
"@voltro/protocol": "0.39.0"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"effect": "^3.22.0",
|