decane-connect-kit 2.7.0 → 2.7.2
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/index.cjs +33 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +33 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2475,7 +2475,12 @@ var TeeClient = class {
|
|
|
2475
2475
|
headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" },
|
|
2476
2476
|
body: JSON.stringify({ share: bytesToBase64(recoveryShare) })
|
|
2477
2477
|
});
|
|
2478
|
-
if (!res.ok)
|
|
2478
|
+
if (!res.ok) {
|
|
2479
|
+
const detail = await res.text().catch(() => "");
|
|
2480
|
+
throw new Error(
|
|
2481
|
+
`auth share enrolment failed (HTTP ${res.status})${detail ? `: ${detail.slice(0, 200)}` : ""}`
|
|
2482
|
+
);
|
|
2483
|
+
}
|
|
2479
2484
|
}
|
|
2480
2485
|
/**
|
|
2481
2486
|
* Ask the enclave for a fresh device share for this authenticated user.
|
|
@@ -2493,7 +2498,12 @@ var TeeClient = class {
|
|
|
2493
2498
|
headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" }
|
|
2494
2499
|
});
|
|
2495
2500
|
if (res.status === 409) return null;
|
|
2496
|
-
if (!res.ok)
|
|
2501
|
+
if (!res.ok) {
|
|
2502
|
+
const detail = await res.text().catch(() => "");
|
|
2503
|
+
throw new Error(
|
|
2504
|
+
`device share provisioning failed (HTTP ${res.status})${detail ? `: ${detail.slice(0, 200)}` : ""}`
|
|
2505
|
+
);
|
|
2506
|
+
}
|
|
2497
2507
|
const body = await res.json();
|
|
2498
2508
|
return base64ToBytes(body.deviceShare);
|
|
2499
2509
|
}
|
|
@@ -3696,6 +3706,22 @@ async function createDecaneConnect(config) {
|
|
|
3696
3706
|
addresses.evm = evmAddress = confirmed.evm;
|
|
3697
3707
|
addresses.solana = solanaAddress = confirmed.solana;
|
|
3698
3708
|
addresses.tron = tronAddress = confirmed.tron ?? evmToTronAddress2(confirmed.evm);
|
|
3709
|
+
if (serverAssistedRecovery) {
|
|
3710
|
+
for (let attempt = 1; attempt <= 2; attempt++) {
|
|
3711
|
+
try {
|
|
3712
|
+
const tee = new TeeClient(teeUrl);
|
|
3713
|
+
await tee.enrolAuthShare(jwt, shareSet.recovery);
|
|
3714
|
+
break;
|
|
3715
|
+
} catch (e) {
|
|
3716
|
+
if (attempt === 2) {
|
|
3717
|
+
console.warn(
|
|
3718
|
+
"decane-connect-kit: could not enrol this wallet for server-assisted recovery; a recovery file will be required on a new device. This wallet will get a 409 not_enrolled from /signer/provision until it is re-enrolled.",
|
|
3719
|
+
e
|
|
3720
|
+
);
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3699
3725
|
if (config.offerRecoveryAtSignup !== false && config.onRecoveryShareOffer) {
|
|
3700
3726
|
try {
|
|
3701
3727
|
const choice = await config.onRecoveryShareOffer({ evmAddress, solanaAddress });
|
|
@@ -3714,17 +3740,6 @@ async function createDecaneConnect(config) {
|
|
|
3714
3740
|
console.warn("decane-connect-kit: recovery share offer failed or was skipped.", e);
|
|
3715
3741
|
}
|
|
3716
3742
|
}
|
|
3717
|
-
if (serverAssistedRecovery) {
|
|
3718
|
-
try {
|
|
3719
|
-
const tee = new TeeClient(teeUrl);
|
|
3720
|
-
await tee.enrolAuthShare(jwt, shareSet.recovery);
|
|
3721
|
-
} catch (e) {
|
|
3722
|
-
console.warn(
|
|
3723
|
-
"decane-connect-kit: could not enrol this wallet for server-assisted recovery; a recovery file will be required on a new device.",
|
|
3724
|
-
e
|
|
3725
|
-
);
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
3743
|
zeroize(shareSet.recovery);
|
|
3729
3744
|
return addresses;
|
|
3730
3745
|
}
|
|
@@ -3750,6 +3765,9 @@ async function createDecaneConnect(config) {
|
|
|
3750
3765
|
}
|
|
3751
3766
|
return addrs;
|
|
3752
3767
|
}
|
|
3768
|
+
console.warn(
|
|
3769
|
+
"decane-connect-kit: this wallet is not enrolled for server-assisted provisioning (/signer/provision returned 409 not_enrolled), so a device share cannot be issued from the JWT alone. Falling back to passkey sync, then the recovery file."
|
|
3770
|
+
);
|
|
3753
3771
|
} catch (e) {
|
|
3754
3772
|
console.warn(
|
|
3755
3773
|
"decane-connect-kit: server-assisted provisioning unavailable; falling back to passkey/recovery-file recovery.",
|
|
@@ -6236,6 +6254,7 @@ function WalletStatusOverlay({
|
|
|
6236
6254
|
var DEFAULT_SOCIAL = {
|
|
6237
6255
|
addresses: null,
|
|
6238
6256
|
isNewUser: false,
|
|
6257
|
+
profile: null,
|
|
6239
6258
|
isUnlocked: false,
|
|
6240
6259
|
sessionExpiresAt: null,
|
|
6241
6260
|
needsReconnect: false,
|
|
@@ -6349,6 +6368,7 @@ function DecaneKit({ config, children }) {
|
|
|
6349
6368
|
setSocialAuth({
|
|
6350
6369
|
addresses: result.addresses,
|
|
6351
6370
|
isNewUser: result.isNewUser,
|
|
6371
|
+
profile: result.profile ?? null,
|
|
6352
6372
|
isUnlocked: sdk?.isUnlocked() ?? false,
|
|
6353
6373
|
sessionExpiresAt: sdk?.sessionExpiresAt() ?? null,
|
|
6354
6374
|
needsReconnect: false,
|