@tempoxyz/id 0.0.0-pr-733.sha-e545d6e → 0.0.0-pr-704.sha-337c895
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-FMSXLTDQ.js → Connections-J72AA66Q.js} +2 -2
- package/dist/{Sheet-NWJMJ4Y6.js → Sheet-LRIER3ST.js} +1 -1
- package/dist/{chunk-OWN434NG.js → chunk-7LJN5HAQ.js} +165 -59
- package/dist/{chunk-IVSEEABZ.js → chunk-HWWXK3KQ.js} +1 -1
- package/dist/{chunk-SQYUAMGZ.js → chunk-WTA7NVIZ.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-YGV3SM4O.js → dialog-CMISBFX2.js} +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,6 @@ var Accounts_exports = {};
|
|
|
20
20
|
__export(Accounts_exports, {
|
|
21
21
|
ChainInvalidError: () => ChainInvalidError,
|
|
22
22
|
ChainUnavailableError: () => ChainUnavailableError,
|
|
23
|
-
ChallengeWithoutKeyError: () => ChallengeWithoutKeyError,
|
|
24
23
|
ClientIdRequiredError: () => ClientIdRequiredError,
|
|
25
24
|
ConnectionsRequiredError: () => ConnectionsRequiredError,
|
|
26
25
|
EverywhereNotAllowedError: () => EverywhereNotAllowedError,
|
|
@@ -234,10 +233,26 @@ function authorization(body, options) {
|
|
|
234
233
|
return {
|
|
235
234
|
...tokens_,
|
|
236
235
|
accessKey: toAccount(key, { accessKey: accessKey2 }),
|
|
236
|
+
...challengeSignature(body, { challenged: options.challenged }),
|
|
237
237
|
key,
|
|
238
238
|
user: user(tokens_)
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
+
function challengeSignature(body, options = {}) {
|
|
242
|
+
if (body.account && body.challenge_signature)
|
|
243
|
+
return {
|
|
244
|
+
address: body.account,
|
|
245
|
+
challengeSignature: body.challenge_signature
|
|
246
|
+
};
|
|
247
|
+
if (options.challenged)
|
|
248
|
+
throw new RequestError({
|
|
249
|
+
code: "server_error",
|
|
250
|
+
message: "Missing challenge signature in the response to a request with a challenge. Update Tempo ID, or sign in without the challenge.",
|
|
251
|
+
signedIn: true,
|
|
252
|
+
status: 200
|
|
253
|
+
});
|
|
254
|
+
return {};
|
|
255
|
+
}
|
|
241
256
|
async function json(response) {
|
|
242
257
|
if (response.type === "opaqueredirect" || Math.trunc(response.status / 100) === 3) {
|
|
243
258
|
await response.body?.cancel().catch(() => void 0);
|
|
@@ -549,9 +564,13 @@ function signedIn(error3, options = {}) {
|
|
|
549
564
|
uri: error3.uri
|
|
550
565
|
});
|
|
551
566
|
}
|
|
552
|
-
function withoutKey(body) {
|
|
567
|
+
function withoutKey(body, options = {}) {
|
|
553
568
|
const tokens_ = "accessToken" in body.tokens ? body.tokens : tokens(body.tokens);
|
|
554
|
-
return {
|
|
569
|
+
return {
|
|
570
|
+
...tokens_,
|
|
571
|
+
...challengeSignature(body, options),
|
|
572
|
+
user: user(tokens_)
|
|
573
|
+
};
|
|
555
574
|
}
|
|
556
575
|
|
|
557
576
|
// ../../accounts/src/actions/account.ts
|
|
@@ -1023,13 +1042,12 @@ function seconds(options) {
|
|
|
1023
1042
|
var base64url = { pad: false, url: true };
|
|
1024
1043
|
async function authorizeUrl(auth, options) {
|
|
1025
1044
|
const { accessKey: accessKey2 } = options;
|
|
1026
|
-
if (!accessKey2 && options.challenge !== void 0)
|
|
1027
|
-
throw new ChallengeWithoutKeyError();
|
|
1028
1045
|
const redirectUri = options.redirectUri ?? auth.redirectUri ?? `${window.location.origin}/`;
|
|
1029
1046
|
const key = accessKey2 ? await resolve(accessKey2) : void 0;
|
|
1030
1047
|
const pending = from2({
|
|
1031
1048
|
...key ? key.material : { key: false },
|
|
1032
1049
|
chainId: auth.chainId,
|
|
1050
|
+
...options.challenge !== void 0 ? { challenge: true } : {},
|
|
1033
1051
|
clientId: auth.clientId,
|
|
1034
1052
|
redirectUri,
|
|
1035
1053
|
// `Bytes.random` needs only `crypto.getRandomValues`, which React Native polyfills.
|
|
@@ -1041,6 +1059,7 @@ async function authorizeUrl(auth, options) {
|
|
|
1041
1059
|
}) : void 0;
|
|
1042
1060
|
const url = new URL("/oauth2/authorize", auth.url);
|
|
1043
1061
|
const parameters = new URLSearchParams({
|
|
1062
|
+
...options.challenge !== void 0 && !accessKey2 ? { chain_id: String(auth.chainId) } : {},
|
|
1044
1063
|
...options.challenge === void 0 ? {} : { challenge: options.challenge },
|
|
1045
1064
|
client_id: auth.clientId,
|
|
1046
1065
|
// In the web message mode, Tempo ID sets the challenge and redeems the code itself.
|
|
@@ -1077,9 +1096,15 @@ async function authorizeUrl(auth, options) {
|
|
|
1077
1096
|
return { pending, url: url.href };
|
|
1078
1097
|
}
|
|
1079
1098
|
function request(auth, options) {
|
|
1080
|
-
const { accessKey: accessKey2, challenge } = options;
|
|
1099
|
+
const { accessKey: accessKey2, challenge: challenge2 } = options;
|
|
1081
1100
|
return {
|
|
1082
|
-
|
|
1101
|
+
// A challenge without an access key names the instance's chain, whose view of the account signs
|
|
1102
|
+
// it, and any account that signs it in place of the selected one.
|
|
1103
|
+
...challenge2 !== void 0 && !accessKey2 ? {
|
|
1104
|
+
...options.account ? { account: options.account } : {},
|
|
1105
|
+
chain_id: auth.chainId
|
|
1106
|
+
} : {},
|
|
1107
|
+
...challenge2 === void 0 ? {} : { challenge: challenge2 },
|
|
1083
1108
|
client_id: auth.clientId,
|
|
1084
1109
|
...accessKey2 ? {
|
|
1085
1110
|
key_authorization: keyAuthorization(auth, {
|
|
@@ -1134,7 +1159,7 @@ function pushes(auth) {
|
|
|
1134
1159
|
|
|
1135
1160
|
// ../../accounts/src/internal/Headless.ts
|
|
1136
1161
|
async function authorize(auth, options) {
|
|
1137
|
-
const { accessKey: accessKey2, challenge, getFn } = options;
|
|
1162
|
+
const { accessKey: accessKey2, challenge: challenge2, getFn } = options;
|
|
1138
1163
|
try {
|
|
1139
1164
|
const key = accessKey2 ? await resolve(accessKey2) : void 0;
|
|
1140
1165
|
if (key)
|
|
@@ -1148,11 +1173,11 @@ async function authorize(auth, options) {
|
|
|
1148
1173
|
getFn,
|
|
1149
1174
|
json: request(auth, {
|
|
1150
1175
|
accessKey: key && accessKey2 && { ...accessKey2, account: key.accessKey },
|
|
1151
|
-
challenge
|
|
1176
|
+
challenge: challenge2
|
|
1152
1177
|
})
|
|
1153
1178
|
})
|
|
1154
1179
|
);
|
|
1155
|
-
const authorization2 = key ? authorization(body, key) : withoutKey(body);
|
|
1180
|
+
const authorization2 = key ? authorization(body, { ...key, challenged: challenge2 !== void 0 }) : withoutKey(body, { challenged: challenge2 !== void 0 });
|
|
1156
1181
|
if (authorization2.user.id !== options.userId) throw sessionChanged();
|
|
1157
1182
|
return {
|
|
1158
1183
|
...authorization2,
|
|
@@ -1174,7 +1199,12 @@ async function complete(auth, options) {
|
|
|
1174
1199
|
step: body.authorization
|
|
1175
1200
|
})
|
|
1176
1201
|
) : body.authorization;
|
|
1177
|
-
const authorization2 = key ? authorization(signed,
|
|
1202
|
+
const authorization2 = key ? authorization(signed, {
|
|
1203
|
+
...key,
|
|
1204
|
+
challenged: options.request.challenge !== void 0
|
|
1205
|
+
}) : withoutKey(signed, {
|
|
1206
|
+
challenged: options.request.challenge !== void 0
|
|
1207
|
+
});
|
|
1178
1208
|
if (authorization2.user.id !== body.user.id) throw sessionChanged();
|
|
1179
1209
|
return {
|
|
1180
1210
|
...authorization2,
|
|
@@ -1253,7 +1283,7 @@ async function sign(auth, options) {
|
|
|
1253
1283
|
});
|
|
1254
1284
|
}
|
|
1255
1285
|
function steps(json2, options) {
|
|
1256
|
-
if (!json2.key_authorization) return false;
|
|
1286
|
+
if (!json2.key_authorization && json2.challenge === void 0) return false;
|
|
1257
1287
|
return options.getFn !== void 0 || globalThis.navigator?.credentials !== void 0;
|
|
1258
1288
|
}
|
|
1259
1289
|
function redemption(auth) {
|
|
@@ -1300,14 +1330,14 @@ async function sendCode(auth, options) {
|
|
|
1300
1330
|
);
|
|
1301
1331
|
}
|
|
1302
1332
|
async function signIn(auth, options) {
|
|
1303
|
-
const { challenge, code, email, userIp } = options;
|
|
1304
|
-
if (!options.accessKey && challenge !== void 0)
|
|
1305
|
-
throw new ChallengeWithoutKeyError();
|
|
1333
|
+
const { challenge: challenge2, code, email, userIp } = options;
|
|
1306
1334
|
authenticated(auth);
|
|
1307
1335
|
const { accessKey: accessKey2 } = options;
|
|
1308
1336
|
const key = accessKey2 ? await resolve(accessKey2) : void 0;
|
|
1309
1337
|
const body = await token(auth, {
|
|
1310
|
-
|
|
1338
|
+
// A challenge without an access key names the instance's chain, whose view of the account signs it.
|
|
1339
|
+
...challenge2 !== void 0 && !key ? { chain_id: String(auth.chainId) } : {},
|
|
1340
|
+
...challenge2 === void 0 ? {} : { challenge: challenge2 },
|
|
1311
1341
|
code,
|
|
1312
1342
|
email,
|
|
1313
1343
|
grant_type: grantType,
|
|
@@ -1326,14 +1356,19 @@ async function signIn(auth, options) {
|
|
|
1326
1356
|
});
|
|
1327
1357
|
const tokens3 = tokens(body);
|
|
1328
1358
|
if (!key)
|
|
1329
|
-
return {
|
|
1359
|
+
return {
|
|
1360
|
+
...tokens3,
|
|
1361
|
+
...challengeSignature(body, { challenged: challenge2 !== void 0 }),
|
|
1362
|
+
user: user(tokens3)
|
|
1363
|
+
};
|
|
1330
1364
|
return authorization(
|
|
1331
1365
|
{
|
|
1332
1366
|
account: body.account,
|
|
1367
|
+
...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
|
|
1333
1368
|
key_authorization: body.key_authorization,
|
|
1334
1369
|
tokens: tokens3
|
|
1335
1370
|
},
|
|
1336
|
-
key
|
|
1371
|
+
{ ...key, challenged: challenge2 !== void 0 }
|
|
1337
1372
|
);
|
|
1338
1373
|
}
|
|
1339
1374
|
function authenticated(auth) {
|
|
@@ -1413,8 +1448,11 @@ __export(device_exports, {
|
|
|
1413
1448
|
});
|
|
1414
1449
|
import { Base64 as Base646 } from "ox";
|
|
1415
1450
|
async function authorize2(auth, options) {
|
|
1416
|
-
const
|
|
1451
|
+
const { accessKey: accessKey2 } = options;
|
|
1452
|
+
const key = accessKey2 ? await resolve(accessKey2) : void 0;
|
|
1417
1453
|
const body = new URLSearchParams({
|
|
1454
|
+
// A challenge without an access key names the instance's chain, whose view of the account signs it.
|
|
1455
|
+
...options.challenge !== void 0 && !key ? { chain_id: String(auth.chainId) } : {},
|
|
1418
1456
|
...options.challenge === void 0 ? {} : { challenge: options.challenge },
|
|
1419
1457
|
// The instance's app is the device app that the CLI signs in to, such as `tempo-cli`.
|
|
1420
1458
|
client_id: auth.clientId,
|
|
@@ -1422,14 +1460,16 @@ async function authorize2(auth, options) {
|
|
|
1422
1460
|
...options.funding?.currency === void 0 ? {} : { funding_currency: options.funding.currency },
|
|
1423
1461
|
...options.funding ? { funding_hint: options.funding.amount } : {},
|
|
1424
1462
|
...options.funding?.token === void 0 ? {} : { funding_token: options.funding.token },
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1463
|
+
...key && accessKey2 ? {
|
|
1464
|
+
key_authorization: Base646.fromString(
|
|
1465
|
+
JSON.stringify(
|
|
1466
|
+
keyAuthorization(auth, {
|
|
1467
|
+
accessKey: { ...accessKey2, account: key.accessKey }
|
|
1468
|
+
})
|
|
1469
|
+
),
|
|
1470
|
+
{ pad: false, url: true }
|
|
1471
|
+
)
|
|
1472
|
+
} : {}
|
|
1433
1473
|
});
|
|
1434
1474
|
for (const resource of resources(auth, options))
|
|
1435
1475
|
body.append("resource", resource);
|
|
@@ -1464,6 +1504,7 @@ async function authorize2(auth, options) {
|
|
|
1464
1504
|
);
|
|
1465
1505
|
failure = void 0;
|
|
1466
1506
|
const result = await request2(poll2, {
|
|
1507
|
+
challenged: options.challenge !== void 0,
|
|
1467
1508
|
deviceCode: code.device_code,
|
|
1468
1509
|
key
|
|
1469
1510
|
}).catch((error3) => {
|
|
@@ -1496,9 +1537,17 @@ async function authorize2(auth, options) {
|
|
|
1496
1537
|
}
|
|
1497
1538
|
async function poll(auth, options) {
|
|
1498
1539
|
const { deviceCode } = options;
|
|
1540
|
+
const challenged = options.challenged ?? options.accessKey === false;
|
|
1541
|
+
if (options.accessKey === false)
|
|
1542
|
+
return request2(auth, {
|
|
1543
|
+
challenged,
|
|
1544
|
+
deviceCode,
|
|
1545
|
+
key: void 0
|
|
1546
|
+
});
|
|
1499
1547
|
const accessKey2 = own(options.accessKey);
|
|
1500
1548
|
if (!accessKey2) throw new AccessKeyRequiredError();
|
|
1501
1549
|
return request2(auth, {
|
|
1550
|
+
challenged,
|
|
1502
1551
|
deviceCode,
|
|
1503
1552
|
key: { accessKey: accessKey2, material: {} }
|
|
1504
1553
|
});
|
|
@@ -1522,15 +1571,20 @@ async function request2(auth, options) {
|
|
|
1522
1571
|
});
|
|
1523
1572
|
if (typeof body === "string")
|
|
1524
1573
|
return { slowDown: body === "slow_down", status: "pending" };
|
|
1574
|
+
const authorization2 = key ? authorization(
|
|
1575
|
+
{
|
|
1576
|
+
account: body.account,
|
|
1577
|
+
...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
|
|
1578
|
+
key_authorization: body.key_authorization,
|
|
1579
|
+
tokens: tokens(body)
|
|
1580
|
+
},
|
|
1581
|
+
{ ...key, challenged: options.challenged }
|
|
1582
|
+
) : withoutKey(
|
|
1583
|
+
{ ...body, tokens: tokens(body) },
|
|
1584
|
+
{ challenged: options.challenged }
|
|
1585
|
+
);
|
|
1525
1586
|
return {
|
|
1526
|
-
authorization:
|
|
1527
|
-
{
|
|
1528
|
-
account: body.account,
|
|
1529
|
-
key_authorization: body.key_authorization,
|
|
1530
|
-
tokens: tokens(body)
|
|
1531
|
-
},
|
|
1532
|
-
key
|
|
1533
|
-
),
|
|
1587
|
+
authorization: authorization2,
|
|
1534
1588
|
status: "approved"
|
|
1535
1589
|
};
|
|
1536
1590
|
}
|
|
@@ -1800,7 +1854,7 @@ async function open(auth, options) {
|
|
|
1800
1854
|
throw new OriginError({ origin: window.location.origin, redirectUri });
|
|
1801
1855
|
if (mode === "popup" && options.mode !== "popup" && !activated()) {
|
|
1802
1856
|
const address2 = await abortable(read2(), { signal });
|
|
1803
|
-
const Sheet = await import("./Sheet-
|
|
1857
|
+
const Sheet = await import("./Sheet-LRIER3ST.js");
|
|
1804
1858
|
return await new Promise((resolve3, reject) => {
|
|
1805
1859
|
const abort = () => {
|
|
1806
1860
|
close();
|
|
@@ -1851,7 +1905,7 @@ async function watch(auth, options) {
|
|
|
1851
1905
|
try {
|
|
1852
1906
|
return await new Promise(
|
|
1853
1907
|
(resolve3, reject) => {
|
|
1854
|
-
void import("./Sheet-
|
|
1908
|
+
void import("./Sheet-LRIER3ST.js").then(
|
|
1855
1909
|
(Sheet) => {
|
|
1856
1910
|
if (settled) return;
|
|
1857
1911
|
unblock = Sheet.waiting({
|
|
@@ -1916,7 +1970,7 @@ function parse(url, options) {
|
|
|
1916
1970
|
async function frame(auth, options) {
|
|
1917
1971
|
const { redirectUri, signal, toUrl } = options;
|
|
1918
1972
|
const address2 = await abortable(options.address, { signal });
|
|
1919
|
-
const Sheet = await import("./Sheet-
|
|
1973
|
+
const Sheet = await import("./Sheet-LRIER3ST.js");
|
|
1920
1974
|
signal?.throwIfAborted();
|
|
1921
1975
|
let close;
|
|
1922
1976
|
let abort;
|
|
@@ -2187,6 +2241,7 @@ function finish(options) {
|
|
|
2187
2241
|
const {
|
|
2188
2242
|
key,
|
|
2189
2243
|
chainId: _chainId,
|
|
2244
|
+
challenge: challenged,
|
|
2190
2245
|
clientId: _clientId,
|
|
2191
2246
|
redirectUri: _redirectUri,
|
|
2192
2247
|
state: _state,
|
|
@@ -2195,7 +2250,11 @@ function finish(options) {
|
|
|
2195
2250
|
} = options.pending;
|
|
2196
2251
|
if (key === false) {
|
|
2197
2252
|
const tokens3 = tokens(body);
|
|
2198
|
-
return {
|
|
2253
|
+
return {
|
|
2254
|
+
...tokens3,
|
|
2255
|
+
...challengeSignature(body, { challenged }),
|
|
2256
|
+
user: user(tokens3)
|
|
2257
|
+
};
|
|
2199
2258
|
}
|
|
2200
2259
|
if (!body.account || !body.key_authorization)
|
|
2201
2260
|
throw new RequestError({
|
|
@@ -2207,10 +2266,11 @@ function finish(options) {
|
|
|
2207
2266
|
return authorization(
|
|
2208
2267
|
{
|
|
2209
2268
|
account: body.account,
|
|
2269
|
+
...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
|
|
2210
2270
|
key_authorization: body.key_authorization,
|
|
2211
2271
|
tokens: body
|
|
2212
2272
|
},
|
|
2213
|
-
{ accessKey: options.accessKey, material }
|
|
2273
|
+
{ accessKey: options.accessKey, challenged, material }
|
|
2214
2274
|
);
|
|
2215
2275
|
}
|
|
2216
2276
|
async function prefetch(auth) {
|
|
@@ -2762,6 +2822,10 @@ function toSession(result) {
|
|
|
2762
2822
|
return from4({
|
|
2763
2823
|
accessToken: result.accessToken,
|
|
2764
2824
|
...result.account ? { account: result.account } : {},
|
|
2825
|
+
...result.address && result.challengeSignature ? {
|
|
2826
|
+
address: result.address,
|
|
2827
|
+
challengeSignature: result.challengeSignature
|
|
2828
|
+
} : {},
|
|
2765
2829
|
expiresAt: result.expiresAt,
|
|
2766
2830
|
...result.idToken !== void 0 ? { idToken: result.idToken } : {},
|
|
2767
2831
|
...result.key ? { key: withLifetime(result.key) } : {},
|
|
@@ -2810,8 +2874,6 @@ async function sendCode2(auth, options) {
|
|
|
2810
2874
|
}
|
|
2811
2875
|
async function signIn3(auth, options) {
|
|
2812
2876
|
const { code, email, getFn, link } = options;
|
|
2813
|
-
if (!options.accessKey && options.challenge !== void 0)
|
|
2814
|
-
throw new ChallengeWithoutKeyError();
|
|
2815
2877
|
const prepared = await prepare(auth, options);
|
|
2816
2878
|
const offline = answered(auth, {
|
|
2817
2879
|
message: "The sign-in received no response. Check the connection, and sign in again. If the code is refused, request a new code."
|
|
@@ -3031,6 +3093,13 @@ function prepare2(auth, options = {}) {
|
|
|
3031
3093
|
}
|
|
3032
3094
|
async function register(auth, options = {}) {
|
|
3033
3095
|
const { createFn, getFn, key } = options;
|
|
3096
|
+
if (options.challenge !== void 0 && !options.accessKey)
|
|
3097
|
+
throw new RequestError({
|
|
3098
|
+
code: "invalid_request",
|
|
3099
|
+
field: "challenge",
|
|
3100
|
+
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.",
|
|
3101
|
+
status: 0
|
|
3102
|
+
});
|
|
3034
3103
|
const chain = options.chain ?? options.chainId;
|
|
3035
3104
|
if (options.accessKey && (key || options.account !== void 0 || chain !== void 0))
|
|
3036
3105
|
throw new RequestError({
|
|
@@ -3122,14 +3191,60 @@ async function register(auth, options = {}) {
|
|
|
3122
3191
|
signed,
|
|
3123
3192
|
headless.key
|
|
3124
3193
|
);
|
|
3194
|
+
const challenged = options.challenge === void 0 ? {} : await challenge(
|
|
3195
|
+
{ ...auth, chainId: Number(authorization2.key.chainId) },
|
|
3196
|
+
{
|
|
3197
|
+
account: registered.address,
|
|
3198
|
+
challenge: options.challenge,
|
|
3199
|
+
getFn,
|
|
3200
|
+
userId: authorization2.user.id
|
|
3201
|
+
}
|
|
3202
|
+
);
|
|
3125
3203
|
return {
|
|
3126
3204
|
...result,
|
|
3127
3205
|
authorization: {
|
|
3128
3206
|
...authorization2,
|
|
3207
|
+
..."challengeError" in challenged ? {} : challenged,
|
|
3129
3208
|
upgradeAvailable: signed.upgrade_available === true
|
|
3130
|
-
}
|
|
3209
|
+
},
|
|
3210
|
+
..."challengeError" in challenged ? { challengeError: challenged.challengeError } : {}
|
|
3131
3211
|
};
|
|
3132
3212
|
}
|
|
3213
|
+
async function challenge(auth, options) {
|
|
3214
|
+
try {
|
|
3215
|
+
const body = await json(
|
|
3216
|
+
await post2(auth, {
|
|
3217
|
+
getFn: options.getFn,
|
|
3218
|
+
json: request(auth, {
|
|
3219
|
+
account: options.account,
|
|
3220
|
+
challenge: options.challenge
|
|
3221
|
+
})
|
|
3222
|
+
})
|
|
3223
|
+
);
|
|
3224
|
+
const tokens3 = "accessToken" in body.tokens ? body.tokens : tokens(body.tokens);
|
|
3225
|
+
if (tokens3.refreshToken)
|
|
3226
|
+
await revoke(auth, { refreshToken: tokens3.refreshToken }).catch(
|
|
3227
|
+
() => void 0
|
|
3228
|
+
);
|
|
3229
|
+
const signed = challengeSignature(body, { challenged: true });
|
|
3230
|
+
if (user(tokens3).id !== options.userId || !Address3.isEqual(signed.address, options.account))
|
|
3231
|
+
throw new RequestError({
|
|
3232
|
+
code: "server_error",
|
|
3233
|
+
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.",
|
|
3234
|
+
status: 200
|
|
3235
|
+
});
|
|
3236
|
+
return signed;
|
|
3237
|
+
} catch (error3) {
|
|
3238
|
+
return {
|
|
3239
|
+
challengeError: error3 instanceof RequestError ? error3 : new RequestError({
|
|
3240
|
+
cause: error3,
|
|
3241
|
+
code: "server_error",
|
|
3242
|
+
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.",
|
|
3243
|
+
status: 0
|
|
3244
|
+
})
|
|
3245
|
+
};
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3133
3248
|
async function signIn4(auth, options = {}) {
|
|
3134
3249
|
const prepared = await requestOptions(auth, options);
|
|
3135
3250
|
const assertion = await sign2(prepared, options);
|
|
@@ -3154,8 +3269,6 @@ function refused(error3) {
|
|
|
3154
3269
|
}
|
|
3155
3270
|
async function requestOptions(auth, options) {
|
|
3156
3271
|
const { credentialId, mediation, select } = options;
|
|
3157
|
-
if (!options.accessKey && options.challenge !== void 0)
|
|
3158
|
-
throw new ChallengeWithoutKeyError();
|
|
3159
3272
|
const { authorize: authorize6, key } = await prepare(auth, options);
|
|
3160
3273
|
const requestedAt = Date.now();
|
|
3161
3274
|
const requested = await json(
|
|
@@ -3240,8 +3353,6 @@ async function list(auth) {
|
|
|
3240
3353
|
// ../../accounts/src/internal/Actions.ts
|
|
3241
3354
|
async function authorize4(auth, options = {}) {
|
|
3242
3355
|
const { accessKey: accessKey2 } = options;
|
|
3243
|
-
if (!accessKey2 && options.challenge !== void 0)
|
|
3244
|
-
throw new ChallengeWithoutKeyError();
|
|
3245
3356
|
const [session2, generated] = await Promise.all([
|
|
3246
3357
|
options.checked ? { user: true } : (async () => json(
|
|
3247
3358
|
await (auth.fetch ?? globalThis.fetch)(
|
|
@@ -3275,7 +3386,10 @@ async function authorize4(auth, options = {}) {
|
|
|
3275
3386
|
const body = await json(response);
|
|
3276
3387
|
const [first] = body.tempo ?? [];
|
|
3277
3388
|
const result = {
|
|
3278
|
-
...key ? authorization(body,
|
|
3389
|
+
...key ? authorization(body, {
|
|
3390
|
+
...key,
|
|
3391
|
+
challenged: options.challenge !== void 0
|
|
3392
|
+
}) : withoutKey(body, { challenged: options.challenge !== void 0 }),
|
|
3279
3393
|
// The response lists the access key's account first, so the app reads no `GET /v1/account`.
|
|
3280
3394
|
// An account that the client cannot rebuild stays absent, so the session holds the access key alone.
|
|
3281
3395
|
...key && first ? (() => {
|
|
@@ -4936,7 +5050,7 @@ var signInIds = /* @__PURE__ */ new Set([
|
|
|
4936
5050
|
function plugin() {
|
|
4937
5051
|
let loading;
|
|
4938
5052
|
function load() {
|
|
4939
|
-
loading ??= import("./dialog-
|
|
5053
|
+
loading ??= import("./dialog-CMISBFX2.js").then((module) => module.dialog()).catch((error3) => {
|
|
4940
5054
|
loading = void 0;
|
|
4941
5055
|
throw error3;
|
|
4942
5056
|
});
|
|
@@ -5107,14 +5221,6 @@ var ChainUnavailableError = class extends Error {
|
|
|
5107
5221
|
);
|
|
5108
5222
|
}
|
|
5109
5223
|
};
|
|
5110
|
-
var ChallengeWithoutKeyError = class extends Error {
|
|
5111
|
-
name = "Accounts.ChallengeWithoutKeyError";
|
|
5112
|
-
constructor() {
|
|
5113
|
-
super(
|
|
5114
|
-
"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."
|
|
5115
|
-
);
|
|
5116
|
-
}
|
|
5117
|
-
};
|
|
5118
5224
|
var ClientIdRequiredError = class extends Error {
|
|
5119
5225
|
name = "Accounts.ClientIdRequiredError";
|
|
5120
5226
|
constructor() {
|
|
@@ -5433,7 +5539,7 @@ function create5(options = {}) {
|
|
|
5433
5539
|
function connections2() {
|
|
5434
5540
|
if (!connectionsOptions)
|
|
5435
5541
|
return Promise.reject(new ConnectionsRequiredError());
|
|
5436
|
-
attached ??= import("./Connections-
|
|
5542
|
+
attached ??= import("./Connections-J72AA66Q.js").then(
|
|
5437
5543
|
(module) => module.attach(config, connectionsOptions)
|
|
5438
5544
|
);
|
|
5439
5545
|
return attached;
|
|
@@ -5486,7 +5592,7 @@ function create5(options = {}) {
|
|
|
5486
5592
|
(module) => module.create({
|
|
5487
5593
|
accessKeys: connectionsOptions ? async () => (await connections2()).keyEndpoint : void 0,
|
|
5488
5594
|
basePath: handlerOptions.basePath,
|
|
5489
|
-
// The relay
|
|
5595
|
+
// The relay spends the fee payer's balance, so it is served only on request. The `relay` plugin's
|
|
5490
5596
|
// `extend` adds its route to the instance after this object.
|
|
5491
5597
|
relay: handlerOptions.relay && relaying ? () => instance.relay : void 0
|
|
5492
5598
|
})
|
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-WTA7NVIZ.js";
|
|
5
|
+
import "../chunk-HWWXK3KQ.js";
|
|
6
|
+
import "../chunk-7LJN5HAQ.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-WTA7NVIZ.js";
|
|
5
|
+
import "../chunk-HWWXK3KQ.js";
|
|
6
|
+
import "../chunk-7LJN5HAQ.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-WTA7NVIZ.js";
|
|
6
|
+
import "../chunk-HWWXK3KQ.js";
|
|
7
|
+
import "../chunk-7LJN5HAQ.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-337c895",
|
|
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": {
|