@tempoxyz/id 0.0.0-pr-682.sha-69b80ae → 0.0.0-pr-681.sha-4ead0bb

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-GOY75KTX.js";
8
- import "./chunk-HU7IKUQX.js";
7
+ } from "./chunk-QIQD2DXD.js";
8
+ import "./chunk-GMRE2WA3.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-HU7IKUQX.js";
7
+ } from "./chunk-GMRE2WA3.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
  export {
10
10
  create,
@@ -1658,7 +1658,7 @@ async function open(auth, options) {
1658
1658
  throw new OriginError({ origin: window.location.origin, redirectUri });
1659
1659
  if (mode === "popup" && options.mode !== "popup" && !activated()) {
1660
1660
  const address2 = await abortable(read2(), { signal });
1661
- const Sheet = await import("./Sheet-IFKNYXEI.js");
1661
+ const Sheet = await import("./Sheet-JJQ2IG6X.js");
1662
1662
  return await new Promise((resolve3, reject) => {
1663
1663
  const abort = () => {
1664
1664
  close();
@@ -1709,7 +1709,7 @@ async function watch(auth, options) {
1709
1709
  try {
1710
1710
  return await new Promise(
1711
1711
  (resolve3, reject) => {
1712
- void import("./Sheet-IFKNYXEI.js").then(
1712
+ void import("./Sheet-JJQ2IG6X.js").then(
1713
1713
  (Sheet) => {
1714
1714
  if (settled) return;
1715
1715
  unblock = Sheet.waiting({
@@ -1774,7 +1774,7 @@ function parse(url, options) {
1774
1774
  async function frame(auth, options) {
1775
1775
  const { redirectUri, signal, toUrl } = options;
1776
1776
  const address2 = await abortable(options.address, { signal });
1777
- const Sheet = await import("./Sheet-IFKNYXEI.js");
1777
+ const Sheet = await import("./Sheet-JJQ2IG6X.js");
1778
1778
  signal?.throwIfAborted();
1779
1779
  let close;
1780
1780
  let abort;
@@ -2694,70 +2694,6 @@ import {
2694
2694
  Credential,
2695
2695
  Registration
2696
2696
  } from "ox/webauthn";
2697
-
2698
- // ../../accounts/src/internal/SignIn.ts
2699
- import { KeyAuthorization as KeyAuthorization2 } from "ox/tempo";
2700
-
2701
- // ../../accounts/src/Session.ts
2702
- function from4(value) {
2703
- return value;
2704
- }
2705
- function expired2(session2) {
2706
- if (session2.key) return expired(session2.key);
2707
- return !session2.refreshToken && session2.expiresAt <= Date.now();
2708
- }
2709
-
2710
- // ../../accounts/src/internal/SignIn.ts
2711
- function accessKey(context, value) {
2712
- if (value === false) return void 0;
2713
- if (typeof value === "function") return value();
2714
- if (value) return value;
2715
- return context.accessKey();
2716
- }
2717
- function toSession(result) {
2718
- return from4({
2719
- accessToken: result.accessToken,
2720
- ...result.account ? { account: result.account } : {},
2721
- expiresAt: result.expiresAt,
2722
- ...result.idToken !== void 0 ? { idToken: result.idToken } : {},
2723
- ...result.key ? { key: withLifetime(result.key) } : {},
2724
- ...result.refreshToken !== void 0 ? { refreshToken: result.refreshToken } : {},
2725
- user: result.user
2726
- });
2727
- }
2728
- function withLifetime(key) {
2729
- const { expiry } = KeyAuthorization2.fromRpc(key.keyAuthorization);
2730
- if (!expiry) return key;
2731
- return { ...key, lifetime: expiry - Math.floor(Date.now() / 1e3) };
2732
- }
2733
- async function account(config, options) {
2734
- const listed = await (async () => {
2735
- try {
2736
- return await json(
2737
- await (config.fetch ?? fetch)(
2738
- new URL(
2739
- `/v1/account?${new URLSearchParams({ chain: String(config.chainId), client_id: config.clientId })}`,
2740
- config.url
2741
- ),
2742
- { credentials: "include" }
2743
- )
2744
- );
2745
- } catch (error3) {
2746
- if (unlisted(error3, { field: "chain" })) return void 0;
2747
- return signedIn(error3, {
2748
- message: "The account read failed after the sign-in, with no response from Tempo ID. The user is signed in, so sign in again."
2749
- });
2750
- }
2751
- })();
2752
- if (!listed || listed.id !== options.userId) return void 0;
2753
- const [first] = listed.tempo;
2754
- return first && tempoAccount(first, { getFn: options.getFn });
2755
- }
2756
- function unlisted(error3, options) {
2757
- return error3 instanceof RequestError && error3.reason === "invalid_field" && error3.field === options.field;
2758
- }
2759
-
2760
- // ../../accounts/src/actions/passkey.ts
2761
2697
  async function available(auth) {
2762
2698
  const response = await (auth.fetch ?? fetch)(
2763
2699
  new URL(
@@ -2956,42 +2892,21 @@ async function sign2(prepared, options) {
2956
2892
  }
2957
2893
  async function verify(auth, options) {
2958
2894
  const { assertion, prepared } = options;
2959
- const requested = prepared.key ? void 0 : prepared.request.account;
2960
- const chain = requested?.chain ?? requested?.chainId;
2961
- const send2 = async (withAccount) => read(
2895
+ const body = await read(
2962
2896
  await post(auth, "/v1/auth/passkey/verify", {
2963
2897
  // The prepared authorization's code redeems in the same request.
2964
2898
  headers: await redemption(auth),
2965
- json: {
2966
- ...withAccount ? {
2967
- account: {
2968
- ...chain !== void 0 ? { chain } : {},
2969
- client_id: auth.clientId
2970
- }
2971
- } : {},
2972
- assertion
2973
- }
2899
+ json: { assertion }
2974
2900
  })
2975
2901
  );
2976
- const body = await send2(requested !== void 0).catch((error3) => {
2977
- if (!requested || !unlisted(error3, { field: "account.chain" }))
2978
- throw error3;
2979
- return send2(false);
2980
- });
2981
2902
  if ("step" in body)
2982
2903
  return { step: { link: body.step.link, type: body.step.type } };
2983
- const authorization2 = await complete(auth, {
2904
+ return await complete(auth, {
2984
2905
  authorize: prepared.authorize,
2985
2906
  body,
2986
2907
  key: prepared.key,
2987
2908
  request: prepared.request
2988
2909
  });
2989
- if (!requested || !body.tempo) return authorization2;
2990
- const [first] = body.tempo;
2991
- return {
2992
- ...authorization2,
2993
- account: first ? tempoAccount(first, { getFn: requested.getFn }) : void 0
2994
- };
2995
2910
  }
2996
2911
 
2997
2912
  // ../../accounts/src/actions/realm.ts
@@ -3111,6 +3026,70 @@ function thirdParty(clientId) {
3111
3026
  // ../../accounts/src/internal/Core.ts
3112
3027
  import { Address as Address4 } from "ox";
3113
3028
  import { KeyAuthorization as KeyAuthorization3 } from "ox/tempo";
3029
+
3030
+ // ../../accounts/src/internal/SignIn.ts
3031
+ import { KeyAuthorization as KeyAuthorization2 } from "ox/tempo";
3032
+
3033
+ // ../../accounts/src/Session.ts
3034
+ function from4(value) {
3035
+ return value;
3036
+ }
3037
+ function expired2(session2) {
3038
+ if (session2.key) return expired(session2.key);
3039
+ return !session2.refreshToken && session2.expiresAt <= Date.now();
3040
+ }
3041
+
3042
+ // ../../accounts/src/internal/SignIn.ts
3043
+ function accessKey(context, value) {
3044
+ if (value === false) return void 0;
3045
+ if (typeof value === "function") return value();
3046
+ if (value) return value;
3047
+ return context.accessKey();
3048
+ }
3049
+ function toSession(result) {
3050
+ return from4({
3051
+ accessToken: result.accessToken,
3052
+ ...result.account ? { account: result.account } : {},
3053
+ expiresAt: result.expiresAt,
3054
+ ...result.idToken !== void 0 ? { idToken: result.idToken } : {},
3055
+ ...result.key ? { key: withLifetime(result.key) } : {},
3056
+ ...result.refreshToken !== void 0 ? { refreshToken: result.refreshToken } : {},
3057
+ user: result.user
3058
+ });
3059
+ }
3060
+ function withLifetime(key) {
3061
+ const { expiry } = KeyAuthorization2.fromRpc(key.keyAuthorization);
3062
+ if (!expiry) return key;
3063
+ return { ...key, lifetime: expiry - Math.floor(Date.now() / 1e3) };
3064
+ }
3065
+ async function account(config, options) {
3066
+ const listed = await (async () => {
3067
+ try {
3068
+ return await json(
3069
+ await (config.fetch ?? fetch)(
3070
+ new URL(
3071
+ `/v1/account?${new URLSearchParams({ chain: String(config.chainId), client_id: config.clientId })}`,
3072
+ config.url
3073
+ ),
3074
+ { credentials: "include" }
3075
+ )
3076
+ );
3077
+ } catch (error3) {
3078
+ if (unlisted(error3, { field: "chain" })) return void 0;
3079
+ return signedIn(error3, {
3080
+ message: "The account read failed after the sign-in, with no response from Tempo ID. The user is signed in, so sign in again."
3081
+ });
3082
+ }
3083
+ })();
3084
+ if (!listed || listed.id !== options.userId) return void 0;
3085
+ const [first] = listed.tempo;
3086
+ return first && tempoAccount(first, { getFn: options.getFn });
3087
+ }
3088
+ function unlisted(error3, options) {
3089
+ return error3 instanceof RequestError && error3.reason === "invalid_field" && error3.field === options.field;
3090
+ }
3091
+
3092
+ // ../../accounts/src/internal/Core.ts
3114
3093
  function authorize5(context, options = {}) {
3115
3094
  return context.session.authorize(() => run(context, options));
3116
3095
  }
@@ -3241,8 +3220,6 @@ async function getSession(context, options) {
3241
3220
  const { restore } = options;
3242
3221
  if (!options.reauthorize) {
3243
3222
  await restore();
3244
- const loaded = await context.session.load();
3245
- if (loaded || !await context.session.settled()) return loaded;
3246
3223
  return await context.session.load();
3247
3224
  }
3248
3225
  const fn = (() => {
@@ -3265,7 +3242,6 @@ async function getSession(context, options) {
3265
3242
  await restore();
3266
3243
  return await context.session.load();
3267
3244
  }
3268
- await context.session.settled();
3269
3245
  return await context.session.authorize(async () => {
3270
3246
  await restore();
3271
3247
  const loaded = await context.session.load();
@@ -3327,7 +3303,7 @@ var signInIds = /* @__PURE__ */ new Set([
3327
3303
  function plugin() {
3328
3304
  let loading;
3329
3305
  function load() {
3330
- loading ??= import("./dialog-4273L5TD.js").then((module) => module.dialog()).catch((error3) => {
3306
+ loading ??= import("./dialog-6645IIOG.js").then((module) => module.dialog()).catch((error3) => {
3331
3307
  loading = void 0;
3332
3308
  throw error3;
3333
3309
  });
@@ -3602,22 +3578,14 @@ function create3(options) {
3602
3578
  return () => subscription.unsubscribe();
3603
3579
  }
3604
3580
  const rotated = /* @__PURE__ */ new Map();
3605
- const authorizations = /* @__PURE__ */ new Set();
3606
3581
  return {
3607
3582
  actor,
3608
3583
  async authorize(fn) {
3609
3584
  if (!actor) return await fn();
3610
3585
  actor.send({ type: "authorize.start" });
3611
- const promise = fn();
3612
- const entry = promise.then(
3613
- () => void 0,
3614
- () => void 0
3615
- );
3616
- authorizations.add(entry);
3617
3586
  try {
3618
- return await promise;
3587
+ return await fn();
3619
3588
  } finally {
3620
- authorizations.delete(entry);
3621
3589
  actor.send({ type: "authorize.end" });
3622
3590
  }
3623
3591
  },
@@ -3720,11 +3688,6 @@ function create3(options) {
3720
3688
  },
3721
3689
  reload,
3722
3690
  renewing: () => actor?.getSnapshot().context.renewing,
3723
- async settled() {
3724
- if (authorizations.size === 0) return false;
3725
- await Promise.all(authorizations);
3726
- return true;
3727
- },
3728
3691
  async signedOut() {
3729
3692
  if (actor ? context().marked : markedLocal) return true;
3730
3693
  const stored = await (async () => store2?.getItem(`${name}:signed-out`))().catch(() => void 0);
@@ -4494,8 +4457,7 @@ function create4(options = {}) {
4494
4457
  get: session2.get,
4495
4458
  load: session2.load,
4496
4459
  reload: session2.reload,
4497
- renewing: session2.renewing,
4498
- settled: session2.settled
4460
+ renewing: session2.renewing
4499
4461
  }
4500
4462
  };
4501
4463
  const namespaces = {};
@@ -4519,10 +4481,6 @@ function create4(options = {}) {
4519
4481
  refreshing ??= refresh2(context, { margin: 3e4 }).finally(() => {
4520
4482
  refreshing = void 0;
4521
4483
  });
4522
- if (current.expiresAt - 5e3 > Date.now()) {
4523
- refreshing.catch(() => void 0);
4524
- return current.accessToken;
4525
- }
4526
4484
  const latest = await refreshing ?? context.session.get();
4527
4485
  if (!latest) throw new SignedOutError2();
4528
4486
  if (latest.user.id !== current.user.id) throw new SignedOutError2();
@@ -4535,7 +4493,7 @@ function create4(options = {}) {
4535
4493
  function connections2() {
4536
4494
  if (!connectionsOptions)
4537
4495
  return Promise.reject(new ConnectionsRequiredError());
4538
- attached ??= import("./Connections-RTGUTHPP.js").then(
4496
+ attached ??= import("./Connections-ZL3DMPMV.js").then(
4539
4497
  (module) => module.attach(config, connectionsOptions)
4540
4498
  );
4541
4499
  return attached;
@@ -4593,7 +4551,6 @@ function create4(options = {}) {
4593
4551
  }
4594
4552
  },
4595
4553
  session: {
4596
- accessToken: accessToken2,
4597
4554
  actor: session2.actor,
4598
4555
  fetch: async (parameters) => fetch2(config, {
4599
4556
  ...parameters,
@@ -5611,10 +5568,10 @@ export {
5611
5568
  frame2 as frame,
5612
5569
  machines3 as machines,
5613
5570
  dialog_exports,
5571
+ Actions_exports,
5614
5572
  expired2,
5615
5573
  accessKey,
5616
5574
  toSession,
5617
- Actions_exports,
5618
5575
  from5 as from2,
5619
5576
  PendingNotFoundError,
5620
5577
  RequestError,
@@ -2,7 +2,7 @@ import {
2
2
  AccessKey_exports,
3
3
  Accounts_exports,
4
4
  Actions_exports
5
- } from "./chunk-HU7IKUQX.js";
5
+ } from "./chunk-GMRE2WA3.js";
6
6
 
7
7
  // src/Session.ts
8
8
  import * as Fs from "node:fs/promises";
@@ -5,7 +5,7 @@ import {
5
5
  expired,
6
6
  from,
7
7
  revokeAccessKey
8
- } from "./chunk-HU7IKUQX.js";
8
+ } from "./chunk-GMRE2WA3.js";
9
9
  import {
10
10
  from as from2
11
11
  } from "./chunk-YW5DUQT3.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  env,
3
3
  login
4
- } from "../chunk-KUGGMQNM.js";
5
- import "../chunk-GOY75KTX.js";
6
- import "../chunk-HU7IKUQX.js";
4
+ } from "../chunk-HOCQX34A.js";
5
+ import "../chunk-QIQD2DXD.js";
6
+ import "../chunk-GMRE2WA3.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-KUGGMQNM.js";
5
- import "../chunk-GOY75KTX.js";
6
- import "../chunk-HU7IKUQX.js";
4
+ } from "../chunk-HOCQX34A.js";
5
+ import "../chunk-QIQD2DXD.js";
6
+ import "../chunk-GMRE2WA3.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-KUGGMQNM.js";
6
- import "../chunk-GOY75KTX.js";
7
- import "../chunk-HU7IKUQX.js";
5
+ } from "../chunk-HOCQX34A.js";
6
+ import "../chunk-QIQD2DXD.js";
7
+ import "../chunk-GMRE2WA3.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-HU7IKUQX.js";
7
+ } from "./chunk-GMRE2WA3.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-682.sha-69b80ae",
12
+ "version": "0.0.0-pr-681.sha-4ead0bb",
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": {