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