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.d.cts
CHANGED
|
@@ -970,6 +970,15 @@ interface SocialAuthState {
|
|
|
970
970
|
tron?: string;
|
|
971
971
|
} | null;
|
|
972
972
|
isNewUser: boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Who the provider said the user is — `{ name?, email?, picture? }`.
|
|
975
|
+
*
|
|
976
|
+
* `null` until a sign-in returns one, and stays null for email sign-in and
|
|
977
|
+
* for providers the user withheld a profile from. It is not persisted across
|
|
978
|
+
* reloads: the backend stores no profile, so a restored session has an
|
|
979
|
+
* address but no name. Copy it somewhere durable if you need it to survive.
|
|
980
|
+
*/
|
|
981
|
+
profile: AuthProfile | null;
|
|
973
982
|
isUnlocked: boolean;
|
|
974
983
|
sessionExpiresAt: number | null;
|
|
975
984
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -970,6 +970,15 @@ interface SocialAuthState {
|
|
|
970
970
|
tron?: string;
|
|
971
971
|
} | null;
|
|
972
972
|
isNewUser: boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Who the provider said the user is — `{ name?, email?, picture? }`.
|
|
975
|
+
*
|
|
976
|
+
* `null` until a sign-in returns one, and stays null for email sign-in and
|
|
977
|
+
* for providers the user withheld a profile from. It is not persisted across
|
|
978
|
+
* reloads: the backend stores no profile, so a restored session has an
|
|
979
|
+
* address but no name. Copy it somewhere durable if you need it to survive.
|
|
980
|
+
*/
|
|
981
|
+
profile: AuthProfile | null;
|
|
973
982
|
isUnlocked: boolean;
|
|
974
983
|
sessionExpiresAt: number | null;
|
|
975
984
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2400,7 +2400,12 @@ var TeeClient = class {
|
|
|
2400
2400
|
headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" },
|
|
2401
2401
|
body: JSON.stringify({ share: bytesToBase64(recoveryShare) })
|
|
2402
2402
|
});
|
|
2403
|
-
if (!res.ok)
|
|
2403
|
+
if (!res.ok) {
|
|
2404
|
+
const detail = await res.text().catch(() => "");
|
|
2405
|
+
throw new Error(
|
|
2406
|
+
`auth share enrolment failed (HTTP ${res.status})${detail ? `: ${detail.slice(0, 200)}` : ""}`
|
|
2407
|
+
);
|
|
2408
|
+
}
|
|
2404
2409
|
}
|
|
2405
2410
|
/**
|
|
2406
2411
|
* Ask the enclave for a fresh device share for this authenticated user.
|
|
@@ -2418,7 +2423,12 @@ var TeeClient = class {
|
|
|
2418
2423
|
headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" }
|
|
2419
2424
|
});
|
|
2420
2425
|
if (res.status === 409) return null;
|
|
2421
|
-
if (!res.ok)
|
|
2426
|
+
if (!res.ok) {
|
|
2427
|
+
const detail = await res.text().catch(() => "");
|
|
2428
|
+
throw new Error(
|
|
2429
|
+
`device share provisioning failed (HTTP ${res.status})${detail ? `: ${detail.slice(0, 200)}` : ""}`
|
|
2430
|
+
);
|
|
2431
|
+
}
|
|
2422
2432
|
const body = await res.json();
|
|
2423
2433
|
return base64ToBytes(body.deviceShare);
|
|
2424
2434
|
}
|
|
@@ -3621,6 +3631,22 @@ async function createDecaneConnect(config) {
|
|
|
3621
3631
|
addresses.evm = evmAddress = confirmed.evm;
|
|
3622
3632
|
addresses.solana = solanaAddress = confirmed.solana;
|
|
3623
3633
|
addresses.tron = tronAddress = confirmed.tron ?? evmToTronAddress2(confirmed.evm);
|
|
3634
|
+
if (serverAssistedRecovery) {
|
|
3635
|
+
for (let attempt = 1; attempt <= 2; attempt++) {
|
|
3636
|
+
try {
|
|
3637
|
+
const tee = new TeeClient(teeUrl);
|
|
3638
|
+
await tee.enrolAuthShare(jwt, shareSet.recovery);
|
|
3639
|
+
break;
|
|
3640
|
+
} catch (e) {
|
|
3641
|
+
if (attempt === 2) {
|
|
3642
|
+
console.warn(
|
|
3643
|
+
"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.",
|
|
3644
|
+
e
|
|
3645
|
+
);
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3624
3650
|
if (config.offerRecoveryAtSignup !== false && config.onRecoveryShareOffer) {
|
|
3625
3651
|
try {
|
|
3626
3652
|
const choice = await config.onRecoveryShareOffer({ evmAddress, solanaAddress });
|
|
@@ -3639,17 +3665,6 @@ async function createDecaneConnect(config) {
|
|
|
3639
3665
|
console.warn("decane-connect-kit: recovery share offer failed or was skipped.", e);
|
|
3640
3666
|
}
|
|
3641
3667
|
}
|
|
3642
|
-
if (serverAssistedRecovery) {
|
|
3643
|
-
try {
|
|
3644
|
-
const tee = new TeeClient(teeUrl);
|
|
3645
|
-
await tee.enrolAuthShare(jwt, shareSet.recovery);
|
|
3646
|
-
} catch (e) {
|
|
3647
|
-
console.warn(
|
|
3648
|
-
"decane-connect-kit: could not enrol this wallet for server-assisted recovery; a recovery file will be required on a new device.",
|
|
3649
|
-
e
|
|
3650
|
-
);
|
|
3651
|
-
}
|
|
3652
|
-
}
|
|
3653
3668
|
zeroize(shareSet.recovery);
|
|
3654
3669
|
return addresses;
|
|
3655
3670
|
}
|
|
@@ -3675,6 +3690,9 @@ async function createDecaneConnect(config) {
|
|
|
3675
3690
|
}
|
|
3676
3691
|
return addrs;
|
|
3677
3692
|
}
|
|
3693
|
+
console.warn(
|
|
3694
|
+
"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."
|
|
3695
|
+
);
|
|
3678
3696
|
} catch (e) {
|
|
3679
3697
|
console.warn(
|
|
3680
3698
|
"decane-connect-kit: server-assisted provisioning unavailable; falling back to passkey/recovery-file recovery.",
|
|
@@ -6168,6 +6186,7 @@ function WalletStatusOverlay({
|
|
|
6168
6186
|
var DEFAULT_SOCIAL = {
|
|
6169
6187
|
addresses: null,
|
|
6170
6188
|
isNewUser: false,
|
|
6189
|
+
profile: null,
|
|
6171
6190
|
isUnlocked: false,
|
|
6172
6191
|
sessionExpiresAt: null,
|
|
6173
6192
|
needsReconnect: false,
|
|
@@ -6281,6 +6300,7 @@ function DecaneKit({ config, children }) {
|
|
|
6281
6300
|
setSocialAuth({
|
|
6282
6301
|
addresses: result.addresses,
|
|
6283
6302
|
isNewUser: result.isNewUser,
|
|
6303
|
+
profile: result.profile ?? null,
|
|
6284
6304
|
isUnlocked: sdk?.isUnlocked() ?? false,
|
|
6285
6305
|
sessionExpiresAt: sdk?.sessionExpiresAt() ?? null,
|
|
6286
6306
|
needsReconnect: false,
|