@orangecheck/auth-client 2.0.0 → 2.1.1
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/dist/index.d.mts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.js +273 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +270 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React4 from 'react';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { startRegistration, startAuthentication } from '@simplewebauthn/browser';
|
|
3
4
|
|
|
4
5
|
// src/provider.tsx
|
|
5
6
|
|
|
@@ -20,7 +21,7 @@ function buildSignInUrl(cfg, returnTo) {
|
|
|
20
21
|
u.searchParams.set("return_to", returnTo);
|
|
21
22
|
return u.toString();
|
|
22
23
|
}
|
|
23
|
-
var SessionContext =
|
|
24
|
+
var SessionContext = React4.createContext(null);
|
|
24
25
|
function normalizeAccount(raw) {
|
|
25
26
|
if (!raw) return null;
|
|
26
27
|
const didOc = raw.did_oc ?? raw.didOc;
|
|
@@ -42,11 +43,11 @@ function OcSessionProvider({
|
|
|
42
43
|
config,
|
|
43
44
|
defaultReturnTo
|
|
44
45
|
}) {
|
|
45
|
-
const cfg =
|
|
46
|
-
const [account, setAccount] =
|
|
47
|
-
const [status, setStatus] =
|
|
48
|
-
const [error, setError] =
|
|
49
|
-
const refresh =
|
|
46
|
+
const cfg = React4.useMemo(() => resolveConfig(config), [config]);
|
|
47
|
+
const [account, setAccount] = React4.useState(null);
|
|
48
|
+
const [status, setStatus] = React4.useState("loading");
|
|
49
|
+
const [error, setError] = React4.useState(null);
|
|
50
|
+
const refresh = React4.useCallback(async () => {
|
|
50
51
|
if (typeof window === "undefined") return;
|
|
51
52
|
try {
|
|
52
53
|
const res = await fetch(cfg.mePath, {
|
|
@@ -75,10 +76,10 @@ function OcSessionProvider({
|
|
|
75
76
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
76
77
|
}
|
|
77
78
|
}, [cfg.mePath]);
|
|
78
|
-
|
|
79
|
+
React4.useEffect(() => {
|
|
79
80
|
void refresh();
|
|
80
81
|
}, [refresh]);
|
|
81
|
-
const signOut =
|
|
82
|
+
const signOut = React4.useCallback(async () => {
|
|
82
83
|
try {
|
|
83
84
|
await fetch(`${cfg.authOrigin}${cfg.logoutPath}`, {
|
|
84
85
|
method: "POST",
|
|
@@ -89,7 +90,7 @@ function OcSessionProvider({
|
|
|
89
90
|
setAccount(null);
|
|
90
91
|
setStatus("anonymous");
|
|
91
92
|
}, [cfg.authOrigin, cfg.logoutPath]);
|
|
92
|
-
const value =
|
|
93
|
+
const value = React4.useMemo(() => {
|
|
93
94
|
const returnTo = defaultReturnTo ?? (typeof window !== "undefined" ? window.location.href : void 0);
|
|
94
95
|
return {
|
|
95
96
|
status,
|
|
@@ -103,7 +104,7 @@ function OcSessionProvider({
|
|
|
103
104
|
return /* @__PURE__ */ jsx(SessionContext.Provider, { value, children });
|
|
104
105
|
}
|
|
105
106
|
function useOcSession() {
|
|
106
|
-
const ctx =
|
|
107
|
+
const ctx = React4.useContext(SessionContext);
|
|
107
108
|
if (!ctx) {
|
|
108
109
|
throw new Error(
|
|
109
110
|
"[@orangecheck/auth-client] useOcSession() must be called inside <OcSessionProvider>"
|
|
@@ -112,7 +113,7 @@ function useOcSession() {
|
|
|
112
113
|
return ctx;
|
|
113
114
|
}
|
|
114
115
|
function useOptionalOcSession() {
|
|
115
|
-
return
|
|
116
|
+
return React4.useContext(SessionContext);
|
|
116
117
|
}
|
|
117
118
|
function shortenAddress(addr) {
|
|
118
119
|
if (addr.length <= 12) return addr;
|
|
@@ -127,7 +128,7 @@ function isPrefixOf(value, target) {
|
|
|
127
128
|
}
|
|
128
129
|
var listboxIdCounter = 0;
|
|
129
130
|
function useUniqueId(prefix) {
|
|
130
|
-
const [id] =
|
|
131
|
+
const [id] = React4.useState(() => `${prefix}-${++listboxIdCounter}`);
|
|
131
132
|
return id;
|
|
132
133
|
}
|
|
133
134
|
function OcAccountChip({
|
|
@@ -141,9 +142,9 @@ function OcAccountChip({
|
|
|
141
142
|
}) {
|
|
142
143
|
const { status, account, signInUrl: sessionSignInUrl, signOut } = useOcSession();
|
|
143
144
|
const signInUrl = signInUrlOverride ?? sessionSignInUrl;
|
|
144
|
-
const [open, setOpen] =
|
|
145
|
-
const wrapRef =
|
|
146
|
-
|
|
145
|
+
const [open, setOpen] = React4.useState(false);
|
|
146
|
+
const wrapRef = React4.useRef(null);
|
|
147
|
+
React4.useEffect(() => {
|
|
147
148
|
if (!open) return;
|
|
148
149
|
function handleClickOutside(e) {
|
|
149
150
|
if (wrapRef.current && !wrapRef.current.contains(e.target)) {
|
|
@@ -466,9 +467,9 @@ function useOcAddressSuggestion(options) {
|
|
|
466
467
|
} = options;
|
|
467
468
|
const { status, account } = useOcSession();
|
|
468
469
|
const sessionAddress = status === "authenticated" ? account?.primaryBtc ?? null : null;
|
|
469
|
-
const [open, setOpen] =
|
|
470
|
-
const [highlighted, setHighlighted] =
|
|
471
|
-
const blurTimer =
|
|
470
|
+
const [open, setOpen] = React4.useState(false);
|
|
471
|
+
const [highlighted, setHighlighted] = React4.useState(false);
|
|
472
|
+
const blurTimer = React4.useRef(null);
|
|
472
473
|
const listboxId = useUniqueId("oc-addr-listbox");
|
|
473
474
|
const optionId = `${listboxId}-opt`;
|
|
474
475
|
const valueMatchesSession = sessionAddress != null && value.toLowerCase() === sessionAddress.toLowerCase();
|
|
@@ -480,7 +481,7 @@ function useOcAddressSuggestion(options) {
|
|
|
480
481
|
setOpen(false);
|
|
481
482
|
setHighlighted(false);
|
|
482
483
|
}
|
|
483
|
-
|
|
484
|
+
React4.useEffect(() => {
|
|
484
485
|
return () => {
|
|
485
486
|
if (blurTimer.current != null) window.clearTimeout(blurTimer.current);
|
|
486
487
|
};
|
|
@@ -583,7 +584,7 @@ function useOcAddressSuggestion(options) {
|
|
|
583
584
|
) : null;
|
|
584
585
|
return { inputProps, popover };
|
|
585
586
|
}
|
|
586
|
-
var OcAddressInput =
|
|
587
|
+
var OcAddressInput = React4.forwardRef(
|
|
587
588
|
function OcAddressInput2({
|
|
588
589
|
value,
|
|
589
590
|
onValueChange,
|
|
@@ -598,15 +599,15 @@ var OcAddressInput = React2.forwardRef(
|
|
|
598
599
|
}, forwardedRef) {
|
|
599
600
|
const { status, account } = useOcSession();
|
|
600
601
|
const sessionAddress = status === "authenticated" ? account?.primaryBtc ?? null : null;
|
|
601
|
-
const [open, setOpen] =
|
|
602
|
-
const [highlighted, setHighlighted] =
|
|
603
|
-
const innerRef =
|
|
602
|
+
const [open, setOpen] = React4.useState(false);
|
|
603
|
+
const [highlighted, setHighlighted] = React4.useState(false);
|
|
604
|
+
const innerRef = React4.useRef(null);
|
|
604
605
|
const setRef = (node) => {
|
|
605
606
|
innerRef.current = node;
|
|
606
607
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
607
608
|
else if (forwardedRef) forwardedRef.current = node;
|
|
608
609
|
};
|
|
609
|
-
const blurTimer =
|
|
610
|
+
const blurTimer = React4.useRef(null);
|
|
610
611
|
const listboxId = useUniqueId("oc-addr-listbox");
|
|
611
612
|
const optionId = `${listboxId}-opt`;
|
|
612
613
|
const valueMatchesSession = sessionAddress != null && value.toLowerCase() === sessionAddress.toLowerCase();
|
|
@@ -653,7 +654,7 @@ var OcAddressInput = React2.forwardRef(
|
|
|
653
654
|
}
|
|
654
655
|
onKeyDown?.(e);
|
|
655
656
|
}
|
|
656
|
-
|
|
657
|
+
React4.useEffect(() => {
|
|
657
658
|
return () => {
|
|
658
659
|
if (blurTimer.current != null) window.clearTimeout(blurTimer.current);
|
|
659
660
|
};
|
|
@@ -768,8 +769,8 @@ function OcSignIn({
|
|
|
768
769
|
const walletEnabled = paths?.wallet ?? true;
|
|
769
770
|
const emailEnabled = paths?.email ?? true;
|
|
770
771
|
const safeReturn = safeReturnTo(returnTo);
|
|
771
|
-
const [path, setPath] =
|
|
772
|
-
const handleSuccess =
|
|
772
|
+
const [path, setPath] = React4.useState(initialPath);
|
|
773
|
+
const handleSuccess = React4.useCallback(
|
|
773
774
|
(account) => {
|
|
774
775
|
if (onSuccess) {
|
|
775
776
|
onSuccess(account);
|
|
@@ -877,10 +878,10 @@ function SigninTab({
|
|
|
877
878
|
);
|
|
878
879
|
}
|
|
879
880
|
function WalletFlow({ authOrigin, audience, onSuccess }) {
|
|
880
|
-
const [address, setAddress] =
|
|
881
|
-
const [error, setError] =
|
|
882
|
-
const [submitting, setSubmitting] =
|
|
883
|
-
const [stage, setStage] =
|
|
881
|
+
const [address, setAddress] = React4.useState("");
|
|
882
|
+
const [error, setError] = React4.useState(null);
|
|
883
|
+
const [submitting, setSubmitting] = React4.useState(false);
|
|
884
|
+
const [stage, setStage] = React4.useState("enter");
|
|
884
885
|
async function signIn(e) {
|
|
885
886
|
e.preventDefault();
|
|
886
887
|
const addr = address.trim();
|
|
@@ -979,13 +980,13 @@ function WalletFlow({ authOrigin, audience, onSuccess }) {
|
|
|
979
980
|
] });
|
|
980
981
|
}
|
|
981
982
|
function EmailFlow({ authOrigin, onSuccess }) {
|
|
982
|
-
const [stage, setStage] =
|
|
983
|
-
const [email, setEmail] =
|
|
984
|
-
const [emailError, setEmailError] =
|
|
985
|
-
const [code, setCode] =
|
|
986
|
-
const [codeError, setCodeError] =
|
|
987
|
-
const [token, setToken] =
|
|
988
|
-
const [submitting, setSubmitting] =
|
|
983
|
+
const [stage, setStage] = React4.useState("enter");
|
|
984
|
+
const [email, setEmail] = React4.useState("");
|
|
985
|
+
const [emailError, setEmailError] = React4.useState(null);
|
|
986
|
+
const [code, setCode] = React4.useState("");
|
|
987
|
+
const [codeError, setCodeError] = React4.useState(null);
|
|
988
|
+
const [token, setToken] = React4.useState(null);
|
|
989
|
+
const [submitting, setSubmitting] = React4.useState(false);
|
|
989
990
|
async function start(e) {
|
|
990
991
|
e.preventDefault();
|
|
991
992
|
const trimmed = email.trim().toLowerCase();
|
|
@@ -1249,7 +1250,236 @@ function Hint({ children }) {
|
|
|
1249
1250
|
}
|
|
1250
1251
|
);
|
|
1251
1252
|
}
|
|
1253
|
+
function resolveAuthOrigin(opts) {
|
|
1254
|
+
if (!opts) return resolveConfig(void 0).authOrigin;
|
|
1255
|
+
return resolveConfig(opts).authOrigin;
|
|
1256
|
+
}
|
|
1257
|
+
function isAbortError(err) {
|
|
1258
|
+
if (!(err instanceof Error)) return false;
|
|
1259
|
+
return /NotAllowed|aborted|cancel|user cancelled/i.test(err.message);
|
|
1260
|
+
}
|
|
1261
|
+
function useWebAuthnRegister(opts) {
|
|
1262
|
+
const authOrigin = resolveAuthOrigin(opts);
|
|
1263
|
+
const [status, setStatus] = React4.useState("idle");
|
|
1264
|
+
const [error, setError] = React4.useState(null);
|
|
1265
|
+
const reset = React4.useCallback(() => {
|
|
1266
|
+
setStatus("idle");
|
|
1267
|
+
setError(null);
|
|
1268
|
+
}, []);
|
|
1269
|
+
const register = React4.useCallback(
|
|
1270
|
+
async (args) => {
|
|
1271
|
+
setError(null);
|
|
1272
|
+
setStatus("requesting-options");
|
|
1273
|
+
try {
|
|
1274
|
+
const optsRes = await fetch(`${authOrigin}/api/auth/webauthn/register/options`, {
|
|
1275
|
+
method: "POST",
|
|
1276
|
+
credentials: "include",
|
|
1277
|
+
headers: { "Content-Type": "application/json" },
|
|
1278
|
+
body: JSON.stringify({ label: args?.label })
|
|
1279
|
+
});
|
|
1280
|
+
const optsBody = await optsRes.json();
|
|
1281
|
+
if (!optsRes.ok || !optsBody.ok || !optsBody.options || !optsBody.challenge_token) {
|
|
1282
|
+
const reason = optsBody.reason ?? `options_failed_${optsRes.status}`;
|
|
1283
|
+
setError(new Error(reason));
|
|
1284
|
+
setStatus("error");
|
|
1285
|
+
return { ok: false, reason };
|
|
1286
|
+
}
|
|
1287
|
+
setStatus("authenticating");
|
|
1288
|
+
let attestation;
|
|
1289
|
+
try {
|
|
1290
|
+
attestation = await startRegistration({ optionsJSON: optsBody.options });
|
|
1291
|
+
} catch (e) {
|
|
1292
|
+
const reason = isAbortError(e) ? "cancelled" : e.message;
|
|
1293
|
+
setError(new Error(reason));
|
|
1294
|
+
setStatus("error");
|
|
1295
|
+
return { ok: false, reason };
|
|
1296
|
+
}
|
|
1297
|
+
setStatus("verifying");
|
|
1298
|
+
const verifyRes = await fetch(`${authOrigin}/api/auth/webauthn/register/verify`, {
|
|
1299
|
+
method: "POST",
|
|
1300
|
+
credentials: "include",
|
|
1301
|
+
headers: { "Content-Type": "application/json" },
|
|
1302
|
+
body: JSON.stringify({
|
|
1303
|
+
challenge_token: optsBody.challenge_token,
|
|
1304
|
+
response: attestation,
|
|
1305
|
+
label: args?.label
|
|
1306
|
+
})
|
|
1307
|
+
});
|
|
1308
|
+
const verifyBody = await verifyRes.json();
|
|
1309
|
+
if (!verifyRes.ok || !verifyBody.ok || !verifyBody.credential) {
|
|
1310
|
+
const reason = verifyBody.reason ?? `verify_failed_${verifyRes.status}`;
|
|
1311
|
+
setError(new Error(reason));
|
|
1312
|
+
setStatus("error");
|
|
1313
|
+
return { ok: false, reason };
|
|
1314
|
+
}
|
|
1315
|
+
setStatus("success");
|
|
1316
|
+
return { ok: true, credential: verifyBody.credential };
|
|
1317
|
+
} catch (e) {
|
|
1318
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
1319
|
+
setError(new Error(reason));
|
|
1320
|
+
setStatus("error");
|
|
1321
|
+
return { ok: false, reason };
|
|
1322
|
+
}
|
|
1323
|
+
},
|
|
1324
|
+
[authOrigin]
|
|
1325
|
+
);
|
|
1326
|
+
return { status, error, register, reset };
|
|
1327
|
+
}
|
|
1328
|
+
function useWebAuthnList(opts) {
|
|
1329
|
+
const authOrigin = resolveAuthOrigin(opts);
|
|
1330
|
+
const { status: sessionStatus } = useOcSession();
|
|
1331
|
+
const [credentials, setCredentials] = React4.useState([]);
|
|
1332
|
+
const [status, setStatus] = React4.useState("loading");
|
|
1333
|
+
const [error, setError] = React4.useState(null);
|
|
1334
|
+
const refetch = React4.useCallback(async () => {
|
|
1335
|
+
setError(null);
|
|
1336
|
+
if (sessionStatus !== "authenticated") {
|
|
1337
|
+
setCredentials([]);
|
|
1338
|
+
setStatus("ready");
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1341
|
+
setStatus("loading");
|
|
1342
|
+
try {
|
|
1343
|
+
const r = await fetch(`${authOrigin}/api/auth/webauthn/credentials`, {
|
|
1344
|
+
credentials: "include"
|
|
1345
|
+
});
|
|
1346
|
+
if (r.status === 401) {
|
|
1347
|
+
setCredentials([]);
|
|
1348
|
+
setStatus("ready");
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
const j = await r.json();
|
|
1352
|
+
if (!j.ok || !j.credentials) {
|
|
1353
|
+
throw new Error(j.reason ?? "list_failed");
|
|
1354
|
+
}
|
|
1355
|
+
setCredentials(j.credentials);
|
|
1356
|
+
setStatus("ready");
|
|
1357
|
+
} catch (e) {
|
|
1358
|
+
setError(e instanceof Error ? e : new Error(String(e)));
|
|
1359
|
+
setStatus("error");
|
|
1360
|
+
}
|
|
1361
|
+
}, [authOrigin, sessionStatus]);
|
|
1362
|
+
React4.useEffect(() => {
|
|
1363
|
+
void refetch();
|
|
1364
|
+
}, [refetch]);
|
|
1365
|
+
const rename = React4.useCallback(
|
|
1366
|
+
async (id, label) => {
|
|
1367
|
+
try {
|
|
1368
|
+
const r = await fetch(`${authOrigin}/api/auth/webauthn/credentials/${id}`, {
|
|
1369
|
+
method: "PATCH",
|
|
1370
|
+
credentials: "include",
|
|
1371
|
+
headers: { "Content-Type": "application/json" },
|
|
1372
|
+
body: JSON.stringify({ label })
|
|
1373
|
+
});
|
|
1374
|
+
const j = await r.json();
|
|
1375
|
+
if (!j.ok || !j.credential) {
|
|
1376
|
+
setError(new Error(j.reason ?? "rename_failed"));
|
|
1377
|
+
return null;
|
|
1378
|
+
}
|
|
1379
|
+
await refetch();
|
|
1380
|
+
return j.credential;
|
|
1381
|
+
} catch (e) {
|
|
1382
|
+
setError(e instanceof Error ? e : new Error(String(e)));
|
|
1383
|
+
return null;
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
[authOrigin, refetch]
|
|
1387
|
+
);
|
|
1388
|
+
const remove = React4.useCallback(
|
|
1389
|
+
async (id) => {
|
|
1390
|
+
try {
|
|
1391
|
+
const r = await fetch(`${authOrigin}/api/auth/webauthn/credentials/${id}`, {
|
|
1392
|
+
method: "DELETE",
|
|
1393
|
+
credentials: "include"
|
|
1394
|
+
});
|
|
1395
|
+
const j = await r.json();
|
|
1396
|
+
if (!j.ok) {
|
|
1397
|
+
setError(new Error(j.reason ?? "delete_failed"));
|
|
1398
|
+
return false;
|
|
1399
|
+
}
|
|
1400
|
+
await refetch();
|
|
1401
|
+
return true;
|
|
1402
|
+
} catch (e) {
|
|
1403
|
+
setError(e instanceof Error ? e : new Error(String(e)));
|
|
1404
|
+
return false;
|
|
1405
|
+
}
|
|
1406
|
+
},
|
|
1407
|
+
[authOrigin, refetch]
|
|
1408
|
+
);
|
|
1409
|
+
return { status, credentials, error, refetch, rename, remove };
|
|
1410
|
+
}
|
|
1411
|
+
function useStepUpAuth(opts) {
|
|
1412
|
+
const authOrigin = resolveAuthOrigin(opts);
|
|
1413
|
+
const { refresh } = useOcSession();
|
|
1414
|
+
const [status, setStatus] = React4.useState("idle");
|
|
1415
|
+
const [error, setError] = React4.useState(null);
|
|
1416
|
+
const reset = React4.useCallback(() => {
|
|
1417
|
+
setStatus("idle");
|
|
1418
|
+
setError(null);
|
|
1419
|
+
}, []);
|
|
1420
|
+
const stepUp = React4.useCallback(
|
|
1421
|
+
async (args) => {
|
|
1422
|
+
setError(null);
|
|
1423
|
+
setStatus("requesting-options");
|
|
1424
|
+
try {
|
|
1425
|
+
const optsRes = await fetch(`${authOrigin}/api/auth/webauthn/assertion/options`, {
|
|
1426
|
+
method: "POST",
|
|
1427
|
+
credentials: "include",
|
|
1428
|
+
headers: { "Content-Type": "application/json" },
|
|
1429
|
+
body: JSON.stringify({ purpose: args.purpose })
|
|
1430
|
+
});
|
|
1431
|
+
const optsBody = await optsRes.json();
|
|
1432
|
+
if (!optsRes.ok || !optsBody.ok || !optsBody.options || !optsBody.challenge_token) {
|
|
1433
|
+
const reason = optsBody.reason ?? `options_failed_${optsRes.status}`;
|
|
1434
|
+
setError(new Error(reason));
|
|
1435
|
+
setStatus("error");
|
|
1436
|
+
return { ok: false, reason };
|
|
1437
|
+
}
|
|
1438
|
+
setStatus("authenticating");
|
|
1439
|
+
let assertion;
|
|
1440
|
+
try {
|
|
1441
|
+
assertion = await startAuthentication({ optionsJSON: optsBody.options });
|
|
1442
|
+
} catch (e) {
|
|
1443
|
+
const reason = isAbortError(e) ? "cancelled" : e.message;
|
|
1444
|
+
setError(new Error(reason));
|
|
1445
|
+
setStatus("error");
|
|
1446
|
+
return { ok: false, reason };
|
|
1447
|
+
}
|
|
1448
|
+
setStatus("verifying");
|
|
1449
|
+
const verifyRes = await fetch(
|
|
1450
|
+
`${authOrigin}/api/auth/webauthn/assertion/verify`,
|
|
1451
|
+
{
|
|
1452
|
+
method: "POST",
|
|
1453
|
+
credentials: "include",
|
|
1454
|
+
headers: { "Content-Type": "application/json" },
|
|
1455
|
+
body: JSON.stringify({
|
|
1456
|
+
challenge_token: optsBody.challenge_token,
|
|
1457
|
+
response: assertion
|
|
1458
|
+
})
|
|
1459
|
+
}
|
|
1460
|
+
);
|
|
1461
|
+
const verifyBody = await verifyRes.json();
|
|
1462
|
+
if (!verifyRes.ok || !verifyBody.ok || typeof verifyBody.step_up_at !== "number") {
|
|
1463
|
+
const reason = verifyBody.reason ?? `verify_failed_${verifyRes.status}`;
|
|
1464
|
+
setError(new Error(reason));
|
|
1465
|
+
setStatus("error");
|
|
1466
|
+
return { ok: false, reason };
|
|
1467
|
+
}
|
|
1468
|
+
await refresh();
|
|
1469
|
+
setStatus("success");
|
|
1470
|
+
return { ok: true, step_up_at: verifyBody.step_up_at };
|
|
1471
|
+
} catch (e) {
|
|
1472
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
1473
|
+
setError(new Error(reason));
|
|
1474
|
+
setStatus("error");
|
|
1475
|
+
return { ok: false, reason };
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
[authOrigin, refresh]
|
|
1479
|
+
);
|
|
1480
|
+
return { status, error, stepUp, reset };
|
|
1481
|
+
}
|
|
1252
1482
|
|
|
1253
|
-
export { DEFAULT_CONFIG, OcAccountChip, OcAccountPill, OcAddressInput, OcSessionProvider, OcSignIn, OcSignInButton, buildSignInUrl, useOcAddressSuggestion, useOcSession, useOptionalOcSession };
|
|
1483
|
+
export { DEFAULT_CONFIG, OcAccountChip, OcAccountPill, OcAddressInput, OcSessionProvider, OcSignIn, OcSignInButton, buildSignInUrl, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister };
|
|
1254
1484
|
//# sourceMappingURL=index.mjs.map
|
|
1255
1485
|
//# sourceMappingURL=index.mjs.map
|