@nice2dev/ui-security 1.2.1 → 1.2.2
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 +39 -0
- package/dist/core/biometricEngine.d.ts +10 -0
- package/dist/core/i18n.d.ts +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +1313 -1278
- package/package.json +4 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as c, jsxs as P, Fragment as Pe } from "react/jsx-runtime";
|
|
2
|
-
import { useContext as Ee, createContext as Fe, useRef as
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { useContext as Ee, createContext as Fe, useRef as V, useState as j, useCallback as K, useEffect as ne, useMemo as ae } from "react";
|
|
3
|
+
import { useNiceTranslation as ze } from "@nice2dev/ui-core";
|
|
4
|
+
import { NtdBackspace as Ne, NtdArrowLeft as Le, NtdArrowRight as $e } from "@nice2dev/icons";
|
|
5
|
+
const je = {
|
|
5
6
|
low: 0.7,
|
|
6
7
|
medium: 0.8,
|
|
7
8
|
high: 0.85,
|
|
@@ -21,7 +22,7 @@ const $e = {
|
|
|
21
22
|
};
|
|
22
23
|
function fe(e) {
|
|
23
24
|
const t = { ..._e, ...e };
|
|
24
|
-
return e != null && e.matchThreshold || (t.matchThreshold =
|
|
25
|
+
return e != null && e.matchThreshold || (t.matchThreshold = je[t.securityLevel]), t;
|
|
25
26
|
}
|
|
26
27
|
async function ue(e) {
|
|
27
28
|
const t = new TextEncoder().encode(e), r = await crypto.subtle.digest("SHA-256", t);
|
|
@@ -31,11 +32,11 @@ function ye(e = 8) {
|
|
|
31
32
|
const t = new Uint8Array(e);
|
|
32
33
|
return crypto.getRandomValues(t), Array.from(t).map((r) => r.toString(36).padStart(2, "0")).join("").slice(0, e);
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function Be(e) {
|
|
35
36
|
const t = new Uint32Array(1);
|
|
36
37
|
return crypto.getRandomValues(t), t[0] % e;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function We(e, t) {
|
|
39
40
|
return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
40
41
|
}
|
|
41
42
|
async function pe(e = "user") {
|
|
@@ -45,143 +46,143 @@ async function pe(e = "user") {
|
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
function le(e, t, r) {
|
|
48
|
-
const n = t ?? e.videoWidth,
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
return { canvas:
|
|
49
|
+
const n = t ?? e.videoWidth, o = r ?? e.videoHeight, s = document.createElement("canvas");
|
|
50
|
+
s.width = n, s.height = o;
|
|
51
|
+
const a = s.getContext("2d");
|
|
52
|
+
a.drawImage(e, 0, 0, n, o);
|
|
53
|
+
const i = a.getImageData(0, 0, n, o);
|
|
54
|
+
return { canvas: s, ctx: a, imageData: i };
|
|
54
55
|
}
|
|
55
56
|
function ce(e) {
|
|
56
57
|
const t = new Uint8Array(e.width * e.height), r = e.data;
|
|
57
58
|
for (let n = 0; n < t.length; n++) {
|
|
58
|
-
const
|
|
59
|
-
t[n] = Math.round(0.299 * r[
|
|
59
|
+
const o = n * 4;
|
|
60
|
+
t[n] = Math.round(0.299 * r[o] + 0.587 * r[o + 1] + 0.114 * r[o + 2]);
|
|
60
61
|
}
|
|
61
62
|
return t;
|
|
62
63
|
}
|
|
63
64
|
function Ae(e, t, r) {
|
|
64
|
-
const n = new Uint8Array(t * r),
|
|
65
|
-
for (let
|
|
66
|
-
for (let
|
|
67
|
-
let
|
|
65
|
+
const n = new Uint8Array(t * r), o = [1, 2, 1, 2, 4, 2, 1, 2, 1], s = 16;
|
|
66
|
+
for (let a = 1; a < r - 1; a++)
|
|
67
|
+
for (let i = 1; i < t - 1; i++) {
|
|
68
|
+
let y = 0, b = 0;
|
|
68
69
|
for (let f = -1; f <= 1; f++)
|
|
69
|
-
for (let
|
|
70
|
-
|
|
71
|
-
n[
|
|
70
|
+
for (let x = -1; x <= 1; x++)
|
|
71
|
+
y += e[(a + f) * t + (i + x)] * o[b++];
|
|
72
|
+
n[a * t + i] = Math.round(y / s);
|
|
72
73
|
}
|
|
73
74
|
return n;
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function He(e, t, r) {
|
|
76
77
|
const n = new Uint8Array(t * r);
|
|
77
|
-
for (let
|
|
78
|
-
for (let
|
|
79
|
-
const
|
|
80
|
-
n[
|
|
78
|
+
for (let o = 1; o < r - 1; o++)
|
|
79
|
+
for (let s = 1; s < t - 1; s++) {
|
|
80
|
+
const a = -e[(o - 1) * t + (s - 1)] + e[(o - 1) * t + (s + 1)] + -2 * e[o * t + (s - 1)] + 2 * e[o * t + (s + 1)] + -e[(o + 1) * t + (s - 1)] + e[(o + 1) * t + (s + 1)], i = -e[(o - 1) * t + (s - 1)] - 2 * e[(o - 1) * t + s] - e[(o - 1) * t + (s + 1)] + e[(o + 1) * t + (s - 1)] + 2 * e[(o + 1) * t + s] + e[(o + 1) * t + (s + 1)];
|
|
81
|
+
n[o * t + s] = Math.min(255, Math.round(Math.sqrt(a * a + i * i)));
|
|
81
82
|
}
|
|
82
83
|
return n;
|
|
83
84
|
}
|
|
84
85
|
function Oe(e) {
|
|
85
86
|
const t = new Array(256).fill(0);
|
|
86
|
-
for (const
|
|
87
|
-
t[
|
|
87
|
+
for (const b of e)
|
|
88
|
+
t[b]++;
|
|
88
89
|
const r = e.length;
|
|
89
90
|
let n = 0;
|
|
90
|
-
for (let
|
|
91
|
-
n +=
|
|
92
|
-
let
|
|
93
|
-
for (let
|
|
94
|
-
if (
|
|
91
|
+
for (let b = 0; b < 256; b++)
|
|
92
|
+
n += b * t[b];
|
|
93
|
+
let o = 0, s = 0, a = 0, i = 0;
|
|
94
|
+
for (let b = 0; b < 256; b++) {
|
|
95
|
+
if (s += t[b], s === 0)
|
|
95
96
|
continue;
|
|
96
|
-
const f = r -
|
|
97
|
+
const f = r - s;
|
|
97
98
|
if (f === 0)
|
|
98
99
|
break;
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
100
|
+
o += b * t[b];
|
|
101
|
+
const x = o / s, A = (n - o) / f, g = s * f * (x - A) ** 2;
|
|
102
|
+
g > a && (a = g, i = b);
|
|
102
103
|
}
|
|
103
|
-
const
|
|
104
|
-
for (let
|
|
105
|
-
|
|
106
|
-
return { threshold:
|
|
104
|
+
const y = new Uint8Array(e.length);
|
|
105
|
+
for (let b = 0; b < e.length; b++)
|
|
106
|
+
y[b] = e[b] > i ? 255 : 0;
|
|
107
|
+
return { threshold: i, binary: y };
|
|
107
108
|
}
|
|
108
109
|
function Ue(e, t = 0.3) {
|
|
109
|
-
var
|
|
110
|
-
const r = e.width, n = e.height,
|
|
111
|
-
for (let
|
|
112
|
-
for (let
|
|
113
|
-
if (
|
|
110
|
+
var S;
|
|
111
|
+
const r = e.width, n = e.height, o = ce(e), s = Ae(o, r, n), a = He(s, r, n), { binary: i } = Oe(a), y = [], b = [], f = [];
|
|
112
|
+
for (let v = 2; v < n - 2; v++)
|
|
113
|
+
for (let l = 2; l < r - 2; l++) {
|
|
114
|
+
if (i[v * r + l] === 0)
|
|
114
115
|
continue;
|
|
115
116
|
const w = [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
i[(v - 1) * r + l],
|
|
118
|
+
i[(v - 1) * r + (l + 1)],
|
|
119
|
+
i[v * r + (l + 1)],
|
|
120
|
+
i[(v + 1) * r + (l + 1)],
|
|
121
|
+
i[(v + 1) * r + l],
|
|
122
|
+
i[(v + 1) * r + (l - 1)],
|
|
123
|
+
i[v * r + (l - 1)],
|
|
124
|
+
i[(v - 1) * r + (l - 1)]
|
|
124
125
|
];
|
|
125
|
-
let
|
|
126
|
-
for (let
|
|
127
|
-
const
|
|
128
|
-
|
|
126
|
+
let u = 0;
|
|
127
|
+
for (let W = 0; W < 8; W++) {
|
|
128
|
+
const O = w[W] > 0 ? 1 : 0, Y = w[(W + 1) % 8] > 0 ? 1 : 0;
|
|
129
|
+
u += Math.abs(O - Y);
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
-
let h = 0,
|
|
132
|
-
for (let
|
|
133
|
-
for (let
|
|
134
|
-
h +=
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
131
|
+
u /= 2;
|
|
132
|
+
let h = 0, R = 0;
|
|
133
|
+
for (let W = -2; W <= 2; W++)
|
|
134
|
+
for (let O = -2; O <= 2; O++)
|
|
135
|
+
h += a[(v + W) * r + (l + O)], R++;
|
|
136
|
+
const G = h / R / 255;
|
|
137
|
+
if (G < t)
|
|
137
138
|
continue;
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
const J = Math.atan2(
|
|
140
|
+
o[(v + 1) * r + l] - o[(v - 1) * r + l],
|
|
141
|
+
o[v * r + (l + 1)] - o[v * r + (l - 1)]
|
|
141
142
|
);
|
|
142
|
-
|
|
143
|
+
u === 1 ? y.push({ x: l / r, y: v / n, angle: J, type: "ending", quality: G }) : u === 3 && y.push({ x: l / r, y: v / n, angle: J, type: "bifurcation", quality: G });
|
|
143
144
|
}
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
const
|
|
148
|
-
|
|
145
|
+
y.sort((v, l) => l.quality - v.quality);
|
|
146
|
+
const x = y.slice(0, 120);
|
|
147
|
+
if (x.length > 5) {
|
|
148
|
+
const v = x.reduce((w, u) => w + u.x, 0) / x.length, l = x.reduce((w, u) => w + u.y, 0) / x.length;
|
|
149
|
+
b.push({ x: v, y: l });
|
|
149
150
|
}
|
|
150
|
-
const
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
const
|
|
151
|
+
const A = x.length, g = x.filter((v) => v.type === "ending").length, L = x.filter((v) => v.type === "bifurcation").length / (g + 1);
|
|
152
|
+
let p = "loop-right";
|
|
153
|
+
L > 1.5 ? p = "whorl" : L < 0.5 ? p = "arch" : ((S = b[0]) == null ? void 0 : S.x) < 0.45 && (p = "loop-left");
|
|
154
|
+
const C = x.length > 20 ? x.reduce((v, l) => v + l.quality, 0) / x.length : 0;
|
|
154
155
|
return {
|
|
155
|
-
minutiae:
|
|
156
|
-
corePoints:
|
|
156
|
+
minutiae: x,
|
|
157
|
+
corePoints: b,
|
|
157
158
|
deltaPoints: f,
|
|
158
|
-
ridgeCount:
|
|
159
|
-
patternType:
|
|
160
|
-
quality:
|
|
159
|
+
ridgeCount: A,
|
|
160
|
+
patternType: p,
|
|
161
|
+
quality: C
|
|
161
162
|
};
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
+
function qe(e, t) {
|
|
164
165
|
if (e.minutiae.length < 5 || t.minutiae.length < 5)
|
|
165
166
|
return 0;
|
|
166
167
|
let r = 0;
|
|
167
|
-
const n = 0.05,
|
|
168
|
-
for (const
|
|
169
|
-
let
|
|
168
|
+
const n = 0.05, o = 0.5, s = /* @__PURE__ */ new Set();
|
|
169
|
+
for (const i of e.minutiae) {
|
|
170
|
+
let y = 1 / 0, b = -1;
|
|
170
171
|
for (let f = 0; f < t.minutiae.length; f++) {
|
|
171
|
-
if (
|
|
172
|
+
if (s.has(f))
|
|
172
173
|
continue;
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
174
|
+
const x = t.minutiae[f];
|
|
175
|
+
if (i.type !== x.type)
|
|
175
176
|
continue;
|
|
176
|
-
const
|
|
177
|
-
|
|
177
|
+
const A = We(i, x), g = Math.abs(i.angle - x.angle);
|
|
178
|
+
A < n && g < o && A < y && (y = A, b = f);
|
|
178
179
|
}
|
|
179
|
-
|
|
180
|
+
b >= 0 && (r++, s.add(b));
|
|
180
181
|
}
|
|
181
|
-
const
|
|
182
|
-
return
|
|
182
|
+
const a = Math.min(e.minutiae.length, t.minutiae.length);
|
|
183
|
+
return a > 0 ? r / a : 0;
|
|
183
184
|
}
|
|
184
|
-
async function
|
|
185
|
+
async function Ke(e, t) {
|
|
185
186
|
const r = JSON.stringify(e), n = await ue(r);
|
|
186
187
|
return {
|
|
187
188
|
id: `fp_${Date.now()}_${ye()}`,
|
|
@@ -192,65 +193,65 @@ async function qe(e, t) {
|
|
|
192
193
|
hash: n
|
|
193
194
|
};
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
+
function Ge(e) {
|
|
196
197
|
return JSON.parse(atob(e.templateData));
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
-
const r = e.width, n = e.height,
|
|
200
|
-
let
|
|
201
|
-
for (let
|
|
202
|
-
for (let
|
|
203
|
-
for (let
|
|
204
|
-
let
|
|
205
|
-
for (let
|
|
206
|
-
const h = Math.round(
|
|
207
|
-
h >= 0 && h < r &&
|
|
199
|
+
function Je(e, t = "left") {
|
|
200
|
+
const r = e.width, n = e.height, o = ce(e), s = Ae(o, r, n);
|
|
201
|
+
let a = { cx: r / 2, cy: n / 2, r: Math.min(r, n) * 0.08, score: 1 / 0 };
|
|
202
|
+
for (let I = Math.round(n * 0.3); I < Math.round(n * 0.7); I += 2)
|
|
203
|
+
for (let L = Math.round(r * 0.3); L < Math.round(r * 0.7); L += 2)
|
|
204
|
+
for (let p = Math.round(Math.min(r, n) * 0.04); p < Math.round(Math.min(r, n) * 0.15); p += 2) {
|
|
205
|
+
let C = 0, S = 0;
|
|
206
|
+
for (let u = 0; u < Math.PI * 2; u += 0.3) {
|
|
207
|
+
const h = Math.round(L + p * Math.cos(u)), R = Math.round(I + p * Math.sin(u));
|
|
208
|
+
h >= 0 && h < r && R >= 0 && R < n && (C += s[R * r + h], S++);
|
|
208
209
|
}
|
|
209
|
-
const
|
|
210
|
-
w <
|
|
210
|
+
const v = S > 0 ? C / S : 255, l = s[I * r + L], w = v * 0.5 + l * 0.5;
|
|
211
|
+
w < a.score && (a = { cx: L, cy: I, r: p, score: w });
|
|
211
212
|
}
|
|
212
|
-
const
|
|
213
|
-
cx:
|
|
214
|
-
cy:
|
|
215
|
-
r: Math.min(
|
|
216
|
-
},
|
|
217
|
-
for (let
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
220
|
-
const
|
|
221
|
-
f.push(w >
|
|
213
|
+
const i = a.r * 3, y = {
|
|
214
|
+
cx: a.cx,
|
|
215
|
+
cy: a.cy,
|
|
216
|
+
r: Math.min(i, Math.min(r, n) * 0.4)
|
|
217
|
+
}, b = 256, f = [];
|
|
218
|
+
for (let I = 0; I < b; I++) {
|
|
219
|
+
const L = I / b * Math.PI * 2, p = a.r + (y.r - a.r) * 0.5, C = Math.round(a.cx + p * Math.cos(L)), S = Math.round(a.cy + p * Math.sin(L));
|
|
220
|
+
if (C >= 0 && C < r && S >= 0 && S < n) {
|
|
221
|
+
const v = Math.round(a.cx + p * Math.cos(L + 0.1)), l = Math.round(a.cy + p * Math.sin(L + 0.1)), w = s[S * r + C], u = v >= 0 && v < r && l >= 0 && l < n ? s[l * r + v] : w;
|
|
222
|
+
f.push(w > u ? 1 : 0);
|
|
222
223
|
} else
|
|
223
224
|
f.push(0);
|
|
224
225
|
}
|
|
225
|
-
const
|
|
226
|
+
const x = f.join(""), A = Math.PI * a.r ** 2, g = Math.min(1, Math.max(0, A / (r * n) * 100));
|
|
226
227
|
return {
|
|
227
|
-
irisCode:
|
|
228
|
-
pupil:
|
|
229
|
-
iris:
|
|
230
|
-
quality:
|
|
228
|
+
irisCode: x,
|
|
229
|
+
pupil: a,
|
|
230
|
+
iris: y,
|
|
231
|
+
quality: g,
|
|
231
232
|
eye: t
|
|
232
233
|
};
|
|
233
234
|
}
|
|
234
|
-
function
|
|
235
|
+
function Ye(e, t) {
|
|
235
236
|
if (!e.irisCode || !t.irisCode)
|
|
236
237
|
return 0;
|
|
237
238
|
const r = Math.min(e.irisCode.length, t.irisCode.length);
|
|
238
239
|
if (r === 0)
|
|
239
240
|
return 0;
|
|
240
|
-
let n = 0,
|
|
241
|
-
for (let
|
|
242
|
-
let
|
|
243
|
-
for (let
|
|
244
|
-
const
|
|
245
|
-
e.irisCode[
|
|
241
|
+
let n = 0, o = r;
|
|
242
|
+
for (let a = -8; a <= 8; a++) {
|
|
243
|
+
let i = 0;
|
|
244
|
+
for (let y = 0; y < r; y++) {
|
|
245
|
+
const b = (y + a + r) % r;
|
|
246
|
+
e.irisCode[y] !== t.irisCode[b] && i++;
|
|
246
247
|
}
|
|
247
|
-
|
|
248
|
+
i < o && (o = i);
|
|
248
249
|
}
|
|
249
|
-
n =
|
|
250
|
-
const
|
|
251
|
-
return Math.max(0, 1 -
|
|
250
|
+
n = o;
|
|
251
|
+
const s = n / r;
|
|
252
|
+
return Math.max(0, 1 - s * 2.5);
|
|
252
253
|
}
|
|
253
|
-
async function
|
|
254
|
+
async function Ze(e, t) {
|
|
254
255
|
const r = JSON.stringify(e), n = await ue(r);
|
|
255
256
|
return {
|
|
256
257
|
id: `iris_${Date.now()}_${ye()}`,
|
|
@@ -261,59 +262,59 @@ async function Ye(e, t) {
|
|
|
261
262
|
hash: n
|
|
262
263
|
};
|
|
263
264
|
}
|
|
264
|
-
function
|
|
265
|
+
function Xe(e) {
|
|
265
266
|
return JSON.parse(atob(e.templateData));
|
|
266
267
|
}
|
|
267
268
|
function he(e) {
|
|
268
|
-
const t = e.width, r = e.height, n = e.data,
|
|
269
|
-
for (let
|
|
270
|
-
const w =
|
|
271
|
-
|
|
269
|
+
const t = e.width, r = e.height, n = e.data, o = new Uint8Array(t * r);
|
|
270
|
+
for (let l = 0; l < t * r; l++) {
|
|
271
|
+
const w = l * 4, u = n[w], h = n[w + 1], R = n[w + 2], G = 0.299 * u + 0.587 * h + 0.114 * R, J = 128 - 0.169 * u - 0.331 * h + 0.5 * R, W = 128 + 0.5 * u - 0.419 * h - 0.081 * R;
|
|
272
|
+
J >= 77 && J <= 127 && W >= 133 && W <= 173 && G > 80 && (o[l] = 1);
|
|
272
273
|
}
|
|
273
|
-
let
|
|
274
|
-
for (let
|
|
274
|
+
let s = t, a = r, i = 0, y = 0, b = 0;
|
|
275
|
+
for (let l = 0; l < r; l++)
|
|
275
276
|
for (let w = 0; w < t; w++)
|
|
276
|
-
|
|
277
|
-
const f =
|
|
278
|
-
if (f < t * 0.1 ||
|
|
277
|
+
o[l * t + w] && (b++, w < s && (s = w), w > i && (i = w), l < a && (a = l), l > y && (y = l));
|
|
278
|
+
const f = i - s, x = y - a;
|
|
279
|
+
if (f < t * 0.1 || x < r * 0.1)
|
|
279
280
|
return null;
|
|
280
|
-
const
|
|
281
|
-
for (let
|
|
281
|
+
const A = { x: s, y: a, width: f, height: x }, g = [], I = ce(e), L = Math.max(1, Math.floor(f / 8)), p = Math.max(1, Math.floor(x / 16));
|
|
282
|
+
for (let l = 0; l < 16; l++)
|
|
282
283
|
for (let w = 0; w < 8; w++) {
|
|
283
|
-
const
|
|
284
|
-
|
|
284
|
+
const u = s + w * L + Math.floor(L / 2), h = a + l * p + Math.floor(p / 2);
|
|
285
|
+
u < t && h < r ? g.push(I[h * t + u] / 255) : g.push(0);
|
|
285
286
|
}
|
|
286
|
-
const
|
|
287
|
-
for (let
|
|
288
|
-
const w =
|
|
289
|
-
|
|
290
|
-
x: (
|
|
291
|
-
y: (
|
|
287
|
+
const C = [], S = { x: s + f / 2, y: a + x / 2 };
|
|
288
|
+
for (let l = 0; l < 68; l++) {
|
|
289
|
+
const w = l / 68 * Math.PI * 2, u = f * 0.4 * Math.cos(w), h = x * 0.45 * Math.sin(w);
|
|
290
|
+
C.push({
|
|
291
|
+
x: (S.x + u) / t,
|
|
292
|
+
y: (S.y + h) / r
|
|
292
293
|
});
|
|
293
294
|
}
|
|
294
|
-
const
|
|
295
|
+
const v = Math.min(1, b / (f * x) * 2);
|
|
295
296
|
return {
|
|
296
|
-
embedding:
|
|
297
|
-
boundingBox:
|
|
298
|
-
landmarks:
|
|
297
|
+
embedding: g,
|
|
298
|
+
boundingBox: A,
|
|
299
|
+
landmarks: C,
|
|
299
300
|
headPose: { yaw: 0, pitch: 0, roll: 0 },
|
|
300
|
-
quality:
|
|
301
|
+
quality: v
|
|
301
302
|
};
|
|
302
303
|
}
|
|
303
304
|
function Te(e, t) {
|
|
304
305
|
if (e.embedding.length !== t.embedding.length)
|
|
305
306
|
return 0;
|
|
306
|
-
let r = 0, n = 0,
|
|
307
|
-
for (let
|
|
308
|
-
r += e.embedding[
|
|
309
|
-
const
|
|
310
|
-
return
|
|
307
|
+
let r = 0, n = 0, o = 0;
|
|
308
|
+
for (let a = 0; a < e.embedding.length; a++)
|
|
309
|
+
r += e.embedding[a] * t.embedding[a], n += e.embedding[a] ** 2, o += t.embedding[a] ** 2;
|
|
310
|
+
const s = Math.sqrt(n) * Math.sqrt(o);
|
|
311
|
+
return s > 0 ? (r / s + 1) / 2 : 0;
|
|
311
312
|
}
|
|
312
|
-
function
|
|
313
|
+
function Qe(e, t) {
|
|
313
314
|
const r = he(e), n = he(t);
|
|
314
315
|
return !r || !n ? { similarity: 0, cameraFeatures: r, refFeatures: n } : { similarity: Te(r, n), cameraFeatures: r, refFeatures: n };
|
|
315
316
|
}
|
|
316
|
-
async function
|
|
317
|
+
async function Ve(e, t) {
|
|
317
318
|
const r = JSON.stringify(e), n = await ue(r);
|
|
318
319
|
return {
|
|
319
320
|
id: `face_${Date.now()}_${ye()}`,
|
|
@@ -324,10 +325,10 @@ async function Qe(e, t) {
|
|
|
324
325
|
hash: n
|
|
325
326
|
};
|
|
326
327
|
}
|
|
327
|
-
function
|
|
328
|
+
function et(e) {
|
|
328
329
|
return JSON.parse(atob(e.templateData));
|
|
329
330
|
}
|
|
330
|
-
function
|
|
331
|
+
function zt() {
|
|
331
332
|
const e = [
|
|
332
333
|
"blink",
|
|
333
334
|
"smile",
|
|
@@ -335,7 +336,7 @@ function Ft() {
|
|
|
335
336
|
"turn-right",
|
|
336
337
|
"nod",
|
|
337
338
|
"raise-eyebrows"
|
|
338
|
-
], t = e[
|
|
339
|
+
], t = e[Be(e.length)];
|
|
339
340
|
return { type: t, instruction: {
|
|
340
341
|
blink: "Please blink your eyes",
|
|
341
342
|
smile: "Please smile",
|
|
@@ -349,17 +350,17 @@ function Ie(e, t = 0.02) {
|
|
|
349
350
|
if (e.length < 2)
|
|
350
351
|
return { isLive: !1, confidence: 0, motionScore: 0 };
|
|
351
352
|
let r = 0;
|
|
352
|
-
for (let
|
|
353
|
-
const
|
|
354
|
-
let
|
|
355
|
-
for (let f = 0; f <
|
|
356
|
-
|
|
357
|
-
r +=
|
|
353
|
+
for (let a = 1; a < e.length; a++) {
|
|
354
|
+
const i = ce(e[a - 1]), y = ce(e[a]);
|
|
355
|
+
let b = 0;
|
|
356
|
+
for (let f = 0; f < i.length; f++)
|
|
357
|
+
b += Math.abs(i[f] - y[f]);
|
|
358
|
+
r += b / (i.length * 255);
|
|
358
359
|
}
|
|
359
|
-
const n = r / (e.length - 1),
|
|
360
|
-
return { isLive:
|
|
360
|
+
const n = r / (e.length - 1), o = n > t, s = Math.min(1, n / (t * 3));
|
|
361
|
+
return { isLive: o, confidence: s, motionScore: n };
|
|
361
362
|
}
|
|
362
|
-
function
|
|
363
|
+
function Ce() {
|
|
363
364
|
return {
|
|
364
365
|
userAgent: navigator.userAgent,
|
|
365
366
|
platform: navigator.platform,
|
|
@@ -371,14 +372,14 @@ function De() {
|
|
|
371
372
|
};
|
|
372
373
|
}
|
|
373
374
|
async function de() {
|
|
374
|
-
const e =
|
|
375
|
+
const e = Ce(), t = JSON.stringify(e);
|
|
375
376
|
return ue(t);
|
|
376
377
|
}
|
|
377
|
-
function
|
|
378
|
+
function De() {
|
|
378
379
|
return typeof window < "u" && !!window.PublicKeyCredential;
|
|
379
380
|
}
|
|
380
|
-
async function
|
|
381
|
-
if (!
|
|
381
|
+
async function tt() {
|
|
382
|
+
if (!De())
|
|
382
383
|
return !1;
|
|
383
384
|
try {
|
|
384
385
|
return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();
|
|
@@ -386,7 +387,7 @@ async function et() {
|
|
|
386
387
|
return !1;
|
|
387
388
|
}
|
|
388
389
|
}
|
|
389
|
-
async function
|
|
390
|
+
async function rt(e) {
|
|
390
391
|
const t = {
|
|
391
392
|
rp: { name: e.rpName, id: e.rpId },
|
|
392
393
|
user: {
|
|
@@ -402,21 +403,21 @@ async function tt(e) {
|
|
|
402
403
|
// RS256
|
|
403
404
|
],
|
|
404
405
|
authenticatorSelection: {
|
|
405
|
-
authenticatorAttachment: "platform",
|
|
406
|
-
userVerification: "required",
|
|
407
|
-
residentKey: "preferred"
|
|
406
|
+
authenticatorAttachment: e.authenticatorAttachment ?? "platform",
|
|
407
|
+
userVerification: e.userVerification ?? "required",
|
|
408
|
+
residentKey: e.residentKey ?? "preferred"
|
|
408
409
|
},
|
|
409
410
|
timeout: e.timeout ?? 6e4,
|
|
410
|
-
attestation: "none"
|
|
411
|
+
attestation: e.attestation ?? "none"
|
|
411
412
|
};
|
|
412
413
|
return await navigator.credentials.create({ publicKey: t });
|
|
413
414
|
}
|
|
414
|
-
async function
|
|
415
|
+
async function nt(e) {
|
|
415
416
|
const t = {
|
|
416
417
|
rpId: e.rpId,
|
|
417
418
|
challenge: e.challenge,
|
|
418
419
|
allowCredentials: e.allowCredentials,
|
|
419
|
-
userVerification: "required",
|
|
420
|
+
userVerification: e.userVerification ?? "required",
|
|
420
421
|
timeout: e.timeout ?? 6e4
|
|
421
422
|
};
|
|
422
423
|
return await navigator.credentials.get({ publicKey: t });
|
|
@@ -424,140 +425,141 @@ async function rt(e) {
|
|
|
424
425
|
async function ge(e, t, r) {
|
|
425
426
|
const n = { "Content-Type": "application/json" };
|
|
426
427
|
r && (n.Authorization = `Bearer ${r}`);
|
|
427
|
-
const
|
|
428
|
+
const o = await fetch(e, {
|
|
428
429
|
method: "POST",
|
|
429
430
|
headers: n,
|
|
430
431
|
body: JSON.stringify(t)
|
|
431
432
|
});
|
|
432
|
-
return
|
|
433
|
+
return o.ok ? o.json() : { verified: !1, message: `Server error: ${o.status}` };
|
|
433
434
|
}
|
|
434
435
|
function re(e, t) {
|
|
435
|
-
var
|
|
436
|
+
var a;
|
|
436
437
|
const r = e.trim().match(/^var\(\s*([^,\s)]+)\s*(?:,\s*(.+))?\)$/);
|
|
437
438
|
if (!r)
|
|
438
439
|
return e;
|
|
439
|
-
const n = (
|
|
440
|
+
const n = (a = r[2]) == null ? void 0 : a.trim();
|
|
440
441
|
if (typeof document > "u" || typeof getComputedStyle > "u")
|
|
441
442
|
return n ? re(n) : e;
|
|
442
|
-
const
|
|
443
|
-
return
|
|
443
|
+
const o = typeof Element < "u" && t instanceof Element && t.isConnected ? t : document.documentElement, s = getComputedStyle(o).getPropertyValue(r[1]).trim();
|
|
444
|
+
return s || (n ? re(n, t) : e);
|
|
444
445
|
}
|
|
445
|
-
const
|
|
446
|
+
const Re = /* @__PURE__ */ Fe(null), Nt = ({ t: e, children: t }) => /* @__PURE__ */ c(Re.Provider, { value: e, children: t });
|
|
446
447
|
function te() {
|
|
447
|
-
|
|
448
|
+
const e = Ee(Re), { t } = ze();
|
|
449
|
+
return { t: e ?? t };
|
|
448
450
|
}
|
|
449
|
-
const it = { sm: 200, md: 280, lg: 380 },
|
|
451
|
+
const it = { sm: 200, md: 280, lg: 380 }, Lt = (e) => {
|
|
450
452
|
const {
|
|
451
453
|
mode: t,
|
|
452
454
|
enrolledTemplates: r = [],
|
|
453
455
|
fingerPosition: n = "right-index",
|
|
454
|
-
onEnroll:
|
|
455
|
-
onVerify:
|
|
456
|
-
onStatusChange:
|
|
457
|
-
onError:
|
|
458
|
-
className:
|
|
459
|
-
size:
|
|
456
|
+
onEnroll: o,
|
|
457
|
+
onVerify: s,
|
|
458
|
+
onStatusChange: a,
|
|
459
|
+
onError: i,
|
|
460
|
+
className: y,
|
|
461
|
+
size: b = "md",
|
|
460
462
|
label: f,
|
|
461
|
-
showQuality:
|
|
462
|
-
showMinutiae:
|
|
463
|
-
instructionText:
|
|
464
|
-
cameraFacing:
|
|
465
|
-
...
|
|
466
|
-
} = e, { t:
|
|
463
|
+
showQuality: x = !0,
|
|
464
|
+
showMinutiae: A = !1,
|
|
465
|
+
instructionText: g,
|
|
466
|
+
cameraFacing: I = "environment",
|
|
467
|
+
...L
|
|
468
|
+
} = e, { t: p } = te(), C = fe(L), S = it[b], v = V(null), l = V(null), w = V(null), [u, h] = j("idle"), [R, G] = j(0), [J, W] = j(null), [O, Y] = j(0), [_, $] = j(""), B = K(
|
|
467
469
|
(E) => {
|
|
468
|
-
h(E),
|
|
470
|
+
h(E), a == null || a(E);
|
|
469
471
|
},
|
|
470
|
-
[
|
|
471
|
-
), F =
|
|
472
|
+
[a]
|
|
473
|
+
), F = K(async () => {
|
|
472
474
|
try {
|
|
473
|
-
const E = await pe(
|
|
474
|
-
w.current = E,
|
|
475
|
+
const E = await pe(I);
|
|
476
|
+
w.current = E, v.current && (v.current.srcObject = E, await v.current.play()), B("idle"), $(p("security.fingerprint.placeFingerPrompt", "Place your finger on the scanner"));
|
|
475
477
|
} catch (E) {
|
|
476
|
-
|
|
478
|
+
i == null || i(E instanceof Error ? E : new Error(String(E))), $(p("security.fingerprint.cameraError", "Camera access denied")), B("error");
|
|
477
479
|
}
|
|
478
|
-
}, [
|
|
480
|
+
}, [I, p, B, i]), q = K(() => {
|
|
479
481
|
var E;
|
|
480
|
-
(E = w.current) == null || E.getTracks().forEach((
|
|
482
|
+
(E = w.current) == null || E.getTracks().forEach((z) => z.stop()), w.current = null;
|
|
481
483
|
}, []);
|
|
482
|
-
ne(() => (F(),
|
|
483
|
-
const
|
|
484
|
-
if (!(!
|
|
485
|
-
|
|
484
|
+
ne(() => (F(), q), [F, q]);
|
|
485
|
+
const H = K(async () => {
|
|
486
|
+
if (!(!v.current || u === "processing" || u === "success")) {
|
|
487
|
+
B("scanning"), $(p("security.fingerprint.scanning", "Scanning…"));
|
|
486
488
|
try {
|
|
487
|
-
const { imageData: E } = le(
|
|
488
|
-
|
|
489
|
-
const
|
|
490
|
-
if (
|
|
491
|
-
$(
|
|
489
|
+
const { imageData: E } = le(v.current);
|
|
490
|
+
B("processing"), $(p("security.fingerprint.processing", "Processing fingerprint…"));
|
|
491
|
+
const z = Ue(E);
|
|
492
|
+
if (W(z), G(z.quality), z.quality < 0.2) {
|
|
493
|
+
$(p("security.fingerprint.lowQuality", "Low quality — try again")), B("idle");
|
|
492
494
|
return;
|
|
493
495
|
}
|
|
494
496
|
if (t === "enroll") {
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
+
const D = await Ke(z, f ?? n);
|
|
498
|
+
o == null || o(D, z), $(p("security.fingerprint.enrolled", "Fingerprint enrolled successfully")), B("success");
|
|
497
499
|
} else {
|
|
498
|
-
let
|
|
500
|
+
let D = 0;
|
|
499
501
|
for (const d of r) {
|
|
500
|
-
const
|
|
501
|
-
N >
|
|
502
|
+
const k = Ge(d), N = qe(z, k);
|
|
503
|
+
N > D && (D = N);
|
|
502
504
|
}
|
|
503
|
-
const
|
|
504
|
-
success:
|
|
505
|
-
confidence:
|
|
505
|
+
const T = D >= C.matchThreshold, m = {
|
|
506
|
+
success: T,
|
|
507
|
+
confidence: D,
|
|
506
508
|
method: "fingerprint",
|
|
507
509
|
timestamp: Date.now(),
|
|
508
510
|
duration: 0,
|
|
509
|
-
payload: btoa(JSON.stringify(
|
|
511
|
+
payload: btoa(JSON.stringify(z))
|
|
510
512
|
};
|
|
511
|
-
if (
|
|
512
|
-
const d = await de(),
|
|
513
|
-
|
|
513
|
+
if (T && C.verifyEndpoint) {
|
|
514
|
+
const d = await de(), k = await ge(
|
|
515
|
+
C.verifyEndpoint,
|
|
514
516
|
{
|
|
515
517
|
method: "fingerprint",
|
|
516
|
-
templateData:
|
|
517
|
-
matchScore:
|
|
518
|
+
templateData: m.payload,
|
|
519
|
+
matchScore: D,
|
|
518
520
|
deviceFingerprint: d
|
|
519
521
|
},
|
|
520
|
-
|
|
522
|
+
C.authToken
|
|
521
523
|
);
|
|
522
|
-
|
|
524
|
+
m.success = k.verified;
|
|
523
525
|
}
|
|
524
|
-
|
|
526
|
+
m.success ? ($(p("security.fingerprint.verified", "Fingerprint verified")), B("success")) : (Y((d) => d + 1), O + 1 >= C.maxRetries ? ($(p("security.fingerprint.maxAttempts", "Maximum attempts reached")), B("failure")) : ($(p("security.fingerprint.noMatch", "No match — try again")), B("idle"))), s == null || s(m);
|
|
525
527
|
}
|
|
526
528
|
} catch (E) {
|
|
527
|
-
|
|
529
|
+
i == null || i(E instanceof Error ? E : new Error(String(E))), $(p("security.fingerprint.error", "Scan error — try again")), B("error");
|
|
528
530
|
}
|
|
529
531
|
}
|
|
530
532
|
}, [
|
|
531
|
-
|
|
533
|
+
u,
|
|
532
534
|
t,
|
|
533
535
|
r,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
536
|
+
C,
|
|
537
|
+
p,
|
|
538
|
+
B,
|
|
539
|
+
o,
|
|
537
540
|
s,
|
|
538
541
|
i,
|
|
539
|
-
a,
|
|
540
542
|
f,
|
|
541
543
|
n,
|
|
542
|
-
|
|
544
|
+
O
|
|
543
545
|
]);
|
|
544
546
|
ne(() => {
|
|
545
|
-
if (!
|
|
547
|
+
if (!A || !J || !l.current)
|
|
546
548
|
return;
|
|
547
|
-
const E =
|
|
549
|
+
const E = l.current.getContext("2d");
|
|
548
550
|
if (!E)
|
|
549
551
|
return;
|
|
550
|
-
E.clearRect(0, 0,
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
E.beginPath(), E.arc(
|
|
552
|
+
E.clearRect(0, 0, S, S);
|
|
553
|
+
const z = re("var(--nice-success, #10b981)", E.canvas), D = re("var(--nice-warning, #f59e0b)", E.canvas);
|
|
554
|
+
J.minutiae.forEach((T) => {
|
|
555
|
+
E.beginPath(), E.arc(T.x * S, T.y * S, 2, 0, Math.PI * 2), E.fillStyle = T.type === "ending" ? z : D, E.fill(), E.beginPath(), E.moveTo(T.x * S, T.y * S), E.lineTo(T.x * S + Math.cos(T.angle) * 8, T.y * S + Math.sin(T.angle) * 8), E.strokeStyle = E.fillStyle, E.lineWidth = 1, E.stroke();
|
|
554
556
|
});
|
|
555
|
-
}, [
|
|
556
|
-
const Q =
|
|
557
|
+
}, [J, A, S]);
|
|
558
|
+
const Q = u === "success" ? "var(--security-success)" : u === "failure" || u === "error" ? "var(--security-error)" : u === "scanning" || u === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
557
559
|
return /* @__PURE__ */ P(
|
|
558
560
|
"div",
|
|
559
561
|
{
|
|
560
|
-
className:
|
|
562
|
+
className: y,
|
|
561
563
|
style: { display: "inline-flex", flexDirection: "column", alignItems: "center", gap: 12 },
|
|
562
564
|
children: [
|
|
563
565
|
f && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f }),
|
|
@@ -565,31 +567,31 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
565
567
|
"div",
|
|
566
568
|
{
|
|
567
569
|
style: {
|
|
568
|
-
width:
|
|
569
|
-
height:
|
|
570
|
+
width: S,
|
|
571
|
+
height: S,
|
|
570
572
|
position: "relative",
|
|
571
573
|
borderRadius: "var(--security-radius-lg)",
|
|
572
574
|
overflow: "hidden",
|
|
573
575
|
border: `3px solid ${Q}`,
|
|
574
|
-
boxShadow:
|
|
576
|
+
boxShadow: u === "scanning" ? `0 0 20px ${Q}` : "var(--security-shadow)",
|
|
575
577
|
transition: "border-color 0.3s, box-shadow 0.3s"
|
|
576
578
|
},
|
|
577
579
|
children: [
|
|
578
580
|
/* @__PURE__ */ c(
|
|
579
581
|
"video",
|
|
580
582
|
{
|
|
581
|
-
ref:
|
|
583
|
+
ref: v,
|
|
582
584
|
style: { width: "100%", height: "100%", objectFit: "cover" },
|
|
583
585
|
playsInline: !0,
|
|
584
586
|
muted: !0
|
|
585
587
|
}
|
|
586
588
|
),
|
|
587
|
-
|
|
589
|
+
A && /* @__PURE__ */ c(
|
|
588
590
|
"canvas",
|
|
589
591
|
{
|
|
590
|
-
ref:
|
|
591
|
-
width:
|
|
592
|
-
height:
|
|
592
|
+
ref: l,
|
|
593
|
+
width: S,
|
|
594
|
+
height: S,
|
|
593
595
|
style: { position: "absolute", inset: 0, pointerEvents: "none" }
|
|
594
596
|
}
|
|
595
597
|
),
|
|
@@ -635,7 +637,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
635
637
|
]
|
|
636
638
|
}
|
|
637
639
|
),
|
|
638
|
-
(
|
|
640
|
+
(u === "scanning" || u === "processing") && /* @__PURE__ */ c(
|
|
639
641
|
"div",
|
|
640
642
|
{
|
|
641
643
|
style: {
|
|
@@ -664,11 +666,11 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
664
666
|
]
|
|
665
667
|
}
|
|
666
668
|
),
|
|
667
|
-
|
|
669
|
+
x && R > 0 && /* @__PURE__ */ c(
|
|
668
670
|
"div",
|
|
669
671
|
{
|
|
670
672
|
style: {
|
|
671
|
-
width:
|
|
673
|
+
width: S,
|
|
672
674
|
height: 4,
|
|
673
675
|
background: "var(--security-bg-panel)",
|
|
674
676
|
borderRadius: 2,
|
|
@@ -678,9 +680,9 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
678
680
|
"div",
|
|
679
681
|
{
|
|
680
682
|
style: {
|
|
681
|
-
width: `${
|
|
683
|
+
width: `${R * 100}%`,
|
|
682
684
|
height: "100%",
|
|
683
|
-
background:
|
|
685
|
+
background: R > 0.6 ? "var(--security-success)" : R > 0.3 ? "var(--security-warning)" : "var(--security-error)",
|
|
684
686
|
transition: "width 0.3s"
|
|
685
687
|
}
|
|
686
688
|
}
|
|
@@ -696,14 +698,14 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
696
698
|
textAlign: "center",
|
|
697
699
|
minHeight: 20
|
|
698
700
|
},
|
|
699
|
-
children:
|
|
701
|
+
children: g ?? _
|
|
700
702
|
}
|
|
701
703
|
),
|
|
702
|
-
|
|
704
|
+
u !== "success" && u !== "failure" && /* @__PURE__ */ c(
|
|
703
705
|
"button",
|
|
704
706
|
{
|
|
705
|
-
onClick:
|
|
706
|
-
disabled:
|
|
707
|
+
onClick: H,
|
|
708
|
+
disabled: u === "scanning" || u === "processing",
|
|
707
709
|
style: {
|
|
708
710
|
padding: "10px 24px",
|
|
709
711
|
fontSize: 14,
|
|
@@ -713,16 +715,16 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
713
715
|
border: "none",
|
|
714
716
|
borderRadius: "var(--security-radius)",
|
|
715
717
|
cursor: "pointer",
|
|
716
|
-
opacity:
|
|
718
|
+
opacity: u === "scanning" || u === "processing" ? 0.6 : 1
|
|
717
719
|
},
|
|
718
|
-
children: t === "enroll" ?
|
|
720
|
+
children: t === "enroll" ? p("security.fingerprint.captureBtn", "Capture Fingerprint") : p("security.fingerprint.verifyBtn", "Verify Fingerprint")
|
|
719
721
|
}
|
|
720
722
|
),
|
|
721
|
-
(
|
|
723
|
+
(u === "failure" || u === "error") && /* @__PURE__ */ c(
|
|
722
724
|
"button",
|
|
723
725
|
{
|
|
724
726
|
onClick: () => {
|
|
725
|
-
|
|
727
|
+
Y(0), B("idle"), $("");
|
|
726
728
|
},
|
|
727
729
|
style: {
|
|
728
730
|
padding: "8px 20px",
|
|
@@ -733,149 +735,149 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
733
735
|
borderRadius: "var(--security-radius)",
|
|
734
736
|
cursor: "pointer"
|
|
735
737
|
},
|
|
736
|
-
children:
|
|
738
|
+
children: p("security.common.retry", "Try Again")
|
|
737
739
|
}
|
|
738
740
|
),
|
|
739
741
|
/* @__PURE__ */ c("style", { children: "@keyframes spin { to { transform: rotate(360deg); } }" })
|
|
740
742
|
]
|
|
741
743
|
}
|
|
742
744
|
);
|
|
743
|
-
}, st = { sm: 220, md: 300, lg: 400 },
|
|
745
|
+
}, st = { sm: 220, md: 300, lg: 400 }, $t = (e) => {
|
|
744
746
|
const {
|
|
745
747
|
mode: t,
|
|
746
748
|
enrolledTemplates: r = [],
|
|
747
749
|
eye: n = "right",
|
|
748
|
-
onEnroll:
|
|
749
|
-
onVerify:
|
|
750
|
-
onStatusChange:
|
|
751
|
-
onError:
|
|
752
|
-
className:
|
|
753
|
-
size:
|
|
750
|
+
onEnroll: o,
|
|
751
|
+
onVerify: s,
|
|
752
|
+
onStatusChange: a,
|
|
753
|
+
onError: i,
|
|
754
|
+
className: y,
|
|
755
|
+
size: b = "md",
|
|
754
756
|
label: f,
|
|
755
|
-
showQuality:
|
|
756
|
-
showSegmentation:
|
|
757
|
-
showGuide:
|
|
758
|
-
instructionText:
|
|
759
|
-
...
|
|
760
|
-
} = e, { t:
|
|
761
|
-
(
|
|
762
|
-
|
|
757
|
+
showQuality: x = !0,
|
|
758
|
+
showSegmentation: A = !0,
|
|
759
|
+
showGuide: g = !0,
|
|
760
|
+
instructionText: I,
|
|
761
|
+
...L
|
|
762
|
+
} = e, { t: p } = te(), C = fe(L), S = st[b], v = V(null), l = V(null), w = V(null), u = V([]), [h, R] = j("idle"), [G, J] = j(0), [W, O] = j(null), [Y, _] = j(0), [$, B] = j(""), F = K(
|
|
763
|
+
(z) => {
|
|
764
|
+
R(z), a == null || a(z);
|
|
763
765
|
},
|
|
764
|
-
[
|
|
765
|
-
),
|
|
766
|
+
[a]
|
|
767
|
+
), q = K(async () => {
|
|
766
768
|
try {
|
|
767
|
-
const
|
|
768
|
-
w.current =
|
|
769
|
-
} catch (
|
|
770
|
-
|
|
769
|
+
const z = await pe("user");
|
|
770
|
+
w.current = z, v.current && (v.current.srcObject = z, await v.current.play()), F("idle"), B(p("security.iris.alignEyePrompt", "Align your eye with the circle"));
|
|
771
|
+
} catch (z) {
|
|
772
|
+
i == null || i(z instanceof Error ? z : new Error(String(z))), B(p("security.iris.cameraError", "Camera access denied")), F("error");
|
|
771
773
|
}
|
|
772
|
-
}, [
|
|
773
|
-
var
|
|
774
|
-
(
|
|
774
|
+
}, [p, F, i]), H = K(() => {
|
|
775
|
+
var z;
|
|
776
|
+
(z = w.current) == null || z.getTracks().forEach((D) => D.stop()), w.current = null;
|
|
775
777
|
}, []);
|
|
776
|
-
ne(() => (
|
|
777
|
-
const Q =
|
|
778
|
-
if (!(!
|
|
779
|
-
F("scanning"),
|
|
778
|
+
ne(() => (q(), H), [q, H]);
|
|
779
|
+
const Q = K(async () => {
|
|
780
|
+
if (!(!v.current || h === "processing" || h === "success")) {
|
|
781
|
+
F("scanning"), B(p("security.iris.scanning", "Scanning iris…"));
|
|
780
782
|
try {
|
|
781
|
-
const
|
|
782
|
-
for (let
|
|
783
|
-
const { imageData: d } = le(
|
|
784
|
-
|
|
783
|
+
const z = [];
|
|
784
|
+
for (let m = 0; m < 5; m++) {
|
|
785
|
+
const { imageData: d } = le(v.current);
|
|
786
|
+
z.push(d), await new Promise((k) => setTimeout(k, 200));
|
|
785
787
|
}
|
|
786
|
-
if (
|
|
787
|
-
|
|
788
|
-
|
|
788
|
+
if (u.current = z, C.livenessDetection && !Ie(z).isLive) {
|
|
789
|
+
B(
|
|
790
|
+
p("security.iris.notLive", "Liveness check failed — please blink or move slightly")
|
|
789
791
|
), F("idle");
|
|
790
792
|
return;
|
|
791
793
|
}
|
|
792
|
-
F("processing"),
|
|
793
|
-
const
|
|
794
|
-
if (!
|
|
795
|
-
|
|
794
|
+
F("processing"), B(p("security.iris.processing", "Processing iris pattern…"));
|
|
795
|
+
const D = z[z.length - 1], T = Je(D, n === "both" ? "left" : n);
|
|
796
|
+
if (!T) {
|
|
797
|
+
B(p("security.iris.noIrisDetected", "No iris detected — adjust position")), F("idle");
|
|
796
798
|
return;
|
|
797
799
|
}
|
|
798
|
-
if (
|
|
799
|
-
|
|
800
|
+
if (O(T), J(T.quality), T.quality < 0.1) {
|
|
801
|
+
B(p("security.iris.lowQuality", "Low quality — move closer")), F("idle");
|
|
800
802
|
return;
|
|
801
803
|
}
|
|
802
|
-
if (
|
|
803
|
-
const
|
|
804
|
-
if (
|
|
805
|
-
|
|
806
|
-
const d =
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
804
|
+
if (A && l.current) {
|
|
805
|
+
const m = l.current.getContext("2d");
|
|
806
|
+
if (m) {
|
|
807
|
+
m.clearRect(0, 0, S, S);
|
|
808
|
+
const d = S / D.width, k = S / D.height;
|
|
809
|
+
m.beginPath(), m.arc(
|
|
810
|
+
T.pupil.cx * d,
|
|
811
|
+
T.pupil.cy * k,
|
|
812
|
+
T.pupil.r * d,
|
|
811
813
|
0,
|
|
812
814
|
Math.PI * 2
|
|
813
|
-
),
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
815
|
+
), m.strokeStyle = re("var(--nice-danger, #ef4444)", m.canvas), m.lineWidth = 2, m.stroke(), m.beginPath(), m.arc(
|
|
816
|
+
T.iris.cx * d,
|
|
817
|
+
T.iris.cy * k,
|
|
818
|
+
T.iris.r * d,
|
|
817
819
|
0,
|
|
818
820
|
Math.PI * 2
|
|
819
|
-
),
|
|
821
|
+
), m.strokeStyle = re("var(--nice-primary, #3b82f6)", m.canvas), m.lineWidth = 2, m.stroke();
|
|
820
822
|
}
|
|
821
823
|
}
|
|
822
824
|
if (t === "enroll") {
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
+
const m = await Ze(T, f ?? `${n} eye`);
|
|
826
|
+
o == null || o(m, T), B(p("security.iris.enrolled", "Iris enrolled successfully")), F("success");
|
|
825
827
|
} else {
|
|
826
|
-
let
|
|
828
|
+
let m = 0;
|
|
827
829
|
for (const N of r) {
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
+
const M = Xe(N), U = Ye(T, M);
|
|
831
|
+
U > m && (m = U);
|
|
830
832
|
}
|
|
831
|
-
const d =
|
|
833
|
+
const d = m >= C.matchThreshold, k = {
|
|
832
834
|
success: d,
|
|
833
|
-
confidence:
|
|
835
|
+
confidence: m,
|
|
834
836
|
method: "iris",
|
|
835
837
|
timestamp: Date.now(),
|
|
836
838
|
duration: 0,
|
|
837
|
-
livenessPassed:
|
|
838
|
-
payload: btoa(JSON.stringify(
|
|
839
|
+
livenessPassed: C.livenessDetection ? !0 : void 0,
|
|
840
|
+
payload: btoa(JSON.stringify(T))
|
|
839
841
|
};
|
|
840
|
-
if (d &&
|
|
841
|
-
const N = await de(),
|
|
842
|
-
|
|
842
|
+
if (d && C.verifyEndpoint) {
|
|
843
|
+
const N = await de(), M = await ge(
|
|
844
|
+
C.verifyEndpoint,
|
|
843
845
|
{
|
|
844
846
|
method: "iris",
|
|
845
|
-
templateData:
|
|
846
|
-
matchScore:
|
|
847
|
+
templateData: k.payload,
|
|
848
|
+
matchScore: m,
|
|
847
849
|
deviceFingerprint: N
|
|
848
850
|
},
|
|
849
|
-
|
|
851
|
+
C.authToken
|
|
850
852
|
);
|
|
851
|
-
|
|
853
|
+
k.success = M.verified;
|
|
852
854
|
}
|
|
853
|
-
|
|
855
|
+
k.success ? (B(p("security.iris.verified", "Iris verified")), F("success")) : (_((N) => N + 1), Y + 1 >= C.maxRetries ? (B(p("security.iris.maxAttempts", "Maximum attempts reached")), F("failure")) : (B(p("security.iris.noMatch", "No match — try again")), F("idle"))), s == null || s(k);
|
|
854
856
|
}
|
|
855
|
-
} catch (
|
|
856
|
-
|
|
857
|
+
} catch (z) {
|
|
858
|
+
i == null || i(z instanceof Error ? z : new Error(String(z))), B(p("security.iris.error", "Scan error")), F("error");
|
|
857
859
|
}
|
|
858
860
|
}
|
|
859
861
|
}, [
|
|
860
862
|
h,
|
|
861
863
|
t,
|
|
862
864
|
r,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
+
C,
|
|
866
|
+
p,
|
|
865
867
|
F,
|
|
868
|
+
o,
|
|
866
869
|
s,
|
|
867
870
|
i,
|
|
868
|
-
a,
|
|
869
871
|
f,
|
|
870
872
|
n,
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
873
|
+
Y,
|
|
874
|
+
A,
|
|
875
|
+
S
|
|
874
876
|
]), E = h === "success" ? "var(--security-success)" : h === "failure" || h === "error" ? "var(--security-error)" : h === "scanning" || h === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
875
877
|
return /* @__PURE__ */ P(
|
|
876
878
|
"div",
|
|
877
879
|
{
|
|
878
|
-
className:
|
|
880
|
+
className: y,
|
|
879
881
|
style: { display: "inline-flex", flexDirection: "column", alignItems: "center", gap: 12 },
|
|
880
882
|
children: [
|
|
881
883
|
f && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--security-text)" }, children: f }),
|
|
@@ -883,8 +885,8 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
883
885
|
"div",
|
|
884
886
|
{
|
|
885
887
|
style: {
|
|
886
|
-
width:
|
|
887
|
-
height:
|
|
888
|
+
width: S,
|
|
889
|
+
height: S,
|
|
888
890
|
position: "relative",
|
|
889
891
|
borderRadius: "50%",
|
|
890
892
|
overflow: "hidden",
|
|
@@ -896,22 +898,22 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
896
898
|
/* @__PURE__ */ c(
|
|
897
899
|
"video",
|
|
898
900
|
{
|
|
899
|
-
ref:
|
|
901
|
+
ref: v,
|
|
900
902
|
style: { width: "100%", height: "100%", objectFit: "cover" },
|
|
901
903
|
playsInline: !0,
|
|
902
904
|
muted: !0
|
|
903
905
|
}
|
|
904
906
|
),
|
|
905
|
-
|
|
907
|
+
A && /* @__PURE__ */ c(
|
|
906
908
|
"canvas",
|
|
907
909
|
{
|
|
908
|
-
ref:
|
|
909
|
-
width:
|
|
910
|
-
height:
|
|
910
|
+
ref: l,
|
|
911
|
+
width: S,
|
|
912
|
+
height: S,
|
|
911
913
|
style: { position: "absolute", inset: 0, pointerEvents: "none" }
|
|
912
914
|
}
|
|
913
915
|
),
|
|
914
|
-
|
|
916
|
+
g && h === "idle" && /* @__PURE__ */ P(
|
|
915
917
|
"svg",
|
|
916
918
|
{
|
|
917
919
|
viewBox: "0 0 100 100",
|
|
@@ -970,7 +972,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
970
972
|
"div",
|
|
971
973
|
{
|
|
972
974
|
style: {
|
|
973
|
-
width:
|
|
975
|
+
width: S * 0.7,
|
|
974
976
|
height: 3,
|
|
975
977
|
background: E,
|
|
976
978
|
animation: "irisLineAnim 1.5s ease-in-out infinite",
|
|
@@ -993,14 +995,14 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
993
995
|
textTransform: "uppercase",
|
|
994
996
|
letterSpacing: 1
|
|
995
997
|
},
|
|
996
|
-
children: n === "both" ?
|
|
998
|
+
children: n === "both" ? p("security.iris.bothEyes", "Both eyes") : n === "left" ? p("security.iris.leftEye", "Left eye") : p("security.iris.rightEye", "Right eye")
|
|
997
999
|
}
|
|
998
1000
|
),
|
|
999
|
-
|
|
1001
|
+
x && G > 0 && /* @__PURE__ */ c(
|
|
1000
1002
|
"div",
|
|
1001
1003
|
{
|
|
1002
1004
|
style: {
|
|
1003
|
-
width:
|
|
1005
|
+
width: S * 0.6,
|
|
1004
1006
|
height: 4,
|
|
1005
1007
|
background: "var(--security-bg-panel)",
|
|
1006
1008
|
borderRadius: 2,
|
|
@@ -1010,9 +1012,9 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1010
1012
|
"div",
|
|
1011
1013
|
{
|
|
1012
1014
|
style: {
|
|
1013
|
-
width: `${Math.min(100,
|
|
1015
|
+
width: `${Math.min(100, G * 300)}%`,
|
|
1014
1016
|
height: "100%",
|
|
1015
|
-
background:
|
|
1017
|
+
background: G > 0.3 ? "var(--security-success)" : G > 0.1 ? "var(--security-warning)" : "var(--security-error)",
|
|
1016
1018
|
transition: "width 0.3s"
|
|
1017
1019
|
}
|
|
1018
1020
|
}
|
|
@@ -1028,7 +1030,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1028
1030
|
textAlign: "center",
|
|
1029
1031
|
minHeight: 20
|
|
1030
1032
|
},
|
|
1031
|
-
children:
|
|
1033
|
+
children: I ?? $
|
|
1032
1034
|
}
|
|
1033
1035
|
),
|
|
1034
1036
|
h !== "success" && h !== "failure" && /* @__PURE__ */ c(
|
|
@@ -1047,14 +1049,14 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1047
1049
|
cursor: "pointer",
|
|
1048
1050
|
opacity: h === "scanning" || h === "processing" ? 0.6 : 1
|
|
1049
1051
|
},
|
|
1050
|
-
children: t === "enroll" ?
|
|
1052
|
+
children: t === "enroll" ? p("security.iris.captureBtn", "Capture Iris") : p("security.iris.verifyBtn", "Verify Iris")
|
|
1051
1053
|
}
|
|
1052
1054
|
),
|
|
1053
1055
|
(h === "failure" || h === "error") && /* @__PURE__ */ c(
|
|
1054
1056
|
"button",
|
|
1055
1057
|
{
|
|
1056
1058
|
onClick: () => {
|
|
1057
|
-
|
|
1059
|
+
_(0), F("idle"), B("");
|
|
1058
1060
|
},
|
|
1059
1061
|
style: {
|
|
1060
1062
|
padding: "8px 20px",
|
|
@@ -1065,151 +1067,156 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1065
1067
|
borderRadius: "var(--security-radius)",
|
|
1066
1068
|
cursor: "pointer"
|
|
1067
1069
|
},
|
|
1068
|
-
children:
|
|
1070
|
+
children: p("security.common.retry", "Try Again")
|
|
1069
1071
|
}
|
|
1070
1072
|
),
|
|
1071
1073
|
/* @__PURE__ */ c("style", { children: `
|
|
1072
1074
|
@keyframes irisLineAnim {
|
|
1073
|
-
0%, 100% { transform: translateY(-${
|
|
1074
|
-
50% { transform: translateY(${
|
|
1075
|
+
0%, 100% { transform: translateY(-${S * 0.3}px); opacity: 0.3; }
|
|
1076
|
+
50% { transform: translateY(${S * 0.3}px); opacity: 0.8; }
|
|
1075
1077
|
}
|
|
1076
1078
|
` })
|
|
1077
1079
|
]
|
|
1078
1080
|
}
|
|
1079
1081
|
);
|
|
1080
|
-
}, ot = { sm: 240, md: 320, lg: 440 },
|
|
1082
|
+
}, ot = { sm: 240, md: 320, lg: 440 }, jt = (e) => {
|
|
1081
1083
|
const {
|
|
1082
1084
|
mode: t,
|
|
1083
1085
|
enrolledTemplates: r = [],
|
|
1084
1086
|
referencePhoto: n,
|
|
1085
|
-
onEnroll:
|
|
1086
|
-
onVerify:
|
|
1087
|
-
onStatusChange:
|
|
1088
|
-
onError:
|
|
1089
|
-
className:
|
|
1090
|
-
size:
|
|
1087
|
+
onEnroll: o,
|
|
1088
|
+
onVerify: s,
|
|
1089
|
+
onStatusChange: a,
|
|
1090
|
+
onError: i,
|
|
1091
|
+
className: y,
|
|
1092
|
+
size: b = "md",
|
|
1091
1093
|
label: f,
|
|
1092
|
-
showQuality:
|
|
1093
|
-
showBoundingBox:
|
|
1094
|
-
livenessSteps:
|
|
1095
|
-
showReference:
|
|
1096
|
-
instructionText:
|
|
1097
|
-
...
|
|
1098
|
-
} = e, { t:
|
|
1099
|
-
(
|
|
1100
|
-
|
|
1094
|
+
showQuality: x = !0,
|
|
1095
|
+
showBoundingBox: A = !0,
|
|
1096
|
+
livenessSteps: g = 1,
|
|
1097
|
+
showReference: I = !0,
|
|
1098
|
+
instructionText: L,
|
|
1099
|
+
...p
|
|
1100
|
+
} = e, { t: C } = te(), S = fe(p), v = ot[b], l = V(null), w = V(null), u = V(null), [h, R] = j("idle"), [G, J] = j(0), [W, O] = j(0), [Y, _] = j(""), [$, B] = j(null), [F, q] = j(0), H = K(
|
|
1101
|
+
(m) => {
|
|
1102
|
+
R(m), a == null || a(m);
|
|
1101
1103
|
},
|
|
1102
|
-
[
|
|
1103
|
-
), Q =
|
|
1104
|
+
[a]
|
|
1105
|
+
), Q = K(async () => {
|
|
1104
1106
|
try {
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
} catch (
|
|
1108
|
-
|
|
1107
|
+
const m = await pe("user");
|
|
1108
|
+
u.current = m, l.current && (l.current.srcObject = m, await l.current.play()), H("idle"), _(C("security.face.lookAtCamera", "Look at the camera"));
|
|
1109
|
+
} catch (m) {
|
|
1110
|
+
i == null || i(m instanceof Error ? m : new Error(String(m))), _(C("security.face.cameraError", "Camera access denied")), H("error");
|
|
1109
1111
|
}
|
|
1110
|
-
}, [
|
|
1111
|
-
var
|
|
1112
|
-
(
|
|
1112
|
+
}, [C, H, i]), E = K(() => {
|
|
1113
|
+
var m;
|
|
1114
|
+
(m = u.current) == null || m.getTracks().forEach((d) => d.stop()), u.current = null;
|
|
1113
1115
|
}, []);
|
|
1114
1116
|
ne(() => (Q(), E), [Q, E]);
|
|
1115
|
-
const
|
|
1116
|
-
(
|
|
1117
|
+
const z = K(
|
|
1118
|
+
(m) => {
|
|
1117
1119
|
var ie, ve, be;
|
|
1118
1120
|
const d = (ie = w.current) == null ? void 0 : ie.getContext("2d");
|
|
1119
1121
|
if (!d)
|
|
1120
1122
|
return;
|
|
1121
|
-
const
|
|
1122
|
-
if (d.clearRect(0, 0,
|
|
1123
|
+
const k = w.current.width, N = w.current.height;
|
|
1124
|
+
if (d.clearRect(0, 0, k, N), !m || !A)
|
|
1123
1125
|
return;
|
|
1124
|
-
const
|
|
1126
|
+
const M = m.boundingBox, U = k / (((ve = l.current) == null ? void 0 : ve.videoWidth) ?? k), Z = N / (((be = l.current) == null ? void 0 : be.videoHeight) ?? N);
|
|
1125
1127
|
d.strokeStyle = re(
|
|
1126
1128
|
h === "success" ? "var(--nice-success, #10b981)" : "var(--nice-primary, #3b82f6)",
|
|
1127
1129
|
d.canvas
|
|
1128
|
-
), d.lineWidth = 2, d.setLineDash([6, 4]), d.strokeRect(
|
|
1129
|
-
const
|
|
1130
|
-
[
|
|
1131
|
-
[(
|
|
1132
|
-
[
|
|
1133
|
-
[(
|
|
1130
|
+
), d.lineWidth = 2, d.setLineDash([6, 4]), d.strokeRect(M.x * U, M.y * Z, M.width * U, M.height * Z), d.setLineDash([]);
|
|
1131
|
+
const ee = [
|
|
1132
|
+
[M.x * U, M.y * Z],
|
|
1133
|
+
[(M.x + M.width) * U, M.y * Z],
|
|
1134
|
+
[M.x * U, (M.y + M.height) * Z],
|
|
1135
|
+
[(M.x + M.width) * U, (M.y + M.height) * Z]
|
|
1134
1136
|
], X = 12;
|
|
1135
1137
|
d.lineWidth = 3;
|
|
1136
|
-
for (const [se, oe] of
|
|
1137
|
-
d.beginPath(), d.moveTo(se ===
|
|
1138
|
+
for (const [se, oe] of ee)
|
|
1139
|
+
d.beginPath(), d.moveTo(se === M.x * U ? se : se - X, oe), d.lineTo(se, oe), d.lineTo(se, oe === M.y * Z ? oe + X : oe - X), d.stroke();
|
|
1138
1140
|
},
|
|
1139
|
-
[
|
|
1140
|
-
),
|
|
1141
|
-
if (!(!
|
|
1142
|
-
|
|
1141
|
+
[A, h]
|
|
1142
|
+
), D = K(async () => {
|
|
1143
|
+
if (!(!l.current || h === "processing" || h === "success")) {
|
|
1144
|
+
H("scanning"), _(C("security.face.scanning", "Scanning face…"));
|
|
1143
1145
|
try {
|
|
1144
|
-
if (
|
|
1145
|
-
const
|
|
1146
|
-
for (let
|
|
1147
|
-
|
|
1148
|
-
if (!Ie(
|
|
1149
|
-
|
|
1146
|
+
if (S.livenessDetection) {
|
|
1147
|
+
const k = [];
|
|
1148
|
+
for (let M = 0; M < 8; M++)
|
|
1149
|
+
k.push(le(l.current).imageData), await new Promise((U) => setTimeout(U, 200));
|
|
1150
|
+
if (!Ie(k).isLive) {
|
|
1151
|
+
_(C("security.face.notLive", "Liveness check failed — move naturally")), H("idle");
|
|
1150
1152
|
return;
|
|
1151
1153
|
}
|
|
1152
1154
|
}
|
|
1153
|
-
|
|
1154
|
-
const { imageData:
|
|
1155
|
+
H("processing"), _(C("security.face.processing", "Analysing face…"));
|
|
1156
|
+
const { imageData: m } = le(l.current);
|
|
1155
1157
|
if (t === "compare" && n) {
|
|
1156
|
-
const
|
|
1158
|
+
const k = typeof n == "string" ? await at(n) : ct(n), {
|
|
1157
1159
|
similarity: N,
|
|
1158
|
-
cameraFeatures:
|
|
1159
|
-
refFeatures:
|
|
1160
|
-
} =
|
|
1161
|
-
|
|
1162
|
-
const
|
|
1163
|
-
success: N >=
|
|
1160
|
+
cameraFeatures: M,
|
|
1161
|
+
refFeatures: U
|
|
1162
|
+
} = Qe(m, k);
|
|
1163
|
+
q(N), J((M == null ? void 0 : M.quality) ?? 0), z(M);
|
|
1164
|
+
const ee = {
|
|
1165
|
+
success: N >= S.matchThreshold,
|
|
1164
1166
|
confidence: N,
|
|
1165
1167
|
method: "face",
|
|
1166
1168
|
timestamp: Date.now(),
|
|
1167
1169
|
duration: 0,
|
|
1168
|
-
livenessPassed:
|
|
1170
|
+
livenessPassed: S.livenessDetection
|
|
1169
1171
|
};
|
|
1170
|
-
|
|
1172
|
+
ee.success ? (_(
|
|
1173
|
+
C("security.face.matchFound", "Match: {percent}%").replace(
|
|
1174
|
+
"{percent}",
|
|
1175
|
+
(N * 100).toFixed(0)
|
|
1176
|
+
)
|
|
1177
|
+
), H("success")) : (O((X) => X + 1), W + 1 >= S.maxRetries ? (_(C("security.face.maxAttempts", "Maximum attempts reached")), H("failure")) : (_(C("security.face.noMatch", "No match — try again")), H("idle"))), s == null || s(ee);
|
|
1171
1178
|
return;
|
|
1172
1179
|
}
|
|
1173
|
-
const d = he(
|
|
1180
|
+
const d = he(m);
|
|
1174
1181
|
if (!d) {
|
|
1175
|
-
|
|
1182
|
+
_(C("security.face.noFaceDetected", "No face detected")), H("idle");
|
|
1176
1183
|
return;
|
|
1177
1184
|
}
|
|
1178
|
-
if (
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1185
|
+
if (J(d.quality), z(d), t === "enroll") {
|
|
1186
|
+
const k = await Ve(d, f ?? "face");
|
|
1187
|
+
o == null || o(k, d), _(C("security.face.enrolled", "Face enrolled successfully")), H("success");
|
|
1181
1188
|
} else {
|
|
1182
|
-
let
|
|
1183
|
-
for (const
|
|
1184
|
-
const Z =
|
|
1185
|
-
|
|
1189
|
+
let k = 0;
|
|
1190
|
+
for (const U of r) {
|
|
1191
|
+
const Z = et(U), ee = Te(d, Z);
|
|
1192
|
+
ee > k && (k = ee);
|
|
1186
1193
|
}
|
|
1187
|
-
|
|
1188
|
-
const N =
|
|
1194
|
+
q(k);
|
|
1195
|
+
const N = k >= S.matchThreshold, M = {
|
|
1189
1196
|
success: N,
|
|
1190
|
-
confidence:
|
|
1197
|
+
confidence: k,
|
|
1191
1198
|
method: "face",
|
|
1192
1199
|
timestamp: Date.now(),
|
|
1193
1200
|
duration: 0,
|
|
1194
|
-
livenessPassed:
|
|
1201
|
+
livenessPassed: S.livenessDetection
|
|
1195
1202
|
};
|
|
1196
|
-
if (N &&
|
|
1197
|
-
const
|
|
1198
|
-
|
|
1203
|
+
if (N && S.verifyEndpoint) {
|
|
1204
|
+
const U = await de(), Z = await ge(
|
|
1205
|
+
S.verifyEndpoint,
|
|
1199
1206
|
{
|
|
1200
1207
|
method: "face",
|
|
1201
1208
|
templateData: btoa(JSON.stringify(d)),
|
|
1202
|
-
matchScore:
|
|
1203
|
-
deviceFingerprint:
|
|
1209
|
+
matchScore: k,
|
|
1210
|
+
deviceFingerprint: U
|
|
1204
1211
|
},
|
|
1205
|
-
|
|
1212
|
+
S.authToken
|
|
1206
1213
|
);
|
|
1207
|
-
|
|
1214
|
+
M.success = Z.verified;
|
|
1208
1215
|
}
|
|
1209
|
-
|
|
1216
|
+
M.success ? (_(C("security.face.verified", "Face verified")), H("success")) : (O((U) => U + 1), W + 1 >= S.maxRetries ? (_(C("security.face.maxAttempts", "Maximum attempts reached")), H("failure")) : (_(C("security.face.noMatch", "No match — try again")), H("idle"))), s == null || s(M);
|
|
1210
1217
|
}
|
|
1211
|
-
} catch (
|
|
1212
|
-
|
|
1218
|
+
} catch (m) {
|
|
1219
|
+
i == null || i(m instanceof Error ? m : new Error(String(m))), _(C("security.face.error", "Error — try again")), H("error");
|
|
1213
1220
|
}
|
|
1214
1221
|
}
|
|
1215
1222
|
}, [
|
|
@@ -1217,20 +1224,20 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1217
1224
|
t,
|
|
1218
1225
|
r,
|
|
1219
1226
|
n,
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1227
|
+
S,
|
|
1228
|
+
C,
|
|
1229
|
+
H,
|
|
1230
|
+
o,
|
|
1223
1231
|
s,
|
|
1224
1232
|
i,
|
|
1225
|
-
a,
|
|
1226
1233
|
f,
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
]),
|
|
1234
|
+
W,
|
|
1235
|
+
z
|
|
1236
|
+
]), T = h === "success" ? "var(--security-success)" : h === "failure" || h === "error" ? "var(--security-error)" : h === "scanning" || h === "processing" ? "var(--security-biometric)" : "var(--security-border)";
|
|
1230
1237
|
return /* @__PURE__ */ P(
|
|
1231
1238
|
"div",
|
|
1232
1239
|
{
|
|
1233
|
-
className:
|
|
1240
|
+
className: y,
|
|
1234
1241
|
style: {
|
|
1235
1242
|
display: "inline-flex",
|
|
1236
1243
|
flexDirection: "column",
|
|
@@ -1244,20 +1251,20 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1244
1251
|
"div",
|
|
1245
1252
|
{
|
|
1246
1253
|
style: {
|
|
1247
|
-
width:
|
|
1248
|
-
height:
|
|
1254
|
+
width: v,
|
|
1255
|
+
height: v * 0.75,
|
|
1249
1256
|
position: "relative",
|
|
1250
1257
|
borderRadius: "var(--security-radius-lg)",
|
|
1251
1258
|
overflow: "hidden",
|
|
1252
|
-
border: `3px solid ${
|
|
1253
|
-
boxShadow: h === "scanning" ? `0 0 20px ${
|
|
1259
|
+
border: `3px solid ${T}`,
|
|
1260
|
+
boxShadow: h === "scanning" ? `0 0 20px ${T}` : "var(--security-shadow)",
|
|
1254
1261
|
transition: "border-color 0.3s, box-shadow 0.3s"
|
|
1255
1262
|
},
|
|
1256
1263
|
children: [
|
|
1257
1264
|
/* @__PURE__ */ c(
|
|
1258
1265
|
"video",
|
|
1259
1266
|
{
|
|
1260
|
-
ref:
|
|
1267
|
+
ref: l,
|
|
1261
1268
|
style: { width: "100%", height: "100%", objectFit: "cover", transform: "scaleX(-1)" },
|
|
1262
1269
|
playsInline: !0,
|
|
1263
1270
|
muted: !0
|
|
@@ -1267,8 +1274,8 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1267
1274
|
"canvas",
|
|
1268
1275
|
{
|
|
1269
1276
|
ref: w,
|
|
1270
|
-
width:
|
|
1271
|
-
height:
|
|
1277
|
+
width: v,
|
|
1278
|
+
height: v * 0.75,
|
|
1272
1279
|
style: {
|
|
1273
1280
|
position: "absolute",
|
|
1274
1281
|
inset: 0,
|
|
@@ -1323,7 +1330,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1323
1330
|
height: 50,
|
|
1324
1331
|
borderRadius: "50%",
|
|
1325
1332
|
border: "3px solid transparent",
|
|
1326
|
-
borderTopColor:
|
|
1333
|
+
borderTopColor: T,
|
|
1327
1334
|
animation: "spin 0.8s linear infinite"
|
|
1328
1335
|
}
|
|
1329
1336
|
}
|
|
@@ -1333,12 +1340,12 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1333
1340
|
]
|
|
1334
1341
|
}
|
|
1335
1342
|
),
|
|
1336
|
-
t === "compare" &&
|
|
1343
|
+
t === "compare" && I && n && /* @__PURE__ */ P(
|
|
1337
1344
|
"div",
|
|
1338
1345
|
{
|
|
1339
1346
|
style: {
|
|
1340
|
-
width:
|
|
1341
|
-
height:
|
|
1347
|
+
width: v * 0.4,
|
|
1348
|
+
height: v * 0.5,
|
|
1342
1349
|
borderRadius: "var(--security-radius)",
|
|
1343
1350
|
overflow: "hidden",
|
|
1344
1351
|
border: "2px solid var(--security-border)"
|
|
@@ -1348,7 +1355,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1348
1355
|
"img",
|
|
1349
1356
|
{
|
|
1350
1357
|
src: typeof n == "string" ? n : void 0,
|
|
1351
|
-
alt:
|
|
1358
|
+
alt: C("security.face.referenceAlt", "Reference"),
|
|
1352
1359
|
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
1353
1360
|
}
|
|
1354
1361
|
),
|
|
@@ -1362,7 +1369,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1362
1369
|
color: "var(--security-text-muted)",
|
|
1363
1370
|
background: "var(--security-bg-panel)"
|
|
1364
1371
|
},
|
|
1365
|
-
children:
|
|
1372
|
+
children: C("security.face.reference", "Reference")
|
|
1366
1373
|
}
|
|
1367
1374
|
)
|
|
1368
1375
|
]
|
|
@@ -1371,7 +1378,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1371
1378
|
] }),
|
|
1372
1379
|
F > 0 && /* @__PURE__ */ P("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13 }, children: [
|
|
1373
1380
|
/* @__PURE__ */ P("span", { style: { color: "var(--security-text-secondary)" }, children: [
|
|
1374
|
-
|
|
1381
|
+
C("security.face.confidence", "Confidence"),
|
|
1375
1382
|
":"
|
|
1376
1383
|
] }),
|
|
1377
1384
|
/* @__PURE__ */ c(
|
|
@@ -1390,7 +1397,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1390
1397
|
style: {
|
|
1391
1398
|
width: `${F * 100}%`,
|
|
1392
1399
|
height: "100%",
|
|
1393
|
-
background: F >=
|
|
1400
|
+
background: F >= S.matchThreshold ? "var(--security-success)" : "var(--security-warning)"
|
|
1394
1401
|
}
|
|
1395
1402
|
}
|
|
1396
1403
|
)
|
|
@@ -1401,7 +1408,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1401
1408
|
{
|
|
1402
1409
|
style: {
|
|
1403
1410
|
fontWeight: 600,
|
|
1404
|
-
color: F >=
|
|
1411
|
+
color: F >= S.matchThreshold ? "var(--security-success)" : "var(--security-warning)"
|
|
1405
1412
|
},
|
|
1406
1413
|
children: [
|
|
1407
1414
|
(F * 100).toFixed(0),
|
|
@@ -1419,13 +1426,13 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1419
1426
|
textAlign: "center",
|
|
1420
1427
|
minHeight: 20
|
|
1421
1428
|
},
|
|
1422
|
-
children:
|
|
1429
|
+
children: L ?? Y
|
|
1423
1430
|
}
|
|
1424
1431
|
),
|
|
1425
1432
|
h !== "success" && h !== "failure" && /* @__PURE__ */ c(
|
|
1426
1433
|
"button",
|
|
1427
1434
|
{
|
|
1428
|
-
onClick:
|
|
1435
|
+
onClick: D,
|
|
1429
1436
|
disabled: h === "scanning" || h === "processing",
|
|
1430
1437
|
style: {
|
|
1431
1438
|
padding: "10px 24px",
|
|
@@ -1438,14 +1445,14 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1438
1445
|
cursor: "pointer",
|
|
1439
1446
|
opacity: h === "scanning" || h === "processing" ? 0.6 : 1
|
|
1440
1447
|
},
|
|
1441
|
-
children: t === "enroll" ?
|
|
1448
|
+
children: t === "enroll" ? C("security.face.captureBtn", "Capture Face") : t === "compare" ? C("security.face.compareBtn", "Compare") : C("security.face.verifyBtn", "Verify Face")
|
|
1442
1449
|
}
|
|
1443
1450
|
),
|
|
1444
1451
|
(h === "failure" || h === "error") && /* @__PURE__ */ c(
|
|
1445
1452
|
"button",
|
|
1446
1453
|
{
|
|
1447
1454
|
onClick: () => {
|
|
1448
|
-
|
|
1455
|
+
O(0), q(0), H("idle"), _("");
|
|
1449
1456
|
},
|
|
1450
1457
|
style: {
|
|
1451
1458
|
padding: "8px 20px",
|
|
@@ -1456,7 +1463,7 @@ const it = { sm: 200, md: 280, lg: 380 }, Nt = (e) => {
|
|
|
1456
1463
|
borderRadius: "var(--security-radius)",
|
|
1457
1464
|
cursor: "pointer"
|
|
1458
1465
|
},
|
|
1459
|
-
children:
|
|
1466
|
+
children: C("security.common.retry", "Try Again")
|
|
1460
1467
|
}
|
|
1461
1468
|
),
|
|
1462
1469
|
/* @__PURE__ */ c("style", { children: "@keyframes spin { to { transform: rotate(360deg); } }" })
|
|
@@ -1468,10 +1475,10 @@ async function at(e) {
|
|
|
1468
1475
|
return new Promise((t, r) => {
|
|
1469
1476
|
const n = new Image();
|
|
1470
1477
|
n.crossOrigin = "anonymous", n.onload = () => {
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1478
|
+
const o = document.createElement("canvas");
|
|
1479
|
+
o.width = n.naturalWidth, o.height = n.naturalHeight;
|
|
1480
|
+
const s = o.getContext("2d");
|
|
1481
|
+
s.drawImage(n, 0, 0), t(s.getImageData(0, 0, o.width, o.height));
|
|
1475
1482
|
}, n.onerror = () => r(new Error("Failed to load reference image")), n.src = e;
|
|
1476
1483
|
});
|
|
1477
1484
|
}
|
|
@@ -1486,115 +1493,115 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1486
1493
|
length: t = lt,
|
|
1487
1494
|
scramble: r = !1,
|
|
1488
1495
|
showDigits: n = !1,
|
|
1489
|
-
maxAttempts:
|
|
1490
|
-
lockoutDuration:
|
|
1491
|
-
keySize:
|
|
1492
|
-
haptic:
|
|
1493
|
-
keyLabels:
|
|
1494
|
-
expectedHash:
|
|
1496
|
+
maxAttempts: o = ut,
|
|
1497
|
+
lockoutDuration: s = dt,
|
|
1498
|
+
keySize: a = 64,
|
|
1499
|
+
haptic: i = !0,
|
|
1500
|
+
keyLabels: y,
|
|
1501
|
+
expectedHash: b,
|
|
1495
1502
|
expectedPin: f,
|
|
1496
|
-
mode:
|
|
1497
|
-
onComplete:
|
|
1498
|
-
onVerify:
|
|
1499
|
-
onStatusChange:
|
|
1500
|
-
onError:
|
|
1501
|
-
showBiometricFallback:
|
|
1502
|
-
onBiometricFallback:
|
|
1503
|
-
label:
|
|
1504
|
-
className:
|
|
1505
|
-
} = e, { t:
|
|
1506
|
-
const
|
|
1503
|
+
mode: x = "verify",
|
|
1504
|
+
onComplete: A,
|
|
1505
|
+
onVerify: g,
|
|
1506
|
+
onStatusChange: I,
|
|
1507
|
+
onError: L,
|
|
1508
|
+
showBiometricFallback: p = !1,
|
|
1509
|
+
onBiometricFallback: C,
|
|
1510
|
+
label: S,
|
|
1511
|
+
className: v
|
|
1512
|
+
} = e, { t: l } = te(), [w, u] = j([]), [h, R] = j("idle"), [G, J] = j(0), [W, O] = j(0), [Y, _] = j(null), $ = V(void 0), B = ae(() => {
|
|
1513
|
+
const D = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "", "0", "back"];
|
|
1507
1514
|
if (!r)
|
|
1508
|
-
return
|
|
1509
|
-
const
|
|
1510
|
-
for (let
|
|
1515
|
+
return D;
|
|
1516
|
+
const T = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
1517
|
+
for (let m = T.length - 1; m > 0; m--) {
|
|
1511
1518
|
const d = new Uint32Array(1);
|
|
1512
1519
|
crypto.getRandomValues(d);
|
|
1513
|
-
const
|
|
1514
|
-
[
|
|
1520
|
+
const k = d[0] % (m + 1);
|
|
1521
|
+
[T[m], T[k]] = [T[k], T[m]];
|
|
1515
1522
|
}
|
|
1516
1523
|
return [
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1524
|
+
T[0],
|
|
1525
|
+
T[1],
|
|
1526
|
+
T[2],
|
|
1527
|
+
T[3],
|
|
1528
|
+
T[4],
|
|
1529
|
+
T[5],
|
|
1530
|
+
T[6],
|
|
1531
|
+
T[7],
|
|
1532
|
+
T[8],
|
|
1526
1533
|
"",
|
|
1527
|
-
|
|
1534
|
+
T[9],
|
|
1528
1535
|
"back"
|
|
1529
1536
|
];
|
|
1530
|
-
}, [r, h]), F =
|
|
1531
|
-
(
|
|
1532
|
-
|
|
1537
|
+
}, [r, h]), F = K(
|
|
1538
|
+
(D) => {
|
|
1539
|
+
R(D), I == null || I(D);
|
|
1533
1540
|
},
|
|
1534
|
-
[
|
|
1541
|
+
[I]
|
|
1535
1542
|
);
|
|
1536
1543
|
ne(() => {
|
|
1537
|
-
if (!(
|
|
1544
|
+
if (!(W <= Date.now()))
|
|
1538
1545
|
return $.current = setInterval(() => {
|
|
1539
|
-
Date.now() >=
|
|
1546
|
+
Date.now() >= W && (clearInterval($.current), F("idle"), J(0), u([]));
|
|
1540
1547
|
}, 500), () => clearInterval($.current);
|
|
1541
|
-
}, [
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1544
|
-
}, [
|
|
1545
|
-
async (
|
|
1546
|
-
if (
|
|
1548
|
+
}, [W, F]);
|
|
1549
|
+
const q = W > Date.now(), H = K(() => {
|
|
1550
|
+
i && navigator.vibrate && navigator.vibrate(20);
|
|
1551
|
+
}, [i]), Q = K(
|
|
1552
|
+
async (D) => {
|
|
1553
|
+
if (q || h === "success")
|
|
1547
1554
|
return;
|
|
1548
|
-
if (
|
|
1549
|
-
|
|
1555
|
+
if (H(), D === "back") {
|
|
1556
|
+
u((k) => k.slice(0, -1));
|
|
1550
1557
|
return;
|
|
1551
1558
|
}
|
|
1552
|
-
if (
|
|
1559
|
+
if (D === "")
|
|
1553
1560
|
return;
|
|
1554
|
-
const
|
|
1555
|
-
if (
|
|
1561
|
+
const T = [...w, D];
|
|
1562
|
+
if (u(T), T.length < t)
|
|
1556
1563
|
return;
|
|
1557
|
-
const
|
|
1558
|
-
if (F("processing"),
|
|
1559
|
-
if (
|
|
1560
|
-
|
|
1564
|
+
const m = T.join("");
|
|
1565
|
+
if (F("processing"), x === "set") {
|
|
1566
|
+
if (Y === null) {
|
|
1567
|
+
_(m), u([]), F("idle");
|
|
1561
1568
|
return;
|
|
1562
1569
|
}
|
|
1563
|
-
if (
|
|
1564
|
-
|
|
1570
|
+
if (Y !== m) {
|
|
1571
|
+
_(null), u([]), F("failure"), setTimeout(() => F("idle"), 1200);
|
|
1565
1572
|
return;
|
|
1566
1573
|
}
|
|
1567
|
-
|
|
1574
|
+
A == null || A(m), F("success");
|
|
1568
1575
|
return;
|
|
1569
1576
|
}
|
|
1570
1577
|
let d = !1;
|
|
1571
|
-
if (
|
|
1572
|
-
const
|
|
1573
|
-
d = Array.from(new Uint8Array(N)).map((
|
|
1578
|
+
if (b) {
|
|
1579
|
+
const k = new TextEncoder(), N = await crypto.subtle.digest("SHA-256", k.encode(m));
|
|
1580
|
+
d = Array.from(new Uint8Array(N)).map((U) => U.toString(16).padStart(2, "0")).join("") === b;
|
|
1574
1581
|
} else if (f)
|
|
1575
|
-
d =
|
|
1582
|
+
d = m === f;
|
|
1576
1583
|
else {
|
|
1577
|
-
|
|
1584
|
+
A == null || A(m), F("success");
|
|
1578
1585
|
return;
|
|
1579
1586
|
}
|
|
1580
1587
|
if (d)
|
|
1581
|
-
F("success"),
|
|
1588
|
+
F("success"), g == null || g({
|
|
1582
1589
|
success: !0,
|
|
1583
1590
|
confidence: 1,
|
|
1584
1591
|
method: "pin",
|
|
1585
1592
|
timestamp: Date.now(),
|
|
1586
1593
|
duration: 0
|
|
1587
|
-
}),
|
|
1594
|
+
}), A == null || A(m);
|
|
1588
1595
|
else {
|
|
1589
|
-
const
|
|
1590
|
-
if (
|
|
1591
|
-
const N = Date.now() +
|
|
1592
|
-
|
|
1596
|
+
const k = G + 1;
|
|
1597
|
+
if (J(k), k >= o) {
|
|
1598
|
+
const N = Date.now() + s;
|
|
1599
|
+
O(N), F("failure"), L == null || L(new Error("Too many failed PIN attempts"));
|
|
1593
1600
|
} else
|
|
1594
1601
|
F("failure"), setTimeout(() => {
|
|
1595
|
-
F("idle"),
|
|
1602
|
+
F("idle"), u([]);
|
|
1596
1603
|
}, 800);
|
|
1597
|
-
|
|
1604
|
+
g == null || g({
|
|
1598
1605
|
success: !1,
|
|
1599
1606
|
confidence: 0,
|
|
1600
1607
|
method: "pin",
|
|
@@ -1606,26 +1613,26 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1606
1613
|
[
|
|
1607
1614
|
w,
|
|
1608
1615
|
t,
|
|
1609
|
-
|
|
1616
|
+
q,
|
|
1610
1617
|
h,
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1618
|
+
x,
|
|
1619
|
+
Y,
|
|
1620
|
+
b,
|
|
1614
1621
|
f,
|
|
1615
|
-
|
|
1622
|
+
G,
|
|
1623
|
+
o,
|
|
1616
1624
|
s,
|
|
1617
|
-
|
|
1618
|
-
O,
|
|
1625
|
+
H,
|
|
1619
1626
|
F,
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1627
|
+
A,
|
|
1628
|
+
g,
|
|
1629
|
+
L
|
|
1623
1630
|
]
|
|
1624
|
-
), E = Math.max(0, Math.ceil((
|
|
1631
|
+
), E = Math.max(0, Math.ceil((W - Date.now()) / 1e3)), z = h === "success" ? "var(--security-success)" : h === "failure" ? "var(--security-error)" : "var(--security-border)";
|
|
1625
1632
|
return /* @__PURE__ */ P(
|
|
1626
1633
|
"div",
|
|
1627
1634
|
{
|
|
1628
|
-
className:
|
|
1635
|
+
className: v,
|
|
1629
1636
|
style: {
|
|
1630
1637
|
display: "inline-flex",
|
|
1631
1638
|
flexDirection: "column",
|
|
@@ -1635,7 +1642,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1635
1642
|
color: "var(--security-text)"
|
|
1636
1643
|
},
|
|
1637
1644
|
children: [
|
|
1638
|
-
|
|
1645
|
+
S && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600 }, children: S }),
|
|
1639
1646
|
/* @__PURE__ */ c(
|
|
1640
1647
|
"div",
|
|
1641
1648
|
{
|
|
@@ -1645,51 +1652,54 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1645
1652
|
minHeight: 18,
|
|
1646
1653
|
textAlign: "center"
|
|
1647
1654
|
},
|
|
1648
|
-
children:
|
|
1655
|
+
children: q ? l("security.pin.locked", "Locked — try again in {seconds}s").replace(
|
|
1656
|
+
"{seconds}",
|
|
1657
|
+
String(E)
|
|
1658
|
+
) : x === "set" && Y !== null ? l("security.pin.confirm", "Confirm your PIN") : x === "set" ? l("security.pin.setNew", "Enter a new PIN") : l("security.pin.enter", "Enter your PIN")
|
|
1649
1659
|
}
|
|
1650
1660
|
),
|
|
1651
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 12 }, children: Array.from({ length: t }, (
|
|
1661
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 12 }, children: Array.from({ length: t }, (D, T) => /* @__PURE__ */ c(
|
|
1652
1662
|
"div",
|
|
1653
1663
|
{
|
|
1654
1664
|
style: {
|
|
1655
1665
|
width: 16,
|
|
1656
1666
|
height: 16,
|
|
1657
1667
|
borderRadius: "50%",
|
|
1658
|
-
border: `2px solid ${
|
|
1659
|
-
background:
|
|
1668
|
+
border: `2px solid ${z}`,
|
|
1669
|
+
background: T < w.length ? z : "transparent",
|
|
1660
1670
|
transition: "background 0.15s, border-color 0.15s"
|
|
1661
1671
|
}
|
|
1662
1672
|
},
|
|
1663
|
-
|
|
1673
|
+
T
|
|
1664
1674
|
)) }),
|
|
1665
1675
|
/* @__PURE__ */ c(
|
|
1666
1676
|
"div",
|
|
1667
1677
|
{
|
|
1668
1678
|
style: {
|
|
1669
1679
|
display: "grid",
|
|
1670
|
-
gridTemplateColumns: `repeat(3, ${
|
|
1680
|
+
gridTemplateColumns: `repeat(3, ${a}px)`,
|
|
1671
1681
|
gap: 10,
|
|
1672
|
-
opacity:
|
|
1673
|
-
pointerEvents:
|
|
1682
|
+
opacity: q ? 0.4 : 1,
|
|
1683
|
+
pointerEvents: q ? "none" : "auto"
|
|
1674
1684
|
},
|
|
1675
|
-
children:
|
|
1676
|
-
if (
|
|
1677
|
-
return /* @__PURE__ */ c("div", {},
|
|
1678
|
-
const
|
|
1685
|
+
children: B.map((D, T) => {
|
|
1686
|
+
if (D === "")
|
|
1687
|
+
return /* @__PURE__ */ c("div", {}, T);
|
|
1688
|
+
const m = D === "back";
|
|
1679
1689
|
return /* @__PURE__ */ c(
|
|
1680
1690
|
"button",
|
|
1681
1691
|
{
|
|
1682
|
-
onClick: () => Q(
|
|
1683
|
-
disabled:
|
|
1684
|
-
"aria-label":
|
|
1692
|
+
onClick: () => Q(D),
|
|
1693
|
+
disabled: q || h === "success",
|
|
1694
|
+
"aria-label": m ? l("security.pin.backspace", "Backspace") : D,
|
|
1685
1695
|
style: {
|
|
1686
|
-
width:
|
|
1687
|
-
height:
|
|
1696
|
+
width: a,
|
|
1697
|
+
height: a,
|
|
1688
1698
|
borderRadius: "var(--security-key-border-radius, 50%)",
|
|
1689
1699
|
border: "1px solid var(--security-key-border, var(--security-border))",
|
|
1690
1700
|
background: "var(--security-key-bg, var(--security-bg-panel))",
|
|
1691
1701
|
color: "var(--security-key-text, var(--security-text))",
|
|
1692
|
-
fontSize:
|
|
1702
|
+
fontSize: m ? 20 : 22,
|
|
1693
1703
|
fontWeight: 600,
|
|
1694
1704
|
cursor: "pointer",
|
|
1695
1705
|
display: "flex",
|
|
@@ -1707,9 +1717,9 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1707
1717
|
onMouseLeave: (d) => {
|
|
1708
1718
|
d.currentTarget.style.transform = "";
|
|
1709
1719
|
},
|
|
1710
|
-
children:
|
|
1720
|
+
children: m ? /* @__PURE__ */ c(Ne, { size: 22 }) : (y == null ? void 0 : y[D]) ?? D
|
|
1711
1721
|
},
|
|
1712
|
-
|
|
1722
|
+
T
|
|
1713
1723
|
);
|
|
1714
1724
|
})
|
|
1715
1725
|
}
|
|
@@ -1717,7 +1727,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1717
1727
|
w.length > 0 && h !== "success" && /* @__PURE__ */ c(
|
|
1718
1728
|
"button",
|
|
1719
1729
|
{
|
|
1720
|
-
onClick: () =>
|
|
1730
|
+
onClick: () => u([]),
|
|
1721
1731
|
style: {
|
|
1722
1732
|
fontSize: 12,
|
|
1723
1733
|
background: "none",
|
|
@@ -1726,13 +1736,13 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1726
1736
|
cursor: "pointer",
|
|
1727
1737
|
textDecoration: "underline"
|
|
1728
1738
|
},
|
|
1729
|
-
children:
|
|
1739
|
+
children: l("security.pin.clear", "Clear")
|
|
1730
1740
|
}
|
|
1731
1741
|
),
|
|
1732
|
-
|
|
1742
|
+
p && /* @__PURE__ */ c(
|
|
1733
1743
|
"button",
|
|
1734
1744
|
{
|
|
1735
|
-
onClick:
|
|
1745
|
+
onClick: C,
|
|
1736
1746
|
style: {
|
|
1737
1747
|
fontSize: 13,
|
|
1738
1748
|
padding: "8px 16px",
|
|
@@ -1742,158 +1752,158 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1742
1752
|
color: "var(--security-biometric)",
|
|
1743
1753
|
cursor: "pointer"
|
|
1744
1754
|
},
|
|
1745
|
-
children:
|
|
1755
|
+
children: l("security.pin.biometricFallback", "Use biometrics instead")
|
|
1746
1756
|
}
|
|
1747
1757
|
),
|
|
1748
|
-
|
|
1758
|
+
G > 0 && h !== "success" && !q && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: l("security.pin.attempts", "{attempts}/{max} attempts").replace("{attempts}", String(G)).replace("{max}", String(o)) })
|
|
1749
1759
|
]
|
|
1750
1760
|
}
|
|
1751
1761
|
);
|
|
1752
|
-
}, ht = 3, ft = 4, yt = 5, pt = 14,
|
|
1762
|
+
}, ht = 3, ft = 4, yt = 5, pt = 14, Bt = (e) => {
|
|
1753
1763
|
const {
|
|
1754
1764
|
gridSize: t = ht,
|
|
1755
1765
|
minLength: r = ft,
|
|
1756
1766
|
showTrail: n = !0,
|
|
1757
|
-
showError:
|
|
1758
|
-
maxAttempts:
|
|
1759
|
-
dotSize:
|
|
1760
|
-
trailColor:
|
|
1761
|
-
mode:
|
|
1762
|
-
expectedHash:
|
|
1767
|
+
showError: o = !0,
|
|
1768
|
+
maxAttempts: s = yt,
|
|
1769
|
+
dotSize: a = pt,
|
|
1770
|
+
trailColor: i,
|
|
1771
|
+
mode: y = "verify",
|
|
1772
|
+
expectedHash: b,
|
|
1763
1773
|
expectedPattern: f,
|
|
1764
|
-
onComplete:
|
|
1765
|
-
onVerify:
|
|
1766
|
-
onStatusChange:
|
|
1767
|
-
onError:
|
|
1768
|
-
label:
|
|
1769
|
-
className:
|
|
1770
|
-
canvasSize:
|
|
1771
|
-
} = e, { t:
|
|
1774
|
+
onComplete: x,
|
|
1775
|
+
onVerify: A,
|
|
1776
|
+
onStatusChange: g,
|
|
1777
|
+
onError: I,
|
|
1778
|
+
label: L,
|
|
1779
|
+
className: p,
|
|
1780
|
+
canvasSize: C
|
|
1781
|
+
} = e, { t: S } = te(), v = V(null), [l, w] = j([]), [u, h] = j(!1), [R, G] = j("idle"), [J, W] = j(0), [O, Y] = j(null), [_, $] = j(null), B = C ?? t * 80, F = B / t, q = K(
|
|
1772
1782
|
(d) => {
|
|
1773
|
-
|
|
1783
|
+
G(d), g == null || g(d);
|
|
1774
1784
|
},
|
|
1775
|
-
[
|
|
1776
|
-
),
|
|
1785
|
+
[g]
|
|
1786
|
+
), H = K(() => {
|
|
1777
1787
|
const d = [];
|
|
1778
|
-
for (let
|
|
1788
|
+
for (let k = 0; k < t; k++)
|
|
1779
1789
|
for (let N = 0; N < t; N++)
|
|
1780
|
-
d.push({ x: N * F + F / 2, y:
|
|
1790
|
+
d.push({ x: N * F + F / 2, y: k * F + F / 2 });
|
|
1781
1791
|
return d;
|
|
1782
|
-
}, [t, F]), Q =
|
|
1783
|
-
const
|
|
1784
|
-
return { x: N -
|
|
1785
|
-
}, []), E =
|
|
1786
|
-
(d,
|
|
1787
|
-
const N =
|
|
1788
|
-
for (let
|
|
1789
|
-
const Z = N[
|
|
1790
|
-
if (Z * Z +
|
|
1791
|
-
return
|
|
1792
|
+
}, [t, F]), Q = K((d) => {
|
|
1793
|
+
const k = v.current.getBoundingClientRect(), N = "touches" in d ? d.touches[0].clientX : d.clientX, M = "touches" in d ? d.touches[0].clientY : d.clientY;
|
|
1794
|
+
return { x: N - k.left, y: M - k.top };
|
|
1795
|
+
}, []), E = K(
|
|
1796
|
+
(d, k) => {
|
|
1797
|
+
const N = H(), M = F * 0.38;
|
|
1798
|
+
for (let U = 0; U < N.length; U++) {
|
|
1799
|
+
const Z = N[U].x - d, ee = N[U].y - k;
|
|
1800
|
+
if (Z * Z + ee * ee < M * M)
|
|
1801
|
+
return U;
|
|
1792
1802
|
}
|
|
1793
1803
|
return -1;
|
|
1794
1804
|
},
|
|
1795
|
-
[
|
|
1796
|
-
),
|
|
1797
|
-
var
|
|
1798
|
-
const d = (
|
|
1805
|
+
[H, F]
|
|
1806
|
+
), z = K(() => {
|
|
1807
|
+
var ee;
|
|
1808
|
+
const d = (ee = v.current) == null ? void 0 : ee.getContext("2d");
|
|
1799
1809
|
if (!d)
|
|
1800
1810
|
return;
|
|
1801
|
-
d.clearRect(0, 0,
|
|
1802
|
-
const
|
|
1803
|
-
N &&
|
|
1804
|
-
|
|
1805
|
-
), Z = re("var(--security-border)",
|
|
1806
|
-
for (let X = 0; X <
|
|
1807
|
-
const ie =
|
|
1808
|
-
d.beginPath(), d.arc(
|
|
1811
|
+
d.clearRect(0, 0, B, B);
|
|
1812
|
+
const k = H(), N = R === "failure", M = d.canvas, U = re(
|
|
1813
|
+
N && o ? "var(--security-error)" : i ?? "var(--security-biometric)",
|
|
1814
|
+
M
|
|
1815
|
+
), Z = re("var(--security-border)", M);
|
|
1816
|
+
for (let X = 0; X < k.length; X++) {
|
|
1817
|
+
const ie = l.includes(X);
|
|
1818
|
+
d.beginPath(), d.arc(k[X].x, k[X].y, ie ? a * 0.75 : a * 0.5, 0, Math.PI * 2), d.fillStyle = ie ? U : Z, d.fill(), ie && (d.beginPath(), d.arc(k[X].x, k[X].y, a * 1.2, 0, Math.PI * 2), d.strokeStyle = U, d.lineWidth = 1.5, d.globalAlpha = 0.3, d.stroke(), d.globalAlpha = 1);
|
|
1809
1819
|
}
|
|
1810
|
-
if (n &&
|
|
1811
|
-
d.beginPath(), d.moveTo(
|
|
1812
|
-
for (let X = 1; X <
|
|
1813
|
-
d.lineTo(
|
|
1814
|
-
|
|
1815
|
-
} else n &&
|
|
1820
|
+
if (n && l.length > 1) {
|
|
1821
|
+
d.beginPath(), d.moveTo(k[l[0]].x, k[l[0]].y);
|
|
1822
|
+
for (let X = 1; X < l.length; X++)
|
|
1823
|
+
d.lineTo(k[l[X]].x, k[l[X]].y);
|
|
1824
|
+
u && _ && d.lineTo(_.x, _.y), d.strokeStyle = U, d.lineWidth = 3, d.lineCap = "round", d.lineJoin = "round", d.globalAlpha = 0.5, d.stroke(), d.globalAlpha = 1;
|
|
1825
|
+
} else n && l.length === 1 && u && _ && (d.beginPath(), d.moveTo(k[l[0]].x, k[l[0]].y), d.lineTo(_.x, _.y), d.strokeStyle = re(i ?? "var(--security-biometric)", M), d.lineWidth = 3, d.globalAlpha = 0.4, d.stroke(), d.globalAlpha = 1);
|
|
1816
1826
|
}, [
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
u,
|
|
1827
|
+
B,
|
|
1828
|
+
H,
|
|
1829
|
+
a,
|
|
1821
1830
|
l,
|
|
1822
|
-
|
|
1823
|
-
|
|
1831
|
+
u,
|
|
1832
|
+
_,
|
|
1833
|
+
R,
|
|
1824
1834
|
n,
|
|
1825
|
-
|
|
1826
|
-
|
|
1835
|
+
o,
|
|
1836
|
+
i
|
|
1827
1837
|
]);
|
|
1828
1838
|
ne(() => {
|
|
1829
|
-
|
|
1830
|
-
}, [
|
|
1831
|
-
const
|
|
1839
|
+
z();
|
|
1840
|
+
}, [z]);
|
|
1841
|
+
const D = K(
|
|
1832
1842
|
(d) => {
|
|
1833
|
-
if (
|
|
1843
|
+
if (R === "success" || R === "failure")
|
|
1834
1844
|
return;
|
|
1835
1845
|
d.preventDefault();
|
|
1836
|
-
const { x:
|
|
1837
|
-
|
|
1846
|
+
const { x: k, y: N } = Q(d), M = E(k, N);
|
|
1847
|
+
M >= 0 && (h(!0), w([M]), $({ x: k, y: N }));
|
|
1838
1848
|
},
|
|
1839
|
-
[
|
|
1840
|
-
),
|
|
1849
|
+
[R, Q, E]
|
|
1850
|
+
), T = K(
|
|
1841
1851
|
(d) => {
|
|
1842
|
-
if (!
|
|
1852
|
+
if (!u)
|
|
1843
1853
|
return;
|
|
1844
1854
|
d.preventDefault();
|
|
1845
|
-
const { x:
|
|
1846
|
-
$({ x:
|
|
1847
|
-
const
|
|
1848
|
-
|
|
1855
|
+
const { x: k, y: N } = Q(d);
|
|
1856
|
+
$({ x: k, y: N });
|
|
1857
|
+
const M = E(k, N);
|
|
1858
|
+
M >= 0 && !l.includes(M) && w((U) => [...U, M]);
|
|
1849
1859
|
},
|
|
1850
|
-
[
|
|
1851
|
-
),
|
|
1852
|
-
if (!
|
|
1860
|
+
[u, Q, E, l]
|
|
1861
|
+
), m = K(async () => {
|
|
1862
|
+
if (!u)
|
|
1853
1863
|
return;
|
|
1854
|
-
if (h(!1), $(null),
|
|
1864
|
+
if (h(!1), $(null), l.length < r) {
|
|
1855
1865
|
w([]);
|
|
1856
1866
|
return;
|
|
1857
1867
|
}
|
|
1858
|
-
const d =
|
|
1859
|
-
if (
|
|
1860
|
-
if (
|
|
1861
|
-
|
|
1868
|
+
const d = l.join(",");
|
|
1869
|
+
if (y === "set") {
|
|
1870
|
+
if (O === null) {
|
|
1871
|
+
Y([...l]), w([]);
|
|
1862
1872
|
return;
|
|
1863
1873
|
}
|
|
1864
|
-
if (
|
|
1865
|
-
|
|
1866
|
-
|
|
1874
|
+
if (O.join(",") !== d) {
|
|
1875
|
+
Y(null), q("failure"), setTimeout(() => {
|
|
1876
|
+
q("idle"), w([]);
|
|
1867
1877
|
}, 800);
|
|
1868
1878
|
return;
|
|
1869
1879
|
}
|
|
1870
|
-
|
|
1880
|
+
x == null || x([...l]), q("success");
|
|
1871
1881
|
return;
|
|
1872
1882
|
}
|
|
1873
|
-
|
|
1874
|
-
let
|
|
1875
|
-
if (
|
|
1876
|
-
const N = new TextEncoder(),
|
|
1877
|
-
|
|
1883
|
+
q("processing");
|
|
1884
|
+
let k = !1;
|
|
1885
|
+
if (b) {
|
|
1886
|
+
const N = new TextEncoder(), M = await crypto.subtle.digest("SHA-256", N.encode(d));
|
|
1887
|
+
k = Array.from(new Uint8Array(M)).map((Z) => Z.toString(16).padStart(2, "0")).join("") === b;
|
|
1878
1888
|
} else if (f)
|
|
1879
|
-
|
|
1889
|
+
k = d === f;
|
|
1880
1890
|
else {
|
|
1881
|
-
|
|
1891
|
+
x == null || x([...l]), q("success");
|
|
1882
1892
|
return;
|
|
1883
1893
|
}
|
|
1884
|
-
if (
|
|
1885
|
-
|
|
1894
|
+
if (k)
|
|
1895
|
+
q("success"), A == null || A({
|
|
1886
1896
|
success: !0,
|
|
1887
1897
|
confidence: 1,
|
|
1888
1898
|
method: "pattern",
|
|
1889
1899
|
timestamp: Date.now(),
|
|
1890
1900
|
duration: 0
|
|
1891
|
-
}),
|
|
1901
|
+
}), x == null || x([...l]);
|
|
1892
1902
|
else {
|
|
1893
|
-
const N =
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
}, 900),
|
|
1903
|
+
const N = J + 1;
|
|
1904
|
+
W(N), q("failure"), N >= s && (I == null || I(new Error("Too many failed pattern attempts"))), setTimeout(() => {
|
|
1905
|
+
q("idle"), w([]);
|
|
1906
|
+
}, 900), A == null || A({
|
|
1897
1907
|
success: !1,
|
|
1898
1908
|
confidence: 0,
|
|
1899
1909
|
method: "pattern",
|
|
@@ -1902,24 +1912,24 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1902
1912
|
});
|
|
1903
1913
|
}
|
|
1904
1914
|
}, [
|
|
1905
|
-
l,
|
|
1906
1915
|
u,
|
|
1916
|
+
l,
|
|
1907
1917
|
r,
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1918
|
+
y,
|
|
1919
|
+
O,
|
|
1920
|
+
b,
|
|
1911
1921
|
f,
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1922
|
+
J,
|
|
1923
|
+
s,
|
|
1924
|
+
q,
|
|
1925
|
+
x,
|
|
1926
|
+
A,
|
|
1927
|
+
I
|
|
1918
1928
|
]);
|
|
1919
1929
|
return /* @__PURE__ */ P(
|
|
1920
1930
|
"div",
|
|
1921
1931
|
{
|
|
1922
|
-
className:
|
|
1932
|
+
className: p,
|
|
1923
1933
|
style: {
|
|
1924
1934
|
display: "inline-flex",
|
|
1925
1935
|
flexDirection: "column",
|
|
@@ -1929,7 +1939,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1929
1939
|
color: "var(--security-text)"
|
|
1930
1940
|
},
|
|
1931
1941
|
children: [
|
|
1932
|
-
|
|
1942
|
+
L && /* @__PURE__ */ c("div", { style: { fontSize: 14, fontWeight: 600 }, children: L }),
|
|
1933
1943
|
/* @__PURE__ */ c(
|
|
1934
1944
|
"div",
|
|
1935
1945
|
{
|
|
@@ -1939,37 +1949,37 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1939
1949
|
minHeight: 18,
|
|
1940
1950
|
textAlign: "center"
|
|
1941
1951
|
},
|
|
1942
|
-
children:
|
|
1952
|
+
children: R === "success" ? S("security.pattern.success", "Pattern accepted") : R === "failure" ? S("security.pattern.wrong", "Wrong pattern") : y === "set" && O !== null ? S("security.pattern.confirm", "Draw pattern again to confirm") : y === "set" ? S("security.pattern.setNew", "Draw a new pattern") : S("security.pattern.draw", "Draw your pattern")
|
|
1943
1953
|
}
|
|
1944
1954
|
),
|
|
1945
1955
|
/* @__PURE__ */ c(
|
|
1946
1956
|
"canvas",
|
|
1947
1957
|
{
|
|
1948
|
-
ref:
|
|
1949
|
-
width:
|
|
1950
|
-
height:
|
|
1958
|
+
ref: v,
|
|
1959
|
+
width: B,
|
|
1960
|
+
height: B,
|
|
1951
1961
|
style: {
|
|
1952
1962
|
touchAction: "none",
|
|
1953
1963
|
borderRadius: "var(--security-radius-lg)",
|
|
1954
1964
|
background: "var(--security-bg-panel)",
|
|
1955
|
-
border: `1px solid ${
|
|
1965
|
+
border: `1px solid ${R === "failure" ? "var(--security-error)" : "var(--security-border)"}`,
|
|
1956
1966
|
cursor: "pointer",
|
|
1957
1967
|
transition: "border-color 0.3s"
|
|
1958
1968
|
},
|
|
1959
|
-
onMouseDown:
|
|
1960
|
-
onMouseMove:
|
|
1961
|
-
onMouseUp:
|
|
1962
|
-
onMouseLeave:
|
|
1963
|
-
onTouchStart:
|
|
1964
|
-
onTouchMove:
|
|
1965
|
-
onTouchEnd:
|
|
1969
|
+
onMouseDown: D,
|
|
1970
|
+
onMouseMove: T,
|
|
1971
|
+
onMouseUp: m,
|
|
1972
|
+
onMouseLeave: m,
|
|
1973
|
+
onTouchStart: D,
|
|
1974
|
+
onTouchMove: T,
|
|
1975
|
+
onTouchEnd: m
|
|
1966
1976
|
}
|
|
1967
1977
|
),
|
|
1968
|
-
(
|
|
1978
|
+
(R === "failure" || R === "success") && /* @__PURE__ */ c(
|
|
1969
1979
|
"button",
|
|
1970
1980
|
{
|
|
1971
1981
|
onClick: () => {
|
|
1972
|
-
w([]),
|
|
1982
|
+
w([]), W(0), Y(null), q("idle");
|
|
1973
1983
|
},
|
|
1974
1984
|
style: {
|
|
1975
1985
|
fontSize: 13,
|
|
@@ -1980,70 +1990,79 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
1980
1990
|
color: "var(--security-text)",
|
|
1981
1991
|
cursor: "pointer"
|
|
1982
1992
|
},
|
|
1983
|
-
children:
|
|
1993
|
+
children: S("security.common.retry", "Try Again")
|
|
1984
1994
|
}
|
|
1985
1995
|
),
|
|
1986
|
-
|
|
1996
|
+
J > 0 && R !== "success" && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: S("security.pattern.attempts", "{attempts}/{max} attempts").replace("{attempts}", String(J)).replace("{max}", String(s)) })
|
|
1987
1997
|
]
|
|
1988
1998
|
}
|
|
1989
1999
|
);
|
|
1990
|
-
}, gt = { sm: "8px 16px", md: "12px 24px", lg: "14px 32px" }, mt = { sm: 13, md: 14, lg: 16 },
|
|
2000
|
+
}, gt = { sm: "8px 16px", md: "12px 24px", lg: "14px 32px" }, mt = { sm: 13, md: 14, lg: 16 }, Wt = (e) => {
|
|
1991
2001
|
const {
|
|
1992
2002
|
mode: t,
|
|
1993
2003
|
credentialIds: r = [],
|
|
1994
2004
|
challenge: n,
|
|
1995
|
-
rpName:
|
|
1996
|
-
rpId:
|
|
1997
|
-
user:
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2005
|
+
rpName: o = window.location.hostname,
|
|
2006
|
+
rpId: s = window.location.hostname,
|
|
2007
|
+
user: a,
|
|
2008
|
+
// no defaults here: the engine applies the documented ones (WebAuthnConfig). Until 1.2.2
|
|
2009
|
+
// these four were read and never passed on — the registration always used the engine's
|
|
2010
|
+
// fixed values, whatever the props said.
|
|
2011
|
+
attestation: i,
|
|
2012
|
+
authenticatorAttachment: y,
|
|
2013
|
+
residentKey: b,
|
|
2014
|
+
userVerification: f,
|
|
2015
|
+
timeout: x,
|
|
2016
|
+
onRegister: A,
|
|
2017
|
+
onAuthenticate: g,
|
|
2018
|
+
onVerify: I,
|
|
2019
|
+
onStatusChange: L,
|
|
2020
|
+
onError: p,
|
|
2021
|
+
label: C,
|
|
2022
|
+
className: S,
|
|
2023
|
+
variant: v = "primary",
|
|
2024
|
+
size: l = "md",
|
|
2025
|
+
fullWidth: w = !1,
|
|
2026
|
+
icon: u
|
|
2027
|
+
} = e, { t: h } = te(), [R, G] = j("idle"), [J, W] = j(!0), [O, Y] = j(!1), _ = K(
|
|
2028
|
+
(D) => {
|
|
2029
|
+
G(D), L == null || L(D);
|
|
2016
2030
|
},
|
|
2017
|
-
[
|
|
2031
|
+
[L]
|
|
2018
2032
|
);
|
|
2019
2033
|
ne(() => {
|
|
2020
|
-
|
|
2034
|
+
W(De()), tt().then(Y);
|
|
2021
2035
|
}, []);
|
|
2022
|
-
const
|
|
2036
|
+
const $ = K(() => {
|
|
2023
2037
|
if (n) {
|
|
2024
|
-
const
|
|
2025
|
-
for (let
|
|
2026
|
-
|
|
2027
|
-
return
|
|
2038
|
+
const D = atob(n.replace(/-/g, "+").replace(/_/g, "/")), T = new Uint8Array(D.length);
|
|
2039
|
+
for (let m = 0; m < D.length; m++)
|
|
2040
|
+
T[m] = D.charCodeAt(m);
|
|
2041
|
+
return T.buffer;
|
|
2028
2042
|
}
|
|
2029
2043
|
return crypto.getRandomValues(new Uint8Array(32)).buffer;
|
|
2030
|
-
}, [n]),
|
|
2031
|
-
if (!
|
|
2032
|
-
|
|
2044
|
+
}, [n]), B = K(async () => {
|
|
2045
|
+
if (!J) {
|
|
2046
|
+
p == null || p(new Error("WebAuthn not available"));
|
|
2033
2047
|
return;
|
|
2034
2048
|
}
|
|
2035
|
-
|
|
2049
|
+
_("processing");
|
|
2036
2050
|
try {
|
|
2037
2051
|
if (t === "register") {
|
|
2038
|
-
const
|
|
2039
|
-
rpName:
|
|
2040
|
-
rpId:
|
|
2041
|
-
userId: typeof
|
|
2042
|
-
userName:
|
|
2043
|
-
userDisplayName:
|
|
2044
|
-
challenge:
|
|
2052
|
+
const D = (a == null ? void 0 : a.id) ?? crypto.getRandomValues(new Uint8Array(16)), T = (a == null ? void 0 : a.name) ?? "user", m = (a == null ? void 0 : a.displayName) ?? T, d = $(), k = await rt({
|
|
2053
|
+
rpName: o,
|
|
2054
|
+
rpId: s,
|
|
2055
|
+
userId: typeof D == "string" ? D : Array.from(D).join(""),
|
|
2056
|
+
userName: T,
|
|
2057
|
+
userDisplayName: m,
|
|
2058
|
+
challenge: d,
|
|
2059
|
+
timeout: x,
|
|
2060
|
+
attestation: i,
|
|
2061
|
+
authenticatorAttachment: y,
|
|
2062
|
+
residentKey: b,
|
|
2063
|
+
userVerification: f
|
|
2045
2064
|
});
|
|
2046
|
-
|
|
2065
|
+
_("success"), k && (A == null || A(k)), I == null || I({
|
|
2047
2066
|
success: !0,
|
|
2048
2067
|
confidence: 1,
|
|
2049
2068
|
method: "webauthn",
|
|
@@ -2051,15 +2070,17 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2051
2070
|
duration: 0
|
|
2052
2071
|
});
|
|
2053
2072
|
} else {
|
|
2054
|
-
const
|
|
2055
|
-
rpId:
|
|
2056
|
-
challenge:
|
|
2057
|
-
allowCredentials: r == null ? void 0 : r.map((
|
|
2058
|
-
id: new TextEncoder().encode(
|
|
2073
|
+
const D = await nt({
|
|
2074
|
+
rpId: s,
|
|
2075
|
+
challenge: $(),
|
|
2076
|
+
allowCredentials: r == null ? void 0 : r.map((T) => ({
|
|
2077
|
+
id: new TextEncoder().encode(T),
|
|
2059
2078
|
type: "public-key"
|
|
2060
|
-
}))
|
|
2079
|
+
})),
|
|
2080
|
+
timeout: x,
|
|
2081
|
+
userVerification: f
|
|
2061
2082
|
});
|
|
2062
|
-
|
|
2083
|
+
_("success"), D && (g == null || g(D)), I == null || I({
|
|
2063
2084
|
success: !0,
|
|
2064
2085
|
confidence: 1,
|
|
2065
2086
|
method: "webauthn",
|
|
@@ -2067,9 +2088,9 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2067
2088
|
duration: 0
|
|
2068
2089
|
});
|
|
2069
2090
|
}
|
|
2070
|
-
} catch (
|
|
2071
|
-
const
|
|
2072
|
-
|
|
2091
|
+
} catch (D) {
|
|
2092
|
+
const T = D instanceof Error ? D : new Error(String(D));
|
|
2093
|
+
T.name === "NotAllowedError" ? _("idle") : (_("error"), p == null || p(T), I == null || I({
|
|
2073
2094
|
success: !1,
|
|
2074
2095
|
confidence: 0,
|
|
2075
2096
|
method: "webauthn",
|
|
@@ -2078,59 +2099,60 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2078
2099
|
}));
|
|
2079
2100
|
}
|
|
2080
2101
|
}, [
|
|
2081
|
-
|
|
2102
|
+
J,
|
|
2082
2103
|
t,
|
|
2083
2104
|
r,
|
|
2105
|
+
a,
|
|
2084
2106
|
o,
|
|
2085
2107
|
s,
|
|
2086
2108
|
i,
|
|
2087
|
-
a,
|
|
2088
|
-
g,
|
|
2089
|
-
v,
|
|
2090
|
-
f,
|
|
2091
|
-
W,
|
|
2092
|
-
J,
|
|
2093
|
-
m,
|
|
2094
|
-
k,
|
|
2095
2109
|
y,
|
|
2096
|
-
|
|
2097
|
-
|
|
2110
|
+
b,
|
|
2111
|
+
f,
|
|
2112
|
+
x,
|
|
2113
|
+
$,
|
|
2114
|
+
_,
|
|
2115
|
+
A,
|
|
2116
|
+
g,
|
|
2117
|
+
I,
|
|
2118
|
+
p
|
|
2119
|
+
]), F = t === "register" ? O ? h("security.webauthn.registerPasskey", "Register Passkey") : h("security.webauthn.register", "Register Security Key") : O ? h("security.webauthn.signInPasskey", "Sign in with Passkey") : h("security.webauthn.signIn", "Sign in with Security Key"), q = C ?? F, H = {
|
|
2098
2120
|
primary: "var(--security-biometric)",
|
|
2099
2121
|
outline: "transparent",
|
|
2100
2122
|
ghost: "transparent"
|
|
2101
|
-
},
|
|
2123
|
+
}, Q = {
|
|
2102
2124
|
primary: "none",
|
|
2103
2125
|
outline: "2px solid var(--security-biometric)",
|
|
2104
2126
|
ghost: "none"
|
|
2105
|
-
},
|
|
2127
|
+
}, E = {
|
|
2106
2128
|
// Label on the brand-coloured button: the on-primary text token, not a surface token.
|
|
2107
2129
|
primary: "var(--nice-color-white, #fff)",
|
|
2108
2130
|
outline: "var(--security-biometric)",
|
|
2109
2131
|
ghost: "var(--security-biometric)"
|
|
2110
|
-
},
|
|
2132
|
+
}, z = !J || R === "processing" || R === "success";
|
|
2111
2133
|
return /* @__PURE__ */ P(
|
|
2112
2134
|
"div",
|
|
2113
2135
|
{
|
|
2114
|
-
className:
|
|
2115
|
-
style: { display:
|
|
2136
|
+
className: S,
|
|
2137
|
+
style: { display: w ? "block" : "inline-block", textAlign: "center" },
|
|
2116
2138
|
children: [
|
|
2117
2139
|
/* @__PURE__ */ P(
|
|
2118
2140
|
"button",
|
|
2119
2141
|
{
|
|
2120
|
-
onClick:
|
|
2121
|
-
disabled:
|
|
2142
|
+
onClick: B,
|
|
2143
|
+
disabled: z,
|
|
2122
2144
|
style: {
|
|
2123
|
-
width:
|
|
2124
|
-
padding: gt[
|
|
2125
|
-
fontSize: mt[
|
|
2145
|
+
width: w ? "100%" : "auto",
|
|
2146
|
+
padding: gt[l],
|
|
2147
|
+
fontSize: mt[l],
|
|
2126
2148
|
fontWeight: 600,
|
|
2127
2149
|
fontFamily: "var(--security-font)",
|
|
2128
|
-
background:
|
|
2129
|
-
color:
|
|
2130
|
-
border:
|
|
2150
|
+
background: H[v],
|
|
2151
|
+
color: E[v],
|
|
2152
|
+
border: Q[v],
|
|
2131
2153
|
borderRadius: "var(--security-radius)",
|
|
2132
|
-
cursor:
|
|
2133
|
-
opacity:
|
|
2154
|
+
cursor: z ? "not-allowed" : "pointer",
|
|
2155
|
+
opacity: z ? 0.6 : 1,
|
|
2134
2156
|
display: "inline-flex",
|
|
2135
2157
|
alignItems: "center",
|
|
2136
2158
|
justifyContent: "center",
|
|
@@ -2138,7 +2160,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2138
2160
|
transition: "opacity 0.2s, transform 0.1s"
|
|
2139
2161
|
},
|
|
2140
2162
|
children: [
|
|
2141
|
-
|
|
2163
|
+
R === "processing" && /* @__PURE__ */ c(
|
|
2142
2164
|
"span",
|
|
2143
2165
|
{
|
|
2144
2166
|
style: {
|
|
@@ -2152,7 +2174,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2152
2174
|
}
|
|
2153
2175
|
}
|
|
2154
2176
|
),
|
|
2155
|
-
|
|
2177
|
+
R === "success" && /* @__PURE__ */ c(
|
|
2156
2178
|
"span",
|
|
2157
2179
|
{
|
|
2158
2180
|
"aria-hidden": "true",
|
|
@@ -2167,33 +2189,33 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2167
2189
|
}
|
|
2168
2190
|
}
|
|
2169
2191
|
),
|
|
2170
|
-
|
|
2171
|
-
|
|
2192
|
+
u && R !== "processing" && R !== "success" && u,
|
|
2193
|
+
q
|
|
2172
2194
|
]
|
|
2173
2195
|
}
|
|
2174
2196
|
),
|
|
2175
|
-
!
|
|
2176
|
-
|
|
2197
|
+
!J && /* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 6, color: "var(--security-warning)" }, children: h("security.webauthn.notAvailable", "WebAuthn is not supported in this browser") }),
|
|
2198
|
+
R === "error" && /* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 6, color: "var(--security-error)" }, children: h("security.webauthn.error", "Authentication failed — try again") }),
|
|
2177
2199
|
/* @__PURE__ */ c("style", { children: "@keyframes spin { to { transform: rotate(360deg); } }" })
|
|
2178
2200
|
]
|
|
2179
2201
|
}
|
|
2180
2202
|
);
|
|
2181
|
-
}, vt = [], bt = (e) => e >= 80 ? "var(--security-error)" : e >= 50 ? "var(--security-warning)" : "var(--security-success)",
|
|
2203
|
+
}, vt = [], bt = (e) => e >= 80 ? "var(--security-error)" : e >= 50 ? "var(--security-warning)" : "var(--security-success)", Ht = ({
|
|
2182
2204
|
entries: e = vt,
|
|
2183
2205
|
pageSize: t = 20,
|
|
2184
2206
|
showExport: r = !0,
|
|
2185
2207
|
filterMethods: n,
|
|
2186
|
-
onEntryClick:
|
|
2187
|
-
className:
|
|
2188
|
-
label:
|
|
2208
|
+
onEntryClick: o,
|
|
2209
|
+
className: s,
|
|
2210
|
+
label: a
|
|
2189
2211
|
}) => {
|
|
2190
|
-
const { t:
|
|
2191
|
-
let
|
|
2192
|
-
return
|
|
2193
|
-
}, [e,
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2196
|
-
}, [
|
|
2212
|
+
const { t: i } = te(), [y, b] = j("all"), [f, x] = j("all"), [A, g] = j(0), I = ae(() => {
|
|
2213
|
+
let u = [...e];
|
|
2214
|
+
return y !== "all" && (u = u.filter((h) => h.method === y)), f !== "all" && (u = u.filter((h) => h.status === f)), u.sort((h, R) => R.timestamp - h.timestamp), u;
|
|
2215
|
+
}, [e, y, f]), L = Math.max(1, Math.ceil(I.length / t)), p = I.slice(A * t, (A + 1) * t), C = ae(() => n || Array.from(new Set(e.map((u) => u.method))), [e, n]), S = ae(() => Array.from(new Set(e.map((u) => u.status))), [e]), v = K(() => {
|
|
2216
|
+
const u = new Blob([JSON.stringify(I, null, 2)], { type: "application/json" }), h = URL.createObjectURL(u), R = document.createElement("a");
|
|
2217
|
+
R.href = h, R.download = `security-audit-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`, R.click(), URL.revokeObjectURL(h);
|
|
2218
|
+
}, [I]), l = (u) => new Date(u).toLocaleString(), w = {
|
|
2197
2219
|
padding: "8px 12px",
|
|
2198
2220
|
borderBottom: "1px solid var(--security-border)",
|
|
2199
2221
|
fontSize: 13,
|
|
@@ -2202,7 +2224,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2202
2224
|
return /* @__PURE__ */ P(
|
|
2203
2225
|
"div",
|
|
2204
2226
|
{
|
|
2205
|
-
className:
|
|
2227
|
+
className: s,
|
|
2206
2228
|
style: {
|
|
2207
2229
|
fontFamily: "var(--security-font)",
|
|
2208
2230
|
color: "var(--security-text)",
|
|
@@ -2224,19 +2246,19 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2224
2246
|
borderBottom: "1px solid var(--security-border)"
|
|
2225
2247
|
},
|
|
2226
2248
|
children: [
|
|
2227
|
-
/* @__PURE__ */ c("div", { style: { fontWeight: 600, fontSize: 15 }, children:
|
|
2249
|
+
/* @__PURE__ */ c("div", { style: { fontWeight: 600, fontSize: 15 }, children: a ?? i("security.audit.title", "Security Audit Log") }),
|
|
2228
2250
|
/* @__PURE__ */ P("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
2229
2251
|
/* @__PURE__ */ P(
|
|
2230
2252
|
"select",
|
|
2231
2253
|
{
|
|
2232
|
-
value:
|
|
2233
|
-
onChange: (
|
|
2234
|
-
|
|
2254
|
+
value: y,
|
|
2255
|
+
onChange: (u) => {
|
|
2256
|
+
b(u.target.value), g(0);
|
|
2235
2257
|
},
|
|
2236
2258
|
style: xe,
|
|
2237
2259
|
children: [
|
|
2238
|
-
/* @__PURE__ */ c("option", { value: "all", children:
|
|
2239
|
-
|
|
2260
|
+
/* @__PURE__ */ c("option", { value: "all", children: i("security.audit.allMethods", "All methods") }),
|
|
2261
|
+
C.map((u) => /* @__PURE__ */ c("option", { value: u, children: u }, u))
|
|
2240
2262
|
]
|
|
2241
2263
|
}
|
|
2242
2264
|
),
|
|
@@ -2244,23 +2266,23 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2244
2266
|
"select",
|
|
2245
2267
|
{
|
|
2246
2268
|
value: f,
|
|
2247
|
-
onChange: (
|
|
2248
|
-
|
|
2269
|
+
onChange: (u) => {
|
|
2270
|
+
x(u.target.value), g(0);
|
|
2249
2271
|
},
|
|
2250
2272
|
style: xe,
|
|
2251
2273
|
children: [
|
|
2252
|
-
/* @__PURE__ */ c("option", { value: "all", children:
|
|
2253
|
-
|
|
2274
|
+
/* @__PURE__ */ c("option", { value: "all", children: i("security.audit.allStatuses", "All statuses") }),
|
|
2275
|
+
S.map((u) => /* @__PURE__ */ c("option", { value: u, children: u }, u))
|
|
2254
2276
|
]
|
|
2255
2277
|
}
|
|
2256
2278
|
),
|
|
2257
2279
|
r && /* @__PURE__ */ c(
|
|
2258
2280
|
"button",
|
|
2259
2281
|
{
|
|
2260
|
-
onClick:
|
|
2282
|
+
onClick: v,
|
|
2261
2283
|
style: xt,
|
|
2262
|
-
title:
|
|
2263
|
-
children:
|
|
2284
|
+
title: i("security.audit.exportJson", "Export JSON"),
|
|
2285
|
+
children: i("security.json", "JSON")
|
|
2264
2286
|
}
|
|
2265
2287
|
)
|
|
2266
2288
|
] })
|
|
@@ -2279,17 +2301,17 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2279
2301
|
letterSpacing: 0.5
|
|
2280
2302
|
},
|
|
2281
2303
|
children: [
|
|
2282
|
-
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children:
|
|
2283
|
-
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children:
|
|
2284
|
-
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children:
|
|
2285
|
-
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children:
|
|
2286
|
-
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children:
|
|
2287
|
-
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children:
|
|
2304
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children: i("security.audit.time", "Time") }),
|
|
2305
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children: i("security.audit.action", "Action") }),
|
|
2306
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children: i("security.audit.method", "Method") }),
|
|
2307
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children: i("security.audit.status", "Status") }),
|
|
2308
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "center" }, children: i("security.audit.risk", "Risk") }),
|
|
2309
|
+
/* @__PURE__ */ c("th", { style: { ...w, textAlign: "left" }, children: i("security.audit.device", "Device") })
|
|
2288
2310
|
]
|
|
2289
2311
|
}
|
|
2290
2312
|
) }),
|
|
2291
2313
|
/* @__PURE__ */ P("tbody", { children: [
|
|
2292
|
-
|
|
2314
|
+
p.length === 0 && /* @__PURE__ */ c("tr", { children: /* @__PURE__ */ c(
|
|
2293
2315
|
"td",
|
|
2294
2316
|
{
|
|
2295
2317
|
colSpan: 6,
|
|
@@ -2299,14 +2321,14 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2299
2321
|
color: "var(--security-text-muted)",
|
|
2300
2322
|
padding: 24
|
|
2301
2323
|
},
|
|
2302
|
-
children:
|
|
2324
|
+
children: i("security.audit.noEntries", "No entries to show")
|
|
2303
2325
|
}
|
|
2304
2326
|
) }),
|
|
2305
|
-
|
|
2327
|
+
p.map((u) => /* @__PURE__ */ P(
|
|
2306
2328
|
"tr",
|
|
2307
2329
|
{
|
|
2308
|
-
onClick: () =>
|
|
2309
|
-
style: { cursor:
|
|
2330
|
+
onClick: () => o == null ? void 0 : o(u),
|
|
2331
|
+
style: { cursor: o ? "pointer" : "default" },
|
|
2310
2332
|
onMouseEnter: (h) => {
|
|
2311
2333
|
h.currentTarget.style.background = "var(--security-bg-panel)";
|
|
2312
2334
|
},
|
|
@@ -2314,8 +2336,8 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2314
2336
|
h.currentTarget.style.background = "";
|
|
2315
2337
|
},
|
|
2316
2338
|
children: [
|
|
2317
|
-
/* @__PURE__ */ c("td", { style: w, children: u
|
|
2318
|
-
/* @__PURE__ */ c("td", { style: w, children:
|
|
2339
|
+
/* @__PURE__ */ c("td", { style: w, children: l(u.timestamp) }),
|
|
2340
|
+
/* @__PURE__ */ c("td", { style: w, children: u.action }),
|
|
2319
2341
|
/* @__PURE__ */ c("td", { style: { ...w, textAlign: "center" }, children: /* @__PURE__ */ c(
|
|
2320
2342
|
"span",
|
|
2321
2343
|
{
|
|
@@ -2327,11 +2349,11 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2327
2349
|
background: "var(--security-bg-panel)",
|
|
2328
2350
|
border: "1px solid var(--security-border)"
|
|
2329
2351
|
},
|
|
2330
|
-
children:
|
|
2352
|
+
children: u.method
|
|
2331
2353
|
}
|
|
2332
2354
|
) }),
|
|
2333
|
-
/* @__PURE__ */ c("td", { style: { ...w, textAlign: "center" }, children:
|
|
2334
|
-
/* @__PURE__ */ c("td", { style: { ...w, textAlign: "center" }, children:
|
|
2355
|
+
/* @__PURE__ */ c("td", { style: { ...w, textAlign: "center" }, children: u.status }),
|
|
2356
|
+
/* @__PURE__ */ c("td", { style: { ...w, textAlign: "center" }, children: u.riskScore != null && /* @__PURE__ */ c("span", { style: { color: bt(u.riskScore), fontWeight: 600 }, children: u.riskScore }) }),
|
|
2335
2357
|
/* @__PURE__ */ c(
|
|
2336
2358
|
"td",
|
|
2337
2359
|
{
|
|
@@ -2341,16 +2363,16 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2341
2363
|
overflow: "hidden",
|
|
2342
2364
|
textOverflow: "ellipsis"
|
|
2343
2365
|
},
|
|
2344
|
-
children:
|
|
2366
|
+
children: u.device ?? "—"
|
|
2345
2367
|
}
|
|
2346
2368
|
)
|
|
2347
2369
|
]
|
|
2348
2370
|
},
|
|
2349
|
-
|
|
2371
|
+
u.id
|
|
2350
2372
|
))
|
|
2351
2373
|
] })
|
|
2352
2374
|
] }) }),
|
|
2353
|
-
|
|
2375
|
+
L > 1 && /* @__PURE__ */ P(
|
|
2354
2376
|
"div",
|
|
2355
2377
|
{
|
|
2356
2378
|
style: {
|
|
@@ -2364,26 +2386,26 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2364
2386
|
borderTop: "1px solid var(--security-border)"
|
|
2365
2387
|
},
|
|
2366
2388
|
children: [
|
|
2367
|
-
/* @__PURE__ */ P("button", { disabled:
|
|
2368
|
-
/* @__PURE__ */ c(
|
|
2389
|
+
/* @__PURE__ */ P("button", { disabled: A === 0, onClick: () => g(A - 1), style: we, children: [
|
|
2390
|
+
/* @__PURE__ */ c(Le, { size: 14, style: { verticalAlign: "-2px" } }),
|
|
2369
2391
|
" ",
|
|
2370
|
-
|
|
2392
|
+
i("security.audit.prev", "Prev")
|
|
2371
2393
|
] }),
|
|
2372
2394
|
/* @__PURE__ */ P("span", { children: [
|
|
2373
|
-
|
|
2395
|
+
A + 1,
|
|
2374
2396
|
" / ",
|
|
2375
|
-
|
|
2397
|
+
L
|
|
2376
2398
|
] }),
|
|
2377
2399
|
/* @__PURE__ */ P(
|
|
2378
2400
|
"button",
|
|
2379
2401
|
{
|
|
2380
|
-
disabled:
|
|
2381
|
-
onClick: () =>
|
|
2402
|
+
disabled: A >= L - 1,
|
|
2403
|
+
onClick: () => g(A + 1),
|
|
2382
2404
|
style: we,
|
|
2383
2405
|
children: [
|
|
2384
|
-
|
|
2406
|
+
i("security.audit.next", "Next"),
|
|
2385
2407
|
" ",
|
|
2386
|
-
/* @__PURE__ */ c(
|
|
2408
|
+
/* @__PURE__ */ c($e, { size: 14, style: { verticalAlign: "-2px" } })
|
|
2387
2409
|
]
|
|
2388
2410
|
}
|
|
2389
2411
|
)
|
|
@@ -2399,7 +2421,10 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2399
2421
|
color: "var(--security-text-muted)",
|
|
2400
2422
|
textAlign: "right"
|
|
2401
2423
|
},
|
|
2402
|
-
children:
|
|
2424
|
+
children: i("security.audit.total", "{count} entries").replace(
|
|
2425
|
+
"{count}",
|
|
2426
|
+
String(I.length)
|
|
2427
|
+
)
|
|
2403
2428
|
}
|
|
2404
2429
|
)
|
|
2405
2430
|
]
|
|
@@ -2439,15 +2464,15 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2439
2464
|
requiredCount: t = 1,
|
|
2440
2465
|
onSelect: r,
|
|
2441
2466
|
onComplete: n,
|
|
2442
|
-
className:
|
|
2443
|
-
label:
|
|
2444
|
-
layout:
|
|
2467
|
+
className: o,
|
|
2468
|
+
label: s,
|
|
2469
|
+
layout: a = "grid"
|
|
2445
2470
|
}) => {
|
|
2446
|
-
const { t:
|
|
2471
|
+
const { t: i } = te(), y = e.filter((f) => f.verified).length, b = y >= t;
|
|
2447
2472
|
return /* @__PURE__ */ P(
|
|
2448
2473
|
"div",
|
|
2449
2474
|
{
|
|
2450
|
-
className:
|
|
2475
|
+
className: o,
|
|
2451
2476
|
style: {
|
|
2452
2477
|
fontFamily: "var(--security-font)",
|
|
2453
2478
|
color: "var(--security-text)",
|
|
@@ -2456,40 +2481,40 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2456
2481
|
gap: 16
|
|
2457
2482
|
},
|
|
2458
2483
|
children: [
|
|
2459
|
-
|
|
2460
|
-
t > 1 && /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-secondary)" }, children:
|
|
2484
|
+
s && /* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: s }),
|
|
2485
|
+
t > 1 && /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-secondary)" }, children: i("security.mfa.progress", "Verified {verified} of {required} required").replace("{verified}", String(y)).replace("{required}", String(t)) }),
|
|
2461
2486
|
/* @__PURE__ */ c(
|
|
2462
2487
|
"div",
|
|
2463
2488
|
{
|
|
2464
2489
|
style: {
|
|
2465
|
-
display:
|
|
2466
|
-
gridTemplateColumns:
|
|
2467
|
-
flexDirection:
|
|
2490
|
+
display: a === "grid" ? "grid" : "flex",
|
|
2491
|
+
gridTemplateColumns: a === "grid" ? "repeat(auto-fill, minmax(140px, 1fr))" : void 0,
|
|
2492
|
+
flexDirection: a === "list" ? "column" : void 0,
|
|
2468
2493
|
gap: 12
|
|
2469
2494
|
},
|
|
2470
2495
|
children: e.map((f) => {
|
|
2471
|
-
const
|
|
2496
|
+
const x = f.verified ?? !1, A = f.disabled || b;
|
|
2472
2497
|
return /* @__PURE__ */ P(
|
|
2473
2498
|
"button",
|
|
2474
2499
|
{
|
|
2475
|
-
onClick: () => !
|
|
2476
|
-
disabled:
|
|
2500
|
+
onClick: () => !A && !x && (r == null ? void 0 : r(f.method)),
|
|
2501
|
+
disabled: A || x,
|
|
2477
2502
|
style: {
|
|
2478
2503
|
display: "flex",
|
|
2479
|
-
flexDirection:
|
|
2504
|
+
flexDirection: a === "grid" ? "column" : "row",
|
|
2480
2505
|
alignItems: "center",
|
|
2481
|
-
gap:
|
|
2482
|
-
padding:
|
|
2483
|
-
background:
|
|
2484
|
-
border: `2px solid ${
|
|
2506
|
+
gap: a === "grid" ? 8 : 12,
|
|
2507
|
+
padding: a === "grid" ? "20px 16px" : "12px 16px",
|
|
2508
|
+
background: x ? "color-mix(in srgb, var(--nice-color-success, #10b981) 8%, transparent)" : "var(--security-bg-panel)",
|
|
2509
|
+
border: `2px solid ${x ? "var(--security-success)" : "var(--security-border)"}`,
|
|
2485
2510
|
borderRadius: "var(--security-radius-lg)",
|
|
2486
|
-
cursor:
|
|
2487
|
-
opacity:
|
|
2511
|
+
cursor: A || x ? "default" : "pointer",
|
|
2512
|
+
opacity: A && !x ? 0.5 : 1,
|
|
2488
2513
|
transition: "border-color 0.2s, background 0.2s",
|
|
2489
|
-
textAlign:
|
|
2514
|
+
textAlign: a === "grid" ? "center" : "left"
|
|
2490
2515
|
},
|
|
2491
2516
|
children: [
|
|
2492
|
-
/* @__PURE__ */ c("span", { style: { fontSize: 28 }, children:
|
|
2517
|
+
/* @__PURE__ */ c("span", { style: { fontSize: 28 }, children: x ? /* @__PURE__ */ c(
|
|
2493
2518
|
"span",
|
|
2494
2519
|
{
|
|
2495
2520
|
"aria-label": "verified",
|
|
@@ -2507,7 +2532,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2507
2532
|
})
|
|
2508
2533
|
}
|
|
2509
2534
|
),
|
|
2510
|
-
|
|
2535
|
+
b && /* @__PURE__ */ P(
|
|
2511
2536
|
"div",
|
|
2512
2537
|
{
|
|
2513
2538
|
style: {
|
|
@@ -2519,7 +2544,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2519
2544
|
},
|
|
2520
2545
|
children: [
|
|
2521
2546
|
/* @__PURE__ */ c("span", { "aria-hidden": "true", style: Se }),
|
|
2522
|
-
|
|
2547
|
+
i("security.mfa.complete", "All factors verified")
|
|
2523
2548
|
]
|
|
2524
2549
|
}
|
|
2525
2550
|
)
|
|
@@ -2531,25 +2556,25 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2531
2556
|
onRevoke: t,
|
|
2532
2557
|
onRevokeAll: r,
|
|
2533
2558
|
onTrust: n,
|
|
2534
|
-
className:
|
|
2535
|
-
label:
|
|
2536
|
-
showRevokeAll:
|
|
2559
|
+
className: o,
|
|
2560
|
+
label: s,
|
|
2561
|
+
showRevokeAll: a = !0
|
|
2537
2562
|
}) => {
|
|
2538
|
-
const { t:
|
|
2563
|
+
const { t: i } = te(), [y, b] = j(/* @__PURE__ */ new Set()), f = ae(
|
|
2539
2564
|
() => [...e].sort(
|
|
2540
|
-
(
|
|
2565
|
+
(g, I) => (I.current ? 1 : 0) - (g.current ? 1 : 0) || I.lastActive - g.lastActive
|
|
2541
2566
|
),
|
|
2542
2567
|
[e]
|
|
2543
|
-
),
|
|
2544
|
-
const
|
|
2545
|
-
return
|
|
2546
|
-
},
|
|
2547
|
-
|
|
2568
|
+
), x = (g) => {
|
|
2569
|
+
const I = new Date(g), p = Date.now() - g;
|
|
2570
|
+
return p < 6e4 ? i("security.session.justNow", "Just now") : p < 36e5 ? `${Math.floor(p / 6e4)}m ago` : p < 864e5 ? `${Math.floor(p / 36e5)}h ago` : I.toLocaleDateString();
|
|
2571
|
+
}, A = (g) => {
|
|
2572
|
+
b((I) => new Set(I).add(g)), t == null || t(g);
|
|
2548
2573
|
};
|
|
2549
2574
|
return /* @__PURE__ */ P(
|
|
2550
2575
|
"div",
|
|
2551
2576
|
{
|
|
2552
|
-
className:
|
|
2577
|
+
className: o,
|
|
2553
2578
|
style: {
|
|
2554
2579
|
fontFamily: "var(--security-font)",
|
|
2555
2580
|
color: "var(--security-text)",
|
|
@@ -2571,8 +2596,8 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2571
2596
|
borderBottom: "1px solid var(--security-border)"
|
|
2572
2597
|
},
|
|
2573
2598
|
children: [
|
|
2574
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children:
|
|
2575
|
-
|
|
2599
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: s ?? i("security.session.title", "Active Sessions") }),
|
|
2600
|
+
a && e.length > 1 && /* @__PURE__ */ c(
|
|
2576
2601
|
"button",
|
|
2577
2602
|
{
|
|
2578
2603
|
onClick: r,
|
|
@@ -2585,14 +2610,14 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2585
2610
|
color: "var(--security-error)",
|
|
2586
2611
|
cursor: "pointer"
|
|
2587
2612
|
},
|
|
2588
|
-
children:
|
|
2613
|
+
children: i("security.session.revokeAll", "Revoke all others")
|
|
2589
2614
|
}
|
|
2590
2615
|
)
|
|
2591
2616
|
]
|
|
2592
2617
|
}
|
|
2593
2618
|
),
|
|
2594
2619
|
/* @__PURE__ */ P("div", { children: [
|
|
2595
|
-
f.map((
|
|
2620
|
+
f.map((g) => /* @__PURE__ */ P(
|
|
2596
2621
|
"div",
|
|
2597
2622
|
{
|
|
2598
2623
|
style: {
|
|
@@ -2601,8 +2626,8 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2601
2626
|
justifyContent: "space-between",
|
|
2602
2627
|
padding: "12px 16px",
|
|
2603
2628
|
borderBottom: "1px solid var(--security-border)",
|
|
2604
|
-
opacity:
|
|
2605
|
-
background:
|
|
2629
|
+
opacity: y.has(g.id) ? 0.5 : 1,
|
|
2630
|
+
background: g.current ? "color-mix(in srgb, var(--nice-color-primary, #3b82f6) 4%, transparent)" : void 0
|
|
2606
2631
|
},
|
|
2607
2632
|
children: [
|
|
2608
2633
|
/* @__PURE__ */ P("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [
|
|
@@ -2616,13 +2641,13 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2616
2641
|
color: "var(--security-text-muted)",
|
|
2617
2642
|
minWidth: 48
|
|
2618
2643
|
},
|
|
2619
|
-
children:
|
|
2644
|
+
children: g.device.toLowerCase().includes("mobile") ? i("security.session.mobile", "Mobile") : i("security.session.desktop", "Desktop")
|
|
2620
2645
|
}
|
|
2621
2646
|
),
|
|
2622
2647
|
/* @__PURE__ */ P("div", { children: [
|
|
2623
2648
|
/* @__PURE__ */ P("div", { style: { fontSize: 14, fontWeight: 500 }, children: [
|
|
2624
|
-
|
|
2625
|
-
|
|
2649
|
+
g.device,
|
|
2650
|
+
g.current && /* @__PURE__ */ c(
|
|
2626
2651
|
"span",
|
|
2627
2652
|
{
|
|
2628
2653
|
style: {
|
|
@@ -2633,10 +2658,10 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2633
2658
|
color: "var(--nice-color-white, #fff)",
|
|
2634
2659
|
borderRadius: 8
|
|
2635
2660
|
},
|
|
2636
|
-
children:
|
|
2661
|
+
children: i("security.session.current", "Current")
|
|
2637
2662
|
}
|
|
2638
2663
|
),
|
|
2639
|
-
|
|
2664
|
+
g.trusted && /* @__PURE__ */ c(
|
|
2640
2665
|
"span",
|
|
2641
2666
|
{
|
|
2642
2667
|
style: {
|
|
@@ -2650,24 +2675,24 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2650
2675
|
color: "var(--nice-success-text, #065f46)",
|
|
2651
2676
|
borderRadius: 8
|
|
2652
2677
|
},
|
|
2653
|
-
children:
|
|
2678
|
+
children: i("security.session.trusted", "Trusted")
|
|
2654
2679
|
}
|
|
2655
2680
|
)
|
|
2656
2681
|
] }),
|
|
2657
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 12, color: "var(--security-text-muted)", marginTop: 2 }, children: [
|
|
2682
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 12, color: "var(--security-text-muted)", marginTop: 2 }, children: [g.browser, g.os, g.location].filter(Boolean).join(" · ") }),
|
|
2658
2683
|
/* @__PURE__ */ P("div", { style: { fontSize: 11, color: "var(--security-text-muted)", marginTop: 1 }, children: [
|
|
2659
|
-
|
|
2684
|
+
i("security.session.lastActive", "Last active"),
|
|
2660
2685
|
":",
|
|
2661
2686
|
" ",
|
|
2662
|
-
|
|
2687
|
+
x(g.lastActive)
|
|
2663
2688
|
] })
|
|
2664
2689
|
] })
|
|
2665
2690
|
] }),
|
|
2666
2691
|
/* @__PURE__ */ P("div", { style: { display: "flex", gap: 6 }, children: [
|
|
2667
|
-
n && !
|
|
2692
|
+
n && !g.current && /* @__PURE__ */ c(
|
|
2668
2693
|
"button",
|
|
2669
2694
|
{
|
|
2670
|
-
onClick: () => n(
|
|
2695
|
+
onClick: () => n(g.id, !g.trusted),
|
|
2671
2696
|
style: {
|
|
2672
2697
|
fontSize: 11,
|
|
2673
2698
|
padding: "4px 8px",
|
|
@@ -2677,14 +2702,14 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2677
2702
|
cursor: "pointer",
|
|
2678
2703
|
color: "var(--security-text-secondary)"
|
|
2679
2704
|
},
|
|
2680
|
-
children:
|
|
2705
|
+
children: g.trusted ? i("security.session.untrust", "Untrust") : i("security.session.trust", "Trust")
|
|
2681
2706
|
}
|
|
2682
2707
|
),
|
|
2683
|
-
!
|
|
2708
|
+
!g.current && /* @__PURE__ */ c(
|
|
2684
2709
|
"button",
|
|
2685
2710
|
{
|
|
2686
|
-
onClick: () =>
|
|
2687
|
-
disabled:
|
|
2711
|
+
onClick: () => A(g.id),
|
|
2712
|
+
disabled: y.has(g.id),
|
|
2688
2713
|
style: {
|
|
2689
2714
|
fontSize: 11,
|
|
2690
2715
|
padding: "4px 10px",
|
|
@@ -2694,13 +2719,13 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2694
2719
|
cursor: "pointer",
|
|
2695
2720
|
color: "var(--security-error)"
|
|
2696
2721
|
},
|
|
2697
|
-
children:
|
|
2722
|
+
children: i("security.session.revoke", "Revoke")
|
|
2698
2723
|
}
|
|
2699
2724
|
)
|
|
2700
2725
|
] })
|
|
2701
2726
|
]
|
|
2702
2727
|
},
|
|
2703
|
-
|
|
2728
|
+
g.id
|
|
2704
2729
|
)),
|
|
2705
2730
|
e.length === 0 && /* @__PURE__ */ c(
|
|
2706
2731
|
"div",
|
|
@@ -2711,98 +2736,103 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2711
2736
|
color: "var(--security-text-muted)",
|
|
2712
2737
|
fontSize: 13
|
|
2713
2738
|
},
|
|
2714
|
-
children:
|
|
2739
|
+
children: i("security.session.noSessions", "No active sessions")
|
|
2715
2740
|
}
|
|
2716
2741
|
)
|
|
2717
2742
|
] })
|
|
2718
2743
|
]
|
|
2719
2744
|
}
|
|
2720
2745
|
);
|
|
2721
|
-
},
|
|
2746
|
+
}, qt = ({
|
|
2722
2747
|
trustScore: e,
|
|
2723
2748
|
onScoreComputed: t,
|
|
2724
2749
|
trustThreshold: r = 60,
|
|
2725
2750
|
showFactors: n = !0,
|
|
2726
|
-
showFingerprint:
|
|
2727
|
-
className:
|
|
2728
|
-
label:
|
|
2751
|
+
showFingerprint: o = !1,
|
|
2752
|
+
className: s,
|
|
2753
|
+
label: a
|
|
2729
2754
|
}) => {
|
|
2730
|
-
const { t:
|
|
2731
|
-
|
|
2732
|
-
|
|
2755
|
+
const { t: i } = te(), [y, b] = j(e ?? null), [f, x] = j(!e), A = V(t);
|
|
2756
|
+
A.current = t;
|
|
2757
|
+
const g = K(async () => {
|
|
2758
|
+
var L, p;
|
|
2759
|
+
x(!0);
|
|
2733
2760
|
try {
|
|
2734
|
-
const
|
|
2735
|
-
let
|
|
2736
|
-
|
|
2737
|
-
name: "Known platform",
|
|
2761
|
+
const C = Ce(), S = await de(), v = [];
|
|
2762
|
+
let l = 50;
|
|
2763
|
+
C.platform && !C.platform.includes("Linux") && (v.push({
|
|
2764
|
+
name: i("security.trust.knownPlatform", "Known platform"),
|
|
2738
2765
|
score: 5,
|
|
2739
|
-
description: "Running on a recognized platform",
|
|
2766
|
+
description: i("security.trust.knownPlatformHint", "Running on a recognized platform"),
|
|
2740
2767
|
weight: 0.05
|
|
2741
|
-
}),
|
|
2742
|
-
name: "Cookies enabled",
|
|
2768
|
+
}), l += 5), navigator.cookieEnabled && (v.push({
|
|
2769
|
+
name: i("security.trust.cookiesEnabled", "Cookies enabled"),
|
|
2743
2770
|
score: 5,
|
|
2744
|
-
description: "Browser cookies are enabled",
|
|
2771
|
+
description: i("security.trust.cookiesEnabledHint", "Browser cookies are enabled"),
|
|
2745
2772
|
weight: 0.05
|
|
2746
|
-
}),
|
|
2747
|
-
name: "Standard resolution",
|
|
2773
|
+
}), l += 5), C.screenResolution[0] >= 360 && C.screenResolution[1] >= 640 && (v.push({
|
|
2774
|
+
name: i("security.trust.standardResolution", "Standard resolution"),
|
|
2748
2775
|
score: 5,
|
|
2749
|
-
description:
|
|
2776
|
+
description: i(
|
|
2777
|
+
"security.trust.standardResolutionHint",
|
|
2778
|
+
"Screen resolution within normal range"
|
|
2779
|
+
),
|
|
2750
2780
|
weight: 0.05
|
|
2751
|
-
}),
|
|
2752
|
-
name: "Secure context",
|
|
2781
|
+
}), l += 5), typeof window < "u" && window.isSecureContext && (v.push({
|
|
2782
|
+
name: i("security.trust.secureContext", "Secure context"),
|
|
2753
2783
|
score: 10,
|
|
2754
|
-
description: "Running in HTTPS secure context",
|
|
2784
|
+
description: i("security.trust.secureContextHint", "Running in HTTPS secure context"),
|
|
2755
2785
|
weight: 0.1
|
|
2756
|
-
}),
|
|
2757
|
-
name: "Language configured",
|
|
2786
|
+
}), l += 10), ((L = navigator.languages) == null ? void 0 : L.length) > 0 && (v.push({
|
|
2787
|
+
name: i("security.trust.languageConfigured", "Language configured"),
|
|
2758
2788
|
score: 5,
|
|
2759
|
-
description: "Browser language is set",
|
|
2789
|
+
description: i("security.trust.languageConfiguredHint", "Browser language is set"),
|
|
2760
2790
|
weight: 0.05
|
|
2761
|
-
}),
|
|
2762
|
-
name: "Touch device",
|
|
2791
|
+
}), l += 5), C.touchSupport && (v.push({
|
|
2792
|
+
name: i("security.trust.touchDevice", "Touch device"),
|
|
2763
2793
|
score: 5,
|
|
2764
|
-
description: "Touch input is supported",
|
|
2794
|
+
description: i("security.trust.touchDeviceHint", "Touch input is supported"),
|
|
2765
2795
|
weight: 0.05
|
|
2766
|
-
}),
|
|
2796
|
+
}), l += 5);
|
|
2767
2797
|
try {
|
|
2768
|
-
const
|
|
2769
|
-
|
|
2770
|
-
name: "Hardware GPU",
|
|
2798
|
+
const R = document.createElement("canvas").getContext("webgl");
|
|
2799
|
+
R && R.getExtension("WEBGL_debug_renderer_info") && (v.push({
|
|
2800
|
+
name: i("security.trust.hardwareGpu", "Hardware GPU"),
|
|
2771
2801
|
score: 10,
|
|
2772
|
-
description: "Hardware GPU detected",
|
|
2802
|
+
description: i("security.trust.hardwareGpuHint", "Hardware GPU detected"),
|
|
2773
2803
|
weight: 0.1
|
|
2774
|
-
}),
|
|
2804
|
+
}), l += 10);
|
|
2775
2805
|
} catch {
|
|
2776
2806
|
}
|
|
2777
|
-
navigator.credentials && (
|
|
2778
|
-
name: "Credential API",
|
|
2807
|
+
navigator.credentials && (v.push({
|
|
2808
|
+
name: i("security.trust.credentialApi", "Credential API"),
|
|
2779
2809
|
score: 5,
|
|
2780
|
-
description: "Credential Management API available",
|
|
2810
|
+
description: i("security.trust.credentialApiHint", "Credential Management API available"),
|
|
2781
2811
|
weight: 0.05
|
|
2782
|
-
}),
|
|
2783
|
-
const
|
|
2784
|
-
score:
|
|
2785
|
-
factors:
|
|
2786
|
-
trusted:
|
|
2787
|
-
firstSeen:
|
|
2788
|
-
lastSeen:
|
|
2789
|
-
fingerprint:
|
|
2812
|
+
}), l += 5), l = Math.min(100, Math.max(0, l));
|
|
2813
|
+
const w = Date.now(), u = {
|
|
2814
|
+
score: l,
|
|
2815
|
+
factors: v,
|
|
2816
|
+
trusted: l >= r,
|
|
2817
|
+
firstSeen: w,
|
|
2818
|
+
lastSeen: w,
|
|
2819
|
+
fingerprint: S
|
|
2790
2820
|
};
|
|
2791
|
-
|
|
2821
|
+
b(u), (p = A.current) == null || p.call(A, u);
|
|
2792
2822
|
} finally {
|
|
2793
|
-
|
|
2823
|
+
x(!1);
|
|
2794
2824
|
}
|
|
2795
|
-
}, [r,
|
|
2825
|
+
}, [r, i]);
|
|
2796
2826
|
ne(() => {
|
|
2797
|
-
e ||
|
|
2798
|
-
}, [e,
|
|
2799
|
-
e &&
|
|
2827
|
+
e || g();
|
|
2828
|
+
}, [e, g]), ne(() => {
|
|
2829
|
+
e && b(e);
|
|
2800
2830
|
}, [e]);
|
|
2801
|
-
const
|
|
2831
|
+
const I = y ? y.score >= 80 ? "var(--security-success)" : y.score >= 50 ? "var(--security-warning)" : "var(--security-error)" : "var(--security-text-muted)";
|
|
2802
2832
|
return /* @__PURE__ */ P(
|
|
2803
2833
|
"div",
|
|
2804
2834
|
{
|
|
2805
|
-
className:
|
|
2835
|
+
className: s,
|
|
2806
2836
|
style: {
|
|
2807
2837
|
fontFamily: "var(--security-font)",
|
|
2808
2838
|
color: "var(--security-text)",
|
|
@@ -2816,8 +2846,8 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2816
2846
|
alignItems: "center"
|
|
2817
2847
|
},
|
|
2818
2848
|
children: [
|
|
2819
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children:
|
|
2820
|
-
f ? /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-muted)" }, children:
|
|
2849
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 15, fontWeight: 600 }, children: a ?? i("security.trust.title", "Device Trust") }),
|
|
2850
|
+
f ? /* @__PURE__ */ c("div", { style: { fontSize: 13, color: "var(--security-text-muted)" }, children: i("security.trust.computing", "Analysing device…") }) : y ? /* @__PURE__ */ P(Pe, { children: [
|
|
2821
2851
|
/* @__PURE__ */ P("div", { style: { position: "relative", width: 100, height: 100 }, children: [
|
|
2822
2852
|
/* @__PURE__ */ P(
|
|
2823
2853
|
"svg",
|
|
@@ -2843,9 +2873,9 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2843
2873
|
cy: "18",
|
|
2844
2874
|
r: "15.9",
|
|
2845
2875
|
fill: "none",
|
|
2846
|
-
stroke:
|
|
2876
|
+
stroke: I,
|
|
2847
2877
|
strokeWidth: "2.5",
|
|
2848
|
-
strokeDasharray: `${
|
|
2878
|
+
strokeDasharray: `${y.score}, 100`,
|
|
2849
2879
|
strokeLinecap: "round"
|
|
2850
2880
|
}
|
|
2851
2881
|
)
|
|
@@ -2864,7 +2894,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2864
2894
|
justifyContent: "center"
|
|
2865
2895
|
},
|
|
2866
2896
|
children: [
|
|
2867
|
-
/* @__PURE__ */ c("span", { style: { fontSize: 24, fontWeight: 700, color:
|
|
2897
|
+
/* @__PURE__ */ c("span", { style: { fontSize: 24, fontWeight: 700, color: I }, children: y.score }),
|
|
2868
2898
|
/* @__PURE__ */ c("span", { style: { fontSize: 10, color: "var(--security-text-muted)" }, children: "/100" })
|
|
2869
2899
|
]
|
|
2870
2900
|
}
|
|
@@ -2876,12 +2906,12 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2876
2906
|
style: {
|
|
2877
2907
|
fontSize: 14,
|
|
2878
2908
|
fontWeight: 600,
|
|
2879
|
-
color:
|
|
2909
|
+
color: y.trusted ? "var(--security-success)" : "var(--security-warning)"
|
|
2880
2910
|
},
|
|
2881
|
-
children:
|
|
2911
|
+
children: y.trusted ? i("security.trust.trusted", "Device Trusted") : i("security.trust.untrusted", "Low Trust Score")
|
|
2882
2912
|
}
|
|
2883
2913
|
),
|
|
2884
|
-
n &&
|
|
2914
|
+
n && y.factors.length > 0 && /* @__PURE__ */ P("div", { style: { width: "100%", fontSize: 12 }, children: [
|
|
2885
2915
|
/* @__PURE__ */ P(
|
|
2886
2916
|
"div",
|
|
2887
2917
|
{
|
|
@@ -2891,14 +2921,14 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2891
2921
|
color: "var(--security-text-secondary)"
|
|
2892
2922
|
},
|
|
2893
2923
|
children: [
|
|
2894
|
-
|
|
2924
|
+
i("security.trust.factors", "Contributing factors"),
|
|
2895
2925
|
":"
|
|
2896
2926
|
]
|
|
2897
2927
|
}
|
|
2898
2928
|
),
|
|
2899
|
-
/* @__PURE__ */ c("ul", { style: { margin: 0, paddingLeft: 18, color: "var(--security-text-muted)" }, children:
|
|
2929
|
+
/* @__PURE__ */ c("ul", { style: { margin: 0, paddingLeft: 18, color: "var(--security-text-muted)" }, children: y.factors.map((L, p) => /* @__PURE__ */ c("li", { style: { marginBottom: 2 }, children: L.name }, p)) })
|
|
2900
2930
|
] }),
|
|
2901
|
-
|
|
2931
|
+
o && y.fingerprint && /* @__PURE__ */ c(
|
|
2902
2932
|
"div",
|
|
2903
2933
|
{
|
|
2904
2934
|
style: {
|
|
@@ -2909,7 +2939,7 @@ const lt = 4, ut = 5, dt = 3e4, _t = (e) => {
|
|
|
2909
2939
|
maxWidth: 280,
|
|
2910
2940
|
fontFamily: "monospace"
|
|
2911
2941
|
},
|
|
2912
|
-
children:
|
|
2942
|
+
children: y.fingerprint
|
|
2913
2943
|
}
|
|
2914
2944
|
)
|
|
2915
2945
|
] }) : null
|
|
@@ -2929,56 +2959,61 @@ const At = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], ke = [
|
|
|
2929
2959
|
"var(--nice-warning, #eab308)",
|
|
2930
2960
|
"var(--nice-success, #22c55e)",
|
|
2931
2961
|
"var(--nice-success, #10b981)"
|
|
2932
|
-
],
|
|
2962
|
+
], Kt = ({
|
|
2933
2963
|
mode: e = "verify",
|
|
2934
2964
|
expectedHash: t,
|
|
2935
2965
|
minStrength: r = 2,
|
|
2936
2966
|
minLength: n = 8,
|
|
2937
|
-
onComplete:
|
|
2938
|
-
onVerify:
|
|
2939
|
-
onStatusChange:
|
|
2940
|
-
onError:
|
|
2941
|
-
label:
|
|
2942
|
-
placeholder:
|
|
2967
|
+
onComplete: o,
|
|
2968
|
+
onVerify: s,
|
|
2969
|
+
onStatusChange: a,
|
|
2970
|
+
onError: i,
|
|
2971
|
+
label: y,
|
|
2972
|
+
placeholder: b,
|
|
2943
2973
|
className: f,
|
|
2944
|
-
showStrength:
|
|
2945
|
-
maxAttempts:
|
|
2974
|
+
showStrength: x = !0,
|
|
2975
|
+
maxAttempts: A = 5
|
|
2946
2976
|
}) => {
|
|
2947
|
-
const { t:
|
|
2977
|
+
const { t: g } = te(), [I, L] = j(""), [p, C] = j(""), [S, v] = j(!1), [l, w] = j("idle"), [u, h] = j(0), [R, G] = j(""), J = V(null), W = kt(I), O = K(
|
|
2948
2978
|
($) => {
|
|
2949
|
-
w($),
|
|
2979
|
+
w($), a == null || a($);
|
|
2950
2980
|
},
|
|
2951
|
-
[
|
|
2952
|
-
),
|
|
2953
|
-
if (
|
|
2954
|
-
if (
|
|
2955
|
-
|
|
2981
|
+
[a]
|
|
2982
|
+
), Y = K(async () => {
|
|
2983
|
+
if (G(""), O("processing"), e === "set") {
|
|
2984
|
+
if (I.length < n) {
|
|
2985
|
+
G(
|
|
2986
|
+
g("security.passphrase.tooShort", "Minimum {min} characters").replace(
|
|
2987
|
+
"{min}",
|
|
2988
|
+
String(n)
|
|
2989
|
+
)
|
|
2990
|
+
), O("idle");
|
|
2956
2991
|
return;
|
|
2957
2992
|
}
|
|
2958
|
-
if (
|
|
2959
|
-
|
|
2993
|
+
if (W < r) {
|
|
2994
|
+
G(g("security.passphrase.tooWeak", "Passphrase is too weak")), O("idle");
|
|
2960
2995
|
return;
|
|
2961
2996
|
}
|
|
2962
|
-
if (
|
|
2963
|
-
|
|
2997
|
+
if (I !== p) {
|
|
2998
|
+
G(g("security.passphrase.noMatch", "Passphrases do not match")), O("failure"), setTimeout(() => O("idle"), 1e3);
|
|
2964
2999
|
return;
|
|
2965
3000
|
}
|
|
2966
|
-
|
|
3001
|
+
o == null || o(I), O("success");
|
|
2967
3002
|
return;
|
|
2968
3003
|
}
|
|
2969
3004
|
if (t) {
|
|
2970
|
-
const $ = new TextEncoder(),
|
|
2971
|
-
if (Array.from(new Uint8Array(
|
|
2972
|
-
|
|
3005
|
+
const $ = new TextEncoder(), B = await crypto.subtle.digest("SHA-256", $.encode(I));
|
|
3006
|
+
if (Array.from(new Uint8Array(B)).map((H) => H.toString(16).padStart(2, "0")).join("") === t)
|
|
3007
|
+
O("success"), s == null || s({
|
|
2973
3008
|
success: !0,
|
|
2974
3009
|
confidence: 1,
|
|
2975
3010
|
method: "passphrase",
|
|
2976
3011
|
timestamp: Date.now(),
|
|
2977
3012
|
duration: 0
|
|
2978
|
-
}),
|
|
3013
|
+
}), o == null || o(I);
|
|
2979
3014
|
else {
|
|
2980
|
-
const
|
|
2981
|
-
h(
|
|
3015
|
+
const H = u + 1;
|
|
3016
|
+
h(H), H >= A ? (O("failure"), i == null || i(new Error("Too many failed attempts"))) : (G(g("security.passphrase.incorrect", "Incorrect passphrase")), O("idle")), s == null || s({
|
|
2982
3017
|
success: !1,
|
|
2983
3018
|
confidence: 0,
|
|
2984
3019
|
method: "passphrase",
|
|
@@ -2987,29 +3022,29 @@ const At = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], ke = [
|
|
|
2987
3022
|
});
|
|
2988
3023
|
}
|
|
2989
3024
|
} else
|
|
2990
|
-
|
|
3025
|
+
o == null || o(I), O("success");
|
|
2991
3026
|
}, [
|
|
2992
|
-
|
|
2993
|
-
|
|
3027
|
+
I,
|
|
3028
|
+
p,
|
|
2994
3029
|
e,
|
|
2995
3030
|
t,
|
|
2996
|
-
|
|
3031
|
+
W,
|
|
2997
3032
|
r,
|
|
2998
3033
|
n,
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3034
|
+
u,
|
|
3035
|
+
A,
|
|
3036
|
+
g,
|
|
3037
|
+
O,
|
|
3038
|
+
o,
|
|
3003
3039
|
s,
|
|
3004
|
-
i
|
|
3005
|
-
|
|
3006
|
-
]), W = {
|
|
3040
|
+
i
|
|
3041
|
+
]), _ = {
|
|
3007
3042
|
width: "100%",
|
|
3008
3043
|
padding: "10px 14px",
|
|
3009
3044
|
fontSize: 14,
|
|
3010
3045
|
background: "var(--security-bg)",
|
|
3011
3046
|
color: "var(--security-text)",
|
|
3012
|
-
border: `1px solid ${
|
|
3047
|
+
border: `1px solid ${l === "failure" ? "var(--security-error)" : "var(--security-border)"}`,
|
|
3013
3048
|
borderRadius: "var(--security-radius)",
|
|
3014
3049
|
boxSizing: "border-box",
|
|
3015
3050
|
fontFamily: "var(--security-font)"
|
|
@@ -3027,26 +3062,26 @@ const At = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], ke = [
|
|
|
3027
3062
|
color: "var(--security-text)"
|
|
3028
3063
|
},
|
|
3029
3064
|
children: [
|
|
3030
|
-
|
|
3065
|
+
y && /* @__PURE__ */ c("label", { style: { fontSize: 14, fontWeight: 600 }, children: y }),
|
|
3031
3066
|
/* @__PURE__ */ P("div", { style: { position: "relative" }, children: [
|
|
3032
3067
|
/* @__PURE__ */ c(
|
|
3033
3068
|
"input",
|
|
3034
3069
|
{
|
|
3035
|
-
ref:
|
|
3036
|
-
type:
|
|
3037
|
-
value:
|
|
3038
|
-
onChange: ($) =>
|
|
3039
|
-
placeholder:
|
|
3040
|
-
style:
|
|
3041
|
-
disabled:
|
|
3042
|
-
onKeyDown: ($) => $.key === "Enter" &&
|
|
3070
|
+
ref: J,
|
|
3071
|
+
type: S ? "text" : "password",
|
|
3072
|
+
value: I,
|
|
3073
|
+
onChange: ($) => L($.target.value),
|
|
3074
|
+
placeholder: b ?? g("security.passphrase.placeholder", "Enter passphrase"),
|
|
3075
|
+
style: _,
|
|
3076
|
+
disabled: l === "success",
|
|
3077
|
+
onKeyDown: ($) => $.key === "Enter" && Y()
|
|
3043
3078
|
}
|
|
3044
3079
|
),
|
|
3045
3080
|
/* @__PURE__ */ c(
|
|
3046
3081
|
"button",
|
|
3047
3082
|
{
|
|
3048
3083
|
type: "button",
|
|
3049
|
-
onClick: () =>
|
|
3084
|
+
onClick: () => v(!S),
|
|
3050
3085
|
style: {
|
|
3051
3086
|
position: "absolute",
|
|
3052
3087
|
right: 8,
|
|
@@ -3059,64 +3094,64 @@ const At = ["Very weak", "Weak", "Fair", "Strong", "Very strong"], ke = [
|
|
|
3059
3094
|
color: "var(--security-text-muted)"
|
|
3060
3095
|
},
|
|
3061
3096
|
tabIndex: -1,
|
|
3062
|
-
children:
|
|
3097
|
+
children: S ? g("security.passphrase.hide", "Hide") : g("security.passphrase.show", "Show")
|
|
3063
3098
|
}
|
|
3064
3099
|
)
|
|
3065
3100
|
] }),
|
|
3066
|
-
e === "set" &&
|
|
3101
|
+
e === "set" && x && I.length > 0 && /* @__PURE__ */ P("div", { children: [
|
|
3067
3102
|
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 3, height: 4 }, children: [0, 1, 2, 3].map(($) => /* @__PURE__ */ c(
|
|
3068
3103
|
"div",
|
|
3069
3104
|
{
|
|
3070
3105
|
style: {
|
|
3071
3106
|
flex: 1,
|
|
3072
3107
|
borderRadius: 2,
|
|
3073
|
-
background: $ <
|
|
3108
|
+
background: $ < W ? ke[W] : "var(--security-border)",
|
|
3074
3109
|
transition: "background 0.2s"
|
|
3075
3110
|
}
|
|
3076
3111
|
},
|
|
3077
3112
|
$
|
|
3078
3113
|
)) }),
|
|
3079
|
-
/* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 4, color: ke[
|
|
3114
|
+
/* @__PURE__ */ c("div", { style: { fontSize: 11, marginTop: 4, color: ke[W] }, children: g(`security.passphrase.strength${W}`, At[W]) })
|
|
3080
3115
|
] }),
|
|
3081
3116
|
e === "set" && /* @__PURE__ */ c(
|
|
3082
3117
|
"input",
|
|
3083
3118
|
{
|
|
3084
|
-
type:
|
|
3085
|
-
value:
|
|
3086
|
-
onChange: ($) =>
|
|
3087
|
-
placeholder:
|
|
3088
|
-
style:
|
|
3089
|
-
disabled:
|
|
3090
|
-
onKeyDown: ($) => $.key === "Enter" &&
|
|
3119
|
+
type: S ? "text" : "password",
|
|
3120
|
+
value: p,
|
|
3121
|
+
onChange: ($) => C($.target.value),
|
|
3122
|
+
placeholder: g("security.passphrase.confirmPlaceholder", "Confirm passphrase"),
|
|
3123
|
+
style: _,
|
|
3124
|
+
disabled: l === "success",
|
|
3125
|
+
onKeyDown: ($) => $.key === "Enter" && Y(),
|
|
3091
3126
|
onPaste: ($) => $.preventDefault()
|
|
3092
3127
|
}
|
|
3093
3128
|
),
|
|
3094
|
-
|
|
3129
|
+
R && /* @__PURE__ */ c("div", { style: { fontSize: 12, color: "var(--security-error)" }, children: R }),
|
|
3095
3130
|
/* @__PURE__ */ c(
|
|
3096
3131
|
"button",
|
|
3097
3132
|
{
|
|
3098
|
-
onClick:
|
|
3099
|
-
disabled: !
|
|
3133
|
+
onClick: Y,
|
|
3134
|
+
disabled: !I || l === "processing" || l === "success",
|
|
3100
3135
|
style: {
|
|
3101
3136
|
padding: "10px 20px",
|
|
3102
3137
|
fontSize: 14,
|
|
3103
3138
|
fontWeight: 600,
|
|
3104
|
-
background:
|
|
3139
|
+
background: l === "success" ? "var(--security-success)" : "var(--security-biometric)",
|
|
3105
3140
|
color: "var(--nice-color-white, #fff)",
|
|
3106
3141
|
border: "none",
|
|
3107
3142
|
borderRadius: "var(--security-radius)",
|
|
3108
|
-
cursor:
|
|
3109
|
-
opacity: !
|
|
3143
|
+
cursor: l === "success" ? "default" : "pointer",
|
|
3144
|
+
opacity: !I || l === "processing" ? 0.6 : 1
|
|
3110
3145
|
},
|
|
3111
|
-
children:
|
|
3146
|
+
children: l === "success" ? g("security.passphrase.accepted", "Accepted") : e === "set" ? g("security.passphrase.setBtn", "Set Passphrase") : g("security.passphrase.verifyBtn", "Verify")
|
|
3112
3147
|
}
|
|
3113
3148
|
),
|
|
3114
|
-
|
|
3149
|
+
u > 0 && l !== "success" && /* @__PURE__ */ c("div", { style: { fontSize: 11, color: "var(--security-warning)" }, children: g("security.passphrase.attempts", "{attempts}/{max} attempts").replace("{attempts}", String(u)).replace("{max}", String(A)) })
|
|
3115
3150
|
]
|
|
3116
3151
|
}
|
|
3117
3152
|
);
|
|
3118
3153
|
};
|
|
3119
|
-
function
|
|
3154
|
+
function Gt(e) {
|
|
3120
3155
|
const t = [], r = {
|
|
3121
3156
|
defaultSrc: "default-src",
|
|
3122
3157
|
scriptSrc: "script-src",
|
|
@@ -3137,21 +3172,21 @@ function Kt(e) {
|
|
|
3137
3172
|
upgradeInsecureRequests: "upgrade-insecure-requests",
|
|
3138
3173
|
blockAllMixedContent: "block-all-mixed-content"
|
|
3139
3174
|
};
|
|
3140
|
-
return Object.entries(e.directives).forEach(([n,
|
|
3141
|
-
const
|
|
3142
|
-
if (
|
|
3143
|
-
if (typeof
|
|
3144
|
-
|
|
3145
|
-
else if (typeof
|
|
3146
|
-
t.push(`${
|
|
3147
|
-
else if (Array.isArray(
|
|
3148
|
-
let
|
|
3149
|
-
e.nonce && (n === "scriptSrc" || n === "styleSrc") && (
|
|
3175
|
+
return Object.entries(e.directives).forEach(([n, o]) => {
|
|
3176
|
+
const s = r[n];
|
|
3177
|
+
if (s) {
|
|
3178
|
+
if (typeof o == "boolean")
|
|
3179
|
+
o && t.push(s);
|
|
3180
|
+
else if (typeof o == "string")
|
|
3181
|
+
t.push(`${s} ${o}`);
|
|
3182
|
+
else if (Array.isArray(o)) {
|
|
3183
|
+
let a = o;
|
|
3184
|
+
e.nonce && (n === "scriptSrc" || n === "styleSrc") && (a = [...a, `'nonce-${e.nonce}'`]), t.push(`${s} ${a.join(" ")}`);
|
|
3150
3185
|
}
|
|
3151
3186
|
}
|
|
3152
3187
|
}), t.join("; ");
|
|
3153
3188
|
}
|
|
3154
|
-
function
|
|
3189
|
+
function Jt(e) {
|
|
3155
3190
|
const t = "'self'";
|
|
3156
3191
|
return {
|
|
3157
3192
|
defaultSrc: [t],
|
|
@@ -3170,7 +3205,7 @@ function Gt(e) {
|
|
|
3170
3205
|
reportUri: e == null ? void 0 : e.reportUri
|
|
3171
3206
|
};
|
|
3172
3207
|
}
|
|
3173
|
-
function
|
|
3208
|
+
function Yt() {
|
|
3174
3209
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "") : Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
3175
3210
|
}
|
|
3176
3211
|
const Tt = {
|
|
@@ -3186,11 +3221,11 @@ const Tt = {
|
|
|
3186
3221
|
function It(e) {
|
|
3187
3222
|
return e.replace(/[&<>"'`=/]/g, (t) => Tt[t] || t);
|
|
3188
3223
|
}
|
|
3189
|
-
function
|
|
3224
|
+
function Zt(e, t) {
|
|
3190
3225
|
let r = It(e);
|
|
3191
3226
|
return t != null && t.maxLength && r.length > t.maxLength && (r = r.substring(0, t.maxLength)), r;
|
|
3192
3227
|
}
|
|
3193
|
-
function
|
|
3228
|
+
function Xt(e) {
|
|
3194
3229
|
if (!e)
|
|
3195
3230
|
return null;
|
|
3196
3231
|
try {
|
|
@@ -3200,25 +3235,25 @@ function Zt(e) {
|
|
|
3200
3235
|
return null;
|
|
3201
3236
|
}
|
|
3202
3237
|
}
|
|
3203
|
-
function
|
|
3238
|
+
function Qt(e) {
|
|
3204
3239
|
const t = ["script", "iframe", "object", "embed", "form"];
|
|
3205
3240
|
let r = e;
|
|
3206
|
-
t.forEach((
|
|
3207
|
-
const
|
|
3208
|
-
r = r.replace(o, "");
|
|
3209
|
-
const a = new RegExp(`<${i}[^>]*/>`, "gi");
|
|
3241
|
+
t.forEach((s) => {
|
|
3242
|
+
const a = new RegExp(`<${s}[^>]*>.*?</${s}>`, "gi");
|
|
3210
3243
|
r = r.replace(a, "");
|
|
3244
|
+
const i = new RegExp(`<${s}[^>]*/>`, "gi");
|
|
3245
|
+
r = r.replace(i, "");
|
|
3211
3246
|
});
|
|
3212
3247
|
const n = /\s+on\w+\s*=/gi;
|
|
3213
3248
|
r = r.replace(n, " data-removed=");
|
|
3214
|
-
const
|
|
3215
|
-
return r = r.replace(
|
|
3249
|
+
const o = /javascript:/gi;
|
|
3250
|
+
return r = r.replace(o, ""), r;
|
|
3216
3251
|
}
|
|
3217
|
-
function
|
|
3252
|
+
function Vt(e, t) {
|
|
3218
3253
|
let r = e;
|
|
3219
3254
|
if (t != null && t.allowedTags) {
|
|
3220
3255
|
const n = /<\/?([a-z][a-z0-9]*)[^>]*>/gi;
|
|
3221
|
-
r = r.replace(n, (
|
|
3256
|
+
r = r.replace(n, (o, s) => t.allowedTags.includes(s.toLowerCase()) ? o : "");
|
|
3222
3257
|
}
|
|
3223
3258
|
return r = r.replace(/\s+on\w+\s*=/gi, " data-removed="), r = r.replace(/javascript:/gi, ""), { __html: r };
|
|
3224
3259
|
}
|
|
@@ -3227,29 +3262,29 @@ const me = {
|
|
|
3227
3262
|
cookieName: "XSRF-TOKEN",
|
|
3228
3263
|
fieldName: "_csrf"
|
|
3229
3264
|
};
|
|
3230
|
-
function
|
|
3265
|
+
function er() {
|
|
3231
3266
|
if (typeof crypto < "u") {
|
|
3232
3267
|
const e = new Uint8Array(32);
|
|
3233
3268
|
return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
|
|
3234
3269
|
}
|
|
3235
3270
|
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
3236
3271
|
}
|
|
3237
|
-
function
|
|
3272
|
+
function Me(e = me.cookieName) {
|
|
3238
3273
|
if (typeof document > "u")
|
|
3239
3274
|
return null;
|
|
3240
3275
|
const t = document.cookie.match(new RegExp(`(^| )${e}=([^;]+)`));
|
|
3241
3276
|
return t ? decodeURIComponent(t[2]) : null;
|
|
3242
3277
|
}
|
|
3243
|
-
function
|
|
3278
|
+
function tr(e = me) {
|
|
3244
3279
|
return async function(r, n = {}) {
|
|
3245
|
-
const
|
|
3246
|
-
|
|
3247
|
-
const
|
|
3248
|
-
return
|
|
3280
|
+
const o = Me(e.cookieName);
|
|
3281
|
+
o || console.warn("CSRF token not found");
|
|
3282
|
+
const s = new Headers(n.headers);
|
|
3283
|
+
return o && e.headerName && s.set(e.headerName, o), fetch(r, { ...n, headers: s });
|
|
3249
3284
|
};
|
|
3250
3285
|
}
|
|
3251
|
-
function
|
|
3252
|
-
const t =
|
|
3286
|
+
function rr(e = me) {
|
|
3287
|
+
const t = Me(e.cookieName);
|
|
3253
3288
|
return {
|
|
3254
3289
|
token: t,
|
|
3255
3290
|
inputProps: {
|
|
@@ -3260,46 +3295,46 @@ function tr(e = me) {
|
|
|
3260
3295
|
headerName: e.headerName
|
|
3261
3296
|
};
|
|
3262
3297
|
}
|
|
3263
|
-
function
|
|
3264
|
-
const t = /* @__PURE__ */ new Map(), r = e.keyGenerator || ((
|
|
3265
|
-
function n(
|
|
3266
|
-
const
|
|
3267
|
-
let
|
|
3268
|
-
(!
|
|
3298
|
+
function Ct(e) {
|
|
3299
|
+
const t = /* @__PURE__ */ new Map(), r = e.keyGenerator || ((s) => s.url);
|
|
3300
|
+
function n(s) {
|
|
3301
|
+
const a = r(s), i = Date.now();
|
|
3302
|
+
let y = t.get(a);
|
|
3303
|
+
(!y || i > y.resetAt) && (y = {
|
|
3269
3304
|
count: 0,
|
|
3270
|
-
resetAt:
|
|
3271
|
-
}),
|
|
3272
|
-
const
|
|
3273
|
-
return { allowed:
|
|
3305
|
+
resetAt: i + e.windowMs
|
|
3306
|
+
}), y.count++, t.set(a, y);
|
|
3307
|
+
const b = y.count <= e.maxRequests, f = Math.max(0, e.maxRequests - y.count);
|
|
3308
|
+
return { allowed: b, remaining: f, resetAt: y.resetAt };
|
|
3274
3309
|
}
|
|
3275
|
-
function s
|
|
3276
|
-
|
|
3310
|
+
function o(s) {
|
|
3311
|
+
s ? t.delete(s) : t.clear();
|
|
3277
3312
|
}
|
|
3278
|
-
return { checkLimit: n, reset:
|
|
3279
|
-
}
|
|
3280
|
-
function
|
|
3281
|
-
const t =
|
|
3282
|
-
return { checkAndFetch: async (n,
|
|
3283
|
-
const
|
|
3284
|
-
if (!
|
|
3285
|
-
const
|
|
3286
|
-
throw new Error(`Rate limit exceeded. Retry after ${
|
|
3313
|
+
return { checkLimit: n, reset: o };
|
|
3314
|
+
}
|
|
3315
|
+
function nr(e) {
|
|
3316
|
+
const t = Ct(e);
|
|
3317
|
+
return { checkAndFetch: async (n, o) => {
|
|
3318
|
+
const s = t.checkLimit({ url: n, method: o == null ? void 0 : o.method });
|
|
3319
|
+
if (!s.allowed) {
|
|
3320
|
+
const a = Math.ceil((s.resetAt - Date.now()) / 1e3);
|
|
3321
|
+
throw new Error(`Rate limit exceeded. Retry after ${a} seconds.`);
|
|
3287
3322
|
}
|
|
3288
|
-
return fetch(n,
|
|
3323
|
+
return fetch(n, o);
|
|
3289
3324
|
}, checkLimit: t.checkLimit, reset: t.reset };
|
|
3290
3325
|
}
|
|
3291
|
-
function
|
|
3326
|
+
function Dt(e, t) {
|
|
3292
3327
|
const r = [];
|
|
3293
3328
|
if (t.allowedTypes && t.allowedTypes.length > 0 && (t.allowedTypes.includes(e.type) || r.push(
|
|
3294
3329
|
`File type '${e.type}' is not allowed. Allowed types: ${t.allowedTypes.join(", ")}`
|
|
3295
3330
|
)), t.maxSize && e.size > t.maxSize) {
|
|
3296
|
-
const
|
|
3297
|
-
r.push(`File size (${
|
|
3331
|
+
const s = (t.maxSize / 1048576).toFixed(2), a = (e.size / (1024 * 1024)).toFixed(2);
|
|
3332
|
+
r.push(`File size (${a}MB) exceeds maximum allowed size (${s}MB)`);
|
|
3298
3333
|
}
|
|
3299
|
-
const n = [".exe", ".bat", ".cmd", ".sh", ".ps1", ".vbs", ".js", ".jar"],
|
|
3300
|
-
for (const
|
|
3301
|
-
if (
|
|
3302
|
-
r.push(`File extension '${
|
|
3334
|
+
const n = [".exe", ".bat", ".cmd", ".sh", ".ps1", ".vbs", ".js", ".jar"], o = e.name.toLowerCase();
|
|
3335
|
+
for (const s of n)
|
|
3336
|
+
if (o.includes(s + ".") || o.endsWith(s)) {
|
|
3337
|
+
r.push(`File extension '${s}' is not allowed`);
|
|
3303
3338
|
break;
|
|
3304
3339
|
}
|
|
3305
3340
|
return {
|
|
@@ -3308,25 +3343,25 @@ function Ct(e, t) {
|
|
|
3308
3343
|
file: r.length === 0 ? e : void 0
|
|
3309
3344
|
};
|
|
3310
3345
|
}
|
|
3311
|
-
function
|
|
3312
|
-
const r = [], n = [],
|
|
3346
|
+
function ir(e, t) {
|
|
3347
|
+
const r = [], n = [], o = [];
|
|
3313
3348
|
t.maxFiles && e.length > t.maxFiles && r.push(`Too many files. Maximum allowed: ${t.maxFiles}`);
|
|
3314
|
-
const
|
|
3315
|
-
if (t.maxTotalSize &&
|
|
3316
|
-
const
|
|
3317
|
-
r.push(`Total file size (${
|
|
3349
|
+
const s = e.reduce((a, i) => a + i.size, 0);
|
|
3350
|
+
if (t.maxTotalSize && s > t.maxTotalSize) {
|
|
3351
|
+
const a = (t.maxTotalSize / 1048576).toFixed(2), i = (s / (1024 * 1024)).toFixed(2);
|
|
3352
|
+
r.push(`Total file size (${i}MB) exceeds maximum (${a}MB)`);
|
|
3318
3353
|
}
|
|
3319
|
-
return e.forEach((
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3354
|
+
return e.forEach((a) => {
|
|
3355
|
+
const i = Dt(a, t);
|
|
3356
|
+
i.valid ? n.push(a) : o.push({ file: a, errors: i.errors });
|
|
3322
3357
|
}), {
|
|
3323
|
-
valid: r.length === 0 &&
|
|
3324
|
-
errors: [...r, ...
|
|
3358
|
+
valid: r.length === 0 && o.length === 0,
|
|
3359
|
+
errors: [...r, ...o.flatMap((a) => a.errors)],
|
|
3325
3360
|
validFiles: n,
|
|
3326
|
-
invalidFiles:
|
|
3361
|
+
invalidFiles: o
|
|
3327
3362
|
};
|
|
3328
3363
|
}
|
|
3329
|
-
async function
|
|
3364
|
+
async function sr(e, t) {
|
|
3330
3365
|
const r = new FormData();
|
|
3331
3366
|
r.append("file", e);
|
|
3332
3367
|
try {
|
|
@@ -3341,7 +3376,7 @@ async function ir(e, t) {
|
|
|
3341
3376
|
return console.error("Virus scan error:", n), { clean: !1, threat: "Scan failed" };
|
|
3342
3377
|
}
|
|
3343
3378
|
}
|
|
3344
|
-
function
|
|
3379
|
+
function Rt() {
|
|
3345
3380
|
if (typeof localStorage > "u")
|
|
3346
3381
|
return null;
|
|
3347
3382
|
const e = localStorage.getItem("nice2dev_consent");
|
|
@@ -3353,7 +3388,7 @@ function Mt() {
|
|
|
3353
3388
|
return null;
|
|
3354
3389
|
}
|
|
3355
3390
|
}
|
|
3356
|
-
function
|
|
3391
|
+
function or(e) {
|
|
3357
3392
|
typeof localStorage > "u" || localStorage.setItem(
|
|
3358
3393
|
"nice2dev_consent",
|
|
3359
3394
|
JSON.stringify({
|
|
@@ -3364,11 +3399,11 @@ function sr(e) {
|
|
|
3364
3399
|
})
|
|
3365
3400
|
);
|
|
3366
3401
|
}
|
|
3367
|
-
function
|
|
3368
|
-
const t =
|
|
3402
|
+
function ar(e) {
|
|
3403
|
+
const t = Rt();
|
|
3369
3404
|
return t ? t[e] === !0 : !1;
|
|
3370
3405
|
}
|
|
3371
|
-
function
|
|
3406
|
+
function cr(e) {
|
|
3372
3407
|
if (typeof document > "u")
|
|
3373
3408
|
return;
|
|
3374
3409
|
document.cookie.split(";").forEach((r) => {
|
|
@@ -3376,23 +3411,23 @@ function ar(e) {
|
|
|
3376
3411
|
e.includes(n) || (document.cookie = `${n}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`);
|
|
3377
3412
|
});
|
|
3378
3413
|
}
|
|
3379
|
-
async function
|
|
3414
|
+
async function lr(e, t, r = fetch) {
|
|
3380
3415
|
const n = {
|
|
3381
3416
|
exportDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3382
3417
|
userId: e
|
|
3383
3418
|
};
|
|
3384
3419
|
return await Promise.all(
|
|
3385
|
-
Object.entries(t).map(async ([
|
|
3420
|
+
Object.entries(t).map(async ([o, s]) => {
|
|
3386
3421
|
try {
|
|
3387
|
-
const
|
|
3388
|
-
|
|
3389
|
-
} catch (
|
|
3390
|
-
console.error(`Failed to fetch ${
|
|
3422
|
+
const a = await r(s);
|
|
3423
|
+
a.ok && (n[o] = await a.json());
|
|
3424
|
+
} catch (a) {
|
|
3425
|
+
console.error(`Failed to fetch ${o} data:`, a), n[o] = { error: "Failed to retrieve data" };
|
|
3391
3426
|
}
|
|
3392
3427
|
})
|
|
3393
3428
|
), n;
|
|
3394
3429
|
}
|
|
3395
|
-
async function
|
|
3430
|
+
async function ur(e, t, r = fetch) {
|
|
3396
3431
|
try {
|
|
3397
3432
|
const n = await r(t, {
|
|
3398
3433
|
method: "DELETE",
|
|
@@ -3404,7 +3439,7 @@ async function lr(e, t, r = fetch) {
|
|
|
3404
3439
|
return { success: !1, error: String(n) };
|
|
3405
3440
|
}
|
|
3406
3441
|
}
|
|
3407
|
-
function
|
|
3442
|
+
function dr(e, t) {
|
|
3408
3443
|
var n;
|
|
3409
3444
|
const r = {
|
|
3410
3445
|
...e,
|
|
@@ -3417,119 +3452,119 @@ function ur(e, t) {
|
|
|
3417
3452
|
body: JSON.stringify(r)
|
|
3418
3453
|
}).catch(console.error), process.env.NODE_ENV === "development" && console.warn("[HIPAA] PHI Access:", r), r;
|
|
3419
3454
|
}
|
|
3420
|
-
function
|
|
3455
|
+
function hr(e) {
|
|
3421
3456
|
let t = null, r = null, n = Date.now();
|
|
3422
|
-
const
|
|
3423
|
-
function
|
|
3457
|
+
const o = e.timeoutMinutes * 60 * 1e3, s = e.warningBeforeMs || 6e4;
|
|
3458
|
+
function a() {
|
|
3424
3459
|
n = Date.now(), t && clearTimeout(t), r && clearTimeout(r), e.onWarning && (r = setTimeout(() => {
|
|
3425
3460
|
var f;
|
|
3426
|
-
const
|
|
3427
|
-
(f = e.onWarning) == null || f.call(e,
|
|
3428
|
-
},
|
|
3461
|
+
const b = o - (Date.now() - n);
|
|
3462
|
+
(f = e.onWarning) == null || f.call(e, b);
|
|
3463
|
+
}, o - s)), t = setTimeout(e.onTimeout, o);
|
|
3429
3464
|
}
|
|
3430
|
-
function
|
|
3465
|
+
function i() {
|
|
3431
3466
|
t && clearTimeout(t), r && clearTimeout(r);
|
|
3432
3467
|
}
|
|
3433
|
-
function
|
|
3434
|
-
return Math.max(0,
|
|
3468
|
+
function y() {
|
|
3469
|
+
return Math.max(0, o - (Date.now() - n));
|
|
3435
3470
|
}
|
|
3436
|
-
return
|
|
3437
|
-
window.addEventListener(f,
|
|
3438
|
-
}), { resetTimer:
|
|
3439
|
-
}
|
|
3440
|
-
function
|
|
3441
|
-
const r = (
|
|
3442
|
-
const
|
|
3443
|
-
return 0.2126 *
|
|
3444
|
-
}, n = r(e),
|
|
3471
|
+
return a(), typeof window < "u" && ["mousedown", "keypress", "touchstart", "scroll"].forEach((f) => {
|
|
3472
|
+
window.addEventListener(f, a, { passive: !0 });
|
|
3473
|
+
}), { resetTimer: a, destroy: i, getTimeRemaining: y };
|
|
3474
|
+
}
|
|
3475
|
+
function fr(e, t) {
|
|
3476
|
+
const r = (a) => {
|
|
3477
|
+
const i = a.replace("#", ""), y = parseInt(i.substr(0, 2), 16) / 255, b = parseInt(i.substr(2, 2), 16) / 255, f = parseInt(i.substr(4, 2), 16) / 255, x = (A) => A <= 0.03928 ? A / 12.92 : Math.pow((A + 0.055) / 1.055, 2.4);
|
|
3478
|
+
return 0.2126 * x(y) + 0.7152 * x(b) + 0.0722 * x(f);
|
|
3479
|
+
}, n = r(e), o = r(t), s = (Math.max(n, o) + 0.05) / (Math.min(n, o) + 0.05);
|
|
3445
3480
|
return {
|
|
3446
|
-
ratio: Math.round(
|
|
3447
|
-
passesAA:
|
|
3481
|
+
ratio: Math.round(s * 100) / 100,
|
|
3482
|
+
passesAA: s >= 4.5,
|
|
3448
3483
|
// Normal text
|
|
3449
|
-
passesAAA:
|
|
3484
|
+
passesAAA: s >= 7,
|
|
3450
3485
|
// Normal text enhanced
|
|
3451
|
-
passesAALarge:
|
|
3486
|
+
passesAALarge: s >= 3,
|
|
3452
3487
|
// Large text (18pt+ or 14pt bold)
|
|
3453
|
-
passesAAALarge:
|
|
3488
|
+
passesAAALarge: s >= 4.5
|
|
3454
3489
|
// Large text enhanced
|
|
3455
3490
|
};
|
|
3456
3491
|
}
|
|
3457
|
-
function
|
|
3458
|
-
var r, n,
|
|
3492
|
+
function yr(e) {
|
|
3493
|
+
var r, n, o;
|
|
3459
3494
|
if (e.getAttribute("aria-label"))
|
|
3460
3495
|
return !0;
|
|
3461
3496
|
const t = e.getAttribute("aria-labelledby");
|
|
3462
3497
|
if (t) {
|
|
3463
|
-
const
|
|
3464
|
-
if ((r =
|
|
3498
|
+
const s = document.getElementById(t);
|
|
3499
|
+
if ((r = s == null ? void 0 : s.textContent) != null && r.trim())
|
|
3465
3500
|
return !0;
|
|
3466
3501
|
}
|
|
3467
3502
|
if (e.id) {
|
|
3468
|
-
const
|
|
3469
|
-
if ((n =
|
|
3503
|
+
const s = document.querySelector(`label[for="${e.id}"]`);
|
|
3504
|
+
if ((n = s == null ? void 0 : s.textContent) != null && n.trim())
|
|
3470
3505
|
return !0;
|
|
3471
3506
|
}
|
|
3472
|
-
return !!((
|
|
3507
|
+
return !!((o = e.textContent) != null && o.trim() || e.getAttribute("title") || e.placeholder);
|
|
3473
3508
|
}
|
|
3474
|
-
function
|
|
3509
|
+
function pr(e) {
|
|
3475
3510
|
const r = (e || document.body).querySelectorAll("h1, h2, h3, h4, h5, h6"), n = [];
|
|
3476
|
-
let
|
|
3477
|
-
return r.forEach((
|
|
3478
|
-
const
|
|
3479
|
-
|
|
3480
|
-
level:
|
|
3481
|
-
element:
|
|
3511
|
+
let o = 0, s = !1;
|
|
3512
|
+
return r.forEach((a) => {
|
|
3513
|
+
const i = parseInt(a.tagName[1]);
|
|
3514
|
+
i === 1 && (s && n.push({
|
|
3515
|
+
level: i,
|
|
3516
|
+
element: a,
|
|
3482
3517
|
issue: "Multiple H1 elements found"
|
|
3483
|
-
}),
|
|
3484
|
-
level:
|
|
3485
|
-
element:
|
|
3486
|
-
issue: `Skipped heading level: H${
|
|
3487
|
-
}),
|
|
3488
|
-
}), !
|
|
3518
|
+
}), s = !0), i > o + 1 && o !== 0 && n.push({
|
|
3519
|
+
level: i,
|
|
3520
|
+
element: a,
|
|
3521
|
+
issue: `Skipped heading level: H${o} to H${i}`
|
|
3522
|
+
}), o = i;
|
|
3523
|
+
}), !s && r.length > 0 && n.push({
|
|
3489
3524
|
level: 0,
|
|
3490
3525
|
element: r[0],
|
|
3491
3526
|
issue: "Missing H1 element"
|
|
3492
3527
|
}), { valid: n.length === 0, issues: n };
|
|
3493
3528
|
}
|
|
3494
|
-
function
|
|
3529
|
+
function gr(e) {
|
|
3495
3530
|
const t = [];
|
|
3496
3531
|
let r = null;
|
|
3497
|
-
const n = e.batchSize || 10,
|
|
3498
|
-
async function
|
|
3532
|
+
const n = e.batchSize || 10, o = e.flushInterval || 5e3;
|
|
3533
|
+
async function s() {
|
|
3499
3534
|
if (t.length === 0)
|
|
3500
3535
|
return;
|
|
3501
|
-
const
|
|
3536
|
+
const b = t.splice(0, n);
|
|
3502
3537
|
try {
|
|
3503
3538
|
await fetch(e.endpoint, {
|
|
3504
3539
|
method: "POST",
|
|
3505
3540
|
headers: { "Content-Type": "application/json" },
|
|
3506
|
-
body: JSON.stringify({ entries:
|
|
3541
|
+
body: JSON.stringify({ entries: b })
|
|
3507
3542
|
});
|
|
3508
3543
|
} catch (f) {
|
|
3509
|
-
console.error("Failed to send audit logs:", f), t.unshift(...
|
|
3544
|
+
console.error("Failed to send audit logs:", f), t.unshift(...b);
|
|
3510
3545
|
}
|
|
3511
3546
|
}
|
|
3512
|
-
function
|
|
3547
|
+
function a() {
|
|
3513
3548
|
r || (r = setTimeout(() => {
|
|
3514
|
-
r = null,
|
|
3515
|
-
},
|
|
3549
|
+
r = null, s();
|
|
3550
|
+
}, o));
|
|
3516
3551
|
}
|
|
3517
|
-
function
|
|
3518
|
-
var
|
|
3552
|
+
function i(b) {
|
|
3553
|
+
var x;
|
|
3519
3554
|
const f = {
|
|
3520
|
-
...
|
|
3521
|
-
id: ((
|
|
3555
|
+
...b,
|
|
3556
|
+
id: ((x = crypto.randomUUID) == null ? void 0 : x.call(crypto)) || Math.random().toString(36),
|
|
3522
3557
|
timestamp: /* @__PURE__ */ new Date(),
|
|
3523
3558
|
userAgent: e.includeUserAgent && typeof navigator < "u" ? navigator.userAgent : void 0
|
|
3524
3559
|
};
|
|
3525
|
-
t.push(f), t.length >= n ?
|
|
3560
|
+
t.push(f), t.length >= n ? s() : a();
|
|
3526
3561
|
}
|
|
3527
|
-
function
|
|
3528
|
-
r && clearTimeout(r),
|
|
3562
|
+
function y() {
|
|
3563
|
+
r && clearTimeout(r), s();
|
|
3529
3564
|
}
|
|
3530
|
-
return { log:
|
|
3565
|
+
return { log: i, flush: s, destroy: y };
|
|
3531
3566
|
}
|
|
3532
|
-
function
|
|
3567
|
+
function mr() {
|
|
3533
3568
|
return [
|
|
3534
3569
|
// Security
|
|
3535
3570
|
{
|
|
@@ -3607,7 +3642,7 @@ function gr() {
|
|
|
3607
3642
|
}
|
|
3608
3643
|
];
|
|
3609
3644
|
}
|
|
3610
|
-
const
|
|
3645
|
+
const vr = {
|
|
3611
3646
|
// Hardcoded secrets
|
|
3612
3647
|
hardcodedSecrets: [
|
|
3613
3648
|
{ pattern: /password\s*[:=]\s*["'][^"']+["']/gi, name: "Hardcoded password" },
|
|
@@ -3644,7 +3679,7 @@ const mr = {
|
|
|
3644
3679
|
{ pattern: /TODO.*password/gi, name: "TODO mentioning password" }
|
|
3645
3680
|
]
|
|
3646
3681
|
};
|
|
3647
|
-
function
|
|
3682
|
+
function br() {
|
|
3648
3683
|
return `# .github/workflows/sast.yml
|
|
3649
3684
|
name: Security Scan (SAST)
|
|
3650
3685
|
|
|
@@ -3695,7 +3730,7 @@ jobs:
|
|
|
3695
3730
|
uses: github/codeql-action/analyze@v3
|
|
3696
3731
|
`;
|
|
3697
3732
|
}
|
|
3698
|
-
function
|
|
3733
|
+
function xr() {
|
|
3699
3734
|
return `# .github/workflows/sca.yml
|
|
3700
3735
|
name: Dependency Security (SCA)
|
|
3701
3736
|
|
|
@@ -3761,7 +3796,7 @@ jobs:
|
|
|
3761
3796
|
args: --severity-threshold=high
|
|
3762
3797
|
`;
|
|
3763
3798
|
}
|
|
3764
|
-
const
|
|
3799
|
+
const wr = [
|
|
3765
3800
|
// API Keys
|
|
3766
3801
|
{ name: "AWS Access Key ID", pattern: /AKIA[0-9A-Z]{16}/g, severity: "critical" },
|
|
3767
3802
|
{ name: "AWS Secret Access Key", pattern: /[A-Za-z0-9/+=]{40}/g, severity: "critical" },
|
|
@@ -3792,7 +3827,7 @@ const xr = [
|
|
|
3792
3827
|
{ name: "Bearer Token", pattern: /bearer [a-zA-Z0-9_\-.=]+/gi, severity: "high" },
|
|
3793
3828
|
{ name: "Connection String", pattern: /[a-z]+:\/\/[^:]+:[^@]+@[^/]+/gi, severity: "critical" }
|
|
3794
3829
|
];
|
|
3795
|
-
function
|
|
3830
|
+
function Sr() {
|
|
3796
3831
|
return `#!/bin/sh
|
|
3797
3832
|
# .git/hooks/pre-commit
|
|
3798
3833
|
|
|
@@ -3823,7 +3858,7 @@ echo "No secrets detected."
|
|
|
3823
3858
|
exit 0
|
|
3824
3859
|
`;
|
|
3825
3860
|
}
|
|
3826
|
-
function
|
|
3861
|
+
function kr() {
|
|
3827
3862
|
return `# .github/workflows/secret-scanning.yml
|
|
3828
3863
|
name: Secret Scanning
|
|
3829
3864
|
|
|
@@ -3861,7 +3896,7 @@ jobs:
|
|
|
3861
3896
|
head: HEAD
|
|
3862
3897
|
`;
|
|
3863
3898
|
}
|
|
3864
|
-
function
|
|
3899
|
+
function Ar(e) {
|
|
3865
3900
|
return `# Security Advisory
|
|
3866
3901
|
|
|
3867
3902
|
## ${e.cves.join(", ")} - ${e.description}
|
|
@@ -3909,7 +3944,7 @@ ${e.cves.map((t) => `- [${t}](https://www.cve.org/CVERecord?id=${t})`).join(`
|
|
|
3909
3944
|
`)}
|
|
3910
3945
|
`;
|
|
3911
3946
|
}
|
|
3912
|
-
function
|
|
3947
|
+
function Tr() {
|
|
3913
3948
|
return `# Security Policy
|
|
3914
3949
|
|
|
3915
3950
|
## Supported Versions
|
|
@@ -3980,80 +4015,80 @@ We will not pursue legal action against researchers who:
|
|
|
3980
4015
|
`;
|
|
3981
4016
|
}
|
|
3982
4017
|
export {
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
4018
|
+
qt as NiceDeviceTrust,
|
|
4019
|
+
jt as NiceFaceRecognition,
|
|
4020
|
+
Lt as NiceFingerprintScanner,
|
|
4021
|
+
Nt as NiceI18nProvider,
|
|
4022
|
+
$t as NiceIrisScanner,
|
|
3988
4023
|
Ot as NiceMfaSelector,
|
|
3989
|
-
|
|
3990
|
-
|
|
4024
|
+
Kt as NicePassphraseInput,
|
|
4025
|
+
Bt as NicePatternLock,
|
|
3991
4026
|
_t as NicePinKeypad,
|
|
3992
|
-
|
|
4027
|
+
Ht as NiceSecurityAuditLog,
|
|
3993
4028
|
Ut as NiceSessionManager,
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
4029
|
+
Wt as NiceWebAuthnButton,
|
|
4030
|
+
wr as SECRET_PATTERNS,
|
|
4031
|
+
vr as SECURITY_PATTERNS,
|
|
4032
|
+
nt as authenticateWebAuthn,
|
|
3998
4033
|
le as captureFrame,
|
|
3999
|
-
|
|
4000
|
-
|
|
4034
|
+
fr as checkColorContrast,
|
|
4035
|
+
pr as checkHeadingHierarchy,
|
|
4001
4036
|
Ie as checkLiveness,
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4037
|
+
cr as clearNonEssentialCookies,
|
|
4038
|
+
Ce as collectDeviceInfo,
|
|
4039
|
+
Qe as compareFaceToPhoto,
|
|
4040
|
+
gr as createAuditLogger,
|
|
4041
|
+
tr as createCSRFFetch,
|
|
4042
|
+
hr as createHIPAASession,
|
|
4043
|
+
Ct as createRateLimiter,
|
|
4044
|
+
Vt as createSafeHtml,
|
|
4045
|
+
Je as detectIris,
|
|
4011
4046
|
It as escapeHtml,
|
|
4012
4047
|
he as extractFaceFeatures,
|
|
4013
4048
|
Ue as extractMinutiae,
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4049
|
+
Ve as faceToTemplate,
|
|
4050
|
+
Ke as fingerprintToTemplate,
|
|
4051
|
+
Gt as generateCSPHeader,
|
|
4052
|
+
er as generateCSRFToken,
|
|
4053
|
+
lr as generateDataExport,
|
|
4019
4054
|
de as generateDeviceFingerprint,
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4055
|
+
zt as generateLivenessChallenge,
|
|
4056
|
+
Yt as generateNonce,
|
|
4057
|
+
Sr as generatePreCommitHook,
|
|
4058
|
+
br as generateSASTConfig,
|
|
4059
|
+
xr as generateSCAConfig,
|
|
4060
|
+
kr as generateSecretScanningConfig,
|
|
4061
|
+
Ar as generateSecurityAdvisory,
|
|
4062
|
+
Tr as generateSecurityMd,
|
|
4063
|
+
Me as getCSRFTokenFromCookie,
|
|
4029
4064
|
pe as getCameraStream,
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4065
|
+
Rt as getConsentPreferences,
|
|
4066
|
+
Jt as getRecommendedCSP,
|
|
4067
|
+
mr as getSOC2Checklist,
|
|
4068
|
+
yr as hasAccessibleName,
|
|
4069
|
+
ar as hasConsent,
|
|
4070
|
+
Ze as irisToTemplate,
|
|
4071
|
+
tt as isPasskeyAvailable,
|
|
4072
|
+
De as isWebAuthnAvailable,
|
|
4073
|
+
dr as logPHIAccess,
|
|
4039
4074
|
Te as matchFaces,
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4075
|
+
qe as matchFingerprints,
|
|
4076
|
+
Ye as matchIris,
|
|
4077
|
+
rt as registerWebAuthn,
|
|
4078
|
+
ur as requestDataDeletion,
|
|
4044
4079
|
fe as resolveConfig,
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4080
|
+
Zt as sanitizeInput,
|
|
4081
|
+
Qt as sanitizeSvg,
|
|
4082
|
+
Xt as sanitizeUrl,
|
|
4083
|
+
or as saveConsentPreferences,
|
|
4084
|
+
sr as scanFileForViruses,
|
|
4085
|
+
et as templateToFace,
|
|
4086
|
+
Ge as templateToFingerprint,
|
|
4087
|
+
Xe as templateToIris,
|
|
4088
|
+
rr as useCSRFToken,
|
|
4054
4089
|
te as useNiceTranslation,
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4090
|
+
nr as useRateLimiter,
|
|
4091
|
+
Dt as validateFile,
|
|
4092
|
+
ir as validateFiles,
|
|
4058
4093
|
ge as verifyWithBackend
|
|
4059
4094
|
};
|