@tempoxyz/id 0.0.0-pr-681.sha-4ead0bb → 0.0.0-pr-682.sha-d0df8be
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-ZL3DMPMV.js → Connections-RTGUTHPP.js} +2 -2
- package/dist/{Sheet-JJQ2IG6X.js → Sheet-IFKNYXEI.js} +1 -1
- package/dist/{chunk-QIQD2DXD.js → chunk-GOY75KTX.js} +1 -1
- package/dist/{chunk-GMRE2WA3.js → chunk-HU7IKUQX.js} +118 -75
- package/dist/{chunk-HOCQX34A.js → chunk-KUGGMQNM.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-6645IIOG.js → dialog-4273L5TD.js} +1 -1
- package/package.json +1 -1
|
@@ -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-
|
|
1661
|
+
const Sheet = await import("./Sheet-IFKNYXEI.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-
|
|
1712
|
+
void import("./Sheet-IFKNYXEI.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-
|
|
1777
|
+
const Sheet = await import("./Sheet-IFKNYXEI.js");
|
|
1778
1778
|
signal?.throwIfAborted();
|
|
1779
1779
|
let close;
|
|
1780
1780
|
let abort;
|
|
@@ -2694,6 +2694,70 @@ 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
|
|
2697
2761
|
async function available(auth) {
|
|
2698
2762
|
const response = await (auth.fetch ?? fetch)(
|
|
2699
2763
|
new URL(
|
|
@@ -2892,21 +2956,42 @@ async function sign2(prepared, options) {
|
|
|
2892
2956
|
}
|
|
2893
2957
|
async function verify(auth, options) {
|
|
2894
2958
|
const { assertion, prepared } = options;
|
|
2895
|
-
const
|
|
2959
|
+
const requested = prepared.key ? void 0 : prepared.request.account;
|
|
2960
|
+
const chain = requested?.chain ?? requested?.chainId;
|
|
2961
|
+
const send2 = async (withAccount) => read(
|
|
2896
2962
|
await post(auth, "/v1/auth/passkey/verify", {
|
|
2897
2963
|
// The prepared authorization's code redeems in the same request.
|
|
2898
2964
|
headers: await redemption(auth),
|
|
2899
|
-
json: {
|
|
2965
|
+
json: {
|
|
2966
|
+
...withAccount ? {
|
|
2967
|
+
account: {
|
|
2968
|
+
...chain !== void 0 ? { chain } : {},
|
|
2969
|
+
client_id: auth.clientId
|
|
2970
|
+
}
|
|
2971
|
+
} : {},
|
|
2972
|
+
assertion
|
|
2973
|
+
}
|
|
2900
2974
|
})
|
|
2901
2975
|
);
|
|
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
|
+
});
|
|
2902
2981
|
if ("step" in body)
|
|
2903
2982
|
return { step: { link: body.step.link, type: body.step.type } };
|
|
2904
|
-
|
|
2983
|
+
const authorization2 = await complete(auth, {
|
|
2905
2984
|
authorize: prepared.authorize,
|
|
2906
2985
|
body,
|
|
2907
2986
|
key: prepared.key,
|
|
2908
2987
|
request: prepared.request
|
|
2909
2988
|
});
|
|
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
|
+
};
|
|
2910
2995
|
}
|
|
2911
2996
|
|
|
2912
2997
|
// ../../accounts/src/actions/realm.ts
|
|
@@ -3026,70 +3111,6 @@ function thirdParty(clientId) {
|
|
|
3026
3111
|
// ../../accounts/src/internal/Core.ts
|
|
3027
3112
|
import { Address as Address4 } from "ox";
|
|
3028
3113
|
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
|
|
3093
3114
|
function authorize5(context, options = {}) {
|
|
3094
3115
|
return context.session.authorize(() => run(context, options));
|
|
3095
3116
|
}
|
|
@@ -3220,6 +3241,8 @@ async function getSession(context, options) {
|
|
|
3220
3241
|
const { restore } = options;
|
|
3221
3242
|
if (!options.reauthorize) {
|
|
3222
3243
|
await restore();
|
|
3244
|
+
const loaded = await context.session.load();
|
|
3245
|
+
if (loaded || !await context.session.settled()) return loaded;
|
|
3223
3246
|
return await context.session.load();
|
|
3224
3247
|
}
|
|
3225
3248
|
const fn = (() => {
|
|
@@ -3242,6 +3265,7 @@ async function getSession(context, options) {
|
|
|
3242
3265
|
await restore();
|
|
3243
3266
|
return await context.session.load();
|
|
3244
3267
|
}
|
|
3268
|
+
await context.session.settled();
|
|
3245
3269
|
return await context.session.authorize(async () => {
|
|
3246
3270
|
await restore();
|
|
3247
3271
|
const loaded = await context.session.load();
|
|
@@ -3303,7 +3327,7 @@ var signInIds = /* @__PURE__ */ new Set([
|
|
|
3303
3327
|
function plugin() {
|
|
3304
3328
|
let loading;
|
|
3305
3329
|
function load() {
|
|
3306
|
-
loading ??= import("./dialog-
|
|
3330
|
+
loading ??= import("./dialog-4273L5TD.js").then((module) => module.dialog()).catch((error3) => {
|
|
3307
3331
|
loading = void 0;
|
|
3308
3332
|
throw error3;
|
|
3309
3333
|
});
|
|
@@ -3578,14 +3602,22 @@ function create3(options) {
|
|
|
3578
3602
|
return () => subscription.unsubscribe();
|
|
3579
3603
|
}
|
|
3580
3604
|
const rotated = /* @__PURE__ */ new Map();
|
|
3605
|
+
const authorizations = /* @__PURE__ */ new Set();
|
|
3581
3606
|
return {
|
|
3582
3607
|
actor,
|
|
3583
3608
|
async authorize(fn) {
|
|
3584
3609
|
if (!actor) return await fn();
|
|
3585
3610
|
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);
|
|
3586
3617
|
try {
|
|
3587
|
-
return await
|
|
3618
|
+
return await promise;
|
|
3588
3619
|
} finally {
|
|
3620
|
+
authorizations.delete(entry);
|
|
3589
3621
|
actor.send({ type: "authorize.end" });
|
|
3590
3622
|
}
|
|
3591
3623
|
},
|
|
@@ -3688,6 +3720,11 @@ function create3(options) {
|
|
|
3688
3720
|
},
|
|
3689
3721
|
reload,
|
|
3690
3722
|
renewing: () => actor?.getSnapshot().context.renewing,
|
|
3723
|
+
async settled() {
|
|
3724
|
+
if (authorizations.size === 0) return false;
|
|
3725
|
+
await Promise.all(authorizations);
|
|
3726
|
+
return true;
|
|
3727
|
+
},
|
|
3691
3728
|
async signedOut() {
|
|
3692
3729
|
if (actor ? context().marked : markedLocal) return true;
|
|
3693
3730
|
const stored = await (async () => store2?.getItem(`${name}:signed-out`))().catch(() => void 0);
|
|
@@ -4457,7 +4494,8 @@ function create4(options = {}) {
|
|
|
4457
4494
|
get: session2.get,
|
|
4458
4495
|
load: session2.load,
|
|
4459
4496
|
reload: session2.reload,
|
|
4460
|
-
renewing: session2.renewing
|
|
4497
|
+
renewing: session2.renewing,
|
|
4498
|
+
settled: session2.settled
|
|
4461
4499
|
}
|
|
4462
4500
|
};
|
|
4463
4501
|
const namespaces = {};
|
|
@@ -4481,6 +4519,10 @@ function create4(options = {}) {
|
|
|
4481
4519
|
refreshing ??= refresh2(context, { margin: 3e4 }).finally(() => {
|
|
4482
4520
|
refreshing = void 0;
|
|
4483
4521
|
});
|
|
4522
|
+
if (current.expiresAt - 5e3 > Date.now()) {
|
|
4523
|
+
refreshing.catch(() => void 0);
|
|
4524
|
+
return current.accessToken;
|
|
4525
|
+
}
|
|
4484
4526
|
const latest = await refreshing ?? context.session.get();
|
|
4485
4527
|
if (!latest) throw new SignedOutError2();
|
|
4486
4528
|
if (latest.user.id !== current.user.id) throw new SignedOutError2();
|
|
@@ -4493,7 +4535,7 @@ function create4(options = {}) {
|
|
|
4493
4535
|
function connections2() {
|
|
4494
4536
|
if (!connectionsOptions)
|
|
4495
4537
|
return Promise.reject(new ConnectionsRequiredError());
|
|
4496
|
-
attached ??= import("./Connections-
|
|
4538
|
+
attached ??= import("./Connections-RTGUTHPP.js").then(
|
|
4497
4539
|
(module) => module.attach(config, connectionsOptions)
|
|
4498
4540
|
);
|
|
4499
4541
|
return attached;
|
|
@@ -4551,6 +4593,7 @@ function create4(options = {}) {
|
|
|
4551
4593
|
}
|
|
4552
4594
|
},
|
|
4553
4595
|
session: {
|
|
4596
|
+
accessToken: accessToken2,
|
|
4554
4597
|
actor: session2.actor,
|
|
4555
4598
|
fetch: async (parameters) => fetch2(config, {
|
|
4556
4599
|
...parameters,
|
|
@@ -5568,10 +5611,10 @@ export {
|
|
|
5568
5611
|
frame2 as frame,
|
|
5569
5612
|
machines3 as machines,
|
|
5570
5613
|
dialog_exports,
|
|
5571
|
-
Actions_exports,
|
|
5572
5614
|
expired2,
|
|
5573
5615
|
accessKey,
|
|
5574
5616
|
toSession,
|
|
5617
|
+
Actions_exports,
|
|
5575
5618
|
from5 as from2,
|
|
5576
5619
|
PendingNotFoundError,
|
|
5577
5620
|
RequestError,
|
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-KUGGMQNM.js";
|
|
5
|
+
import "../chunk-GOY75KTX.js";
|
|
6
|
+
import "../chunk-HU7IKUQX.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-KUGGMQNM.js";
|
|
5
|
+
import "../chunk-GOY75KTX.js";
|
|
6
|
+
import "../chunk-HU7IKUQX.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-KUGGMQNM.js";
|
|
6
|
+
import "../chunk-GOY75KTX.js";
|
|
7
|
+
import "../chunk-HU7IKUQX.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-682.sha-d0df8be",
|
|
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": {
|