@tempoxyz/id 0.0.0-pr-707.sha-3bb0aa5 → 0.0.0-pr-704.sha-0cbffe0
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/{Connections-7J5I4L3Q.js → Connections-D5RJSFJP.js} +2 -2
- package/dist/{Sheet-PTAFRAX2.js → Sheet-FH4KRDI7.js} +1 -1
- package/dist/{chunk-FDHRRJQI.js → chunk-LUSCUHII.js} +1 -1
- package/dist/{chunk-YDYAVOWG.js → chunk-PA3AETBC.js} +164 -58
- package/dist/{chunk-JJT3ITRO.js → chunk-USONPD4G.js} +1 -1
- package/dist/commands/login.js +3 -3
- package/dist/commands/logout.js +3 -3
- package/dist/commands/whoami.js +3 -3
- package/dist/{dialog-7DSDKEHU.js → dialog-RR4ETIE7.js} +1 -1
- package/package.json +1 -1
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
var Accounts_exports = {};
|
|
20
20
|
__export(Accounts_exports, {
|
|
21
21
|
ChainUnavailableError: () => ChainUnavailableError,
|
|
22
|
-
ChallengeWithoutKeyError: () => ChallengeWithoutKeyError,
|
|
23
22
|
ClientIdRequiredError: () => ClientIdRequiredError,
|
|
24
23
|
ConnectionsRequiredError: () => ConnectionsRequiredError,
|
|
25
24
|
EverywhereNotAllowedError: () => EverywhereNotAllowedError,
|
|
@@ -233,10 +232,26 @@ function authorization(body, options) {
|
|
|
233
232
|
return {
|
|
234
233
|
...tokens_,
|
|
235
234
|
accessKey: toAccount(key, { accessKey: accessKey2 }),
|
|
235
|
+
...challengeSignature(body, { challenged: options.challenged }),
|
|
236
236
|
key,
|
|
237
237
|
user: user(tokens_)
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
|
+
function challengeSignature(body, options = {}) {
|
|
241
|
+
if (body.account && body.challenge_signature)
|
|
242
|
+
return {
|
|
243
|
+
address: body.account,
|
|
244
|
+
challengeSignature: body.challenge_signature
|
|
245
|
+
};
|
|
246
|
+
if (options.challenged)
|
|
247
|
+
throw new RequestError({
|
|
248
|
+
code: "server_error",
|
|
249
|
+
message: "Missing challenge signature in the response to a request with a challenge. Update Tempo ID, or sign in without the challenge.",
|
|
250
|
+
signedIn: true,
|
|
251
|
+
status: 200
|
|
252
|
+
});
|
|
253
|
+
return {};
|
|
254
|
+
}
|
|
240
255
|
async function json(response) {
|
|
241
256
|
const body = await response.json().catch(() => ({}));
|
|
242
257
|
if (!response.ok) throw error(body, { status: response.status });
|
|
@@ -473,9 +488,13 @@ function signedIn(error3, options = {}) {
|
|
|
473
488
|
uri: error3.uri
|
|
474
489
|
});
|
|
475
490
|
}
|
|
476
|
-
function withoutKey(body) {
|
|
491
|
+
function withoutKey(body, options = {}) {
|
|
477
492
|
const tokens_ = "accessToken" in body.tokens ? body.tokens : tokens(body.tokens);
|
|
478
|
-
return {
|
|
493
|
+
return {
|
|
494
|
+
...tokens_,
|
|
495
|
+
...challengeSignature(body, options),
|
|
496
|
+
user: user(tokens_)
|
|
497
|
+
};
|
|
479
498
|
}
|
|
480
499
|
|
|
481
500
|
// ../../accounts/src/actions/account.ts
|
|
@@ -941,13 +960,12 @@ function seconds(options) {
|
|
|
941
960
|
var base64url = { pad: false, url: true };
|
|
942
961
|
async function authorizeUrl(auth, options) {
|
|
943
962
|
const { accessKey: accessKey2 } = options;
|
|
944
|
-
if (!accessKey2 && options.challenge !== void 0)
|
|
945
|
-
throw new ChallengeWithoutKeyError();
|
|
946
963
|
const redirectUri = options.redirectUri ?? auth.redirectUri ?? `${window.location.origin}/`;
|
|
947
964
|
const key = accessKey2 ? await resolve(accessKey2) : void 0;
|
|
948
965
|
const pending = from2({
|
|
949
966
|
...key ? key.material : { key: false },
|
|
950
967
|
chainId: auth.chainId,
|
|
968
|
+
...options.challenge !== void 0 ? { challenge: true } : {},
|
|
951
969
|
clientId: auth.clientId,
|
|
952
970
|
redirectUri,
|
|
953
971
|
// `Bytes.random` needs only `crypto.getRandomValues`, which React Native polyfills.
|
|
@@ -959,6 +977,7 @@ async function authorizeUrl(auth, options) {
|
|
|
959
977
|
}) : void 0;
|
|
960
978
|
const url = new URL("/oauth2/authorize", auth.url);
|
|
961
979
|
const parameters = new URLSearchParams({
|
|
980
|
+
...options.challenge !== void 0 && !accessKey2 ? { chain_id: String(auth.chainId) } : {},
|
|
962
981
|
...options.challenge === void 0 ? {} : { challenge: options.challenge },
|
|
963
982
|
client_id: auth.clientId,
|
|
964
983
|
// In the web message mode, Tempo ID sets the challenge and redeems the code itself.
|
|
@@ -994,9 +1013,15 @@ async function authorizeUrl(auth, options) {
|
|
|
994
1013
|
return { pending, url: url.href };
|
|
995
1014
|
}
|
|
996
1015
|
function request(auth, options) {
|
|
997
|
-
const { accessKey: accessKey2, challenge } = options;
|
|
1016
|
+
const { accessKey: accessKey2, challenge: challenge2 } = options;
|
|
998
1017
|
return {
|
|
999
|
-
|
|
1018
|
+
// A challenge without an access key names the instance's chain, whose view of the account signs
|
|
1019
|
+
// it, and any account that signs it in place of the selected one.
|
|
1020
|
+
...challenge2 !== void 0 && !accessKey2 ? {
|
|
1021
|
+
...options.account ? { account: options.account } : {},
|
|
1022
|
+
chain_id: auth.chainId
|
|
1023
|
+
} : {},
|
|
1024
|
+
...challenge2 === void 0 ? {} : { challenge: challenge2 },
|
|
1000
1025
|
client_id: auth.clientId,
|
|
1001
1026
|
...accessKey2 ? {
|
|
1002
1027
|
key_authorization: keyAuthorization(auth, {
|
|
@@ -1051,7 +1076,7 @@ function pushes(auth) {
|
|
|
1051
1076
|
|
|
1052
1077
|
// ../../accounts/src/internal/Headless.ts
|
|
1053
1078
|
async function authorize(auth, options) {
|
|
1054
|
-
const { accessKey: accessKey2, challenge, getFn } = options;
|
|
1079
|
+
const { accessKey: accessKey2, challenge: challenge2, getFn } = options;
|
|
1055
1080
|
try {
|
|
1056
1081
|
const key = accessKey2 ? await resolve(accessKey2) : void 0;
|
|
1057
1082
|
if (key)
|
|
@@ -1065,11 +1090,11 @@ async function authorize(auth, options) {
|
|
|
1065
1090
|
getFn,
|
|
1066
1091
|
json: request(auth, {
|
|
1067
1092
|
accessKey: key && accessKey2 && { ...accessKey2, account: key.accessKey },
|
|
1068
|
-
challenge
|
|
1093
|
+
challenge: challenge2
|
|
1069
1094
|
})
|
|
1070
1095
|
})
|
|
1071
1096
|
);
|
|
1072
|
-
const authorization2 = key ? authorization(body, key) : withoutKey(body);
|
|
1097
|
+
const authorization2 = key ? authorization(body, { ...key, challenged: challenge2 !== void 0 }) : withoutKey(body, { challenged: challenge2 !== void 0 });
|
|
1073
1098
|
if (authorization2.user.id !== options.userId) throw sessionChanged();
|
|
1074
1099
|
return {
|
|
1075
1100
|
...authorization2,
|
|
@@ -1091,7 +1116,12 @@ async function complete(auth, options) {
|
|
|
1091
1116
|
step: body.authorization
|
|
1092
1117
|
})
|
|
1093
1118
|
) : body.authorization;
|
|
1094
|
-
const authorization2 = key ? authorization(signed,
|
|
1119
|
+
const authorization2 = key ? authorization(signed, {
|
|
1120
|
+
...key,
|
|
1121
|
+
challenged: options.request.challenge !== void 0
|
|
1122
|
+
}) : withoutKey(signed, {
|
|
1123
|
+
challenged: options.request.challenge !== void 0
|
|
1124
|
+
});
|
|
1095
1125
|
if (authorization2.user.id !== body.user.id) throw sessionChanged();
|
|
1096
1126
|
return {
|
|
1097
1127
|
...authorization2,
|
|
@@ -1170,7 +1200,7 @@ async function sign(auth, options) {
|
|
|
1170
1200
|
});
|
|
1171
1201
|
}
|
|
1172
1202
|
function steps(json2, options) {
|
|
1173
|
-
if (!json2.key_authorization) return false;
|
|
1203
|
+
if (!json2.key_authorization && json2.challenge === void 0) return false;
|
|
1174
1204
|
return options.getFn !== void 0 || globalThis.navigator?.credentials !== void 0;
|
|
1175
1205
|
}
|
|
1176
1206
|
function redemption(auth) {
|
|
@@ -1215,14 +1245,14 @@ async function sendCode(auth, options) {
|
|
|
1215
1245
|
);
|
|
1216
1246
|
}
|
|
1217
1247
|
async function signIn(auth, options) {
|
|
1218
|
-
const { challenge, code, email, userIp } = options;
|
|
1219
|
-
if (!options.accessKey && challenge !== void 0)
|
|
1220
|
-
throw new ChallengeWithoutKeyError();
|
|
1248
|
+
const { challenge: challenge2, code, email, userIp } = options;
|
|
1221
1249
|
authenticated(auth);
|
|
1222
1250
|
const { accessKey: accessKey2 } = options;
|
|
1223
1251
|
const key = accessKey2 ? await resolve(accessKey2) : void 0;
|
|
1224
1252
|
const body = await token(auth, {
|
|
1225
|
-
|
|
1253
|
+
// A challenge without an access key names the instance's chain, whose view of the account signs it.
|
|
1254
|
+
...challenge2 !== void 0 && !key ? { chain_id: String(auth.chainId) } : {},
|
|
1255
|
+
...challenge2 === void 0 ? {} : { challenge: challenge2 },
|
|
1226
1256
|
code,
|
|
1227
1257
|
email,
|
|
1228
1258
|
grant_type: grantType,
|
|
@@ -1241,14 +1271,19 @@ async function signIn(auth, options) {
|
|
|
1241
1271
|
});
|
|
1242
1272
|
const tokens3 = tokens(body);
|
|
1243
1273
|
if (!key)
|
|
1244
|
-
return {
|
|
1274
|
+
return {
|
|
1275
|
+
...tokens3,
|
|
1276
|
+
...challengeSignature(body, { challenged: challenge2 !== void 0 }),
|
|
1277
|
+
user: user(tokens3)
|
|
1278
|
+
};
|
|
1245
1279
|
return authorization(
|
|
1246
1280
|
{
|
|
1247
1281
|
account: body.account,
|
|
1282
|
+
...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
|
|
1248
1283
|
key_authorization: body.key_authorization,
|
|
1249
1284
|
tokens: tokens3
|
|
1250
1285
|
},
|
|
1251
|
-
key
|
|
1286
|
+
{ ...key, challenged: challenge2 !== void 0 }
|
|
1252
1287
|
);
|
|
1253
1288
|
}
|
|
1254
1289
|
function authenticated(auth) {
|
|
@@ -1328,8 +1363,11 @@ __export(device_exports, {
|
|
|
1328
1363
|
});
|
|
1329
1364
|
import { Base64 as Base646 } from "ox";
|
|
1330
1365
|
async function authorize2(auth, options) {
|
|
1331
|
-
const
|
|
1366
|
+
const { accessKey: accessKey2 } = options;
|
|
1367
|
+
const key = accessKey2 ? await resolve(accessKey2) : void 0;
|
|
1332
1368
|
const body = new URLSearchParams({
|
|
1369
|
+
// A challenge without an access key names the instance's chain, whose view of the account signs it.
|
|
1370
|
+
...options.challenge !== void 0 && !key ? { chain_id: String(auth.chainId) } : {},
|
|
1333
1371
|
...options.challenge === void 0 ? {} : { challenge: options.challenge },
|
|
1334
1372
|
// The instance's app is the device app that the CLI signs in to, such as `tempo-cli`.
|
|
1335
1373
|
client_id: auth.clientId,
|
|
@@ -1337,14 +1375,16 @@ async function authorize2(auth, options) {
|
|
|
1337
1375
|
...options.funding?.currency === void 0 ? {} : { funding_currency: options.funding.currency },
|
|
1338
1376
|
...options.funding ? { funding_hint: options.funding.amount } : {},
|
|
1339
1377
|
...options.funding?.token === void 0 ? {} : { funding_token: options.funding.token },
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1378
|
+
...key && accessKey2 ? {
|
|
1379
|
+
key_authorization: Base646.fromString(
|
|
1380
|
+
JSON.stringify(
|
|
1381
|
+
keyAuthorization(auth, {
|
|
1382
|
+
accessKey: { ...accessKey2, account: key.accessKey }
|
|
1383
|
+
})
|
|
1384
|
+
),
|
|
1385
|
+
{ pad: false, url: true }
|
|
1386
|
+
)
|
|
1387
|
+
} : {}
|
|
1348
1388
|
});
|
|
1349
1389
|
for (const resource of resources(auth, options))
|
|
1350
1390
|
body.append("resource", resource);
|
|
@@ -1379,6 +1419,7 @@ async function authorize2(auth, options) {
|
|
|
1379
1419
|
);
|
|
1380
1420
|
failure = void 0;
|
|
1381
1421
|
const result = await request2(poll2, {
|
|
1422
|
+
challenged: options.challenge !== void 0,
|
|
1382
1423
|
deviceCode: code.device_code,
|
|
1383
1424
|
key
|
|
1384
1425
|
}).catch((error3) => {
|
|
@@ -1411,9 +1452,17 @@ async function authorize2(auth, options) {
|
|
|
1411
1452
|
}
|
|
1412
1453
|
async function poll(auth, options) {
|
|
1413
1454
|
const { deviceCode } = options;
|
|
1455
|
+
const challenged = options.challenged ?? options.accessKey === false;
|
|
1456
|
+
if (options.accessKey === false)
|
|
1457
|
+
return request2(auth, {
|
|
1458
|
+
challenged,
|
|
1459
|
+
deviceCode,
|
|
1460
|
+
key: void 0
|
|
1461
|
+
});
|
|
1414
1462
|
const accessKey2 = own(options.accessKey);
|
|
1415
1463
|
if (!accessKey2) throw new AccessKeyRequiredError();
|
|
1416
1464
|
return request2(auth, {
|
|
1465
|
+
challenged,
|
|
1417
1466
|
deviceCode,
|
|
1418
1467
|
key: { accessKey: accessKey2, material: {} }
|
|
1419
1468
|
});
|
|
@@ -1437,15 +1486,20 @@ async function request2(auth, options) {
|
|
|
1437
1486
|
});
|
|
1438
1487
|
if (typeof body === "string")
|
|
1439
1488
|
return { slowDown: body === "slow_down", status: "pending" };
|
|
1489
|
+
const authorization2 = key ? authorization(
|
|
1490
|
+
{
|
|
1491
|
+
account: body.account,
|
|
1492
|
+
...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
|
|
1493
|
+
key_authorization: body.key_authorization,
|
|
1494
|
+
tokens: tokens(body)
|
|
1495
|
+
},
|
|
1496
|
+
{ ...key, challenged: options.challenged }
|
|
1497
|
+
) : withoutKey(
|
|
1498
|
+
{ ...body, tokens: tokens(body) },
|
|
1499
|
+
{ challenged: options.challenged }
|
|
1500
|
+
);
|
|
1440
1501
|
return {
|
|
1441
|
-
authorization:
|
|
1442
|
-
{
|
|
1443
|
-
account: body.account,
|
|
1444
|
-
key_authorization: body.key_authorization,
|
|
1445
|
-
tokens: tokens(body)
|
|
1446
|
-
},
|
|
1447
|
-
key
|
|
1448
|
-
),
|
|
1502
|
+
authorization: authorization2,
|
|
1449
1503
|
status: "approved"
|
|
1450
1504
|
};
|
|
1451
1505
|
}
|
|
@@ -1712,7 +1766,7 @@ async function open(auth, options) {
|
|
|
1712
1766
|
throw new OriginError({ origin: window.location.origin, redirectUri });
|
|
1713
1767
|
if (mode === "popup" && options.mode !== "popup" && !activated()) {
|
|
1714
1768
|
const address2 = await abortable(read2(), { signal });
|
|
1715
|
-
const Sheet = await import("./Sheet-
|
|
1769
|
+
const Sheet = await import("./Sheet-FH4KRDI7.js");
|
|
1716
1770
|
return await new Promise((resolve3, reject) => {
|
|
1717
1771
|
const abort = () => {
|
|
1718
1772
|
close();
|
|
@@ -1763,7 +1817,7 @@ async function watch(auth, options) {
|
|
|
1763
1817
|
try {
|
|
1764
1818
|
return await new Promise(
|
|
1765
1819
|
(resolve3, reject) => {
|
|
1766
|
-
void import("./Sheet-
|
|
1820
|
+
void import("./Sheet-FH4KRDI7.js").then(
|
|
1767
1821
|
(Sheet) => {
|
|
1768
1822
|
if (settled) return;
|
|
1769
1823
|
unblock = Sheet.waiting({
|
|
@@ -1828,7 +1882,7 @@ function parse(url, options) {
|
|
|
1828
1882
|
async function frame(auth, options) {
|
|
1829
1883
|
const { redirectUri, signal, toUrl } = options;
|
|
1830
1884
|
const address2 = await abortable(options.address, { signal });
|
|
1831
|
-
const Sheet = await import("./Sheet-
|
|
1885
|
+
const Sheet = await import("./Sheet-FH4KRDI7.js");
|
|
1832
1886
|
signal?.throwIfAborted();
|
|
1833
1887
|
let close;
|
|
1834
1888
|
let abort;
|
|
@@ -2086,6 +2140,7 @@ function finish(options) {
|
|
|
2086
2140
|
const {
|
|
2087
2141
|
key,
|
|
2088
2142
|
chainId: _chainId,
|
|
2143
|
+
challenge: challenged,
|
|
2089
2144
|
clientId: _clientId,
|
|
2090
2145
|
redirectUri: _redirectUri,
|
|
2091
2146
|
state: _state,
|
|
@@ -2094,7 +2149,11 @@ function finish(options) {
|
|
|
2094
2149
|
} = options.pending;
|
|
2095
2150
|
if (key === false) {
|
|
2096
2151
|
const tokens3 = tokens(body);
|
|
2097
|
-
return {
|
|
2152
|
+
return {
|
|
2153
|
+
...tokens3,
|
|
2154
|
+
...challengeSignature(body, { challenged }),
|
|
2155
|
+
user: user(tokens3)
|
|
2156
|
+
};
|
|
2098
2157
|
}
|
|
2099
2158
|
if (!body.account || !body.key_authorization)
|
|
2100
2159
|
throw new RequestError({
|
|
@@ -2106,10 +2165,11 @@ function finish(options) {
|
|
|
2106
2165
|
return authorization(
|
|
2107
2166
|
{
|
|
2108
2167
|
account: body.account,
|
|
2168
|
+
...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
|
|
2109
2169
|
key_authorization: body.key_authorization,
|
|
2110
2170
|
tokens: body
|
|
2111
2171
|
},
|
|
2112
|
-
{ accessKey: options.accessKey, material }
|
|
2172
|
+
{ accessKey: options.accessKey, challenged, material }
|
|
2113
2173
|
);
|
|
2114
2174
|
}
|
|
2115
2175
|
async function prefetch(auth) {
|
|
@@ -2646,6 +2706,10 @@ function toSession(result) {
|
|
|
2646
2706
|
return from4({
|
|
2647
2707
|
accessToken: result.accessToken,
|
|
2648
2708
|
...result.account ? { account: result.account } : {},
|
|
2709
|
+
...result.address && result.challengeSignature ? {
|
|
2710
|
+
address: result.address,
|
|
2711
|
+
challengeSignature: result.challengeSignature
|
|
2712
|
+
} : {},
|
|
2649
2713
|
expiresAt: result.expiresAt,
|
|
2650
2714
|
...result.idToken !== void 0 ? { idToken: result.idToken } : {},
|
|
2651
2715
|
...result.key ? { key: withLifetime(result.key) } : {},
|
|
@@ -2691,8 +2755,6 @@ async function sendCode2(auth, options) {
|
|
|
2691
2755
|
}
|
|
2692
2756
|
async function signIn3(auth, options) {
|
|
2693
2757
|
const { code, email, getFn, link } = options;
|
|
2694
|
-
if (!options.accessKey && options.challenge !== void 0)
|
|
2695
|
-
throw new ChallengeWithoutKeyError();
|
|
2696
2758
|
const prepared = await prepare(auth, options);
|
|
2697
2759
|
const assertion = await (async () => {
|
|
2698
2760
|
if (!link) return void 0;
|
|
@@ -2894,6 +2956,13 @@ function prepare2(auth, options = {}) {
|
|
|
2894
2956
|
}
|
|
2895
2957
|
async function register(auth, options = {}) {
|
|
2896
2958
|
const { createFn, getFn, key } = options;
|
|
2959
|
+
if (options.challenge !== void 0 && !options.accessKey)
|
|
2960
|
+
throw new RequestError({
|
|
2961
|
+
code: "invalid_request",
|
|
2962
|
+
field: "challenge",
|
|
2963
|
+
message: "Invalid options: `challenge` signs as the new passkey's account, which only a registration with `accessKey` selects. Pass `accessKey`, or sign in with the challenge.",
|
|
2964
|
+
status: 0
|
|
2965
|
+
});
|
|
2897
2966
|
const chain = options.chain ?? options.chainId;
|
|
2898
2967
|
if (options.accessKey && (key || options.account !== void 0 || chain !== void 0))
|
|
2899
2968
|
throw new RequestError({
|
|
@@ -2985,14 +3054,60 @@ async function register(auth, options = {}) {
|
|
|
2985
3054
|
signed,
|
|
2986
3055
|
headless.key
|
|
2987
3056
|
);
|
|
3057
|
+
const challenged = options.challenge === void 0 ? {} : await challenge(
|
|
3058
|
+
{ ...auth, chainId: Number(authorization2.key.chainId) },
|
|
3059
|
+
{
|
|
3060
|
+
account: registered.address,
|
|
3061
|
+
challenge: options.challenge,
|
|
3062
|
+
getFn,
|
|
3063
|
+
userId: authorization2.user.id
|
|
3064
|
+
}
|
|
3065
|
+
);
|
|
2988
3066
|
return {
|
|
2989
3067
|
...result,
|
|
2990
3068
|
authorization: {
|
|
2991
3069
|
...authorization2,
|
|
3070
|
+
..."challengeError" in challenged ? {} : challenged,
|
|
2992
3071
|
upgradeAvailable: signed.upgrade_available === true
|
|
2993
|
-
}
|
|
3072
|
+
},
|
|
3073
|
+
..."challengeError" in challenged ? { challengeError: challenged.challengeError } : {}
|
|
2994
3074
|
};
|
|
2995
3075
|
}
|
|
3076
|
+
async function challenge(auth, options) {
|
|
3077
|
+
try {
|
|
3078
|
+
const body = await json(
|
|
3079
|
+
await post2(auth, {
|
|
3080
|
+
getFn: options.getFn,
|
|
3081
|
+
json: request(auth, {
|
|
3082
|
+
account: options.account,
|
|
3083
|
+
challenge: options.challenge
|
|
3084
|
+
})
|
|
3085
|
+
})
|
|
3086
|
+
);
|
|
3087
|
+
const tokens3 = "accessToken" in body.tokens ? body.tokens : tokens(body.tokens);
|
|
3088
|
+
if (tokens3.refreshToken)
|
|
3089
|
+
await revoke(auth, { refreshToken: tokens3.refreshToken }).catch(
|
|
3090
|
+
() => void 0
|
|
3091
|
+
);
|
|
3092
|
+
const signed = challengeSignature(body, { challenged: true });
|
|
3093
|
+
if (user(tokens3).id !== options.userId || !Address3.isEqual(signed.address, options.account))
|
|
3094
|
+
throw new RequestError({
|
|
3095
|
+
code: "server_error",
|
|
3096
|
+
message: "Account mismatch: Tempo ID signed the challenge as another account or user than the new passkey's. The passkey is registered, so sign in with it and the challenge.",
|
|
3097
|
+
status: 200
|
|
3098
|
+
});
|
|
3099
|
+
return signed;
|
|
3100
|
+
} catch (error3) {
|
|
3101
|
+
return {
|
|
3102
|
+
challengeError: error3 instanceof RequestError ? error3 : new RequestError({
|
|
3103
|
+
cause: error3,
|
|
3104
|
+
code: "server_error",
|
|
3105
|
+
message: "Challenge signature failed after the registration, with no response from Tempo ID. The passkey is registered, so sign in with it and the challenge.",
|
|
3106
|
+
status: 0
|
|
3107
|
+
})
|
|
3108
|
+
};
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
2996
3111
|
async function signIn4(auth, options = {}) {
|
|
2997
3112
|
const prepared = await requestOptions(auth, options);
|
|
2998
3113
|
const assertion = await sign2(prepared, options);
|
|
@@ -3017,8 +3132,6 @@ function refused(error3) {
|
|
|
3017
3132
|
}
|
|
3018
3133
|
async function requestOptions(auth, options) {
|
|
3019
3134
|
const { credentialId, mediation, select } = options;
|
|
3020
|
-
if (!options.accessKey && options.challenge !== void 0)
|
|
3021
|
-
throw new ChallengeWithoutKeyError();
|
|
3022
3135
|
const { authorize: authorize6, key } = await prepare(auth, options);
|
|
3023
3136
|
const requestedAt = Date.now();
|
|
3024
3137
|
const requested = await json(
|
|
@@ -3103,8 +3216,6 @@ async function list(auth) {
|
|
|
3103
3216
|
// ../../accounts/src/internal/Actions.ts
|
|
3104
3217
|
async function authorize4(auth, options = {}) {
|
|
3105
3218
|
const { accessKey: accessKey2 } = options;
|
|
3106
|
-
if (!accessKey2 && options.challenge !== void 0)
|
|
3107
|
-
throw new ChallengeWithoutKeyError();
|
|
3108
3219
|
const [session2, generated] = await Promise.all([
|
|
3109
3220
|
(async () => json(
|
|
3110
3221
|
await (auth.fetch ?? globalThis.fetch)(
|
|
@@ -3138,7 +3249,10 @@ async function authorize4(auth, options = {}) {
|
|
|
3138
3249
|
const body = await json(response);
|
|
3139
3250
|
const [first] = body.tempo ?? [];
|
|
3140
3251
|
const result = {
|
|
3141
|
-
...key ? authorization(body,
|
|
3252
|
+
...key ? authorization(body, {
|
|
3253
|
+
...key,
|
|
3254
|
+
challenged: options.challenge !== void 0
|
|
3255
|
+
}) : withoutKey(body, { challenged: options.challenge !== void 0 }),
|
|
3142
3256
|
// The response lists the access key's account first, so the app reads no `GET /v1/account`.
|
|
3143
3257
|
// An account that the client cannot rebuild stays absent, so the session holds the access key alone.
|
|
3144
3258
|
...key && first ? (() => {
|
|
@@ -3411,7 +3525,7 @@ var signInIds = /* @__PURE__ */ new Set([
|
|
|
3411
3525
|
function plugin() {
|
|
3412
3526
|
let loading;
|
|
3413
3527
|
function load() {
|
|
3414
|
-
loading ??= import("./dialog-
|
|
3528
|
+
loading ??= import("./dialog-RR4ETIE7.js").then((module) => module.dialog()).catch((error3) => {
|
|
3415
3529
|
loading = void 0;
|
|
3416
3530
|
throw error3;
|
|
3417
3531
|
});
|
|
@@ -4366,14 +4480,6 @@ var ChainUnavailableError = class extends Error {
|
|
|
4366
4480
|
);
|
|
4367
4481
|
}
|
|
4368
4482
|
};
|
|
4369
|
-
var ChallengeWithoutKeyError = class extends Error {
|
|
4370
|
-
name = "Accounts.ChallengeWithoutKeyError";
|
|
4371
|
-
constructor() {
|
|
4372
|
-
super(
|
|
4373
|
-
"A challenge rides in the key authorization, so a sign-in without `accessKey` takes none. Remove `challenge`, or pass `accessKey` to request an access key."
|
|
4374
|
-
);
|
|
4375
|
-
}
|
|
4376
|
-
};
|
|
4377
4483
|
var ClientIdRequiredError = class extends Error {
|
|
4378
4484
|
name = "Accounts.ClientIdRequiredError";
|
|
4379
4485
|
constructor() {
|
|
@@ -4631,7 +4737,7 @@ function create4(options = {}) {
|
|
|
4631
4737
|
function connections2() {
|
|
4632
4738
|
if (!connectionsOptions)
|
|
4633
4739
|
return Promise.reject(new ConnectionsRequiredError());
|
|
4634
|
-
attached ??= import("./Connections-
|
|
4740
|
+
attached ??= import("./Connections-D5RJSFJP.js").then(
|
|
4635
4741
|
(module) => module.attach(config, connectionsOptions)
|
|
4636
4742
|
);
|
|
4637
4743
|
return attached;
|
package/dist/commands/login.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
env,
|
|
3
3
|
login
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LUSCUHII.js";
|
|
5
|
+
import "../chunk-USONPD4G.js";
|
|
6
|
+
import "../chunk-PA3AETBC.js";
|
|
7
7
|
import "../chunk-YW5DUQT3.js";
|
|
8
8
|
import "../chunk-MLKGABMK.js";
|
|
9
9
|
|
package/dist/commands/logout.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
env,
|
|
3
3
|
remove
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LUSCUHII.js";
|
|
5
|
+
import "../chunk-USONPD4G.js";
|
|
6
|
+
import "../chunk-PA3AETBC.js";
|
|
7
7
|
import "../chunk-YW5DUQT3.js";
|
|
8
8
|
import "../chunk-MLKGABMK.js";
|
|
9
9
|
|
package/dist/commands/whoami.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
env,
|
|
3
3
|
signedOut,
|
|
4
4
|
whoami
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-LUSCUHII.js";
|
|
6
|
+
import "../chunk-USONPD4G.js";
|
|
7
|
+
import "../chunk-PA3AETBC.js";
|
|
8
8
|
import "../chunk-YW5DUQT3.js";
|
|
9
9
|
import "../chunk-MLKGABMK.js";
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"node": ">=24.21"
|
|
10
10
|
},
|
|
11
11
|
"name": "@tempoxyz/id",
|
|
12
|
-
"version": "0.0.0-pr-
|
|
12
|
+
"version": "0.0.0-pr-704.sha-0cbffe0",
|
|
13
13
|
"description": "The tempo-id CLI: sign in to Tempo ID, and call its API and the Admin API.",
|
|
14
14
|
"type": "module",
|
|
15
15
|
"bin": {
|