@tempoxyz/id 0.0.0-pr-723.sha-d92cea7 → 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.
@@ -4,8 +4,8 @@ import {
4
4
  name,
5
5
  parseName,
6
6
  pending
7
- } from "./chunk-6BI5RYRU.js";
8
- import "./chunk-ST6NQBMT.js";
7
+ } from "./chunk-HWWXK3KQ.js";
8
+ import "./chunk-7LJN5HAQ.js";
9
9
  import "./chunk-YW5DUQT3.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
  export {
@@ -4,7 +4,7 @@ import {
4
4
  machines,
5
5
  prompt,
6
6
  waiting
7
- } from "./chunk-ST6NQBMT.js";
7
+ } from "./chunk-7LJN5HAQ.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
  export {
10
10
  create,
@@ -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 { ...tokens_, user: user(tokens_) };
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,28 +1042,24 @@ 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
- const key = accessKey2 && !("address" in accessKey2) ? await resolve(accessKey2) : void 0;
1046
+ const key = accessKey2 ? await resolve(accessKey2) : void 0;
1030
1047
  const pending = from2({
1031
- ...key ? key.material : accessKey2 ? {} : { key: false },
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.
1036
1054
  state: Base644.fromBytes(Bytes2.random(16), base64url),
1037
1055
  verifier: Base644.fromBytes(Bytes2.random(32), base64url)
1038
1056
  });
1039
- const authorization2 = (() => {
1040
- if (!accessKey2) return void 0;
1041
- if ("address" in accessKey2) return keyAuthorization(auth, { accessKey: accessKey2 });
1042
- return keyAuthorization(auth, {
1043
- accessKey: { ...accessKey2, account: key.accessKey }
1044
- });
1045
- })();
1057
+ const authorization2 = key && accessKey2 ? keyAuthorization(auth, {
1058
+ accessKey: { ...accessKey2, account: key.accessKey }
1059
+ }) : void 0;
1046
1060
  const url = new URL("/oauth2/authorize", auth.url);
1047
1061
  const parameters = new URLSearchParams({
1062
+ ...options.challenge !== void 0 && !accessKey2 ? { chain_id: String(auth.chainId) } : {},
1048
1063
  ...options.challenge === void 0 ? {} : { challenge: options.challenge },
1049
1064
  client_id: auth.clientId,
1050
1065
  // In the web message mode, Tempo ID sets the challenge and redeems the code itself.
@@ -1081,9 +1096,15 @@ async function authorizeUrl(auth, options) {
1081
1096
  return { pending, url: url.href };
1082
1097
  }
1083
1098
  function request(auth, options) {
1084
- const { accessKey: accessKey2, challenge } = options;
1099
+ const { accessKey: accessKey2, challenge: challenge2 } = options;
1085
1100
  return {
1086
- ...challenge === void 0 ? {} : { challenge },
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 },
1087
1108
  client_id: auth.clientId,
1088
1109
  ...accessKey2 ? {
1089
1110
  key_authorization: keyAuthorization(auth, {
@@ -1099,38 +1120,22 @@ function request(auth, options) {
1099
1120
  };
1100
1121
  }
1101
1122
  function keyAuthorization(auth, options) {
1102
- const { accessKey: accessKey2 } = options;
1103
- const permissions2 = resolve2(accessKey2, {
1123
+ const { account: signer } = options.accessKey;
1124
+ const permissions2 = resolve2(options.accessKey, {
1104
1125
  chainId: auth.chainId
1105
1126
  });
1106
- const named = (() => {
1107
- if ("address" in accessKey2)
1108
- return {
1109
- account: options.account ?? accessKey2.access,
1110
- address: accessKey2.address,
1111
- keyType: accessKey2.type ?? "secp256k1",
1112
- preimage: accessKey2.preimage
1113
- };
1114
- const { account: signer } = accessKey2;
1115
- return {
1116
- account: options.account ?? (signer.accessKeyAddress ? signer.address : void 0),
1117
- address: signer.accessKeyAddress ?? signer.address,
1118
- keyType: signer.keyType,
1119
- preimage: void 0
1120
- };
1121
- })();
1127
+ const account2 = options.account ?? (signer.accessKeyAddress ? signer.address : void 0);
1122
1128
  return {
1123
- ...named.account ? { account: named.account } : {},
1124
- address: named.address,
1129
+ ...account2 ? { account: account2 } : {},
1130
+ address: signer.accessKeyAddress ?? signer.address,
1125
1131
  chainId: Hex2.fromNumber(permissions2.chainId),
1126
1132
  expiry: permissions2.expiry,
1127
- keyType: named.keyType,
1133
+ keyType: signer.keyType,
1128
1134
  limits: permissions2.limits?.map(({ limit, period, token: token2 }) => ({
1129
1135
  limit: Hex2.fromNumber(limit),
1130
1136
  ...period ? { period } : {},
1131
1137
  token: token2
1132
1138
  })),
1133
- ...named.preimage ? { preimage: named.preimage } : {},
1134
1139
  scopes: permissions2.scopes
1135
1140
  };
1136
1141
  }
@@ -1154,7 +1159,7 @@ function pushes(auth) {
1154
1159
 
1155
1160
  // ../../accounts/src/internal/Headless.ts
1156
1161
  async function authorize(auth, options) {
1157
- const { accessKey: accessKey2, challenge, getFn } = options;
1162
+ const { accessKey: accessKey2, challenge: challenge2, getFn } = options;
1158
1163
  try {
1159
1164
  const key = accessKey2 ? await resolve(accessKey2) : void 0;
1160
1165
  if (key)
@@ -1168,11 +1173,11 @@ async function authorize(auth, options) {
1168
1173
  getFn,
1169
1174
  json: request(auth, {
1170
1175
  accessKey: key && accessKey2 && { ...accessKey2, account: key.accessKey },
1171
- challenge
1176
+ challenge: challenge2
1172
1177
  })
1173
1178
  })
1174
1179
  );
1175
- 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 });
1176
1181
  if (authorization2.user.id !== options.userId) throw sessionChanged();
1177
1182
  return {
1178
1183
  ...authorization2,
@@ -1194,7 +1199,12 @@ async function complete(auth, options) {
1194
1199
  step: body.authorization
1195
1200
  })
1196
1201
  ) : body.authorization;
1197
- const authorization2 = key ? authorization(signed, key) : withoutKey(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
+ });
1198
1208
  if (authorization2.user.id !== body.user.id) throw sessionChanged();
1199
1209
  return {
1200
1210
  ...authorization2,
@@ -1273,7 +1283,7 @@ async function sign(auth, options) {
1273
1283
  });
1274
1284
  }
1275
1285
  function steps(json2, options) {
1276
- if (!json2.key_authorization) return false;
1286
+ if (!json2.key_authorization && json2.challenge === void 0) return false;
1277
1287
  return options.getFn !== void 0 || globalThis.navigator?.credentials !== void 0;
1278
1288
  }
1279
1289
  function redemption(auth) {
@@ -1320,14 +1330,14 @@ async function sendCode(auth, options) {
1320
1330
  );
1321
1331
  }
1322
1332
  async function signIn(auth, options) {
1323
- const { challenge, code, email, userIp } = options;
1324
- if (!options.accessKey && challenge !== void 0)
1325
- throw new ChallengeWithoutKeyError();
1333
+ const { challenge: challenge2, code, email, userIp } = options;
1326
1334
  authenticated(auth);
1327
1335
  const { accessKey: accessKey2 } = options;
1328
1336
  const key = accessKey2 ? await resolve(accessKey2) : void 0;
1329
1337
  const body = await token(auth, {
1330
- ...challenge === void 0 ? {} : { challenge },
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 },
1331
1341
  code,
1332
1342
  email,
1333
1343
  grant_type: grantType,
@@ -1346,14 +1356,19 @@ async function signIn(auth, options) {
1346
1356
  });
1347
1357
  const tokens3 = tokens(body);
1348
1358
  if (!key)
1349
- return { ...tokens3, user: user(tokens3) };
1359
+ return {
1360
+ ...tokens3,
1361
+ ...challengeSignature(body, { challenged: challenge2 !== void 0 }),
1362
+ user: user(tokens3)
1363
+ };
1350
1364
  return authorization(
1351
1365
  {
1352
1366
  account: body.account,
1367
+ ...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
1353
1368
  key_authorization: body.key_authorization,
1354
1369
  tokens: tokens3
1355
1370
  },
1356
- key
1371
+ { ...key, challenged: challenge2 !== void 0 }
1357
1372
  );
1358
1373
  }
1359
1374
  function authenticated(auth) {
@@ -1433,8 +1448,11 @@ __export(device_exports, {
1433
1448
  });
1434
1449
  import { Base64 as Base646 } from "ox";
1435
1450
  async function authorize2(auth, options) {
1436
- const key = await resolve(options.accessKey);
1451
+ const { accessKey: accessKey2 } = options;
1452
+ const key = accessKey2 ? await resolve(accessKey2) : void 0;
1437
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) } : {},
1438
1456
  ...options.challenge === void 0 ? {} : { challenge: options.challenge },
1439
1457
  // The instance's app is the device app that the CLI signs in to, such as `tempo-cli`.
1440
1458
  client_id: auth.clientId,
@@ -1442,14 +1460,16 @@ async function authorize2(auth, options) {
1442
1460
  ...options.funding?.currency === void 0 ? {} : { funding_currency: options.funding.currency },
1443
1461
  ...options.funding ? { funding_hint: options.funding.amount } : {},
1444
1462
  ...options.funding?.token === void 0 ? {} : { funding_token: options.funding.token },
1445
- key_authorization: Base646.fromString(
1446
- JSON.stringify(
1447
- keyAuthorization(auth, {
1448
- accessKey: { ...options.accessKey, account: key.accessKey }
1449
- })
1450
- ),
1451
- { pad: false, url: true }
1452
- )
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
+ } : {}
1453
1473
  });
1454
1474
  for (const resource of resources(auth, options))
1455
1475
  body.append("resource", resource);
@@ -1484,6 +1504,7 @@ async function authorize2(auth, options) {
1484
1504
  );
1485
1505
  failure = void 0;
1486
1506
  const result = await request2(poll2, {
1507
+ challenged: options.challenge !== void 0,
1487
1508
  deviceCode: code.device_code,
1488
1509
  key
1489
1510
  }).catch((error3) => {
@@ -1516,9 +1537,17 @@ async function authorize2(auth, options) {
1516
1537
  }
1517
1538
  async function poll(auth, options) {
1518
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
+ });
1519
1547
  const accessKey2 = own(options.accessKey);
1520
1548
  if (!accessKey2) throw new AccessKeyRequiredError();
1521
1549
  return request2(auth, {
1550
+ challenged,
1522
1551
  deviceCode,
1523
1552
  key: { accessKey: accessKey2, material: {} }
1524
1553
  });
@@ -1542,15 +1571,20 @@ async function request2(auth, options) {
1542
1571
  });
1543
1572
  if (typeof body === "string")
1544
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
+ );
1545
1586
  return {
1546
- authorization: authorization(
1547
- {
1548
- account: body.account,
1549
- key_authorization: body.key_authorization,
1550
- tokens: tokens(body)
1551
- },
1552
- key
1553
- ),
1587
+ authorization: authorization2,
1554
1588
  status: "approved"
1555
1589
  };
1556
1590
  }
@@ -1820,7 +1854,7 @@ async function open(auth, options) {
1820
1854
  throw new OriginError({ origin: window.location.origin, redirectUri });
1821
1855
  if (mode === "popup" && options.mode !== "popup" && !activated()) {
1822
1856
  const address2 = await abortable(read2(), { signal });
1823
- const Sheet = await import("./Sheet-BDE6H6G7.js");
1857
+ const Sheet = await import("./Sheet-LRIER3ST.js");
1824
1858
  return await new Promise((resolve3, reject) => {
1825
1859
  const abort = () => {
1826
1860
  close();
@@ -1871,7 +1905,7 @@ async function watch(auth, options) {
1871
1905
  try {
1872
1906
  return await new Promise(
1873
1907
  (resolve3, reject) => {
1874
- void import("./Sheet-BDE6H6G7.js").then(
1908
+ void import("./Sheet-LRIER3ST.js").then(
1875
1909
  (Sheet) => {
1876
1910
  if (settled) return;
1877
1911
  unblock = Sheet.waiting({
@@ -1936,7 +1970,7 @@ function parse(url, options) {
1936
1970
  async function frame(auth, options) {
1937
1971
  const { redirectUri, signal, toUrl } = options;
1938
1972
  const address2 = await abortable(options.address, { signal });
1939
- const Sheet = await import("./Sheet-BDE6H6G7.js");
1973
+ const Sheet = await import("./Sheet-LRIER3ST.js");
1940
1974
  signal?.throwIfAborted();
1941
1975
  let close;
1942
1976
  let abort;
@@ -2104,7 +2138,7 @@ function complete3(auth, options = {}) {
2104
2138
  removed
2105
2139
  ]);
2106
2140
  return finish({
2107
- accessKey: options.accessKey,
2141
+ accessKey: own(options.accessKey),
2108
2142
  body,
2109
2143
  pending: stored
2110
2144
  });
@@ -2117,7 +2151,7 @@ async function createUrl(auth, options = {}) {
2117
2151
  }
2118
2152
  async function handleCallback(auth, options) {
2119
2153
  return finish({
2120
- accessKey: options.accessKey,
2154
+ accessKey: own(options.accessKey),
2121
2155
  body: await redeem(auth, {
2122
2156
  pending: options.pending,
2123
2157
  url: new URL(options.url)
@@ -2146,7 +2180,7 @@ function handleResult(options) {
2146
2180
  status: 400
2147
2181
  });
2148
2182
  return finish({
2149
- accessKey: options.accessKey,
2183
+ accessKey: own(options.accessKey),
2150
2184
  body: authorization2,
2151
2185
  pending: options.pending
2152
2186
  });
@@ -2207,6 +2241,7 @@ function finish(options) {
2207
2241
  const {
2208
2242
  key,
2209
2243
  chainId: _chainId,
2244
+ challenge: challenged,
2210
2245
  clientId: _clientId,
2211
2246
  redirectUri: _redirectUri,
2212
2247
  state: _state,
@@ -2215,7 +2250,11 @@ function finish(options) {
2215
2250
  } = options.pending;
2216
2251
  if (key === false) {
2217
2252
  const tokens3 = tokens(body);
2218
- return { ...tokens3, user: user(tokens3) };
2253
+ return {
2254
+ ...tokens3,
2255
+ ...challengeSignature(body, { challenged }),
2256
+ user: user(tokens3)
2257
+ };
2219
2258
  }
2220
2259
  if (!body.account || !body.key_authorization)
2221
2260
  throw new RequestError({
@@ -2224,24 +2263,14 @@ function finish(options) {
2224
2263
  signedIn: true,
2225
2264
  status: 400
2226
2265
  });
2227
- if (options.accessKey && "address" in options.accessKey) {
2228
- const tokens3 = tokens(body);
2229
- return {
2230
- ...tokens3,
2231
- key: from({
2232
- account: body.account,
2233
- keyAuthorization: body.key_authorization
2234
- }),
2235
- user: user(tokens3)
2236
- };
2237
- }
2238
2266
  return authorization(
2239
2267
  {
2240
2268
  account: body.account,
2269
+ ...body.challenge_signature ? { challenge_signature: body.challenge_signature } : {},
2241
2270
  key_authorization: body.key_authorization,
2242
2271
  tokens: body
2243
2272
  },
2244
- { accessKey: own(options.accessKey), material }
2273
+ { accessKey: options.accessKey, challenged, material }
2245
2274
  );
2246
2275
  }
2247
2276
  async function prefetch(auth) {
@@ -2793,6 +2822,10 @@ function toSession(result) {
2793
2822
  return from4({
2794
2823
  accessToken: result.accessToken,
2795
2824
  ...result.account ? { account: result.account } : {},
2825
+ ...result.address && result.challengeSignature ? {
2826
+ address: result.address,
2827
+ challengeSignature: result.challengeSignature
2828
+ } : {},
2796
2829
  expiresAt: result.expiresAt,
2797
2830
  ...result.idToken !== void 0 ? { idToken: result.idToken } : {},
2798
2831
  ...result.key ? { key: withLifetime(result.key) } : {},
@@ -2841,8 +2874,6 @@ async function sendCode2(auth, options) {
2841
2874
  }
2842
2875
  async function signIn3(auth, options) {
2843
2876
  const { code, email, getFn, link } = options;
2844
- if (!options.accessKey && options.challenge !== void 0)
2845
- throw new ChallengeWithoutKeyError();
2846
2877
  const prepared = await prepare(auth, options);
2847
2878
  const offline = answered(auth, {
2848
2879
  message: "The sign-in received no response. Check the connection, and sign in again. If the code is refused, request a new code."
@@ -3062,6 +3093,13 @@ function prepare2(auth, options = {}) {
3062
3093
  }
3063
3094
  async function register(auth, options = {}) {
3064
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
+ });
3065
3103
  const chain = options.chain ?? options.chainId;
3066
3104
  if (options.accessKey && (key || options.account !== void 0 || chain !== void 0))
3067
3105
  throw new RequestError({
@@ -3153,14 +3191,60 @@ async function register(auth, options = {}) {
3153
3191
  signed,
3154
3192
  headless.key
3155
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
+ );
3156
3203
  return {
3157
3204
  ...result,
3158
3205
  authorization: {
3159
3206
  ...authorization2,
3207
+ ..."challengeError" in challenged ? {} : challenged,
3160
3208
  upgradeAvailable: signed.upgrade_available === true
3161
- }
3209
+ },
3210
+ ..."challengeError" in challenged ? { challengeError: challenged.challengeError } : {}
3162
3211
  };
3163
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
+ }
3164
3248
  async function signIn4(auth, options = {}) {
3165
3249
  const prepared = await requestOptions(auth, options);
3166
3250
  const assertion = await sign2(prepared, options);
@@ -3185,8 +3269,6 @@ function refused(error3) {
3185
3269
  }
3186
3270
  async function requestOptions(auth, options) {
3187
3271
  const { credentialId, mediation, select } = options;
3188
- if (!options.accessKey && options.challenge !== void 0)
3189
- throw new ChallengeWithoutKeyError();
3190
3272
  const { authorize: authorize6, key } = await prepare(auth, options);
3191
3273
  const requestedAt = Date.now();
3192
3274
  const requested = await json(
@@ -3271,8 +3353,6 @@ async function list(auth) {
3271
3353
  // ../../accounts/src/internal/Actions.ts
3272
3354
  async function authorize4(auth, options = {}) {
3273
3355
  const { accessKey: accessKey2 } = options;
3274
- if (!accessKey2 && options.challenge !== void 0)
3275
- throw new ChallengeWithoutKeyError();
3276
3356
  const [session2, generated] = await Promise.all([
3277
3357
  options.checked ? { user: true } : (async () => json(
3278
3358
  await (auth.fetch ?? globalThis.fetch)(
@@ -3306,7 +3386,10 @@ async function authorize4(auth, options = {}) {
3306
3386
  const body = await json(response);
3307
3387
  const [first] = body.tempo ?? [];
3308
3388
  const result = {
3309
- ...key ? authorization(body, key) : withoutKey(body),
3389
+ ...key ? authorization(body, {
3390
+ ...key,
3391
+ challenged: options.challenge !== void 0
3392
+ }) : withoutKey(body, { challenged: options.challenge !== void 0 }),
3310
3393
  // The response lists the access key's account first, so the app reads no `GET /v1/account`.
3311
3394
  // An account that the client cannot rebuild stays absent, so the session holds the access key alone.
3312
3395
  ...key && first ? (() => {
@@ -4967,7 +5050,7 @@ var signInIds = /* @__PURE__ */ new Set([
4967
5050
  function plugin() {
4968
5051
  let loading;
4969
5052
  function load() {
4970
- loading ??= import("./dialog-77GKVXR7.js").then((module) => module.dialog()).catch((error3) => {
5053
+ loading ??= import("./dialog-CMISBFX2.js").then((module) => module.dialog()).catch((error3) => {
4971
5054
  loading = void 0;
4972
5055
  throw error3;
4973
5056
  });
@@ -5138,14 +5221,6 @@ var ChainUnavailableError = class extends Error {
5138
5221
  );
5139
5222
  }
5140
5223
  };
5141
- var ChallengeWithoutKeyError = class extends Error {
5142
- name = "Accounts.ChallengeWithoutKeyError";
5143
- constructor() {
5144
- super(
5145
- "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."
5146
- );
5147
- }
5148
- };
5149
5224
  var ClientIdRequiredError = class extends Error {
5150
5225
  name = "Accounts.ClientIdRequiredError";
5151
5226
  constructor() {
@@ -5464,7 +5539,7 @@ function create5(options = {}) {
5464
5539
  function connections2() {
5465
5540
  if (!connectionsOptions)
5466
5541
  return Promise.reject(new ConnectionsRequiredError());
5467
- attached ??= import("./Connections-DSJQ7HJR.js").then(
5542
+ attached ??= import("./Connections-J72AA66Q.js").then(
5468
5543
  (module) => module.attach(config, connectionsOptions)
5469
5544
  );
5470
5545
  return attached;
@@ -5,7 +5,7 @@ import {
5
5
  expired,
6
6
  from,
7
7
  revokeAccessKey
8
- } from "./chunk-ST6NQBMT.js";
8
+ } from "./chunk-7LJN5HAQ.js";
9
9
  import {
10
10
  from as from2
11
11
  } from "./chunk-YW5DUQT3.js";
@@ -2,7 +2,7 @@ import {
2
2
  AccessKey_exports,
3
3
  Accounts_exports,
4
4
  Actions_exports
5
- } from "./chunk-ST6NQBMT.js";
5
+ } from "./chunk-7LJN5HAQ.js";
6
6
 
7
7
  // src/Session.ts
8
8
  import * as Fs from "node:fs/promises";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  env,
3
3
  login
4
- } from "../chunk-FUBHMKQE.js";
5
- import "../chunk-6BI5RYRU.js";
6
- import "../chunk-ST6NQBMT.js";
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
 
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  env,
3
3
  remove
4
- } from "../chunk-FUBHMKQE.js";
5
- import "../chunk-6BI5RYRU.js";
6
- import "../chunk-ST6NQBMT.js";
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
 
@@ -2,9 +2,9 @@ import {
2
2
  env,
3
3
  signedOut,
4
4
  whoami
5
- } from "../chunk-FUBHMKQE.js";
6
- import "../chunk-6BI5RYRU.js";
7
- import "../chunk-ST6NQBMT.js";
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
 
@@ -4,7 +4,7 @@ import {
4
4
  expired2 as expired,
5
5
  from2 as from,
6
6
  toSession
7
- } from "./chunk-ST6NQBMT.js";
7
+ } from "./chunk-7LJN5HAQ.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
 
10
10
  // ../../accounts/src/plugins/dialog.ts
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-723.sha-d92cea7",
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": {