@tempoxyz/id 0.0.0-pr-908.sha-38fe545 → 0.0.0-pr-958.sha-d7f10be

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.
@@ -2,9 +2,9 @@ import {
2
2
  attach,
3
3
  create,
4
4
  pending
5
- } from "./chunk-TINLMV2R.js";
5
+ } from "./chunk-GQFRK53P.js";
6
6
  import "./chunk-FWGE6HXK.js";
7
- import "./chunk-QQTY4WGS.js";
7
+ import "./chunk-YTC2XI32.js";
8
8
  import "./chunk-Y7KQRRJL.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
  export {
@@ -120,6 +120,8 @@ function create(path) {
120
120
  // signed-out mark, which a first run of a CLI never wrote.
121
121
  { skip: (entries) => !(key in entries) }
122
122
  ),
123
+ // The file has mode `0600` in a folder with mode `0700`, so only its user reads a private key in it.
124
+ private: true,
123
125
  async setItem(key, value, options = {}) {
124
126
  stringify(value);
125
127
  await update((entries) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  InvalidError
3
3
  } from "./chunk-2T7V6ASK.js";
4
- import "./chunk-OZTYXHV2.js";
4
+ import "./chunk-EUWWJJZX.js";
5
5
  import {
6
6
  authPath,
7
7
  basePath,
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  PendingNotFoundError,
12
12
  RequestError
13
- } from "./chunk-QQTY4WGS.js";
13
+ } from "./chunk-YTC2XI32.js";
14
14
  import "./chunk-Y7KQRRJL.js";
15
15
  import "./chunk-MLKGABMK.js";
16
16
 
@@ -4,8 +4,8 @@ import {
4
4
  machines,
5
5
  prompt,
6
6
  waiting
7
- } from "./chunk-KSJGRBP6.js";
8
- import "./chunk-QQTY4WGS.js";
7
+ } from "./chunk-RTMKPMTX.js";
8
+ import "./chunk-YTC2XI32.js";
9
9
  import "./chunk-Y7KQRRJL.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
  export {
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  KeyTypeError,
3
+ RedirectUriRequiredError,
3
4
  RequestError,
4
5
  SignerRequiredError,
5
6
  authorization,
@@ -18,7 +19,7 @@ import {
18
19
  tokens,
19
20
  url,
20
21
  user
21
- } from "./chunk-QQTY4WGS.js";
22
+ } from "./chunk-YTC2XI32.js";
22
23
  import {
23
24
  __export
24
25
  } from "./chunk-MLKGABMK.js";
@@ -194,7 +195,7 @@ function complete(auth, options = {}) {
194
195
  ours && early ? early : redeem(auth, { pending: stored, url: url2 }),
195
196
  removed
196
197
  ]);
197
- return finish({
198
+ return await finish_revoke(auth, {
198
199
  accessKey: options.accessKey,
199
200
  body,
200
201
  pending: stored
@@ -207,7 +208,7 @@ async function createUrl(auth, options = {}) {
207
208
  return await authorizeUrl(auth, options);
208
209
  }
209
210
  async function handleCallback(auth, options) {
210
- return finish({
211
+ return await finish_revoke(auth, {
211
212
  accessKey: options.accessKey,
212
213
  body: await redeem(auth, {
213
214
  pending: options.pending,
@@ -293,6 +294,18 @@ function signedIn2(error3) {
293
294
  uri: error3.uri
294
295
  });
295
296
  }
297
+ async function finish_revoke(auth, options) {
298
+ try {
299
+ return finish(options);
300
+ } catch (error3) {
301
+ const { refresh_token } = options.body;
302
+ if (refresh_token)
303
+ await revoke(auth, { refreshToken: refresh_token }).catch(
304
+ () => void 0
305
+ );
306
+ throw error3;
307
+ }
308
+ }
296
309
  function finish(options) {
297
310
  try {
298
311
  const { body } = options;
@@ -375,6 +388,16 @@ async function prefetch(auth) {
375
388
  return urls;
376
389
  }
377
390
  async function start(auth, options = {}) {
391
+ if (auth.store?.local) {
392
+ if (auth.redirectUri === void 0 && !globalThis.window?.location?.origin)
393
+ throw new RedirectUriRequiredError();
394
+ throw new RequestError({
395
+ code: "invalid_request",
396
+ field: "store",
397
+ message: "Invalid store: it holds its values only in this page, and the redirect leaves the page. Keep the state in a store that persists across page loads, such as the default.",
398
+ status: 0
399
+ });
400
+ }
378
401
  const store = get(auth.store);
379
402
  const { pending, url: url2 } = await createUrl(auth, options);
380
403
  await exclusive(auth, async () => {
@@ -8,7 +8,7 @@ import {
8
8
  from,
9
9
  json,
10
10
  post
11
- } from "./chunk-QQTY4WGS.js";
11
+ } from "./chunk-YTC2XI32.js";
12
12
  import {
13
13
  __export
14
14
  } from "./chunk-MLKGABMK.js";
@@ -8,14 +8,14 @@ import {
8
8
  post,
9
9
  post2,
10
10
  prepare,
11
- read,
11
+ read2 as read,
12
12
  redemption,
13
13
  request,
14
14
  revoke,
15
15
  tempoAccount,
16
16
  tokens,
17
17
  user
18
- } from "./chunk-QQTY4WGS.js";
18
+ } from "./chunk-YTC2XI32.js";
19
19
  import {
20
20
  __export
21
21
  } from "./chunk-MLKGABMK.js";
@@ -1,8 +1,9 @@
1
1
  import {
2
+ activated,
2
3
  openPopup,
3
4
  received,
4
5
  watchPopup
5
- } from "./chunk-QQTY4WGS.js";
6
+ } from "./chunk-YTC2XI32.js";
6
7
 
7
8
  // ../../accounts/src/internal/Sheet.ts
8
9
  import {
@@ -611,7 +612,7 @@ function load(options) {
611
612
  method: "mach"
612
613
  };
613
614
  })();
614
- if (popup.method && handlers()?.onPopup({ ...popup, automatic: true }))
615
+ if ((popup.method || cover === "free" && activated()) && handlers()?.onPopup({ ...popup, automatic: true }))
615
616
  return;
616
617
  offer(popup);
617
618
  } else if (data?.type === "tempo-id:embed.close") handlers()?.onCancel();
@@ -2,16 +2,16 @@ import {
2
2
  bind,
3
3
  from,
4
4
  passkey_exports
5
- } from "./chunk-5ONJKYVW.js";
5
+ } from "./chunk-IPFNLIHS.js";
6
6
  import {
7
7
  dialog_exports
8
- } from "./chunk-CTLWOXGT.js";
8
+ } from "./chunk-XM5OSMFD.js";
9
9
  import {
10
10
  redirect_exports
11
- } from "./chunk-OZTYXHV2.js";
11
+ } from "./chunk-EUWWJJZX.js";
12
12
  import {
13
13
  connections_exports
14
- } from "./chunk-TINLMV2R.js";
14
+ } from "./chunk-GQFRK53P.js";
15
15
  import {
16
16
  AccessKey_exports,
17
17
  Accounts_exports,
@@ -33,7 +33,7 @@ import {
33
33
  own,
34
34
  post,
35
35
  prepare,
36
- read,
36
+ read2 as read,
37
37
  redemption,
38
38
  redirectRefused,
39
39
  refresh,
@@ -50,7 +50,7 @@ import {
50
50
  unlisted,
51
51
  user,
52
52
  withoutAccessKey
53
- } from "./chunk-QQTY4WGS.js";
53
+ } from "./chunk-YTC2XI32.js";
54
54
  import {
55
55
  __export
56
56
  } from "./chunk-MLKGABMK.js";
@@ -115,7 +115,8 @@ async function sendCode(auth2, options) {
115
115
  );
116
116
  }
117
117
  async function signIn(auth2, options) {
118
- const { challenge, code, email, userIp } = options;
118
+ const { challenge, email, userIp } = options;
119
+ const code = String(options.code).replace(/\D/g, "");
119
120
  authenticated(auth2);
120
121
  const { accessKey } = options;
121
122
  const resolved = accessKey ? await resolve(accessKey) : void 0;
@@ -379,7 +380,8 @@ async function sendCode2(auth2, options) {
379
380
  await json(await post(offline, "/v1/auth/code", { json: options }));
380
381
  }
381
382
  async function signIn2(auth2, options) {
382
- const { code, createFn, email, getFn, link } = options;
383
+ const { createFn, email, getFn, link } = options;
384
+ const code = String(options.code).replace(/\D/g, "");
383
385
  const prepared = await prepare(auth2, options);
384
386
  const offline = answered(auth2, {
385
387
  message: "The sign-in received no response. Check the connection, and sign in again. If the code is refused, request a new code."
@@ -443,7 +445,7 @@ async function signIn2(auth2, options) {
443
445
  return { ...next, options: next.options };
444
446
  })();
445
447
  if (creation && prepared.accessKey && options.accessKey) {
446
- const { register } = await import("./passkey-YHATPL2S.js");
448
+ const { register } = await import("./passkey-L6QXC5BT.js");
447
449
  const registered = await register(auth2, {
448
450
  accessKey: { ...options.accessKey, account: prepared.accessKey.signer },
449
451
  challenge: options.challenge,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  handleCallback,
3
3
  handleResult
4
- } from "./chunk-OZTYXHV2.js";
4
+ } from "./chunk-EUWWJJZX.js";
5
5
  import {
6
6
  create,
7
7
  prompt,
8
8
  waiting
9
- } from "./chunk-KSJGRBP6.js";
9
+ } from "./chunk-RTMKPMTX.js";
10
10
  import {
11
11
  authPath,
12
12
  basePath
@@ -26,9 +26,10 @@ import {
26
26
  openPopup,
27
27
  permissions,
28
28
  pushes,
29
+ register,
29
30
  resources,
30
31
  watchPopup
31
- } from "./chunk-QQTY4WGS.js";
32
+ } from "./chunk-YTC2XI32.js";
32
33
  import {
33
34
  __export
34
35
  } from "./chunk-MLKGABMK.js";
@@ -447,9 +448,11 @@ async function authorize(auth, options) {
447
448
  kept: kept && sheet ? { options: { redirectUri }, redirectUri, sheet } : void 0,
448
449
  type: "end"
449
450
  });
451
+ const trusted = entry?.sheet.trusted();
452
+ if (trusted !== void 0) reports.set(auth, trusted);
450
453
  if (!kept) {
451
454
  sheet?.close();
452
- const usable = visibility() || entry?.sheet.trusted() !== false;
455
+ const usable = visibility() || trusted !== false;
453
456
  if (owned && entry && usable && !machines.entry(actor.getSnapshot()))
454
457
  preload(auth, entry.options);
455
458
  }
@@ -568,6 +571,7 @@ function channel(options) {
568
571
  return `tempo-id:dialog:${options.state}`;
569
572
  }
570
573
  var slots = /* @__PURE__ */ new WeakMap();
574
+ var reports = /* @__PURE__ */ new WeakMap();
571
575
  function slot(auth) {
572
576
  const existing = slots.get(auth);
573
577
  if (existing) return existing;
@@ -577,6 +581,9 @@ function slot(auth) {
577
581
  })
578
582
  ).start();
579
583
  slots.set(auth, actor);
584
+ register(auth, {
585
+ read: () => machines.entry(actor.getSnapshot())?.sheet.trusted() ?? reports.get(auth)
586
+ });
580
587
  return actor;
581
588
  }
582
589
  function framed(auth, options) {
@@ -620,6 +620,21 @@ var messages = {
620
620
  login_required: "The browser holds no session. Sign in, then start the request again."
621
621
  };
622
622
 
623
+ // ../../accounts/src/internal/FrameTrust.ts
624
+ var readers = /* @__PURE__ */ new WeakMap();
625
+ function frames(auth) {
626
+ return visibility() || read(auth) === true;
627
+ }
628
+ function read(auth) {
629
+ return readers.get(auth)?.();
630
+ }
631
+ function register(auth, options) {
632
+ readers.set(auth, options.read);
633
+ }
634
+ function visibility() {
635
+ return typeof IntersectionObserverEntry !== "undefined" && "isVisible" in IntersectionObserverEntry.prototype;
636
+ }
637
+
623
638
  // ../../accounts/src/internal/Payment.ts
624
639
  import { Hex } from "ox";
625
640
  var hexPattern = /^0x(?:[0-9a-fA-F]{2})*$/;
@@ -1140,7 +1155,7 @@ async function approve(auth, options) {
1140
1155
  let unwatch;
1141
1156
  try {
1142
1157
  return await new Promise((resolve3, reject) => {
1143
- void import("./Sheet-TTUDP43B.js").then(
1158
+ void import("./Sheet-5AHIVMDK.js").then(
1144
1159
  (Sheet2) => {
1145
1160
  if (settled) return;
1146
1161
  unblock = Sheet2.waiting({
@@ -1181,33 +1196,37 @@ async function approve(auth, options) {
1181
1196
  popup.close();
1182
1197
  }
1183
1198
  };
1184
- if (mode === "popup") {
1199
+ const direct = mode === "popup" || activated() && !frames(auth);
1200
+ if (direct) {
1185
1201
  const held = hold && await hold;
1186
1202
  if (held) return held;
1187
- const popup = openPopup(toUrl("popup"));
1188
- if (popup === null) throw new BlockedError();
1189
- return await watch2(popup);
1203
+ if (mode === "popup" || activated()) {
1204
+ const popup = openPopup(toUrl("popup"));
1205
+ if (popup === null) throw new BlockedError();
1206
+ return await watch2(popup);
1207
+ }
1190
1208
  }
1191
- const Sheet = await import("./Sheet-TTUDP43B.js");
1209
+ const covering = direct ? void 0 : hold;
1210
+ const Sheet = await import("./Sheet-5AHIVMDK.js");
1192
1211
  signal?.throwIfAborted();
1193
1212
  const sheet = Sheet.load({
1194
1213
  // The page runs the passkey ceremony of the account's owner, for Tempo ID's origin.
1195
1214
  allow: `publickey-credentials-get ${origin}`,
1196
- covered: hold !== void 0,
1215
+ covered: covering !== void 0,
1197
1216
  label: options.label,
1198
1217
  origin,
1199
1218
  sandbox: "allow-forms allow-same-origin allow-scripts",
1200
1219
  skeleton: options.skeleton,
1201
1220
  text: options.text,
1202
1221
  // A covered page shows its own skeleton, measured from its screen, until the cover lifts.
1203
- url: hold ? `${toUrl("frame")}&covered=true` : toUrl("frame")
1222
+ url: covering ? `${toUrl("frame")}&covered=true` : toUrl("frame")
1204
1223
  });
1205
1224
  let abort;
1206
1225
  try {
1207
1226
  return await new Promise((resolve3, reject) => {
1208
1227
  abort = () => reject(signal?.reason);
1209
1228
  signal?.addEventListener("abort", abort, { once: true });
1210
- hold?.then((held) => held ? resolve3(held) : sheet.uncover(), reject);
1229
+ covering?.then((held) => held ? resolve3(held) : sheet.uncover(), reject);
1211
1230
  sheet.show({
1212
1231
  onCallback: (value) => {
1213
1232
  try {
@@ -1552,6 +1571,7 @@ function seconds(options) {
1552
1571
  // ../../accounts/src/internal/Request.ts
1553
1572
  var base64url = { pad: false, url: true };
1554
1573
  var fundingAmount = /^(?:0|[1-9]\d{0,17})(?:\.\d{1,18})?$/;
1574
+ var millisecondExpiry = 1e12;
1555
1575
  async function authorizeUrl(auth, options) {
1556
1576
  const { accessKey: accessKey2 } = options;
1557
1577
  const redirectUri = (() => {
@@ -1653,6 +1673,14 @@ function permissions(auth, options) {
1653
1673
  reason: "invalid_expiry",
1654
1674
  status: 0
1655
1675
  });
1676
+ if (resolved.expiry !== void 0 && resolved.expiry >= millisecondExpiry)
1677
+ throw new RequestError({
1678
+ code: "invalid_request",
1679
+ field: "accessKey.expiry",
1680
+ message: `Invalid \`expiry\`: ${resolved.expiry} is after the year 33658, such as a time in milliseconds. Use Unix seconds, such as \`Math.floor(Date.now() / 1000) + 3600\`, or a duration, such as \`'1h'\`.`,
1681
+ reason: "invalid_expiry",
1682
+ status: 0
1683
+ });
1656
1684
  if (resolved.expiry && resolved.expiry <= Date.now() / 1e3)
1657
1685
  throw new RequestError({
1658
1686
  code: "invalid_request",
@@ -1929,7 +1957,7 @@ async function prepare(auth, options) {
1929
1957
  })
1930
1958
  };
1931
1959
  }
1932
- async function read(response) {
1960
+ async function read2(response) {
1933
1961
  try {
1934
1962
  return await json(response);
1935
1963
  } catch (error3) {
@@ -2133,7 +2161,7 @@ function get2(clientId) {
2133
2161
  if (!modules()) return void 0;
2134
2162
  let loading;
2135
2163
  function load() {
2136
- loading ??= import("./File-YAEW4TCK.js").then((module) => module.create()).catch((error3) => {
2164
+ loading ??= import("./File-FGBHPLGS.js").then((module) => module.create()).catch((error3) => {
2137
2165
  loading = void 0;
2138
2166
  throw error3;
2139
2167
  });
@@ -2241,7 +2269,7 @@ function create(options) {
2241
2269
  return await run2;
2242
2270
  }
2243
2271
  async function replace(started) {
2244
- const stored = await read2();
2272
+ const stored = await read3();
2245
2273
  const signIn = machines.switches({ current: context().renewing, stored });
2246
2274
  if (context().version !== started) return;
2247
2275
  actor.send({ type: "lapsed.checked" });
@@ -2346,16 +2374,16 @@ function create(options) {
2346
2374
  running = run2;
2347
2375
  return run2;
2348
2376
  }
2349
- async function reload() {
2377
+ async function reload(options2 = {}) {
2350
2378
  if (!actor) return void 0;
2351
2379
  if (await hydrate() && context().version === 0) return context().session;
2352
2380
  if (!writes) return context().session;
2353
2381
  const started = await flushed();
2354
- const [read3, loaded] = await Promise.all([
2382
+ const [read4, loaded] = await Promise.all([
2355
2383
  writes.storage.getItem(name),
2356
2384
  chainLoaded()
2357
2385
  ]);
2358
- const stored = read3?.session;
2386
+ const stored = read4?.session;
2359
2387
  const current = context().session;
2360
2388
  if (!machines.reloadable({ current: context(), version: started }))
2361
2389
  return current;
@@ -2368,29 +2396,32 @@ function create(options) {
2368
2396
  stored
2369
2397
  });
2370
2398
  })();
2371
- if (adopt2)
2372
- actor.send({
2373
- renewing: machines.renews({
2374
- current,
2375
- expired: !!current && expired2(current),
2376
- stored
2377
- }),
2378
- session: machines.arranged({
2379
- chainId: loaded ? chainId() : void 0,
2380
- current,
2381
- stored
2382
- }),
2383
- signIn: machines.switches({ current, stored }),
2384
- type: "adopt"
2385
- });
2386
- return context().session;
2399
+ if (!adopt2) return current;
2400
+ actor.send({
2401
+ renewing: machines.renews({
2402
+ current,
2403
+ expired: !!current && expired2(current),
2404
+ stored
2405
+ }),
2406
+ session: machines.arranged({
2407
+ chainId: loaded ? chainId() : void 0,
2408
+ current,
2409
+ stored
2410
+ }),
2411
+ signIn: machines.switches({ current, stored }),
2412
+ type: "adopt"
2413
+ });
2414
+ const session = context().session;
2415
+ if (options2.hooks && machines.signsIn({ current, session }))
2416
+ void (async () => onSignIn?.(session))().catch(() => void 0);
2417
+ return session;
2387
2418
  }
2388
2419
  async function adopt(options2) {
2389
2420
  if (!actor || !writes || context().signingOut) return void 0;
2390
2421
  await hydrate();
2391
2422
  await writes.flush().catch(() => void 0);
2392
2423
  const started = context().version;
2393
- const [read3, loaded, marked] = await Promise.all([
2424
+ const [read4, loaded, marked] = await Promise.all([
2394
2425
  (async () => writes.storage.getItem(name))().then(
2395
2426
  (value) => ({ stored: value?.session }),
2396
2427
  () => void 0
@@ -2409,13 +2440,13 @@ function create(options) {
2409
2440
  if (!machines.adoptable({ current: context(), version: started }))
2410
2441
  return void 0;
2411
2442
  if (marked) return void 0;
2412
- if (options2.signOut && !read3?.stored) {
2443
+ if (options2.signOut && !read4?.stored) {
2413
2444
  const { session: shown2 } = machines.status(actor.getSnapshot());
2414
2445
  actor.send({ marked: !options2.everywhere, type: "signOut.remote" });
2415
2446
  return current || shown2 ? async () => onSignOut?.() : void 0;
2416
2447
  }
2417
- if (!read3) return void 0;
2418
- const { stored } = read3;
2448
+ if (!read4) return void 0;
2449
+ const { stored } = read4;
2419
2450
  const failed = writes.failed();
2420
2451
  const adopted = machines.replaces({
2421
2452
  current: current ?? (failed ? context().renewing : void 0),
@@ -2440,7 +2471,7 @@ function create(options) {
2440
2471
  signIn,
2441
2472
  type: "adopt"
2442
2473
  });
2443
- return session && current?.user.id !== session.user.id ? async () => onSignIn?.(session) : void 0;
2474
+ return machines.signsIn({ current, session }) ? async () => onSignIn?.(session) : void 0;
2444
2475
  }
2445
2476
  const unanswered2 = {
2446
2477
  async read() {
@@ -2546,7 +2577,7 @@ function create(options) {
2546
2577
  const { refreshToken } = session;
2547
2578
  if (!refreshToken) return;
2548
2579
  await exclusive(async () => {
2549
- const [stored, digests] = await Promise.all([read2(), revoked.read()]);
2580
+ const [stored, digests] = await Promise.all([read3(), revoked.read()]);
2550
2581
  if (!options2.unsaved && stored?.refreshToken && stored.refreshToken !== refreshToken)
2551
2582
  return;
2552
2583
  if (revoked.has(digests, session)) return;
@@ -2577,7 +2608,7 @@ function create(options) {
2577
2608
  }
2578
2609
  async function endRefused(ended, refused) {
2579
2610
  await exclusive(async () => {
2580
- const [stored, digests] = await Promise.all([read2(), revoked.read()]);
2611
+ const [stored, digests] = await Promise.all([read3(), revoked.read()]);
2581
2612
  const { empty, session: ending } = machines.refusal({
2582
2613
  current: context(),
2583
2614
  ended,
@@ -2606,7 +2637,7 @@ function create(options) {
2606
2637
  const [digests, entries, stored, earlier] = await Promise.all([
2607
2638
  revoked.read(),
2608
2639
  rotations.read(),
2609
- read2(),
2640
+ read3(),
2610
2641
  unanswered2.read()
2611
2642
  ]);
2612
2643
  if (!entries) return;
@@ -2654,6 +2685,35 @@ function create(options) {
2654
2685
  { counted: false }
2655
2686
  ).catch(() => void 0);
2656
2687
  }
2688
+ async function revokeUnsaved(session, started) {
2689
+ const { refreshToken } = session;
2690
+ if (!actor || !refreshToken) return;
2691
+ while (true) {
2692
+ await waitFor(
2693
+ actor,
2694
+ (snapshot) => machines.restored({ current: snapshot.context, started }) !== void 0
2695
+ );
2696
+ const settled = await exclusive(
2697
+ async () => {
2698
+ const current = context();
2699
+ const restored = machines.restored({ current, started });
2700
+ if (restored === void 0) return false;
2701
+ if (restored) return true;
2702
+ const digests = await revoked.read();
2703
+ if (revoked.has(digests, session)) return true;
2704
+ await signOut2(session, {
2705
+ logout: false,
2706
+ onRevoked: () => revoked.write(digests, [refreshToken])
2707
+ }).catch(
2708
+ () => retain(refreshToken, { logouts: current.logouts.remote })
2709
+ );
2710
+ return true;
2711
+ },
2712
+ { counted: false }
2713
+ ).catch(() => true);
2714
+ if (settled) return;
2715
+ }
2716
+ }
2657
2717
  async function revokeRestored(session, started) {
2658
2718
  const { refreshToken } = session;
2659
2719
  if (!actor || !refreshToken) return;
@@ -2714,7 +2774,7 @@ function create(options) {
2714
2774
  await store2?.removeItem(key2);
2715
2775
  })().catch(() => void 0);
2716
2776
  }
2717
- async function read2() {
2777
+ async function read3() {
2718
2778
  if (!writes) return void 0;
2719
2779
  const { storage } = writes;
2720
2780
  const stored = await (async () => storage.getItem(name))().catch(
@@ -2904,7 +2964,7 @@ function create(options) {
2904
2964
  }
2905
2965
  const signIn = !!session && !options2.update && !options2.restore;
2906
2966
  const replaced = signIn ? context().session : void 0;
2907
- const overwriting = signIn ? read2() : void 0;
2967
+ const overwriting = signIn ? read3() : void 0;
2908
2968
  const readAt = Date.now();
2909
2969
  const since = obtained;
2910
2970
  const kept = moved(session, {
@@ -2914,6 +2974,7 @@ function create(options) {
2914
2974
  });
2915
2975
  const unread = !!kept && kept !== session && !kept.account && !kept.accessKey;
2916
2976
  set(kept, { signIn });
2977
+ const issued = context();
2917
2978
  const clears = !!session && !options2.update && machines.clears({ current: context(), started });
2918
2979
  if (clears) actor.send({ type: "change.commit" });
2919
2980
  const rotation = options2.sent && session?.refreshToken && history ? (async () => rotations.write(await history, {
@@ -2921,11 +2982,22 @@ function create(options) {
2921
2982
  from: options2.sent,
2922
2983
  to: session.refreshToken
2923
2984
  }))().catch(() => void 0) : void 0;
2924
- await Promise.all([
2925
- writes?.flush(),
2985
+ const committed = context().version;
2986
+ const [saved] = await Promise.all([
2987
+ writes?.flush().then(
2988
+ () => void 0,
2989
+ (error3) => ({ error: error3 })
2990
+ ),
2926
2991
  clears ? mark(false) : void 0,
2927
2992
  rotation
2928
2993
  ]);
2994
+ if (saved) {
2995
+ if (signIn && kept && context().version === committed) {
2996
+ actor.send({ type: "change.refuse" });
2997
+ void revokeUnsaved(kept, issued);
2998
+ }
2999
+ throw saved.error;
3000
+ }
2929
3001
  if (replaced?.refreshToken && replaced.refreshToken !== session?.refreshToken)
2930
3002
  void revokeReplaced(replaced, since);
2931
3003
  if (overwriting)
@@ -3115,10 +3187,10 @@ function create(options) {
3115
3187
  const hydrated = await hydrate();
3116
3188
  const started = await flushed();
3117
3189
  let version = started;
3118
- let before = hydrated && started === 0 ? hydrated.stored : await read2();
3190
+ let before = hydrated && started === 0 ? hydrated.stored : await read3();
3119
3191
  while (actor && context().version !== version) {
3120
3192
  version = await flushed();
3121
- before = await read2();
3193
+ before = await read3();
3122
3194
  }
3123
3195
  const local = actor ? context().session : void 0;
3124
3196
  const unsaved = !!local && writes?.unsaved() === local;
@@ -3131,7 +3203,7 @@ function create(options) {
3131
3203
  return exclusive(async () => {
3132
3204
  const [{ failed, stored }, earlier, digests, entries] = await Promise.all(
3133
3205
  [
3134
- emptied.then(async (failed2) => ({ failed: failed2, stored: await read2() })),
3206
+ emptied.then(async (failed2) => ({ failed: failed2, stored: await read3() })),
3135
3207
  unanswered2.read(),
3136
3208
  revoked.read(),
3137
3209
  unsaved ? rotations.read() : void 0
@@ -3253,7 +3325,11 @@ function create(options) {
3253
3325
  for (const [token2, remote] of kept) retained.set(token2, remote);
3254
3326
  if (erased) throw erased.error;
3255
3327
  if (signedOut) throw signedOut.error;
3256
- const unsent = [...unsavedToken ? [unsavedToken] : [], ...resent];
3328
+ const unsent = [
3329
+ ...unsavedToken ? [unsavedToken] : [],
3330
+ ...resent,
3331
+ ...ended ? [] : earlier ?? []
3332
+ ];
3257
3333
  const failing = unsent.find(
3258
3334
  (token2) => pending.includes(token2) && !answered2.has(token2)
3259
3335
  );
@@ -3448,6 +3524,22 @@ var machines;
3448
3524
  // A later authorization reads the store again.
3449
3525
  checked: args.context.authorizations > 1 ? args.context.checked : void 0
3450
3526
  })),
3527
+ /**
3528
+ * Counts an authorization that started in the callback of the only authorization in progress,
3529
+ * such as `authorize` in a function `reauthorize`. It keeps that authorization's read of the
3530
+ * store, as the authorization's own request does.
3531
+ */
3532
+ nest: assign((args) => ({
3533
+ authorizations: args.context.authorizations + 1
3534
+ })),
3535
+ /**
3536
+ * Counts an authorization that ended during a callback inside an authorization. A later
3537
+ * authorization in the callback, such as a fallback, reads the store again.
3538
+ */
3539
+ unnest: assign((args) => ({
3540
+ authorizations: args.context.authorizations - 1,
3541
+ checked: void 0
3542
+ })),
3451
3543
  /**
3452
3544
  * Records that the authorizations in progress read the store for the kept expired session, at
3453
3545
  * the version that the read left.
@@ -3601,6 +3693,8 @@ var machines;
3601
3693
  }))
3602
3694
  },
3603
3695
  guards: {
3696
+ /** Whether a callback inside an authorization runs. */
3697
+ delegating: (args) => args.context.delegations > 0,
3604
3698
  /**
3605
3699
  * Whether a sign-out joins the one in progress. It joins only while no change followed that
3606
3700
  * sign-out, such as a sign-in. A call with `everywhere` never joins one without it.
@@ -3611,6 +3705,11 @@ var machines;
3611
3705
  if (!signingOut || signedOut !== version) return false;
3612
3706
  return signingOut.everywhere || !args.event.everywhere;
3613
3707
  },
3708
+ /**
3709
+ * Whether an authorization starts in a callback of the only authorization in progress, so no
3710
+ * other authorization starts beside it.
3711
+ */
3712
+ nested: (args) => args.context.delegations > 0 && args.context.authorizations === 1,
3614
3713
  /** Whether the instance holds no session, so no sign-in followed the sign-out. */
3615
3714
  sessionless: (args) => !args.context.session,
3616
3715
  /** Whether {@link select} selects `params.status` for the context. */
@@ -3643,8 +3742,14 @@ var machines;
3643
3742
  on: {
3644
3743
  // The store already holds another tab's change, so neither saves it again.
3645
3744
  adopt: { actions: "adopt", target: ".settling" },
3646
- "authorize.end": { actions: "authorized", target: ".settling" },
3647
- "authorize.start": { actions: "authorize", target: ".settling" },
3745
+ "authorize.end": [
3746
+ { actions: "unnest", guard: "delegating", target: ".settling" },
3747
+ { actions: "authorized", target: ".settling" }
3748
+ ],
3749
+ "authorize.start": [
3750
+ { actions: "nest", guard: "nested", target: ".settling" },
3751
+ { actions: "authorize", target: ".settling" }
3752
+ ],
3648
3753
  // The events that change no value of `select` stay in the state.
3649
3754
  "change.commit": { actions: "commit" },
3650
3755
  // The runner empties the store under the lock, after any refresh that holds it.
@@ -3946,6 +4051,12 @@ var machines;
3946
4051
  return current.refreshToken !== started?.refreshToken;
3947
4052
  }
3948
4053
  machines2.rotated = rotated;
4054
+ function signsIn(options) {
4055
+ const { current, session: session2 } = options;
4056
+ if (!session2) return false;
4057
+ return current?.user.id !== session2.user.id;
4058
+ }
4059
+ machines2.signsIn = signsIn;
3949
4060
  function switches(options) {
3950
4061
  const { current, stored } = options;
3951
4062
  if (!stored || !current) return false;
@@ -4299,7 +4410,7 @@ function plugin() {
4299
4410
  let loading;
4300
4411
  let loaded_plugin;
4301
4412
  function load() {
4302
- loading ??= import("./dialog-64VCHO3U.js").then((module) => loaded_plugin = module.dialog()).catch((error3) => {
4413
+ loading ??= import("./dialog-VJNNWJQC.js").then((module) => loaded_plugin = module.dialog()).catch((error3) => {
4303
4414
  loading = void 0;
4304
4415
  throw error3;
4305
4416
  });
@@ -4328,16 +4439,16 @@ function plugin() {
4328
4439
  extend(instance, context) {
4329
4440
  if (typeof document === "undefined") return {};
4330
4441
  let extending;
4331
- const extend = (read2) => {
4442
+ const extend = (read3) => {
4332
4443
  extending ??= load().then(
4333
4444
  (loaded) => {
4334
4445
  loaded.extend?.(
4335
4446
  instance,
4336
- read2 ? {
4447
+ read3 ? {
4337
4448
  ...context,
4338
4449
  session: {
4339
4450
  ...context.session,
4340
- reload: () => Promise.resolve(read2.session)
4451
+ reload: () => Promise.resolve(read3.session)
4341
4452
  }
4342
4453
  } : context
4343
4454
  );
@@ -4347,7 +4458,7 @@ function plugin() {
4347
4458
  }
4348
4459
  );
4349
4460
  };
4350
- if (!visibility()) {
4461
+ if (!visibility2()) {
4351
4462
  extend();
4352
4463
  return {};
4353
4464
  }
@@ -4378,7 +4489,7 @@ function plugin() {
4378
4489
  id: "dialog"
4379
4490
  });
4380
4491
  }
4381
- function visibility() {
4492
+ function visibility2() {
4382
4493
  return typeof IntersectionObserverEntry !== "undefined" && "isVisible" in IntersectionObserverEntry.prototype;
4383
4494
  }
4384
4495
 
@@ -4457,7 +4568,7 @@ function create3(options) {
4457
4568
  chainId = next;
4458
4569
  for (const listener of listeners) listener(next, previous);
4459
4570
  }
4460
- async function read2() {
4571
+ async function read3() {
4461
4572
  const stored = await store2?.getItem(key2);
4462
4573
  if (typeof stored === "number" && Number.isSafeInteger(stored) && chains.includes(stored))
4463
4574
  return stored;
@@ -4465,7 +4576,7 @@ function create3(options) {
4465
4576
  }
4466
4577
  function load() {
4467
4578
  loading ??= (async () => {
4468
- const stored = await read2();
4579
+ const stored = await read3();
4469
4580
  if (stored !== void 0) apply(stored);
4470
4581
  })().catch((error3) => {
4471
4582
  loading = void 0;
@@ -4478,7 +4589,7 @@ function create3(options) {
4478
4589
  get: () => chainId,
4479
4590
  load,
4480
4591
  serves: (next) => chains.includes(next),
4481
- stored: async () => await read2() ?? options.chainId,
4592
+ stored: async () => await read3() ?? options.chainId,
4482
4593
  async set(next) {
4483
4594
  await load().catch(() => void 0);
4484
4595
  await store2?.setItem(key2, next);
@@ -4576,7 +4687,7 @@ async function open(auth, options) {
4576
4687
  amount: amount3,
4577
4688
  chainId: options.chainId ?? auth.chainId,
4578
4689
  token: token2
4579
- }))
4690
+ }) || !frames(auth))
4580
4691
  return "popup";
4581
4692
  return value;
4582
4693
  })();
@@ -4590,7 +4701,7 @@ async function open(auth, options) {
4590
4701
  redirectUri,
4591
4702
  token: token2
4592
4703
  });
4593
- const read2 = () => {
4704
+ const read3 = () => {
4594
4705
  if (typeof options.address !== "function") return options.address;
4595
4706
  try {
4596
4707
  return options.address();
@@ -4600,15 +4711,15 @@ async function open(auth, options) {
4600
4711
  };
4601
4712
  if (mode !== "frame") discard(auth);
4602
4713
  if (mode === "redirect") {
4603
- const address = await abortable(read2(), { signal });
4714
+ const address = await abortable(read3(), { signal });
4604
4715
  window.location.assign(toUrl(address));
4605
4716
  return void 0;
4606
4717
  }
4607
4718
  if (new URL(redirectUri).origin !== window.location.origin)
4608
4719
  throw new OriginError2({ origin: window.location.origin, redirectUri });
4609
4720
  if (mode === "popup" && options.mode !== "popup" && !activated()) {
4610
- const address = await abortable(read2(), { signal });
4611
- const Sheet = await import("./Sheet-TTUDP43B.js");
4721
+ const address = await abortable(read3(), { signal });
4722
+ const Sheet = await import("./Sheet-5AHIVMDK.js");
4612
4723
  return await new Promise((resolve3, reject) => {
4613
4724
  const abort = () => {
4614
4725
  close();
@@ -4636,13 +4747,13 @@ async function open(auth, options) {
4636
4747
  });
4637
4748
  }
4638
4749
  if (mode === "frame")
4639
- return await frame(auth, { address: read2(), redirectUri, signal, toUrl });
4750
+ return await frame(auth, { address: read3(), redirectUri, signal, toUrl });
4640
4751
  const popup = openPopup(
4641
4752
  typeof options.address === "string" ? toUrl(options.address) : "about:blank"
4642
4753
  );
4643
4754
  if (popup === null) throw new BlockedError2();
4644
4755
  return await watch(auth, {
4645
- address: read2(),
4756
+ address: read3(),
4646
4757
  popup,
4647
4758
  redirectUri,
4648
4759
  signal,
@@ -4657,7 +4768,7 @@ async function preload(auth, options) {
4657
4768
  amount: options.amount,
4658
4769
  chainId: options.chainId ?? auth.chainId,
4659
4770
  token: options.token
4660
- }))
4771
+ }) || !frames(auth))
4661
4772
  return;
4662
4773
  const url2 = pageUrl(auth, {
4663
4774
  ...options,
@@ -4671,7 +4782,7 @@ async function preload(auth, options) {
4671
4782
  const entry = { ready: Promise.resolve(), sheet: void 0, url: url2 };
4672
4783
  preloads.set(auth, entry);
4673
4784
  entry.ready = (async () => {
4674
- const Sheet = await import("./Sheet-TTUDP43B.js").catch(() => void 0);
4785
+ const Sheet = await import("./Sheet-5AHIVMDK.js").catch(() => void 0);
4675
4786
  if (!document.body)
4676
4787
  await new Promise(
4677
4788
  (resolve3) => document.addEventListener("DOMContentLoaded", resolve3, {
@@ -4697,7 +4808,7 @@ async function watch(auth, options) {
4697
4808
  try {
4698
4809
  return await new Promise(
4699
4810
  (resolve3, reject) => {
4700
- void import("./Sheet-TTUDP43B.js").then(
4811
+ void import("./Sheet-5AHIVMDK.js").then(
4701
4812
  (Sheet) => {
4702
4813
  if (settled) return;
4703
4814
  unblock = Sheet.waiting({
@@ -4798,7 +4909,7 @@ function parse(url2, options) {
4798
4909
  async function frame(auth, options) {
4799
4910
  const { redirectUri, signal, toUrl } = options;
4800
4911
  const address = await abortable(options.address, { signal });
4801
- const Sheet = await import("./Sheet-TTUDP43B.js");
4912
+ const Sheet = await import("./Sheet-5AHIVMDK.js");
4802
4913
  signal?.throwIfAborted();
4803
4914
  const url2 = toUrl(address);
4804
4915
  const held = preloads.get(auth);
@@ -4860,13 +4971,13 @@ var SignedOutError = class extends Error {
4860
4971
  function funding(options = {}) {
4861
4972
  return from5({
4862
4973
  actions: (context) => {
4863
- let read2;
4974
+ let read3;
4864
4975
  const resolve3 = (chainId) => {
4865
4976
  const own2 = (session) => {
4866
4977
  const held = chainId === context.config.chainId ? session?.account?.address ?? session?.accessKey?.account : void 0;
4867
4978
  if (held) return held;
4868
- if (session && read2?.session === session && read2.chainId === chainId)
4869
- return read2.address;
4979
+ if (session && read3?.session === session && read3.chainId === chainId)
4980
+ return read3.address;
4870
4981
  return void 0;
4871
4982
  };
4872
4983
  return own2(context.session.get()) ?? (async () => {
@@ -4879,7 +4990,7 @@ function funding(options = {}) {
4879
4990
  chain: chainId
4880
4991
  });
4881
4992
  if (!account2) throw new SignedOutError();
4882
- read2 = { address: account2.address, chainId, session };
4993
+ read3 = { address: account2.address, chainId, session };
4883
4994
  return account2.address;
4884
4995
  });
4885
4996
  };
@@ -5414,7 +5525,7 @@ function create4(options = {}) {
5414
5525
  function connections2() {
5415
5526
  if (!connectionsOptions)
5416
5527
  return Promise.reject(new ConnectionsRequiredError());
5417
- attached ??= import("./Connections-LFMTE7B3.js").then(
5528
+ attached ??= import("./Connections-VWRB7SU3.js").then(
5418
5529
  (module) => module.attach(config, connectionsOptions)
5419
5530
  );
5420
5531
  return attached;
@@ -5471,7 +5582,7 @@ function create4(options = {}) {
5471
5582
  },
5472
5583
  handler: {
5473
5584
  async fetch(request2) {
5474
- server ??= import("./Server-BBPGA6V3.js").then(
5585
+ server ??= import("./Server-P3ZGXYFX.js").then(
5475
5586
  (module) => module.create({
5476
5587
  accessKeys: connectionsOptions ? async () => (await connections2()).accessKeyEndpoint : void 0,
5477
5588
  // The `backend` plugin's actions sit on the instance under its `id`.
@@ -5553,7 +5664,7 @@ function create4(options = {}) {
5553
5664
  },
5554
5665
  get: (parameters = {}) => {
5555
5666
  if (parameters instanceof Request) return backendOf().get(parameters);
5556
- const read2 = (reauthorize) => getSession(context, {
5667
+ const read3 = (reauthorize) => getSession(context, {
5557
5668
  ...parameters,
5558
5669
  declined: () => session.actor !== void 0 && machines.declined(session.actor.getSnapshot()),
5559
5670
  delegate: session.delegate,
@@ -5574,16 +5685,16 @@ function create4(options = {}) {
5574
5685
  signedOut: session.signedOut
5575
5686
  });
5576
5687
  if (parameters.reauthorize !== true || !session.actor)
5577
- return read2(parameters.reauthorize);
5688
+ return read3(parameters.reauthorize);
5578
5689
  if (restoring)
5579
5690
  return restoring.then(
5580
- () => read2(void 0),
5691
+ () => read3(void 0),
5581
5692
  (error3) => {
5582
- if (error3 instanceof SupersededError) return read2(void 0);
5693
+ if (error3 instanceof SupersededError) return read3(void 0);
5583
5694
  throw error3;
5584
5695
  }
5585
5696
  );
5586
- return restoring = read2(true).finally(() => {
5697
+ return restoring = read3(true).finally(() => {
5587
5698
  restoring = void 0;
5588
5699
  });
5589
5700
  },
@@ -5879,6 +5990,8 @@ export {
5879
5990
  checkState,
5880
5991
  error2,
5881
5992
  url,
5993
+ read,
5994
+ register,
5882
5995
  openPopup,
5883
5996
  watchPopup,
5884
5997
  coinflow,
@@ -5896,7 +6009,7 @@ export {
5896
6009
  pushes,
5897
6010
  complete,
5898
6011
  prepare,
5899
- read,
6012
+ read2,
5900
6013
  post2,
5901
6014
  steps,
5902
6015
  redemption,
@@ -5915,6 +6028,7 @@ export {
5915
6028
  funding_exports,
5916
6029
  AccessKeyRequiredError,
5917
6030
  PendingNotFoundError,
6031
+ RedirectUriRequiredError,
5918
6032
  RequestError,
5919
6033
  SignedOutError2 as SignedOutError,
5920
6034
  SupersededError,
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  env,
3
3
  login
4
- } from "../chunk-HMJFGR5T.js";
4
+ } from "../chunk-TSILKAYU.js";
5
5
  import "../chunk-2T7V6ASK.js";
6
- import "../chunk-5ONJKYVW.js";
7
- import "../chunk-CTLWOXGT.js";
8
- import "../chunk-OZTYXHV2.js";
9
- import "../chunk-KSJGRBP6.js";
10
- import "../chunk-TINLMV2R.js";
6
+ import "../chunk-IPFNLIHS.js";
7
+ import "../chunk-XM5OSMFD.js";
8
+ import "../chunk-EUWWJJZX.js";
9
+ import "../chunk-RTMKPMTX.js";
10
+ import "../chunk-GQFRK53P.js";
11
11
  import "../chunk-FWGE6HXK.js";
12
12
  import {
13
13
  Accounts_exports
14
- } from "../chunk-QQTY4WGS.js";
14
+ } from "../chunk-YTC2XI32.js";
15
15
  import "../chunk-Y7KQRRJL.js";
16
16
  import "../chunk-MLKGABMK.js";
17
17
 
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  env,
3
3
  remove
4
- } from "../chunk-HMJFGR5T.js";
4
+ } from "../chunk-TSILKAYU.js";
5
5
  import "../chunk-2T7V6ASK.js";
6
- import "../chunk-5ONJKYVW.js";
7
- import "../chunk-CTLWOXGT.js";
8
- import "../chunk-OZTYXHV2.js";
9
- import "../chunk-KSJGRBP6.js";
10
- import "../chunk-TINLMV2R.js";
6
+ import "../chunk-IPFNLIHS.js";
7
+ import "../chunk-XM5OSMFD.js";
8
+ import "../chunk-EUWWJJZX.js";
9
+ import "../chunk-RTMKPMTX.js";
10
+ import "../chunk-GQFRK53P.js";
11
11
  import "../chunk-FWGE6HXK.js";
12
- import "../chunk-QQTY4WGS.js";
12
+ import "../chunk-YTC2XI32.js";
13
13
  import "../chunk-Y7KQRRJL.js";
14
14
  import "../chunk-MLKGABMK.js";
15
15
 
@@ -2,15 +2,15 @@ import {
2
2
  env,
3
3
  signedOut,
4
4
  whoami
5
- } from "../chunk-HMJFGR5T.js";
5
+ } from "../chunk-TSILKAYU.js";
6
6
  import "../chunk-2T7V6ASK.js";
7
- import "../chunk-5ONJKYVW.js";
8
- import "../chunk-CTLWOXGT.js";
9
- import "../chunk-OZTYXHV2.js";
10
- import "../chunk-KSJGRBP6.js";
11
- import "../chunk-TINLMV2R.js";
7
+ import "../chunk-IPFNLIHS.js";
8
+ import "../chunk-XM5OSMFD.js";
9
+ import "../chunk-EUWWJJZX.js";
10
+ import "../chunk-RTMKPMTX.js";
11
+ import "../chunk-GQFRK53P.js";
12
12
  import "../chunk-FWGE6HXK.js";
13
- import "../chunk-QQTY4WGS.js";
13
+ import "../chunk-YTC2XI32.js";
14
14
  import "../chunk-Y7KQRRJL.js";
15
15
  import "../chunk-MLKGABMK.js";
16
16
 
@@ -3,9 +3,9 @@ import {
3
3
  preload,
4
4
  signIn,
5
5
  signMessage
6
- } from "./chunk-CTLWOXGT.js";
7
- import "./chunk-OZTYXHV2.js";
8
- import "./chunk-KSJGRBP6.js";
6
+ } from "./chunk-XM5OSMFD.js";
7
+ import "./chunk-EUWWJJZX.js";
8
+ import "./chunk-RTMKPMTX.js";
9
9
  import {
10
10
  authPath,
11
11
  basePath
@@ -17,10 +17,12 @@ import {
17
17
  accessKey,
18
18
  expired2 as expired,
19
19
  from2 as from,
20
+ read,
21
+ register,
20
22
  revokeAccessKey,
21
23
  toSession,
22
24
  updateAccessKey
23
- } from "./chunk-QQTY4WGS.js";
25
+ } from "./chunk-YTC2XI32.js";
24
26
  import "./chunk-Y7KQRRJL.js";
25
27
  import "./chunk-MLKGABMK.js";
26
28
 
@@ -43,19 +45,19 @@ function dialog(options = {}) {
43
45
  };
44
46
  function configOf(context) {
45
47
  if (par === void 0) return context.config;
46
- let config = configs.get(context.config);
47
- if (!config)
48
- configs.set(
49
- context.config,
50
- // The copy keeps the getter of `chainId`, so it follows `switchChain`.
51
- config = Object.assign(
52
- Object.defineProperties(
53
- {},
54
- Object.getOwnPropertyDescriptors(context.config)
55
- ),
56
- { par }
57
- )
58
- );
48
+ const found = configs.get(context.config);
49
+ if (found) return found;
50
+ const config = Object.assign(
51
+ Object.defineProperties(
52
+ {},
53
+ Object.getOwnPropertyDescriptors(context.config)
54
+ ),
55
+ { par }
56
+ );
57
+ configs.set(context.config, config);
58
+ register(context.config, {
59
+ read: () => read(config)
60
+ });
59
61
  return config;
60
62
  }
61
63
  return from({
@@ -220,7 +222,7 @@ function dialog(options = {}) {
220
222
  * [`expiry_passed`](https://github.com/tempoxyz/id/blob/main/docs/errors.md#expiry_passed)
221
223
  * for an `accessKey.expiry` in Unix seconds that has passed,
222
224
  * [`invalid_expiry`](https://github.com/tempoxyz/id/blob/main/docs/errors.md#invalid_expiry)
223
- * for an `accessKey.expiry` that is not a whole number of seconds,
225
+ * for an `accessKey.expiry` that is not a whole number of seconds or holds milliseconds,
224
226
  * [`invalid_period`](https://github.com/tempoxyz/id/blob/main/docs/errors.md#invalid_period)
225
227
  * for an `accessKey.limits` `period` that is fractional, negative, or above
226
228
  * `Number.MAX_SAFE_INTEGER` seconds,
@@ -3,8 +3,8 @@ import {
3
3
  prepare,
4
4
  register,
5
5
  signIn
6
- } from "./chunk-5ONJKYVW.js";
7
- import "./chunk-QQTY4WGS.js";
6
+ } from "./chunk-IPFNLIHS.js";
7
+ import "./chunk-YTC2XI32.js";
8
8
  import "./chunk-Y7KQRRJL.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
  export {
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-908.sha-38fe545",
12
+ "version": "0.0.0-pr-958.sha-d7f10be",
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": {