@tempoxyz/id 0.0.0-pr-707.sha-3bb0aa5 → 0.0.0-pr-704.sha-7c2e350
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-6BMLTJRD.js} +2 -2
- package/dist/{Sheet-PTAFRAX2.js → Sheet-EWEYRZNJ.js} +1 -1
- package/dist/{chunk-FDHRRJQI.js → chunk-BWC6KR4N.js} +1 -1
- package/dist/{chunk-JJT3ITRO.js → chunk-FR3Y7557.js} +1 -1
- package/dist/{chunk-YDYAVOWG.js → chunk-N2AX3I52.js} +161 -58
- 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-B3MKOMPT.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,6 +1452,11 @@ async function authorize2(auth, options) {
|
|
|
1411
1452
|
}
|
|
1412
1453
|
async function poll(auth, options) {
|
|
1413
1454
|
const { deviceCode } = options;
|
|
1455
|
+
if (options.accessKey === false)
|
|
1456
|
+
return request2(auth, {
|
|
1457
|
+
deviceCode,
|
|
1458
|
+
key: void 0
|
|
1459
|
+
});
|
|
1414
1460
|
const accessKey2 = own(options.accessKey);
|
|
1415
1461
|
if (!accessKey2) throw new AccessKeyRequiredError();
|
|
1416
1462
|
return request2(auth, {
|
|
@@ -1437,15 +1483,20 @@ async function request2(auth, options) {
|
|
|
1437
1483
|
});
|
|
1438
1484
|
if (typeof body === "string")
|
|
1439
1485
|
return { slowDown: body === "slow_down", status: "pending" };
|
|
1486
|
+
const authorization2 = key ? authorization(
|
|
1487
|
+
{
|
|
1488
|
+
account: body.account,
|
|
1489
|
+
...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
|
|
1490
|
+
key_authorization: body.key_authorization,
|
|
1491
|
+
tokens: tokens(body)
|
|
1492
|
+
},
|
|
1493
|
+
{ ...key, challenged: options.challenged }
|
|
1494
|
+
) : withoutKey(
|
|
1495
|
+
{ ...body, tokens: tokens(body) },
|
|
1496
|
+
{ challenged: options.challenged }
|
|
1497
|
+
);
|
|
1440
1498
|
return {
|
|
1441
|
-
authorization:
|
|
1442
|
-
{
|
|
1443
|
-
account: body.account,
|
|
1444
|
-
key_authorization: body.key_authorization,
|
|
1445
|
-
tokens: tokens(body)
|
|
1446
|
-
},
|
|
1447
|
-
key
|
|
1448
|
-
),
|
|
1499
|
+
authorization: authorization2,
|
|
1449
1500
|
status: "approved"
|
|
1450
1501
|
};
|
|
1451
1502
|
}
|
|
@@ -1712,7 +1763,7 @@ async function open(auth, options) {
|
|
|
1712
1763
|
throw new OriginError({ origin: window.location.origin, redirectUri });
|
|
1713
1764
|
if (mode === "popup" && options.mode !== "popup" && !activated()) {
|
|
1714
1765
|
const address2 = await abortable(read2(), { signal });
|
|
1715
|
-
const Sheet = await import("./Sheet-
|
|
1766
|
+
const Sheet = await import("./Sheet-EWEYRZNJ.js");
|
|
1716
1767
|
return await new Promise((resolve3, reject) => {
|
|
1717
1768
|
const abort = () => {
|
|
1718
1769
|
close();
|
|
@@ -1763,7 +1814,7 @@ async function watch(auth, options) {
|
|
|
1763
1814
|
try {
|
|
1764
1815
|
return await new Promise(
|
|
1765
1816
|
(resolve3, reject) => {
|
|
1766
|
-
void import("./Sheet-
|
|
1817
|
+
void import("./Sheet-EWEYRZNJ.js").then(
|
|
1767
1818
|
(Sheet) => {
|
|
1768
1819
|
if (settled) return;
|
|
1769
1820
|
unblock = Sheet.waiting({
|
|
@@ -1828,7 +1879,7 @@ function parse(url, options) {
|
|
|
1828
1879
|
async function frame(auth, options) {
|
|
1829
1880
|
const { redirectUri, signal, toUrl } = options;
|
|
1830
1881
|
const address2 = await abortable(options.address, { signal });
|
|
1831
|
-
const Sheet = await import("./Sheet-
|
|
1882
|
+
const Sheet = await import("./Sheet-EWEYRZNJ.js");
|
|
1832
1883
|
signal?.throwIfAborted();
|
|
1833
1884
|
let close;
|
|
1834
1885
|
let abort;
|
|
@@ -2086,6 +2137,7 @@ function finish(options) {
|
|
|
2086
2137
|
const {
|
|
2087
2138
|
key,
|
|
2088
2139
|
chainId: _chainId,
|
|
2140
|
+
challenge: challenged,
|
|
2089
2141
|
clientId: _clientId,
|
|
2090
2142
|
redirectUri: _redirectUri,
|
|
2091
2143
|
state: _state,
|
|
@@ -2094,7 +2146,11 @@ function finish(options) {
|
|
|
2094
2146
|
} = options.pending;
|
|
2095
2147
|
if (key === false) {
|
|
2096
2148
|
const tokens3 = tokens(body);
|
|
2097
|
-
return {
|
|
2149
|
+
return {
|
|
2150
|
+
...tokens3,
|
|
2151
|
+
...challengeSignature(body, { challenged }),
|
|
2152
|
+
user: user(tokens3)
|
|
2153
|
+
};
|
|
2098
2154
|
}
|
|
2099
2155
|
if (!body.account || !body.key_authorization)
|
|
2100
2156
|
throw new RequestError({
|
|
@@ -2106,10 +2162,11 @@ function finish(options) {
|
|
|
2106
2162
|
return authorization(
|
|
2107
2163
|
{
|
|
2108
2164
|
account: body.account,
|
|
2165
|
+
...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
|
|
2109
2166
|
key_authorization: body.key_authorization,
|
|
2110
2167
|
tokens: body
|
|
2111
2168
|
},
|
|
2112
|
-
{ accessKey: options.accessKey, material }
|
|
2169
|
+
{ accessKey: options.accessKey, challenged, material }
|
|
2113
2170
|
);
|
|
2114
2171
|
}
|
|
2115
2172
|
async function prefetch(auth) {
|
|
@@ -2646,6 +2703,10 @@ function toSession(result) {
|
|
|
2646
2703
|
return from4({
|
|
2647
2704
|
accessToken: result.accessToken,
|
|
2648
2705
|
...result.account ? { account: result.account } : {},
|
|
2706
|
+
...result.address && result.challengeSignature ? {
|
|
2707
|
+
address: result.address,
|
|
2708
|
+
challengeSignature: result.challengeSignature
|
|
2709
|
+
} : {},
|
|
2649
2710
|
expiresAt: result.expiresAt,
|
|
2650
2711
|
...result.idToken !== void 0 ? { idToken: result.idToken } : {},
|
|
2651
2712
|
...result.key ? { key: withLifetime(result.key) } : {},
|
|
@@ -2691,8 +2752,6 @@ async function sendCode2(auth, options) {
|
|
|
2691
2752
|
}
|
|
2692
2753
|
async function signIn3(auth, options) {
|
|
2693
2754
|
const { code, email, getFn, link } = options;
|
|
2694
|
-
if (!options.accessKey && options.challenge !== void 0)
|
|
2695
|
-
throw new ChallengeWithoutKeyError();
|
|
2696
2755
|
const prepared = await prepare(auth, options);
|
|
2697
2756
|
const assertion = await (async () => {
|
|
2698
2757
|
if (!link) return void 0;
|
|
@@ -2894,6 +2953,13 @@ function prepare2(auth, options = {}) {
|
|
|
2894
2953
|
}
|
|
2895
2954
|
async function register(auth, options = {}) {
|
|
2896
2955
|
const { createFn, getFn, key } = options;
|
|
2956
|
+
if (options.challenge !== void 0 && !options.accessKey)
|
|
2957
|
+
throw new RequestError({
|
|
2958
|
+
code: "invalid_request",
|
|
2959
|
+
field: "challenge",
|
|
2960
|
+
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.",
|
|
2961
|
+
status: 0
|
|
2962
|
+
});
|
|
2897
2963
|
const chain = options.chain ?? options.chainId;
|
|
2898
2964
|
if (options.accessKey && (key || options.account !== void 0 || chain !== void 0))
|
|
2899
2965
|
throw new RequestError({
|
|
@@ -2985,14 +3051,60 @@ async function register(auth, options = {}) {
|
|
|
2985
3051
|
signed,
|
|
2986
3052
|
headless.key
|
|
2987
3053
|
);
|
|
3054
|
+
const challenged = options.challenge === void 0 ? {} : await challenge(
|
|
3055
|
+
{ ...auth, chainId: Number(authorization2.key.chainId) },
|
|
3056
|
+
{
|
|
3057
|
+
account: registered.address,
|
|
3058
|
+
challenge: options.challenge,
|
|
3059
|
+
getFn,
|
|
3060
|
+
userId: authorization2.user.id
|
|
3061
|
+
}
|
|
3062
|
+
);
|
|
2988
3063
|
return {
|
|
2989
3064
|
...result,
|
|
2990
3065
|
authorization: {
|
|
2991
3066
|
...authorization2,
|
|
3067
|
+
..."challengeError" in challenged ? {} : challenged,
|
|
2992
3068
|
upgradeAvailable: signed.upgrade_available === true
|
|
2993
|
-
}
|
|
3069
|
+
},
|
|
3070
|
+
..."challengeError" in challenged ? { challengeError: challenged.challengeError } : {}
|
|
2994
3071
|
};
|
|
2995
3072
|
}
|
|
3073
|
+
async function challenge(auth, options) {
|
|
3074
|
+
try {
|
|
3075
|
+
const body = await json(
|
|
3076
|
+
await post2(auth, {
|
|
3077
|
+
getFn: options.getFn,
|
|
3078
|
+
json: request(auth, {
|
|
3079
|
+
account: options.account,
|
|
3080
|
+
challenge: options.challenge
|
|
3081
|
+
})
|
|
3082
|
+
})
|
|
3083
|
+
);
|
|
3084
|
+
const tokens3 = "accessToken" in body.tokens ? body.tokens : tokens(body.tokens);
|
|
3085
|
+
if (tokens3.refreshToken)
|
|
3086
|
+
await revoke(auth, { refreshToken: tokens3.refreshToken }).catch(
|
|
3087
|
+
() => void 0
|
|
3088
|
+
);
|
|
3089
|
+
const signed = challengeSignature(body, { challenged: true });
|
|
3090
|
+
if (user(tokens3).id !== options.userId || !Address3.isEqual(signed.address, options.account))
|
|
3091
|
+
throw new RequestError({
|
|
3092
|
+
code: "server_error",
|
|
3093
|
+
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.",
|
|
3094
|
+
status: 200
|
|
3095
|
+
});
|
|
3096
|
+
return signed;
|
|
3097
|
+
} catch (error3) {
|
|
3098
|
+
return {
|
|
3099
|
+
challengeError: error3 instanceof RequestError ? error3 : new RequestError({
|
|
3100
|
+
cause: error3,
|
|
3101
|
+
code: "server_error",
|
|
3102
|
+
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.",
|
|
3103
|
+
status: 0
|
|
3104
|
+
})
|
|
3105
|
+
};
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
2996
3108
|
async function signIn4(auth, options = {}) {
|
|
2997
3109
|
const prepared = await requestOptions(auth, options);
|
|
2998
3110
|
const assertion = await sign2(prepared, options);
|
|
@@ -3017,8 +3129,6 @@ function refused(error3) {
|
|
|
3017
3129
|
}
|
|
3018
3130
|
async function requestOptions(auth, options) {
|
|
3019
3131
|
const { credentialId, mediation, select } = options;
|
|
3020
|
-
if (!options.accessKey && options.challenge !== void 0)
|
|
3021
|
-
throw new ChallengeWithoutKeyError();
|
|
3022
3132
|
const { authorize: authorize6, key } = await prepare(auth, options);
|
|
3023
3133
|
const requestedAt = Date.now();
|
|
3024
3134
|
const requested = await json(
|
|
@@ -3103,8 +3213,6 @@ async function list(auth) {
|
|
|
3103
3213
|
// ../../accounts/src/internal/Actions.ts
|
|
3104
3214
|
async function authorize4(auth, options = {}) {
|
|
3105
3215
|
const { accessKey: accessKey2 } = options;
|
|
3106
|
-
if (!accessKey2 && options.challenge !== void 0)
|
|
3107
|
-
throw new ChallengeWithoutKeyError();
|
|
3108
3216
|
const [session2, generated] = await Promise.all([
|
|
3109
3217
|
(async () => json(
|
|
3110
3218
|
await (auth.fetch ?? globalThis.fetch)(
|
|
@@ -3138,7 +3246,10 @@ async function authorize4(auth, options = {}) {
|
|
|
3138
3246
|
const body = await json(response);
|
|
3139
3247
|
const [first] = body.tempo ?? [];
|
|
3140
3248
|
const result = {
|
|
3141
|
-
...key ? authorization(body,
|
|
3249
|
+
...key ? authorization(body, {
|
|
3250
|
+
...key,
|
|
3251
|
+
challenged: options.challenge !== void 0
|
|
3252
|
+
}) : withoutKey(body, { challenged: options.challenge !== void 0 }),
|
|
3142
3253
|
// The response lists the access key's account first, so the app reads no `GET /v1/account`.
|
|
3143
3254
|
// An account that the client cannot rebuild stays absent, so the session holds the access key alone.
|
|
3144
3255
|
...key && first ? (() => {
|
|
@@ -3411,7 +3522,7 @@ var signInIds = /* @__PURE__ */ new Set([
|
|
|
3411
3522
|
function plugin() {
|
|
3412
3523
|
let loading;
|
|
3413
3524
|
function load() {
|
|
3414
|
-
loading ??= import("./dialog-
|
|
3525
|
+
loading ??= import("./dialog-B3MKOMPT.js").then((module) => module.dialog()).catch((error3) => {
|
|
3415
3526
|
loading = void 0;
|
|
3416
3527
|
throw error3;
|
|
3417
3528
|
});
|
|
@@ -4366,14 +4477,6 @@ var ChainUnavailableError = class extends Error {
|
|
|
4366
4477
|
);
|
|
4367
4478
|
}
|
|
4368
4479
|
};
|
|
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
4480
|
var ClientIdRequiredError = class extends Error {
|
|
4378
4481
|
name = "Accounts.ClientIdRequiredError";
|
|
4379
4482
|
constructor() {
|
|
@@ -4631,7 +4734,7 @@ function create4(options = {}) {
|
|
|
4631
4734
|
function connections2() {
|
|
4632
4735
|
if (!connectionsOptions)
|
|
4633
4736
|
return Promise.reject(new ConnectionsRequiredError());
|
|
4634
|
-
attached ??= import("./Connections-
|
|
4737
|
+
attached ??= import("./Connections-6BMLTJRD.js").then(
|
|
4635
4738
|
(module) => module.attach(config, connectionsOptions)
|
|
4636
4739
|
);
|
|
4637
4740
|
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-BWC6KR4N.js";
|
|
5
|
+
import "../chunk-FR3Y7557.js";
|
|
6
|
+
import "../chunk-N2AX3I52.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-BWC6KR4N.js";
|
|
5
|
+
import "../chunk-FR3Y7557.js";
|
|
6
|
+
import "../chunk-N2AX3I52.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-BWC6KR4N.js";
|
|
6
|
+
import "../chunk-FR3Y7557.js";
|
|
7
|
+
import "../chunk-N2AX3I52.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-7c2e350",
|
|
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": {
|