@nice2dev/ui-security 1.0.11 → 1.0.14
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/README.md +14 -0
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +203 -203
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
2
|
-
import { useContext as
|
|
1
|
+
import { jsx as c, jsxs as C, Fragment as Ce } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as Re, createContext as Pe, useRef as V, useState as j, useCallback as G, useEffect as te, useMemo as se } from "react";
|
|
3
3
|
const Ee = {
|
|
4
4
|
low: 0.7,
|
|
5
5
|
medium: 0.8,
|
|
@@ -122,15 +122,15 @@ function je(e, t = 0.3) {
|
|
|
122
122
|
a[(S - 1) * r + (u - 1)]
|
|
123
123
|
];
|
|
124
124
|
let l = 0;
|
|
125
|
-
for (let
|
|
126
|
-
const H = x[
|
|
125
|
+
for (let B = 0; B < 8; B++) {
|
|
126
|
+
const H = x[B] > 0 ? 1 : 0, Z = x[(B + 1) % 8] > 0 ? 1 : 0;
|
|
127
127
|
l += Math.abs(H - Z);
|
|
128
128
|
}
|
|
129
129
|
l /= 2;
|
|
130
130
|
let h = 0, L = 0;
|
|
131
|
-
for (let
|
|
131
|
+
for (let B = -2; B <= 2; B++)
|
|
132
132
|
for (let H = -2; H <= 2; H++)
|
|
133
|
-
h += o[(S +
|
|
133
|
+
h += o[(S + B) * r + (u + H)], L++;
|
|
134
134
|
const q = h / L / 255;
|
|
135
135
|
if (q < t)
|
|
136
136
|
continue;
|
|
@@ -146,9 +146,9 @@ function je(e, t = 0.3) {
|
|
|
146
146
|
const S = m.reduce((x, l) => x + l.x, 0) / m.length, u = m.reduce((x, l) => x + l.y, 0) / m.length;
|
|
147
147
|
v.push({ x: S, y: u });
|
|
148
148
|
}
|
|
149
|
-
const k = m.length, p = m.filter((S) => S.type === "ending").length,
|
|
149
|
+
const k = m.length, p = m.filter((S) => S.type === "ending").length, R = m.filter((S) => S.type === "bifurcation").length / (p + 1);
|
|
150
150
|
let b = "loop-right";
|
|
151
|
-
|
|
151
|
+
R > 1.5 ? b = "whorl" : R < 0.5 ? b = "arch" : ((y = v[0]) == null ? void 0 : y.x) < 0.45 && (b = "loop-left");
|
|
152
152
|
const T = m.length > 20 ? m.reduce((S, u) => S + u.quality, 0) / m.length : 0;
|
|
153
153
|
return {
|
|
154
154
|
minutiae: m,
|
|
@@ -159,7 +159,7 @@ function je(e, t = 0.3) {
|
|
|
159
159
|
quality: T
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function _e(e, t) {
|
|
163
163
|
if (e.minutiae.length < 5 || t.minutiae.length < 5)
|
|
164
164
|
return 0;
|
|
165
165
|
let r = 0;
|
|
@@ -180,7 +180,7 @@ function Be(e, t) {
|
|
|
180
180
|
const o = Math.min(e.minutiae.length, t.minutiae.length);
|
|
181
181
|
return o > 0 ? r / o : 0;
|
|
182
182
|
}
|
|
183
|
-
async function
|
|
183
|
+
async function Be(e, t) {
|
|
184
184
|
const r = JSON.stringify(e), n = await ce(r);
|
|
185
185
|
return {
|
|
186
186
|
id: `fp_${Date.now()}_${he()}`,
|
|
@@ -191,22 +191,22 @@ async function We(e, t) {
|
|
|
191
191
|
hash: n
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function We(e) {
|
|
195
195
|
return JSON.parse(atob(e.templateData));
|
|
196
196
|
}
|
|
197
197
|
function Ue(e, t = "left") {
|
|
198
198
|
const r = e.width, n = e.height, i = oe(e), s = Se(i, r, n);
|
|
199
199
|
let o = { cx: r / 2, cy: n / 2, r: Math.min(r, n) * 0.08, score: 1 / 0 };
|
|
200
200
|
for (let D = Math.round(n * 0.3); D < Math.round(n * 0.7); D += 2)
|
|
201
|
-
for (let
|
|
201
|
+
for (let R = Math.round(r * 0.3); R < Math.round(r * 0.7); R += 2)
|
|
202
202
|
for (let b = Math.round(Math.min(r, n) * 0.04); b < Math.round(Math.min(r, n) * 0.15); b += 2) {
|
|
203
203
|
let T = 0, y = 0;
|
|
204
204
|
for (let l = 0; l < Math.PI * 2; l += 0.3) {
|
|
205
|
-
const h = Math.round(
|
|
205
|
+
const h = Math.round(R + b * Math.cos(l)), L = Math.round(D + b * Math.sin(l));
|
|
206
206
|
h >= 0 && h < r && L >= 0 && L < n && (T += s[L * r + h], y++);
|
|
207
207
|
}
|
|
208
|
-
const S = y > 0 ? T / y : 255, u = s[D * r +
|
|
209
|
-
x < o.score && (o = { cx:
|
|
208
|
+
const S = y > 0 ? T / y : 255, u = s[D * r + R], x = S * 0.5 + u * 0.5;
|
|
209
|
+
x < o.score && (o = { cx: R, cy: D, r: b, score: x });
|
|
210
210
|
}
|
|
211
211
|
const a = o.r * 3, g = {
|
|
212
212
|
cx: o.cx,
|
|
@@ -214,9 +214,9 @@ function Ue(e, t = "left") {
|
|
|
214
214
|
r: Math.min(a, Math.min(r, n) * 0.4)
|
|
215
215
|
}, v = 256, f = [];
|
|
216
216
|
for (let D = 0; D < v; D++) {
|
|
217
|
-
const
|
|
217
|
+
const R = D / v * Math.PI * 2, b = o.r + (g.r - o.r) * 0.5, T = Math.round(o.cx + b * Math.cos(R)), y = Math.round(o.cy + b * Math.sin(R));
|
|
218
218
|
if (T >= 0 && T < r && y >= 0 && y < n) {
|
|
219
|
-
const S = Math.round(o.cx + b * Math.cos(
|
|
219
|
+
const S = Math.round(o.cx + b * Math.cos(R + 0.1)), u = Math.round(o.cy + b * Math.sin(R + 0.1)), x = s[y * r + T], l = S >= 0 && S < r && u >= 0 && u < n ? s[u * r + S] : x;
|
|
220
220
|
f.push(x > l ? 1 : 0);
|
|
221
221
|
} else
|
|
222
222
|
f.push(0);
|
|
@@ -266,8 +266,8 @@ function qe(e) {
|
|
|
266
266
|
function ue(e) {
|
|
267
267
|
const t = e.width, r = e.height, n = e.data, i = new Uint8Array(t * r);
|
|
268
268
|
for (let u = 0; u < t * r; u++) {
|
|
269
|
-
const x = u * 4, l = n[x], h = n[x + 1], L = n[x + 2], q = 0.299 * l + 0.587 * h + 0.114 * L, Y = 128 - 0.169 * l - 0.331 * h + 0.5 * L,
|
|
270
|
-
Y >= 77 && Y <= 127 &&
|
|
269
|
+
const x = u * 4, l = n[x], h = n[x + 1], L = n[x + 2], q = 0.299 * l + 0.587 * h + 0.114 * L, Y = 128 - 0.169 * l - 0.331 * h + 0.5 * L, B = 128 + 0.5 * l - 0.419 * h - 0.081 * L;
|
|
270
|
+
Y >= 77 && Y <= 127 && B >= 133 && B <= 173 && q > 80 && (i[u] = 1);
|
|
271
271
|
}
|
|
272
272
|
let s = t, o = r, a = 0, g = 0, v = 0;
|
|
273
273
|
for (let u = 0; u < r; u++)
|
|
@@ -276,10 +276,10 @@ function ue(e) {
|
|
|
276
276
|
const f = a - s, m = g - o;
|
|
277
277
|
if (f < t * 0.1 || m < r * 0.1)
|
|
278
278
|
return null;
|
|
279
|
-
const k = { x: s, y: o, width: f, height: m }, p = [], D = oe(e),
|
|
279
|
+
const k = { x: s, y: o, width: f, height: m }, p = [], D = oe(e), R = Math.max(1, Math.floor(f / 8)), b = Math.max(1, Math.floor(m / 16));
|
|
280
280
|
for (let u = 0; u < 16; u++)
|
|
281
281
|
for (let x = 0; x < 8; x++) {
|
|
282
|
-
const l = s + x *
|
|
282
|
+
const l = s + x * R + Math.floor(R / 2), h = o + u * b + Math.floor(b / 2);
|
|
283
283
|
l < t && h < r ? p.push(D[h * t + l] / 255) : p.push(0);
|
|
284
284
|
}
|
|
285
285
|
const T = [], y = { x: s + f / 2, y: o + m / 2 };
|
|
@@ -432,7 +432,7 @@ async function ye(e, t, r) {
|
|
|
432
432
|
}
|
|
433
433
|
const Qe = (e, t) => t, De = Pe(Qe), Dt = ({ t: e, children: t }) => /* @__PURE__ */ c(De.Provider, { value: e, children: t });
|
|
434
434
|
function ee() {
|
|
435
|
-
return { t:
|
|
435
|
+
return { t: Re(De) };
|
|
436
436
|
}
|
|
437
437
|
const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
438
438
|
const {
|
|
@@ -450,8 +450,8 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
450
450
|
showMinutiae: k = !1,
|
|
451
451
|
instructionText: p,
|
|
452
452
|
cameraFacing: D = "environment",
|
|
453
|
-
...
|
|
454
|
-
} = e, { t: b } = ee(), T = de(
|
|
453
|
+
...R
|
|
454
|
+
} = e, { t: b } = ee(), T = de(R), y = Ve[v], S = V(null), u = V(null), x = V(null), [l, h] = j("idle"), [L, q] = j(0), [Y, B] = j(null), [H, Z] = j(0), [W, $] = j(""), _ = G(
|
|
455
455
|
(E) => {
|
|
456
456
|
h(E), o == null || o(E);
|
|
457
457
|
},
|
|
@@ -459,33 +459,33 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
459
459
|
), F = G(async () => {
|
|
460
460
|
try {
|
|
461
461
|
const E = await fe(D);
|
|
462
|
-
x.current = E, S.current && (S.current.srcObject = E, await S.current.play()),
|
|
462
|
+
x.current = E, S.current && (S.current.srcObject = E, await S.current.play()), _("idle"), $(b("security.fingerprint.placeFingerPrompt", "Place your finger on the scanner"));
|
|
463
463
|
} catch (E) {
|
|
464
|
-
a == null || a(E instanceof Error ? E : new Error(String(E))), $(b("security.fingerprint.cameraError", "Camera access denied")),
|
|
464
|
+
a == null || a(E instanceof Error ? E : new Error(String(E))), $(b("security.fingerprint.cameraError", "Camera access denied")), _("error");
|
|
465
465
|
}
|
|
466
|
-
}, [D, b,
|
|
466
|
+
}, [D, b, _, a]), K = G(() => {
|
|
467
467
|
var E;
|
|
468
468
|
(E = x.current) == null || E.getTracks().forEach((I) => I.stop()), x.current = null;
|
|
469
469
|
}, []);
|
|
470
470
|
te(() => (F(), K), [F, K]);
|
|
471
471
|
const U = G(async () => {
|
|
472
472
|
if (!(!S.current || l === "processing" || l === "success")) {
|
|
473
|
-
|
|
473
|
+
_("scanning"), $(b("security.fingerprint.scanning", "Scanning…"));
|
|
474
474
|
try {
|
|
475
475
|
const { imageData: E } = ae(S.current);
|
|
476
|
-
|
|
476
|
+
_("processing"), $(b("security.fingerprint.processing", "Processing fingerprint…"));
|
|
477
477
|
const I = je(E);
|
|
478
|
-
if (
|
|
479
|
-
$(b("security.fingerprint.lowQuality", "Low quality — try again")),
|
|
478
|
+
if (B(I), q(I.quality), I.quality < 0.2) {
|
|
479
|
+
$(b("security.fingerprint.lowQuality", "Low quality — try again")), _("idle");
|
|
480
480
|
return;
|
|
481
481
|
}
|
|
482
482
|
if (t === "enroll") {
|
|
483
|
-
const z = await
|
|
484
|
-
i == null || i(z, I), $(b("security.fingerprint.enrolled", "Fingerprint enrolled successfully")),
|
|
483
|
+
const z = await Be(I, f ?? n);
|
|
484
|
+
i == null || i(z, I), $(b("security.fingerprint.enrolled", "Fingerprint enrolled successfully")), _("success");
|
|
485
485
|
} else {
|
|
486
486
|
let z = 0;
|
|
487
487
|
for (const d of r) {
|
|
488
|
-
const A =
|
|
488
|
+
const A = We(d), N = _e(I, A);
|
|
489
489
|
N > z && (z = N);
|
|
490
490
|
}
|
|
491
491
|
const M = z >= T.matchThreshold, w = {
|
|
@@ -509,10 +509,10 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
509
509
|
);
|
|
510
510
|
w.success = A.verified;
|
|
511
511
|
}
|
|
512
|
-
w.success ? ($(b("security.fingerprint.verified", "Fingerprint verified")),
|
|
512
|
+
w.success ? ($(b("security.fingerprint.verified", "Fingerprint verified")), _("success")) : (Z((d) => d + 1), H + 1 >= T.maxRetries ? ($(b("security.fingerprint.maxAttempts", "Maximum attempts reached")), _("failure")) : ($(b("security.fingerprint.noMatch", "No match — try again")), _("idle"))), s == null || s(w);
|
|
513
513
|
}
|
|
514
514
|
} catch (E) {
|
|
515
|
-
a == null || a(E instanceof Error ? E : new Error(String(E))), $(b("security.fingerprint.error", "Scan error — try again")),
|
|
515
|
+
a == null || a(E instanceof Error ? E : new Error(String(E))), $(b("security.fingerprint.error", "Scan error — try again")), _("error");
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
}, [
|
|
@@ -521,7 +521,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
521
521
|
r,
|
|
522
522
|
T,
|
|
523
523
|
b,
|
|
524
|
-
|
|
524
|
+
_,
|
|
525
525
|
i,
|
|
526
526
|
s,
|
|
527
527
|
a,
|
|
@@ -534,18 +534,18 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
534
534
|
return;
|
|
535
535
|
const E = u.current.getContext("2d");
|
|
536
536
|
E && (E.clearRect(0, 0, y, y), Y.minutiae.forEach((I) => {
|
|
537
|
-
E.beginPath(), E.arc(I.x * y, I.y * y, 2, 0, Math.PI * 2), E.fillStyle = I.type === "ending" ? "#10b981" : "#f59e0b", E.fill(), E.beginPath(), E.moveTo(I.x * y, I.y * y), E.lineTo(I.x * y + Math.cos(I.angle) * 8, I.y * y + Math.sin(I.angle) * 8), E.strokeStyle = E.fillStyle, E.lineWidth = 1, E.stroke();
|
|
537
|
+
E.beginPath(), E.arc(I.x * y, I.y * y, 2, 0, Math.PI * 2), E.fillStyle = I.type === "ending" ? "var(--nice-success, #10b981)" : "var(--nice-warning, #f59e0b)", E.fill(), E.beginPath(), E.moveTo(I.x * y, I.y * y), E.lineTo(I.x * y + Math.cos(I.angle) * 8, I.y * y + Math.sin(I.angle) * 8), E.strokeStyle = E.fillStyle, E.lineWidth = 1, E.stroke();
|
|
538
538
|
}));
|
|
539
539
|
}, [Y, k, y]);
|
|
540
540
|
const X = l === "success" ? "var(--security-success)" : l === "failure" || l === "error" ? "var(--security-error)" : l === "scanning" || l === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
541
|
-
return /* @__PURE__ */
|
|
541
|
+
return /* @__PURE__ */ C(
|
|
542
542
|
"div",
|
|
543
543
|
{
|
|
544
544
|
className: g,
|
|
545
545
|
style: { display: "inline-flex", flexDirection: "column", alignItems: "center", gap: 12 },
|
|
546
546
|
children: [
|
|
547
547
|
f && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f }),
|
|
548
|
-
/* @__PURE__ */
|
|
548
|
+
/* @__PURE__ */ C(
|
|
549
549
|
"div",
|
|
550
550
|
{
|
|
551
551
|
style: {
|
|
@@ -577,7 +577,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
577
577
|
style: { position: "absolute", inset: 0, pointerEvents: "none" }
|
|
578
578
|
}
|
|
579
579
|
),
|
|
580
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ C(
|
|
581
581
|
"svg",
|
|
582
582
|
{
|
|
583
583
|
viewBox: "0 0 100 100",
|
|
@@ -628,7 +628,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
628
628
|
display: "flex",
|
|
629
629
|
alignItems: "center",
|
|
630
630
|
justifyContent: "center",
|
|
631
|
-
background: "rgba(0,0,0,0.3)"
|
|
631
|
+
background: "var(--nice-overlay-30, rgba(0, 0, 0, 0.3))"
|
|
632
632
|
},
|
|
633
633
|
children: /* @__PURE__ */ c(
|
|
634
634
|
"div",
|
|
@@ -680,7 +680,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
680
680
|
textAlign: "center",
|
|
681
681
|
minHeight: 20
|
|
682
682
|
},
|
|
683
|
-
children: p ??
|
|
683
|
+
children: p ?? W
|
|
684
684
|
}
|
|
685
685
|
),
|
|
686
686
|
l !== "success" && l !== "failure" && /* @__PURE__ */ c(
|
|
@@ -693,7 +693,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
693
693
|
fontSize: 14,
|
|
694
694
|
fontWeight: 600,
|
|
695
695
|
background: "var(--security-biometric)",
|
|
696
|
-
color: "#fff",
|
|
696
|
+
color: "var(--nice-bg, #fff)",
|
|
697
697
|
border: "none",
|
|
698
698
|
borderRadius: "var(--security-radius)",
|
|
699
699
|
cursor: "pointer",
|
|
@@ -706,7 +706,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
706
706
|
"button",
|
|
707
707
|
{
|
|
708
708
|
onClick: () => {
|
|
709
|
-
Z(0),
|
|
709
|
+
Z(0), _("idle"), $("");
|
|
710
710
|
},
|
|
711
711
|
style: {
|
|
712
712
|
padding: "8px 20px",
|
|
@@ -724,7 +724,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
724
724
|
]
|
|
725
725
|
}
|
|
726
726
|
);
|
|
727
|
-
}, et = { sm: 220, md: 300, lg: 400 },
|
|
727
|
+
}, et = { sm: 220, md: 300, lg: 400 }, Ct = (e) => {
|
|
728
728
|
const {
|
|
729
729
|
mode: t,
|
|
730
730
|
enrolledTemplates: r = [],
|
|
@@ -740,8 +740,8 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
740
740
|
showSegmentation: k = !0,
|
|
741
741
|
showGuide: p = !0,
|
|
742
742
|
instructionText: D,
|
|
743
|
-
...
|
|
744
|
-
} = e, { t: b } = ee(), T = de(
|
|
743
|
+
...R
|
|
744
|
+
} = e, { t: b } = ee(), T = de(R), y = et[v], S = V(null), u = V(null), x = V(null), l = V([]), [h, L] = j("idle"), [q, Y] = j(0), [B, H] = j(null), [Z, W] = j(0), [$, _] = j(""), F = G(
|
|
745
745
|
(I) => {
|
|
746
746
|
L(I), o == null || o(I);
|
|
747
747
|
},
|
|
@@ -749,9 +749,9 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
749
749
|
), K = G(async () => {
|
|
750
750
|
try {
|
|
751
751
|
const I = await fe("user");
|
|
752
|
-
x.current = I, S.current && (S.current.srcObject = I, await S.current.play()), F("idle"),
|
|
752
|
+
x.current = I, S.current && (S.current.srcObject = I, await S.current.play()), F("idle"), _(b("security.iris.alignEyePrompt", "Align your eye with the circle"));
|
|
753
753
|
} catch (I) {
|
|
754
|
-
a == null || a(I instanceof Error ? I : new Error(String(I))),
|
|
754
|
+
a == null || a(I instanceof Error ? I : new Error(String(I))), _(b("security.iris.cameraError", "Camera access denied")), F("error");
|
|
755
755
|
}
|
|
756
756
|
}, [b, F, a]), U = G(() => {
|
|
757
757
|
var I;
|
|
@@ -760,7 +760,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
760
760
|
te(() => (K(), U), [K, U]);
|
|
761
761
|
const X = G(async () => {
|
|
762
762
|
if (!(!S.current || h === "processing" || h === "success")) {
|
|
763
|
-
F("scanning"),
|
|
763
|
+
F("scanning"), _(b("security.iris.scanning", "Scanning iris…"));
|
|
764
764
|
try {
|
|
765
765
|
const I = [];
|
|
766
766
|
for (let w = 0; w < 5; w++) {
|
|
@@ -768,19 +768,19 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
768
768
|
I.push(d), await new Promise((A) => setTimeout(A, 200));
|
|
769
769
|
}
|
|
770
770
|
if (l.current = I, T.livenessDetection && !Ae(I).isLive) {
|
|
771
|
-
|
|
771
|
+
_(
|
|
772
772
|
b("security.iris.notLive", "Liveness check failed — please blink or move slightly")
|
|
773
773
|
), F("idle");
|
|
774
774
|
return;
|
|
775
775
|
}
|
|
776
|
-
F("processing"),
|
|
776
|
+
F("processing"), _(b("security.iris.processing", "Processing iris pattern…"));
|
|
777
777
|
const z = I[I.length - 1], M = Ue(z, n === "both" ? "left" : n);
|
|
778
778
|
if (!M) {
|
|
779
|
-
|
|
779
|
+
_(b("security.iris.noIrisDetected", "No iris detected — adjust position")), F("idle");
|
|
780
780
|
return;
|
|
781
781
|
}
|
|
782
782
|
if (H(M), Y(M.quality), M.quality < 0.1) {
|
|
783
|
-
|
|
783
|
+
_(b("security.iris.lowQuality", "Low quality — move closer")), F("idle");
|
|
784
784
|
return;
|
|
785
785
|
}
|
|
786
786
|
if (k && u.current) {
|
|
@@ -794,18 +794,18 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
794
794
|
M.pupil.r * d,
|
|
795
795
|
0,
|
|
796
796
|
Math.PI * 2
|
|
797
|
-
), w.strokeStyle = "#ef4444", w.lineWidth = 2, w.stroke(), w.beginPath(), w.arc(
|
|
797
|
+
), w.strokeStyle = "var(--nice-danger, #ef4444)", w.lineWidth = 2, w.stroke(), w.beginPath(), w.arc(
|
|
798
798
|
M.iris.cx * d,
|
|
799
799
|
M.iris.cy * A,
|
|
800
800
|
M.iris.r * d,
|
|
801
801
|
0,
|
|
802
802
|
Math.PI * 2
|
|
803
|
-
), w.strokeStyle = "#3b82f6", w.lineWidth = 2, w.stroke();
|
|
803
|
+
), w.strokeStyle = "var(--nice-primary, #3b82f6)", w.lineWidth = 2, w.stroke();
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
806
|
if (t === "enroll") {
|
|
807
807
|
const w = await Oe(M, f ?? `${n} eye`);
|
|
808
|
-
i == null || i(w, M),
|
|
808
|
+
i == null || i(w, M), _(b("security.iris.enrolled", "Iris enrolled successfully")), F("success");
|
|
809
809
|
} else {
|
|
810
810
|
let w = 0;
|
|
811
811
|
for (const N of r) {
|
|
@@ -834,10 +834,10 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
834
834
|
);
|
|
835
835
|
A.success = P.verified;
|
|
836
836
|
}
|
|
837
|
-
A.success ? (
|
|
837
|
+
A.success ? (_(b("security.iris.verified", "Iris verified")), F("success")) : (W((N) => N + 1), Z + 1 >= T.maxRetries ? (_(b("security.iris.maxAttempts", "Maximum attempts reached")), F("failure")) : (_(b("security.iris.noMatch", "No match — try again")), F("idle"))), s == null || s(A);
|
|
838
838
|
}
|
|
839
839
|
} catch (I) {
|
|
840
|
-
a == null || a(I instanceof Error ? I : new Error(String(I))),
|
|
840
|
+
a == null || a(I instanceof Error ? I : new Error(String(I))), _(b("security.iris.error", "Scan error")), F("error");
|
|
841
841
|
}
|
|
842
842
|
}
|
|
843
843
|
}, [
|
|
@@ -856,14 +856,14 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
856
856
|
k,
|
|
857
857
|
y
|
|
858
858
|
]), E = h === "success" ? "var(--security-success)" : h === "failure" || h === "error" ? "var(--security-error)" : h === "scanning" || h === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
859
|
-
return /* @__PURE__ */
|
|
859
|
+
return /* @__PURE__ */ C(
|
|
860
860
|
"div",
|
|
861
861
|
{
|
|
862
862
|
className: g,
|
|
863
863
|
style: { display: "inline-flex", flexDirection: "column", alignItems: "center", gap: 12 },
|
|
864
864
|
children: [
|
|
865
865
|
f && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f }),
|
|
866
|
-
/* @__PURE__ */
|
|
866
|
+
/* @__PURE__ */ C(
|
|
867
867
|
"div",
|
|
868
868
|
{
|
|
869
869
|
style: {
|
|
@@ -895,7 +895,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
895
895
|
style: { position: "absolute", inset: 0, pointerEvents: "none" }
|
|
896
896
|
}
|
|
897
897
|
),
|
|
898
|
-
p && h === "idle" && /* @__PURE__ */
|
|
898
|
+
p && h === "idle" && /* @__PURE__ */ C(
|
|
899
899
|
"svg",
|
|
900
900
|
{
|
|
901
901
|
viewBox: "0 0 100 100",
|
|
@@ -948,7 +948,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
948
948
|
display: "flex",
|
|
949
949
|
alignItems: "center",
|
|
950
950
|
justifyContent: "center",
|
|
951
|
-
background: "rgba(0,0,0,0.2)"
|
|
951
|
+
background: "var(--nice-overlay-20, rgba(0, 0, 0, 0.2))"
|
|
952
952
|
},
|
|
953
953
|
children: /* @__PURE__ */ c(
|
|
954
954
|
"div",
|
|
@@ -1025,7 +1025,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1025
1025
|
fontSize: 14,
|
|
1026
1026
|
fontWeight: 600,
|
|
1027
1027
|
background: "var(--security-biometric)",
|
|
1028
|
-
color: "#fff",
|
|
1028
|
+
color: "var(--nice-bg, #fff)",
|
|
1029
1029
|
border: "none",
|
|
1030
1030
|
borderRadius: "var(--security-radius)",
|
|
1031
1031
|
cursor: "pointer",
|
|
@@ -1038,7 +1038,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1038
1038
|
"button",
|
|
1039
1039
|
{
|
|
1040
1040
|
onClick: () => {
|
|
1041
|
-
|
|
1041
|
+
W(0), F("idle"), _("");
|
|
1042
1042
|
},
|
|
1043
1043
|
style: {
|
|
1044
1044
|
padding: "8px 20px",
|
|
@@ -1061,7 +1061,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1061
1061
|
]
|
|
1062
1062
|
}
|
|
1063
1063
|
);
|
|
1064
|
-
}, tt = { sm: 240, md: 320, lg: 440 },
|
|
1064
|
+
}, tt = { sm: 240, md: 320, lg: 440 }, Rt = (e) => {
|
|
1065
1065
|
const {
|
|
1066
1066
|
mode: t,
|
|
1067
1067
|
enrolledTemplates: r = [],
|
|
@@ -1077,9 +1077,9 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1077
1077
|
showBoundingBox: k = !0,
|
|
1078
1078
|
livenessSteps: p = 1,
|
|
1079
1079
|
showReference: D = !0,
|
|
1080
|
-
instructionText:
|
|
1080
|
+
instructionText: R,
|
|
1081
1081
|
...b
|
|
1082
|
-
} = e, { t: T } = ee(), y = de(b), S = tt[v], u = V(null), x = V(null), l = V(null), [h, L] = j("idle"), [q, Y] = j(0), [
|
|
1082
|
+
} = e, { t: T } = ee(), y = de(b), S = tt[v], u = V(null), x = V(null), l = V(null), [h, L] = j("idle"), [q, Y] = j(0), [B, H] = j(0), [Z, W] = j(""), [$, _] = j(null), [F, K] = j(0), U = G(
|
|
1083
1083
|
(w) => {
|
|
1084
1084
|
L(w), o == null || o(w);
|
|
1085
1085
|
},
|
|
@@ -1087,9 +1087,9 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1087
1087
|
), X = G(async () => {
|
|
1088
1088
|
try {
|
|
1089
1089
|
const w = await fe("user");
|
|
1090
|
-
l.current = w, u.current && (u.current.srcObject = w, await u.current.play()), U("idle"),
|
|
1090
|
+
l.current = w, u.current && (u.current.srcObject = w, await u.current.play()), U("idle"), W(T("security.face.lookAtCamera", "Look at the camera"));
|
|
1091
1091
|
} catch (w) {
|
|
1092
|
-
a == null || a(w instanceof Error ? w : new Error(String(w))),
|
|
1092
|
+
a == null || a(w instanceof Error ? w : new Error(String(w))), W(T("security.face.cameraError", "Camera access denied")), U("error");
|
|
1093
1093
|
}
|
|
1094
1094
|
}, [T, U, a]), E = G(() => {
|
|
1095
1095
|
var w;
|
|
@@ -1106,7 +1106,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1106
1106
|
if (d.clearRect(0, 0, A, N), !w || !k)
|
|
1107
1107
|
return;
|
|
1108
1108
|
const P = w.boundingBox, O = A / (((me = u.current) == null ? void 0 : me.videoWidth) ?? A), J = N / (((ve = u.current) == null ? void 0 : ve.videoHeight) ?? N);
|
|
1109
|
-
d.strokeStyle = h === "success" ? "#10b981" : "#3b82f6", d.lineWidth = 2, d.setLineDash([6, 4]), d.strokeRect(P.x * O, P.y * J, P.width * O, P.height * J), d.setLineDash([]);
|
|
1109
|
+
d.strokeStyle = h === "success" ? "var(--nice-success, #10b981)" : "var(--nice-primary, #3b82f6)", d.lineWidth = 2, d.setLineDash([6, 4]), d.strokeRect(P.x * O, P.y * J, P.width * O, P.height * J), d.setLineDash([]);
|
|
1110
1110
|
const Q = [
|
|
1111
1111
|
[P.x * O, P.y * J],
|
|
1112
1112
|
[(P.x + P.width) * O, P.y * J],
|
|
@@ -1120,18 +1120,18 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1120
1120
|
[k, h]
|
|
1121
1121
|
), z = G(async () => {
|
|
1122
1122
|
if (!(!u.current || h === "processing" || h === "success")) {
|
|
1123
|
-
U("scanning"),
|
|
1123
|
+
U("scanning"), W(T("security.face.scanning", "Scanning face…"));
|
|
1124
1124
|
try {
|
|
1125
1125
|
if (y.livenessDetection) {
|
|
1126
1126
|
const A = [];
|
|
1127
1127
|
for (let P = 0; P < 8; P++)
|
|
1128
1128
|
A.push(ae(u.current).imageData), await new Promise((O) => setTimeout(O, 200));
|
|
1129
1129
|
if (!Ae(A).isLive) {
|
|
1130
|
-
|
|
1130
|
+
W(T("security.face.notLive", "Liveness check failed — move naturally")), U("idle");
|
|
1131
1131
|
return;
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
U("processing"),
|
|
1134
|
+
U("processing"), W(T("security.face.processing", "Analysing face…"));
|
|
1135
1135
|
const { imageData: w } = ae(u.current);
|
|
1136
1136
|
if (t === "compare" && n) {
|
|
1137
1137
|
const A = typeof n == "string" ? await rt(n) : nt(n), { similarity: N, cameraFeatures: P, refFeatures: O } = Ke(w, A);
|
|
@@ -1144,17 +1144,17 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1144
1144
|
duration: 0,
|
|
1145
1145
|
livenessPassed: y.livenessDetection
|
|
1146
1146
|
};
|
|
1147
|
-
Q.success ? (
|
|
1147
|
+
Q.success ? (W(T("security.face.matchFound", `Match: ${(N * 100).toFixed(0)}%`)), U("success")) : (H((re) => re + 1), B + 1 >= y.maxRetries ? (W(T("security.face.maxAttempts", "Maximum attempts reached")), U("failure")) : (W(T("security.face.noMatch", "No match — try again")), U("idle"))), s == null || s(Q);
|
|
1148
1148
|
return;
|
|
1149
1149
|
}
|
|
1150
1150
|
const d = ue(w);
|
|
1151
1151
|
if (!d) {
|
|
1152
|
-
|
|
1152
|
+
W(T("security.face.noFaceDetected", "No face detected")), U("idle");
|
|
1153
1153
|
return;
|
|
1154
1154
|
}
|
|
1155
1155
|
if (Y(d.quality), I(d), t === "enroll") {
|
|
1156
1156
|
const A = await Ge(d, f ?? "face");
|
|
1157
|
-
i == null || i(A, d),
|
|
1157
|
+
i == null || i(A, d), W(T("security.face.enrolled", "Face enrolled successfully")), U("success");
|
|
1158
1158
|
} else {
|
|
1159
1159
|
let A = 0;
|
|
1160
1160
|
for (const O of r) {
|
|
@@ -1183,10 +1183,10 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1183
1183
|
);
|
|
1184
1184
|
P.success = J.verified;
|
|
1185
1185
|
}
|
|
1186
|
-
P.success ? (
|
|
1186
|
+
P.success ? (W(T("security.face.verified", "Face verified")), U("success")) : (H((O) => O + 1), B + 1 >= y.maxRetries ? (W(T("security.face.maxAttempts", "Maximum attempts reached")), U("failure")) : (W(T("security.face.noMatch", "No match — try again")), U("idle"))), s == null || s(P);
|
|
1187
1187
|
}
|
|
1188
1188
|
} catch (w) {
|
|
1189
|
-
a == null || a(w instanceof Error ? w : new Error(String(w))),
|
|
1189
|
+
a == null || a(w instanceof Error ? w : new Error(String(w))), W(T("security.face.error", "Error — try again")), U("error");
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
1192
|
}, [
|
|
@@ -1201,10 +1201,10 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1201
1201
|
s,
|
|
1202
1202
|
a,
|
|
1203
1203
|
f,
|
|
1204
|
-
|
|
1204
|
+
B,
|
|
1205
1205
|
I
|
|
1206
1206
|
]), M = h === "success" ? "var(--security-success)" : h === "failure" || h === "error" ? "var(--security-error)" : h === "scanning" || h === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
1207
|
-
return /* @__PURE__ */
|
|
1207
|
+
return /* @__PURE__ */ C(
|
|
1208
1208
|
"div",
|
|
1209
1209
|
{
|
|
1210
1210
|
className: g,
|
|
@@ -1216,8 +1216,8 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1216
1216
|
},
|
|
1217
1217
|
children: [
|
|
1218
1218
|
f && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f }),
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
/* @__PURE__ */
|
|
1219
|
+
/* @__PURE__ */ C("div", { style: { display: "flex", gap: 16, alignItems: "center" }, children: [
|
|
1220
|
+
/* @__PURE__ */ C(
|
|
1221
1221
|
"div",
|
|
1222
1222
|
{
|
|
1223
1223
|
style: {
|
|
@@ -1287,7 +1287,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1287
1287
|
style: {
|
|
1288
1288
|
position: "absolute",
|
|
1289
1289
|
inset: 0,
|
|
1290
|
-
background: "rgba(0,0,0,0.15)",
|
|
1290
|
+
background: "var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",
|
|
1291
1291
|
display: "flex",
|
|
1292
1292
|
alignItems: "center",
|
|
1293
1293
|
justifyContent: "center"
|
|
@@ -1310,7 +1310,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1310
1310
|
]
|
|
1311
1311
|
}
|
|
1312
1312
|
),
|
|
1313
|
-
t === "compare" && D && n && /* @__PURE__ */
|
|
1313
|
+
t === "compare" && D && n && /* @__PURE__ */ C(
|
|
1314
1314
|
"div",
|
|
1315
1315
|
{
|
|
1316
1316
|
style: {
|
|
@@ -1346,8 +1346,8 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
)
|
|
1348
1348
|
] }),
|
|
1349
|
-
F > 0 && /* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1349
|
+
F > 0 && /* @__PURE__ */ C("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13 }, children: [
|
|
1350
|
+
/* @__PURE__ */ C("span", { style: { color: "var(--security-text-secondary)" }, children: [
|
|
1351
1351
|
T("security.face.confidence", "Confidence"),
|
|
1352
1352
|
":"
|
|
1353
1353
|
] }),
|
|
@@ -1373,7 +1373,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1373
1373
|
)
|
|
1374
1374
|
}
|
|
1375
1375
|
),
|
|
1376
|
-
/* @__PURE__ */
|
|
1376
|
+
/* @__PURE__ */ C(
|
|
1377
1377
|
"span",
|
|
1378
1378
|
{
|
|
1379
1379
|
style: {
|
|
@@ -1396,7 +1396,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1396
1396
|
textAlign: "center",
|
|
1397
1397
|
minHeight: 20
|
|
1398
1398
|
},
|
|
1399
|
-
children:
|
|
1399
|
+
children: R ?? Z
|
|
1400
1400
|
}
|
|
1401
1401
|
),
|
|
1402
1402
|
h !== "success" && h !== "failure" && /* @__PURE__ */ c(
|
|
@@ -1409,7 +1409,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1409
1409
|
fontSize: 14,
|
|
1410
1410
|
fontWeight: 600,
|
|
1411
1411
|
background: "var(--security-biometric)",
|
|
1412
|
-
color: "#fff",
|
|
1412
|
+
color: "var(--nice-bg, #fff)",
|
|
1413
1413
|
border: "none",
|
|
1414
1414
|
borderRadius: "var(--security-radius)",
|
|
1415
1415
|
cursor: "pointer",
|
|
@@ -1422,7 +1422,7 @@ const Ve = { sm: 200, md: 280, lg: 380 }, Mt = (e) => {
|
|
|
1422
1422
|
"button",
|
|
1423
1423
|
{
|
|
1424
1424
|
onClick: () => {
|
|
1425
|
-
H(0), K(0), U("idle"),
|
|
1425
|
+
H(0), K(0), U("idle"), W("");
|
|
1426
1426
|
},
|
|
1427
1427
|
style: {
|
|
1428
1428
|
padding: "8px 20px",
|
|
@@ -1474,12 +1474,12 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1474
1474
|
onComplete: k,
|
|
1475
1475
|
onVerify: p,
|
|
1476
1476
|
onStatusChange: D,
|
|
1477
|
-
onError:
|
|
1477
|
+
onError: R,
|
|
1478
1478
|
showBiometricFallback: b = !1,
|
|
1479
1479
|
onBiometricFallback: T,
|
|
1480
1480
|
label: y,
|
|
1481
1481
|
className: S
|
|
1482
|
-
} = e, { t: u } = ee(), [x, l] = j([]), [h, L] = j("idle"), [q, Y] = j(0), [
|
|
1482
|
+
} = e, { t: u } = ee(), [x, l] = j([]), [h, L] = j("idle"), [q, Y] = j(0), [B, H] = j(0), [Z, W] = j(null), $ = V(), _ = se(() => {
|
|
1483
1483
|
const z = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "", "0", "back"];
|
|
1484
1484
|
if (!r)
|
|
1485
1485
|
return z;
|
|
@@ -1511,12 +1511,12 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1511
1511
|
[D]
|
|
1512
1512
|
);
|
|
1513
1513
|
te(() => {
|
|
1514
|
-
if (!(
|
|
1514
|
+
if (!(B <= Date.now()))
|
|
1515
1515
|
return $.current = setInterval(() => {
|
|
1516
|
-
Date.now() >=
|
|
1516
|
+
Date.now() >= B && (clearInterval($.current), F("idle"), Y(0), l([]));
|
|
1517
1517
|
}, 500), () => clearInterval($.current);
|
|
1518
|
-
}, [
|
|
1519
|
-
const K =
|
|
1518
|
+
}, [B, F]);
|
|
1519
|
+
const K = B > Date.now(), U = G(() => {
|
|
1520
1520
|
a && navigator.vibrate && navigator.vibrate(20);
|
|
1521
1521
|
}, [a]), X = G(
|
|
1522
1522
|
async (z) => {
|
|
@@ -1534,11 +1534,11 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1534
1534
|
const w = M.join("");
|
|
1535
1535
|
if (F("processing"), m === "set") {
|
|
1536
1536
|
if (Z === null) {
|
|
1537
|
-
|
|
1537
|
+
W(w), l([]), F("idle");
|
|
1538
1538
|
return;
|
|
1539
1539
|
}
|
|
1540
1540
|
if (Z !== w) {
|
|
1541
|
-
|
|
1541
|
+
W(null), l([]), F("failure"), setTimeout(() => F("idle"), 1200);
|
|
1542
1542
|
return;
|
|
1543
1543
|
}
|
|
1544
1544
|
k == null || k(w), F("success");
|
|
@@ -1566,7 +1566,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1566
1566
|
const A = q + 1;
|
|
1567
1567
|
if (Y(A), A >= i) {
|
|
1568
1568
|
const N = Date.now() + s;
|
|
1569
|
-
H(N), F("failure"),
|
|
1569
|
+
H(N), F("failure"), R == null || R(new Error("Too many failed PIN attempts"));
|
|
1570
1570
|
} else
|
|
1571
1571
|
F("failure"), setTimeout(() => {
|
|
1572
1572
|
F("idle"), l([]);
|
|
@@ -1596,10 +1596,10 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1596
1596
|
F,
|
|
1597
1597
|
k,
|
|
1598
1598
|
p,
|
|
1599
|
-
|
|
1599
|
+
R
|
|
1600
1600
|
]
|
|
1601
|
-
), E = Math.max(0, Math.ceil((
|
|
1602
|
-
return /* @__PURE__ */
|
|
1601
|
+
), E = Math.max(0, Math.ceil((B - Date.now()) / 1e3)), I = h === "success" ? "var(--security-success)" : h === "failure" ? "var(--security-error)" : "var(--security-border)";
|
|
1602
|
+
return /* @__PURE__ */ C(
|
|
1603
1603
|
"div",
|
|
1604
1604
|
{
|
|
1605
1605
|
className: S,
|
|
@@ -1649,7 +1649,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1649
1649
|
opacity: K ? 0.4 : 1,
|
|
1650
1650
|
pointerEvents: K ? "none" : "auto"
|
|
1651
1651
|
},
|
|
1652
|
-
children:
|
|
1652
|
+
children: _.map((z, M) => {
|
|
1653
1653
|
if (z === "")
|
|
1654
1654
|
return /* @__PURE__ */ c("div", {}, M);
|
|
1655
1655
|
const w = z === "back";
|
|
@@ -1706,7 +1706,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1706
1706
|
children: u("security.pin.clear", "Clear")
|
|
1707
1707
|
}
|
|
1708
1708
|
),
|
|
1709
|
-
b && /* @__PURE__ */
|
|
1709
|
+
b && /* @__PURE__ */ C(
|
|
1710
1710
|
"button",
|
|
1711
1711
|
{
|
|
1712
1712
|
onClick: T,
|
|
@@ -1745,10 +1745,10 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1745
1745
|
onVerify: k,
|
|
1746
1746
|
onStatusChange: p,
|
|
1747
1747
|
onError: D,
|
|
1748
|
-
label:
|
|
1748
|
+
label: R,
|
|
1749
1749
|
className: b,
|
|
1750
1750
|
canvasSize: T
|
|
1751
|
-
} = e, { t: y } = ee(), S = V(null), [u, x] = j([]), [l, h] = j(!1), [L, q] = j("idle"), [Y,
|
|
1751
|
+
} = e, { t: y } = ee(), S = V(null), [u, x] = j([]), [l, h] = j(!1), [L, q] = j("idle"), [Y, B] = j(0), [H, Z] = j(null), [W, $] = j(null), _ = T ?? t * 80, F = _ / t, K = G(
|
|
1752
1752
|
(d) => {
|
|
1753
1753
|
q(d), p == null || p(d);
|
|
1754
1754
|
},
|
|
@@ -1778,7 +1778,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1778
1778
|
const d = (O = S.current) == null ? void 0 : O.getContext("2d");
|
|
1779
1779
|
if (!d)
|
|
1780
1780
|
return;
|
|
1781
|
-
d.clearRect(0, 0,
|
|
1781
|
+
d.clearRect(0, 0, _, _);
|
|
1782
1782
|
const A = U(), P = L === "failure" && i ? "var(--security-error)" : a ?? "var(--security-biometric)";
|
|
1783
1783
|
for (let J = 0; J < A.length; J++) {
|
|
1784
1784
|
const Q = u.includes(J);
|
|
@@ -1788,15 +1788,15 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1788
1788
|
d.beginPath(), d.moveTo(A[u[0]].x, A[u[0]].y);
|
|
1789
1789
|
for (let J = 1; J < u.length; J++)
|
|
1790
1790
|
d.lineTo(A[u[J]].x, A[u[J]].y);
|
|
1791
|
-
l &&
|
|
1792
|
-
} else n && u.length === 1 && l &&
|
|
1791
|
+
l && W && d.lineTo(W.x, W.y), d.strokeStyle = P, d.lineWidth = 3, d.lineCap = "round", d.lineJoin = "round", d.globalAlpha = 0.5, d.stroke(), d.globalAlpha = 1;
|
|
1792
|
+
} else n && u.length === 1 && l && W && (d.beginPath(), d.moveTo(A[u[0]].x, A[u[0]].y), d.lineTo(W.x, W.y), d.strokeStyle = a ?? "var(--security-biometric)", d.lineWidth = 3, d.globalAlpha = 0.4, d.stroke(), d.globalAlpha = 1);
|
|
1793
1793
|
}, [
|
|
1794
|
-
|
|
1794
|
+
_,
|
|
1795
1795
|
U,
|
|
1796
1796
|
o,
|
|
1797
1797
|
u,
|
|
1798
1798
|
l,
|
|
1799
|
-
|
|
1799
|
+
W,
|
|
1800
1800
|
L,
|
|
1801
1801
|
n,
|
|
1802
1802
|
i,
|
|
@@ -1868,7 +1868,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1868
1868
|
}), m == null || m([...u]);
|
|
1869
1869
|
else {
|
|
1870
1870
|
const N = Y + 1;
|
|
1871
|
-
|
|
1871
|
+
B(N), K("failure"), N >= s && (D == null || D(new Error("Too many failed pattern attempts"))), setTimeout(() => {
|
|
1872
1872
|
K("idle"), x([]);
|
|
1873
1873
|
}, 900), k == null || k({
|
|
1874
1874
|
success: !1,
|
|
@@ -1893,7 +1893,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1893
1893
|
k,
|
|
1894
1894
|
D
|
|
1895
1895
|
]);
|
|
1896
|
-
return /* @__PURE__ */
|
|
1896
|
+
return /* @__PURE__ */ C(
|
|
1897
1897
|
"div",
|
|
1898
1898
|
{
|
|
1899
1899
|
className: b,
|
|
@@ -1906,7 +1906,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1906
1906
|
color: "var(--security-text)"
|
|
1907
1907
|
},
|
|
1908
1908
|
children: [
|
|
1909
|
-
|
|
1909
|
+
R && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600 }, children: R }),
|
|
1910
1910
|
/* @__PURE__ */ c(
|
|
1911
1911
|
"div",
|
|
1912
1912
|
{
|
|
@@ -1923,8 +1923,8 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1923
1923
|
"canvas",
|
|
1924
1924
|
{
|
|
1925
1925
|
ref: S,
|
|
1926
|
-
width:
|
|
1927
|
-
height:
|
|
1926
|
+
width: _,
|
|
1927
|
+
height: _,
|
|
1928
1928
|
style: {
|
|
1929
1929
|
touchAction: "none",
|
|
1930
1930
|
borderRadius: "var(--security-radius-lg)",
|
|
@@ -1946,7 +1946,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1946
1946
|
"button",
|
|
1947
1947
|
{
|
|
1948
1948
|
onClick: () => {
|
|
1949
|
-
x([]),
|
|
1949
|
+
x([]), B(0), Z(null), K("idle");
|
|
1950
1950
|
},
|
|
1951
1951
|
style: {
|
|
1952
1952
|
fontSize: 13,
|
|
@@ -1980,14 +1980,14 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1980
1980
|
onAuthenticate: k,
|
|
1981
1981
|
onVerify: p,
|
|
1982
1982
|
onStatusChange: D,
|
|
1983
|
-
onError:
|
|
1983
|
+
onError: R,
|
|
1984
1984
|
label: b,
|
|
1985
1985
|
className: T,
|
|
1986
1986
|
variant: y = "primary",
|
|
1987
1987
|
size: S = "md",
|
|
1988
1988
|
fullWidth: u = !1,
|
|
1989
1989
|
icon: x
|
|
1990
|
-
} = e, { t: l } = ee(), [h, L] = j("idle"), [q, Y] = j(!0), [
|
|
1990
|
+
} = e, { t: l } = ee(), [h, L] = j("idle"), [q, Y] = j(!0), [B, H] = j(!1), Z = G(
|
|
1991
1991
|
(I) => {
|
|
1992
1992
|
L(I), D == null || D(I);
|
|
1993
1993
|
},
|
|
@@ -1996,7 +1996,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
1996
1996
|
te(() => {
|
|
1997
1997
|
Y(Ie()), Ze().then(H);
|
|
1998
1998
|
}, []);
|
|
1999
|
-
const
|
|
1999
|
+
const W = G(() => {
|
|
2000
2000
|
if (n) {
|
|
2001
2001
|
const I = atob(n.replace(/-/g, "+").replace(/_/g, "/")), z = new Uint8Array(I.length);
|
|
2002
2002
|
for (let M = 0; M < I.length; M++)
|
|
@@ -2006,13 +2006,13 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2006
2006
|
return crypto.getRandomValues(new Uint8Array(32)).buffer;
|
|
2007
2007
|
}, [n]), $ = G(async () => {
|
|
2008
2008
|
if (!q) {
|
|
2009
|
-
|
|
2009
|
+
R == null || R(new Error("WebAuthn not available"));
|
|
2010
2010
|
return;
|
|
2011
2011
|
}
|
|
2012
2012
|
Z("processing");
|
|
2013
2013
|
try {
|
|
2014
2014
|
if (t === "register") {
|
|
2015
|
-
const I = (o == null ? void 0 : o.id) ?? crypto.getRandomValues(new Uint8Array(16)), z = (o == null ? void 0 : o.name) ?? "user", M = (o == null ? void 0 : o.displayName) ?? z, w =
|
|
2015
|
+
const I = (o == null ? void 0 : o.id) ?? crypto.getRandomValues(new Uint8Array(16)), z = (o == null ? void 0 : o.name) ?? "user", M = (o == null ? void 0 : o.displayName) ?? z, w = W(), d = await Ye({
|
|
2016
2016
|
rpName: i,
|
|
2017
2017
|
rpId: s,
|
|
2018
2018
|
userId: typeof I == "string" ? I : Array.from(I).join(""),
|
|
@@ -2030,7 +2030,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2030
2030
|
} else {
|
|
2031
2031
|
const I = await Xe({
|
|
2032
2032
|
rpId: s,
|
|
2033
|
-
challenge:
|
|
2033
|
+
challenge: W(),
|
|
2034
2034
|
allowCredentials: r == null ? void 0 : r.map((z) => ({
|
|
2035
2035
|
id: new TextEncoder().encode(z),
|
|
2036
2036
|
type: "public-key"
|
|
@@ -2046,7 +2046,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
} catch (I) {
|
|
2048
2048
|
const z = I instanceof Error ? I : new Error(String(I));
|
|
2049
|
-
z.name === "NotAllowedError" ? Z("idle") : (Z("error"),
|
|
2049
|
+
z.name === "NotAllowedError" ? Z("idle") : (Z("error"), R == null || R(z), p == null || p({
|
|
2050
2050
|
success: !1,
|
|
2051
2051
|
confidence: 0,
|
|
2052
2052
|
method: "webauthn",
|
|
@@ -2065,13 +2065,13 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2065
2065
|
g,
|
|
2066
2066
|
v,
|
|
2067
2067
|
f,
|
|
2068
|
-
|
|
2068
|
+
W,
|
|
2069
2069
|
Z,
|
|
2070
2070
|
m,
|
|
2071
2071
|
k,
|
|
2072
2072
|
p,
|
|
2073
|
-
|
|
2074
|
-
]),
|
|
2073
|
+
R
|
|
2074
|
+
]), _ = t === "register" ? B ? l("security.webauthn.registerPasskey", "🔑 Register Passkey") : l("security.webauthn.register", "🔐 Register Security Key") : B ? l("security.webauthn.signInPasskey", "🔑 Sign in with Passkey") : l("security.webauthn.signIn", "🔐 Sign in with Security Key"), F = b ?? _, K = {
|
|
2075
2075
|
primary: "var(--security-biometric)",
|
|
2076
2076
|
outline: "transparent",
|
|
2077
2077
|
ghost: "transparent"
|
|
@@ -2080,17 +2080,17 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2080
2080
|
outline: "2px solid var(--security-biometric)",
|
|
2081
2081
|
ghost: "none"
|
|
2082
2082
|
}, X = {
|
|
2083
|
-
primary: "#fff",
|
|
2083
|
+
primary: "var(--nice-bg, #fff)",
|
|
2084
2084
|
outline: "var(--security-biometric)",
|
|
2085
2085
|
ghost: "var(--security-biometric)"
|
|
2086
2086
|
}, E = !q || h === "processing" || h === "success";
|
|
2087
|
-
return /* @__PURE__ */
|
|
2087
|
+
return /* @__PURE__ */ C(
|
|
2088
2088
|
"div",
|
|
2089
2089
|
{
|
|
2090
2090
|
className: T,
|
|
2091
2091
|
style: { display: u ? "block" : "inline-block", textAlign: "center" },
|
|
2092
2092
|
children: [
|
|
2093
|
-
/* @__PURE__ */
|
|
2093
|
+
/* @__PURE__ */ C(
|
|
2094
2094
|
"button",
|
|
2095
2095
|
{
|
|
2096
2096
|
onClick: $,
|
|
@@ -2160,7 +2160,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2160
2160
|
const { t: a } = ee(), [g, v] = j("all"), [f, m] = j("all"), [k, p] = j(0), D = se(() => {
|
|
2161
2161
|
let l = [...e];
|
|
2162
2162
|
return g !== "all" && (l = l.filter((h) => h.method === g)), f !== "all" && (l = l.filter((h) => h.status === f)), l.sort((h, L) => L.timestamp - h.timestamp), l;
|
|
2163
|
-
}, [e, g, f]),
|
|
2163
|
+
}, [e, g, f]), R = Math.max(1, Math.ceil(D.length / t)), b = D.slice(k * t, (k + 1) * t), T = se(() => n || Array.from(new Set(e.map((l) => l.method))), [e, n]), y = se(() => Array.from(new Set(e.map((l) => l.status))), [e]), S = G(() => {
|
|
2164
2164
|
const l = new Blob([JSON.stringify(D, null, 2)], { type: "application/json" }), h = URL.createObjectURL(l), L = document.createElement("a");
|
|
2165
2165
|
L.href = h, L.download = `security-audit-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`, L.click(), URL.revokeObjectURL(h);
|
|
2166
2166
|
}, [D]), u = (l) => new Date(l).toLocaleString(), x = {
|
|
@@ -2169,7 +2169,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2169
2169
|
fontSize: 13,
|
|
2170
2170
|
whiteSpace: "nowrap"
|
|
2171
2171
|
};
|
|
2172
|
-
return /* @__PURE__ */
|
|
2172
|
+
return /* @__PURE__ */ C(
|
|
2173
2173
|
"div",
|
|
2174
2174
|
{
|
|
2175
2175
|
className: s,
|
|
@@ -2182,7 +2182,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2182
2182
|
overflow: "hidden"
|
|
2183
2183
|
},
|
|
2184
2184
|
children: [
|
|
2185
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ C(
|
|
2186
2186
|
"div",
|
|
2187
2187
|
{
|
|
2188
2188
|
style: {
|
|
@@ -2195,8 +2195,8 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2195
2195
|
},
|
|
2196
2196
|
children: [
|
|
2197
2197
|
/* @__PURE__ */ c("div", { style: { fontWeight: 600, fontSize: 15 }, children: o ?? a("security.audit.title", "🔒 Security Audit Log") }),
|
|
2198
|
-
/* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ C("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
2199
|
+
/* @__PURE__ */ C(
|
|
2200
2200
|
"select",
|
|
2201
2201
|
{
|
|
2202
2202
|
value: g,
|
|
@@ -2210,7 +2210,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2210
2210
|
]
|
|
2211
2211
|
}
|
|
2212
2212
|
),
|
|
2213
|
-
/* @__PURE__ */
|
|
2213
|
+
/* @__PURE__ */ C(
|
|
2214
2214
|
"select",
|
|
2215
2215
|
{
|
|
2216
2216
|
value: f,
|
|
@@ -2229,8 +2229,8 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2229
2229
|
]
|
|
2230
2230
|
}
|
|
2231
2231
|
),
|
|
2232
|
-
/* @__PURE__ */ c("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */
|
|
2233
|
-
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ c("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ C("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
|
|
2233
|
+
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ C(
|
|
2234
2234
|
"tr",
|
|
2235
2235
|
{
|
|
2236
2236
|
style: {
|
|
@@ -2250,7 +2250,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2250
2250
|
]
|
|
2251
2251
|
}
|
|
2252
2252
|
) }),
|
|
2253
|
-
/* @__PURE__ */
|
|
2253
|
+
/* @__PURE__ */ C("tbody", { children: [
|
|
2254
2254
|
b.length === 0 && /* @__PURE__ */ c("tr", { children: /* @__PURE__ */ c(
|
|
2255
2255
|
"td",
|
|
2256
2256
|
{
|
|
@@ -2264,7 +2264,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2264
2264
|
children: a("security.audit.noEntries", "No entries to show")
|
|
2265
2265
|
}
|
|
2266
2266
|
) }),
|
|
2267
|
-
b.map((l) => /* @__PURE__ */
|
|
2267
|
+
b.map((l) => /* @__PURE__ */ C(
|
|
2268
2268
|
"tr",
|
|
2269
2269
|
{
|
|
2270
2270
|
onClick: () => i == null ? void 0 : i(l),
|
|
@@ -2292,7 +2292,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2292
2292
|
children: l.method
|
|
2293
2293
|
}
|
|
2294
2294
|
) }),
|
|
2295
|
-
/* @__PURE__ */
|
|
2295
|
+
/* @__PURE__ */ C("td", { style: { ...x, textAlign: "center" }, children: [
|
|
2296
2296
|
ft[l.status] ?? "•",
|
|
2297
2297
|
" ",
|
|
2298
2298
|
l.status
|
|
@@ -2316,7 +2316,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2316
2316
|
))
|
|
2317
2317
|
] })
|
|
2318
2318
|
] }) }),
|
|
2319
|
-
|
|
2319
|
+
R > 1 && /* @__PURE__ */ C(
|
|
2320
2320
|
"div",
|
|
2321
2321
|
{
|
|
2322
2322
|
style: {
|
|
@@ -2330,19 +2330,19 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2330
2330
|
borderTop: "1px solid var(--security-border)"
|
|
2331
2331
|
},
|
|
2332
2332
|
children: [
|
|
2333
|
-
/* @__PURE__ */
|
|
2333
|
+
/* @__PURE__ */ C("button", { disabled: k === 0, onClick: () => p(k - 1), style: xe, children: [
|
|
2334
2334
|
"← ",
|
|
2335
2335
|
a("security.audit.prev", "Prev")
|
|
2336
2336
|
] }),
|
|
2337
|
-
/* @__PURE__ */
|
|
2337
|
+
/* @__PURE__ */ C("span", { children: [
|
|
2338
2338
|
k + 1,
|
|
2339
2339
|
" / ",
|
|
2340
|
-
|
|
2340
|
+
R
|
|
2341
2341
|
] }),
|
|
2342
|
-
/* @__PURE__ */
|
|
2342
|
+
/* @__PURE__ */ C(
|
|
2343
2343
|
"button",
|
|
2344
2344
|
{
|
|
2345
|
-
disabled: k >=
|
|
2345
|
+
disabled: k >= R - 1,
|
|
2346
2346
|
onClick: () => p(k + 1),
|
|
2347
2347
|
style: xe,
|
|
2348
2348
|
children: [
|
|
@@ -2409,7 +2409,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2409
2409
|
layout: o = "grid"
|
|
2410
2410
|
}) => {
|
|
2411
2411
|
const { t: a } = ee(), g = e.filter((f) => f.verified).length, v = g >= t;
|
|
2412
|
-
return /* @__PURE__ */
|
|
2412
|
+
return /* @__PURE__ */ C(
|
|
2413
2413
|
"div",
|
|
2414
2414
|
{
|
|
2415
2415
|
className: i,
|
|
@@ -2434,7 +2434,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2434
2434
|
},
|
|
2435
2435
|
children: e.map((f) => {
|
|
2436
2436
|
const m = f.verified ?? !1, k = f.disabled || v;
|
|
2437
|
-
return /* @__PURE__ */
|
|
2437
|
+
return /* @__PURE__ */ C(
|
|
2438
2438
|
"button",
|
|
2439
2439
|
{
|
|
2440
2440
|
onClick: () => !k && !m && (r == null ? void 0 : r(f.method)),
|
|
@@ -2455,7 +2455,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2455
2455
|
},
|
|
2456
2456
|
children: [
|
|
2457
2457
|
/* @__PURE__ */ c("span", { style: { fontSize: 28 }, children: m ? "✅" : f.icon ?? gt[f.method] ?? "🔐" }),
|
|
2458
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ C("div", { children: [
|
|
2459
2459
|
/* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f.label ?? f.method }),
|
|
2460
2460
|
f.description && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-text-muted)", marginTop: 2 }, children: f.description })
|
|
2461
2461
|
] })
|
|
@@ -2466,7 +2466,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2466
2466
|
})
|
|
2467
2467
|
}
|
|
2468
2468
|
),
|
|
2469
|
-
v && /* @__PURE__ */
|
|
2469
|
+
v && /* @__PURE__ */ C(
|
|
2470
2470
|
"div",
|
|
2471
2471
|
{
|
|
2472
2472
|
style: {
|
|
@@ -2505,7 +2505,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2505
2505
|
}, k = (p) => {
|
|
2506
2506
|
v((D) => new Set(D).add(p)), t == null || t(p);
|
|
2507
2507
|
};
|
|
2508
|
-
return /* @__PURE__ */
|
|
2508
|
+
return /* @__PURE__ */ C(
|
|
2509
2509
|
"div",
|
|
2510
2510
|
{
|
|
2511
2511
|
className: i,
|
|
@@ -2518,7 +2518,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2518
2518
|
overflow: "hidden"
|
|
2519
2519
|
},
|
|
2520
2520
|
children: [
|
|
2521
|
-
/* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ C(
|
|
2522
2522
|
"div",
|
|
2523
2523
|
{
|
|
2524
2524
|
style: {
|
|
@@ -2550,8 +2550,8 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2550
2550
|
]
|
|
2551
2551
|
}
|
|
2552
2552
|
),
|
|
2553
|
-
/* @__PURE__ */
|
|
2554
|
-
f.map((p) => /* @__PURE__ */
|
|
2553
|
+
/* @__PURE__ */ C("div", { children: [
|
|
2554
|
+
f.map((p) => /* @__PURE__ */ C(
|
|
2555
2555
|
"div",
|
|
2556
2556
|
{
|
|
2557
2557
|
style: {
|
|
@@ -2564,10 +2564,10 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2564
2564
|
background: p.current ? "rgba(59,130,246,0.04)" : void 0
|
|
2565
2565
|
},
|
|
2566
2566
|
children: [
|
|
2567
|
-
/* @__PURE__ */
|
|
2567
|
+
/* @__PURE__ */ C("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [
|
|
2568
2568
|
/* @__PURE__ */ c("span", { style: { fontSize: 24 }, children: p.device.toLowerCase().includes("mobile") ? "📱" : "💻" }),
|
|
2569
|
-
/* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2569
|
+
/* @__PURE__ */ C("div", { children: [
|
|
2570
|
+
/* @__PURE__ */ C("div", { style: { fontSize: 14, fontWeight: 500 }, children: [
|
|
2571
2571
|
p.device,
|
|
2572
2572
|
p.current && /* @__PURE__ */ c(
|
|
2573
2573
|
"span",
|
|
@@ -2577,7 +2577,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2577
2577
|
fontSize: 10,
|
|
2578
2578
|
padding: "1px 6px",
|
|
2579
2579
|
background: "var(--security-biometric)",
|
|
2580
|
-
color: "#fff",
|
|
2580
|
+
color: "var(--nice-bg, #fff)",
|
|
2581
2581
|
borderRadius: 8
|
|
2582
2582
|
},
|
|
2583
2583
|
children: a("security.session.current", "Current")
|
|
@@ -2591,7 +2591,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2591
2591
|
fontSize: 10,
|
|
2592
2592
|
padding: "1px 6px",
|
|
2593
2593
|
background: "var(--security-success)",
|
|
2594
|
-
color: "#fff",
|
|
2594
|
+
color: "var(--nice-bg, #fff)",
|
|
2595
2595
|
borderRadius: 8
|
|
2596
2596
|
},
|
|
2597
2597
|
children: a("security.session.trusted", "Trusted")
|
|
@@ -2599,7 +2599,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2599
2599
|
)
|
|
2600
2600
|
] }),
|
|
2601
2601
|
/* @__PURE__ */ c("div", { style: { fontSize: 12, color: "var(--security-text-muted)", marginTop: 2 }, children: [p.browser, p.os, p.location].filter(Boolean).join(" · ") }),
|
|
2602
|
-
/* @__PURE__ */
|
|
2602
|
+
/* @__PURE__ */ C("div", { style: { fontSize: 11, color: "var(--security-text-muted)", marginTop: 1 }, children: [
|
|
2603
2603
|
a("security.session.lastActive", "Last active"),
|
|
2604
2604
|
":",
|
|
2605
2605
|
" ",
|
|
@@ -2607,7 +2607,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2607
2607
|
] })
|
|
2608
2608
|
] })
|
|
2609
2609
|
] }),
|
|
2610
|
-
/* @__PURE__ */
|
|
2610
|
+
/* @__PURE__ */ C("div", { style: { display: "flex", gap: 6 }, children: [
|
|
2611
2611
|
n && !p.current && /* @__PURE__ */ c(
|
|
2612
2612
|
"button",
|
|
2613
2613
|
{
|
|
@@ -2675,9 +2675,9 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2675
2675
|
var D;
|
|
2676
2676
|
m(!0);
|
|
2677
2677
|
try {
|
|
2678
|
-
const
|
|
2678
|
+
const R = Te(), b = await le(), T = [];
|
|
2679
2679
|
let y = 50;
|
|
2680
|
-
|
|
2680
|
+
R.platform && !R.platform.includes("Linux") && (T.push({
|
|
2681
2681
|
name: "Known platform",
|
|
2682
2682
|
score: 5,
|
|
2683
2683
|
description: "Running on a recognized platform",
|
|
@@ -2687,7 +2687,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2687
2687
|
score: 5,
|
|
2688
2688
|
description: "Browser cookies are enabled",
|
|
2689
2689
|
weight: 0.05
|
|
2690
|
-
}), y += 5),
|
|
2690
|
+
}), y += 5), R.screenResolution[0] >= 360 && R.screenResolution[1] >= 640 && (T.push({
|
|
2691
2691
|
name: "Standard resolution",
|
|
2692
2692
|
score: 5,
|
|
2693
2693
|
description: "Screen resolution within normal range",
|
|
@@ -2702,7 +2702,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2702
2702
|
score: 5,
|
|
2703
2703
|
description: "Browser language is set",
|
|
2704
2704
|
weight: 0.05
|
|
2705
|
-
}), y += 5),
|
|
2705
|
+
}), y += 5), R.touchSupport && (T.push({
|
|
2706
2706
|
name: "Touch device",
|
|
2707
2707
|
score: 5,
|
|
2708
2708
|
description: "Touch input is supported",
|
|
@@ -2743,7 +2743,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2743
2743
|
e && v(e);
|
|
2744
2744
|
}, [e]);
|
|
2745
2745
|
const p = g ? g.score >= 80 ? "var(--security-success)" : g.score >= 50 ? "var(--security-warning)" : "var(--security-error)" : "var(--security-text-muted)";
|
|
2746
|
-
return /* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ C(
|
|
2747
2747
|
"div",
|
|
2748
2748
|
{
|
|
2749
2749
|
className: s,
|
|
@@ -2761,9 +2761,9 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2761
2761
|
},
|
|
2762
2762
|
children: [
|
|
2763
2763
|
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: o ?? a("security.trust.title", "🛡️ Device Trust") }),
|
|
2764
|
-
f ? /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-muted)" }, children: a("security.trust.computing", "Analysing device…") }) : g ? /* @__PURE__ */
|
|
2765
|
-
/* @__PURE__ */
|
|
2766
|
-
/* @__PURE__ */
|
|
2764
|
+
f ? /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-muted)" }, children: a("security.trust.computing", "Analysing device…") }) : g ? /* @__PURE__ */ C(Ce, { children: [
|
|
2765
|
+
/* @__PURE__ */ C("div", { style: { position: "relative", width: 100, height: 100 }, children: [
|
|
2766
|
+
/* @__PURE__ */ C(
|
|
2767
2767
|
"svg",
|
|
2768
2768
|
{
|
|
2769
2769
|
viewBox: "0 0 36 36",
|
|
@@ -2796,7 +2796,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2796
2796
|
]
|
|
2797
2797
|
}
|
|
2798
2798
|
),
|
|
2799
|
-
/* @__PURE__ */
|
|
2799
|
+
/* @__PURE__ */ C(
|
|
2800
2800
|
"div",
|
|
2801
2801
|
{
|
|
2802
2802
|
style: {
|
|
@@ -2825,8 +2825,8 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2825
2825
|
children: g.trusted ? a("security.trust.trusted", "✅ Device Trusted") : a("security.trust.untrusted", "⚠️ Low Trust Score")
|
|
2826
2826
|
}
|
|
2827
2827
|
),
|
|
2828
|
-
n && g.factors.length > 0 && /* @__PURE__ */
|
|
2829
|
-
/* @__PURE__ */
|
|
2828
|
+
n && g.factors.length > 0 && /* @__PURE__ */ C("div", { style: { width: "100%", fontSize: 12 }, children: [
|
|
2829
|
+
/* @__PURE__ */ C(
|
|
2830
2830
|
"div",
|
|
2831
2831
|
{
|
|
2832
2832
|
style: {
|
|
@@ -2840,7 +2840,7 @@ const it = 4, st = 5, ot = 3e4, Pt = (e) => {
|
|
|
2840
2840
|
]
|
|
2841
2841
|
}
|
|
2842
2842
|
),
|
|
2843
|
-
/* @__PURE__ */ c("ul", { style: { margin: 0, paddingLeft: 18, color: "var(--security-text-muted)" }, children: g.factors.map((D,
|
|
2843
|
+
/* @__PURE__ */ c("ul", { style: { margin: 0, paddingLeft: 18, color: "var(--security-text-muted)" }, children: g.factors.map((D, R) => /* @__PURE__ */ c("li", { style: { marginBottom: 2 }, children: D.name }, R)) })
|
|
2844
2844
|
] }),
|
|
2845
2845
|
i && g.fingerprint && /* @__PURE__ */ c(
|
|
2846
2846
|
"div",
|
|
@@ -2867,7 +2867,7 @@ function mt(e) {
|
|
|
2867
2867
|
let t = 0;
|
|
2868
2868
|
return e.length >= 8 && t++, e.length >= 12 && t++, /[a-z]/.test(e) && /[A-Z]/.test(e) && t++, /\d/.test(e) && t++, /[^a-zA-Z0-9]/.test(e) && t++, /(.)\1{3,}/.test(e) && t--, Math.max(0, Math.min(4, t));
|
|
2869
2869
|
}
|
|
2870
|
-
const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef4444", "#f97316", "#eab308", "#22c55e", "#10b981"], jt = ({
|
|
2870
|
+
const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["var(--nice-danger, #ef4444)", "var(--nice-warning, #f97316)", "var(--nice-warning, #eab308)", "var(--nice-success, #22c55e)", "var(--nice-success, #10b981)"], jt = ({
|
|
2871
2871
|
mode: e = "verify",
|
|
2872
2872
|
expectedHash: t,
|
|
2873
2873
|
minStrength: r = 2,
|
|
@@ -2882,7 +2882,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
2882
2882
|
showStrength: m = !0,
|
|
2883
2883
|
maxAttempts: k = 5
|
|
2884
2884
|
}) => {
|
|
2885
|
-
const { t: p } = ee(), [D,
|
|
2885
|
+
const { t: p } = ee(), [D, R] = j(""), [b, T] = j(""), [y, S] = j(!1), [u, x] = j("idle"), [l, h] = j(0), [L, q] = j(""), Y = V(null), B = mt(D), H = G(
|
|
2886
2886
|
($) => {
|
|
2887
2887
|
x($), o == null || o($);
|
|
2888
2888
|
},
|
|
@@ -2893,7 +2893,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
2893
2893
|
q(p("security.passphrase.tooShort", `Minimum ${n} characters`)), H("idle");
|
|
2894
2894
|
return;
|
|
2895
2895
|
}
|
|
2896
|
-
if (
|
|
2896
|
+
if (B < r) {
|
|
2897
2897
|
q(p("security.passphrase.tooWeak", "Passphrase is too weak")), H("idle");
|
|
2898
2898
|
return;
|
|
2899
2899
|
}
|
|
@@ -2905,8 +2905,8 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
2905
2905
|
return;
|
|
2906
2906
|
}
|
|
2907
2907
|
if (t) {
|
|
2908
|
-
const $ = new TextEncoder(),
|
|
2909
|
-
if (Array.from(new Uint8Array(
|
|
2908
|
+
const $ = new TextEncoder(), _ = await crypto.subtle.digest("SHA-256", $.encode(D));
|
|
2909
|
+
if (Array.from(new Uint8Array(_)).map((U) => U.toString(16).padStart(2, "0")).join("") === t)
|
|
2910
2910
|
H("success"), s == null || s({
|
|
2911
2911
|
success: !0,
|
|
2912
2912
|
confidence: 1,
|
|
@@ -2931,7 +2931,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
2931
2931
|
b,
|
|
2932
2932
|
e,
|
|
2933
2933
|
t,
|
|
2934
|
-
|
|
2934
|
+
B,
|
|
2935
2935
|
r,
|
|
2936
2936
|
n,
|
|
2937
2937
|
l,
|
|
@@ -2941,7 +2941,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
2941
2941
|
i,
|
|
2942
2942
|
s,
|
|
2943
2943
|
a
|
|
2944
|
-
]),
|
|
2944
|
+
]), W = {
|
|
2945
2945
|
width: "100%",
|
|
2946
2946
|
padding: "10px 14px",
|
|
2947
2947
|
fontSize: 14,
|
|
@@ -2952,7 +2952,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
2952
2952
|
boxSizing: "border-box",
|
|
2953
2953
|
fontFamily: "var(--security-font)"
|
|
2954
2954
|
};
|
|
2955
|
-
return /* @__PURE__ */
|
|
2955
|
+
return /* @__PURE__ */ C(
|
|
2956
2956
|
"div",
|
|
2957
2957
|
{
|
|
2958
2958
|
className: f,
|
|
@@ -2966,16 +2966,16 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
2966
2966
|
},
|
|
2967
2967
|
children: [
|
|
2968
2968
|
g && /* @__PURE__ */ c("label", { style: { fontSize: 14, fontWeight: 600 }, children: g }),
|
|
2969
|
-
/* @__PURE__ */
|
|
2969
|
+
/* @__PURE__ */ C("div", { style: { position: "relative" }, children: [
|
|
2970
2970
|
/* @__PURE__ */ c(
|
|
2971
2971
|
"input",
|
|
2972
2972
|
{
|
|
2973
2973
|
ref: Y,
|
|
2974
2974
|
type: y ? "text" : "password",
|
|
2975
2975
|
value: D,
|
|
2976
|
-
onChange: ($) =>
|
|
2976
|
+
onChange: ($) => R($.target.value),
|
|
2977
2977
|
placeholder: v ?? p("security.passphrase.placeholder", "Enter passphrase"),
|
|
2978
|
-
style:
|
|
2978
|
+
style: W,
|
|
2979
2979
|
disabled: u === "success",
|
|
2980
2980
|
onKeyDown: ($) => $.key === "Enter" && Z()
|
|
2981
2981
|
}
|
|
@@ -3001,20 +3001,20 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
3001
3001
|
}
|
|
3002
3002
|
)
|
|
3003
3003
|
] }),
|
|
3004
|
-
e === "set" && m && D.length > 0 && /* @__PURE__ */
|
|
3004
|
+
e === "set" && m && D.length > 0 && /* @__PURE__ */ C("div", { children: [
|
|
3005
3005
|
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 3, height: 4 }, children: [0, 1, 2, 3].map(($) => /* @__PURE__ */ c(
|
|
3006
3006
|
"div",
|
|
3007
3007
|
{
|
|
3008
3008
|
style: {
|
|
3009
3009
|
flex: 1,
|
|
3010
3010
|
borderRadius: 2,
|
|
3011
|
-
background: $ <
|
|
3011
|
+
background: $ < B ? we[B] : "var(--security-border)",
|
|
3012
3012
|
transition: "background 0.2s"
|
|
3013
3013
|
}
|
|
3014
3014
|
},
|
|
3015
3015
|
$
|
|
3016
3016
|
)) }),
|
|
3017
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 4, color: we[
|
|
3017
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 4, color: we[B] }, children: p(`security.passphrase.strength${B}`, vt[B]) })
|
|
3018
3018
|
] }),
|
|
3019
3019
|
e === "set" && /* @__PURE__ */ c(
|
|
3020
3020
|
"input",
|
|
@@ -3023,7 +3023,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
3023
3023
|
value: b,
|
|
3024
3024
|
onChange: ($) => T($.target.value),
|
|
3025
3025
|
placeholder: p("security.passphrase.confirmPlaceholder", "Confirm passphrase"),
|
|
3026
|
-
style:
|
|
3026
|
+
style: W,
|
|
3027
3027
|
disabled: u === "success",
|
|
3028
3028
|
onKeyDown: ($) => $.key === "Enter" && Z(),
|
|
3029
3029
|
onPaste: ($) => $.preventDefault()
|
|
@@ -3040,7 +3040,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
3040
3040
|
fontSize: 14,
|
|
3041
3041
|
fontWeight: 600,
|
|
3042
3042
|
background: u === "success" ? "var(--security-success)" : "var(--security-biometric)",
|
|
3043
|
-
color: "#fff",
|
|
3043
|
+
color: "var(--nice-bg, #fff)",
|
|
3044
3044
|
border: "none",
|
|
3045
3045
|
borderRadius: "var(--security-radius)",
|
|
3046
3046
|
cursor: u === "success" ? "default" : "pointer",
|
|
@@ -3054,7 +3054,7 @@ const vt = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], we = ["#ef444
|
|
|
3054
3054
|
}
|
|
3055
3055
|
);
|
|
3056
3056
|
};
|
|
3057
|
-
function
|
|
3057
|
+
function _t(e) {
|
|
3058
3058
|
const t = [], r = {
|
|
3059
3059
|
defaultSrc: "default-src",
|
|
3060
3060
|
scriptSrc: "script-src",
|
|
@@ -3089,7 +3089,7 @@ function Bt(e) {
|
|
|
3089
3089
|
}
|
|
3090
3090
|
}), t.join("; ");
|
|
3091
3091
|
}
|
|
3092
|
-
function
|
|
3092
|
+
function Bt(e) {
|
|
3093
3093
|
const t = "'self'";
|
|
3094
3094
|
return {
|
|
3095
3095
|
defaultSrc: [t],
|
|
@@ -3108,7 +3108,7 @@ function Wt(e) {
|
|
|
3108
3108
|
reportUri: e == null ? void 0 : e.reportUri
|
|
3109
3109
|
};
|
|
3110
3110
|
}
|
|
3111
|
-
function
|
|
3111
|
+
function Wt() {
|
|
3112
3112
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "") : Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
3113
3113
|
}
|
|
3114
3114
|
const bt = {
|
|
@@ -3919,10 +3919,10 @@ We will not pursue legal action against researchers who:
|
|
|
3919
3919
|
}
|
|
3920
3920
|
export {
|
|
3921
3921
|
$t as NiceDeviceTrust,
|
|
3922
|
-
|
|
3922
|
+
Rt as NiceFaceRecognition,
|
|
3923
3923
|
Mt as NiceFingerprintScanner,
|
|
3924
3924
|
Dt as NiceI18nProvider,
|
|
3925
|
-
|
|
3925
|
+
Ct as NiceIrisScanner,
|
|
3926
3926
|
Nt as NiceMfaSelector,
|
|
3927
3927
|
jt as NicePassphraseInput,
|
|
3928
3928
|
Et as NicePatternLock,
|
|
@@ -3950,13 +3950,13 @@ export {
|
|
|
3950
3950
|
ue as extractFaceFeatures,
|
|
3951
3951
|
je as extractMinutiae,
|
|
3952
3952
|
Ge as faceToTemplate,
|
|
3953
|
-
|
|
3954
|
-
|
|
3953
|
+
Be as fingerprintToTemplate,
|
|
3954
|
+
_t as generateCSPHeader,
|
|
3955
3955
|
Kt as generateCSRFToken,
|
|
3956
3956
|
tr as generateDataExport,
|
|
3957
3957
|
le as generateDeviceFingerprint,
|
|
3958
3958
|
It as generateLivenessChallenge,
|
|
3959
|
-
|
|
3959
|
+
Wt as generateNonce,
|
|
3960
3960
|
yr as generatePreCommitHook,
|
|
3961
3961
|
dr as generateSASTConfig,
|
|
3962
3962
|
hr as generateSCAConfig,
|
|
@@ -3966,7 +3966,7 @@ export {
|
|
|
3966
3966
|
Me as getCSRFTokenFromCookie,
|
|
3967
3967
|
fe as getCameraStream,
|
|
3968
3968
|
kt as getConsentPreferences,
|
|
3969
|
-
|
|
3969
|
+
Bt as getRecommendedCSP,
|
|
3970
3970
|
lr as getSOC2Checklist,
|
|
3971
3971
|
or as hasAccessibleName,
|
|
3972
3972
|
Vt as hasConsent,
|
|
@@ -3975,7 +3975,7 @@ export {
|
|
|
3975
3975
|
Ie as isWebAuthnAvailable,
|
|
3976
3976
|
nr as logPHIAccess,
|
|
3977
3977
|
ke as matchFaces,
|
|
3978
|
-
|
|
3978
|
+
_e as matchFingerprints,
|
|
3979
3979
|
He as matchIris,
|
|
3980
3980
|
Ye as registerWebAuthn,
|
|
3981
3981
|
rr as requestDataDeletion,
|
|
@@ -3986,7 +3986,7 @@ export {
|
|
|
3986
3986
|
Qt as saveConsentPreferences,
|
|
3987
3987
|
Xt as scanFileForViruses,
|
|
3988
3988
|
Je as templateToFace,
|
|
3989
|
-
|
|
3989
|
+
We as templateToFingerprint,
|
|
3990
3990
|
qe as templateToIris,
|
|
3991
3991
|
Jt as useCSRFToken,
|
|
3992
3992
|
ee as useNiceTranslation,
|