decane-connect-kit 2.9.0 → 2.10.0

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.js CHANGED
@@ -2195,6 +2195,15 @@ var Storage = class {
2195
2195
  async getShare(userId) {
2196
2196
  return (await this._db).get(STORE, userId) ?? null;
2197
2197
  }
2198
+ /**
2199
+ * Every share this browser holds. Needed because signing out clears the
2200
+ * remembered identity while deliberately leaving the share behind, so the
2201
+ * userId that keys it is no longer known and the share can only be found by
2202
+ * enumeration. See passkeyDeviceCandidate().
2203
+ */
2204
+ async listShares() {
2205
+ return (await this._db).getAll(STORE);
2206
+ }
2198
2207
  async putShare(share) {
2199
2208
  await (await this._db).put(STORE, share);
2200
2209
  }
@@ -2215,14 +2224,15 @@ import { getCollateralAndVerify } from "@phala/dcap-qvl";
2215
2224
 
2216
2225
  // ../../infra/tee-measurement.json
2217
2226
  var tee_measurement_default = {
2218
- signerVersion: "0.1.3",
2227
+ signerVersion: "0.2.10",
2219
2228
  acceptedMrtd: [
2229
+ '["fb14dc139f33d6fcf474bc8332cac001259fb31cfbcb6b34d4ceeb552a2c4466884a0cbde45ad98a05c5c060c23ad65a","07e6f51aa763abfe75c3ddfbf4f425fe3f0ceff66d807a75e049303dce9addf68e7218729bd419638af63a370f65878c","a2a58c9a959a4fa44bd6da0c97a2270c051faf12084cfe91ae900e4fdff6cdd4f69a82005e04ee920f231497894d677f","a76a81147b7f733cb400914c8791ec149bb3a31f3727b1c1e12ec22e9c1a183b6e617e78636dca37075f5a695afd46c2"]',
2220
2230
  '["68102e7b524af310f7b7d426ce75481e36c40f5d513a9009c046e9d37e31551f0134d954b496a3357fd61d03f07ffe96","07e6f51aa763abfe75c3ddfbf4f425fe3f0ceff66d807a75e049303dce9addf68e7218729bd419638af63a370f65878c","a2a58c9a959a4fa44bd6da0c97a2270c051faf12084cfe91ae900e4fdff6cdd4f69a82005e04ee920f231497894d677f","a76a81147b7f733cb400914c8791ec149bb3a31f3727b1c1e12ec22e9c1a183b6e617e78636dca37075f5a695afd46c2"]'
2221
2231
  ],
2222
- primaryMrtd: '["68102e7b524af310f7b7d426ce75481e36c40f5d513a9009c046e9d37e31551f0134d954b496a3357fd61d03f07ffe96","07e6f51aa763abfe75c3ddfbf4f425fe3f0ceff66d807a75e049303dce9addf68e7218729bd419638af63a370f65878c","a2a58c9a959a4fa44bd6da0c97a2270c051faf12084cfe91ae900e4fdff6cdd4f69a82005e04ee920f231497894d677f","a76a81147b7f733cb400914c8791ec149bb3a31f3727b1c1e12ec22e9c1a183b6e617e78636dca37075f5a695afd46c2"]',
2223
- capturedAt: "2026-07-20T10:08:58.717Z",
2232
+ primaryMrtd: '["fb14dc139f33d6fcf474bc8332cac001259fb31cfbcb6b34d4ceeb552a2c4466884a0cbde45ad98a05c5c060c23ad65a","07e6f51aa763abfe75c3ddfbf4f425fe3f0ceff66d807a75e049303dce9addf68e7218729bd419638af63a370f65878c","a2a58c9a959a4fa44bd6da0c97a2270c051faf12084cfe91ae900e4fdff6cdd4f69a82005e04ee920f231497894d677f","a76a81147b7f733cb400914c8791ec149bb3a31f3727b1c1e12ec22e9c1a183b6e617e78636dca37075f5a695afd46c2"]',
2233
+ capturedAt: "2026-09-07T07:19:30.544601Z",
2224
2234
  tcbStatus: "UpToDate",
2225
- _note: "Captured from a live, signature-verified TDX quote (getCollateralAndVerify -> UpToDate) against decane-tee-signer v0.1.3 running on Phala Cloud CVM 786e714d-5042-4bf1-8060-0bc358f6a72f. measurement is the JSON.stringify(replayRtmrs()) output, compared as an opaque string (not parsed per-RTMR), matching the actual comparison logic in social/attestation.ts."
2235
+ _note: "Captured from the live CVM 786e714d-5042-4bf1-8060-0bc358f6a72f (app_4405742df08d\u2026) after the 2026-09-07 credential recovery. RTMR0 changed; RTMR1-3 did not \u2014 RTMR3 is the app-compose measurement, so the app's identity is unchanged and this is a platform/firmware move underneath the CVM (Phala node v0.6.0), not a change to what we deploy. Sealing was verified intact across it (/signer/sealing-status: sealingAvailable, roundTripOk, ready), so no auth_shares were lost. The previous measurement is retained above so a rollback still verifies. measurement is the JSON.stringify(replayRtmrs()) output, compared as an opaque string (not parsed per-RTMR), matching social/attestation.ts."
2226
2236
  };
2227
2237
 
2228
2238
  // src/social/attestation.ts
@@ -3947,7 +3957,15 @@ async function createDecaneConnect(config) {
3947
3957
  }
3948
3958
  async function passkeyLoginCandidate() {
3949
3959
  if (!persisted?.userId || !isPasskeySupported()) return null;
3950
- const stored = await storage.getShare(persisted.userId);
3960
+ return usablePasskeyShare(await storage.getShare(persisted.userId));
3961
+ }
3962
+ async function passkeyDeviceCandidate() {
3963
+ if (!isPasskeySupported()) return null;
3964
+ if (persisted?.userId) return passkeyLoginCandidate();
3965
+ const candidates = (await storage.listShares()).map(usablePasskeyShare).filter(Boolean);
3966
+ return candidates.length === 1 ? candidates[0] : null;
3967
+ }
3968
+ function usablePasskeyShare(stored) {
3951
3969
  if (!stored || stored.unlockMethod !== "passkey") return null;
3952
3970
  if (!stored.credentialId || !stored.prfSalt) return null;
3953
3971
  return stored;
@@ -4106,10 +4124,10 @@ async function createDecaneConnect(config) {
4106
4124
  return handleAuthResult(result);
4107
4125
  },
4108
4126
  async canSignInWithPasskey() {
4109
- return await passkeyLoginCandidate() !== null;
4127
+ return await passkeyDeviceCandidate() !== null;
4110
4128
  },
4111
4129
  async signInWithPasskey() {
4112
- const candidate = await passkeyLoginCandidate();
4130
+ const candidate = await passkeyDeviceCandidate();
4113
4131
  if (!candidate) throw new NewDeviceError();
4114
4132
  return passkeyLogin(candidate);
4115
4133
  },
@@ -6693,7 +6711,11 @@ function DecaneKit({ config, children }) {
6693
6711
  "session-expired",
6694
6712
  () => setSocialAuth((p) => ({ ...p, isUnlocked: false, sessionExpiresAt: null }))
6695
6713
  );
6696
- sdk.on("disconnected", () => setSocialAuth(DEFAULT_SOCIAL));
6714
+ sdk.on("disconnected", () => {
6715
+ setSocialAuth(DEFAULT_SOCIAL);
6716
+ sdk.canSignInWithPasskey().then((can) => setSocialAuth((p) => ({ ...p, canUsePasskey: can }))).catch(() => {
6717
+ });
6718
+ });
6697
6719
  sdk.on("wallet-creating", () => setSocialAuth((p) => ({ ...p, phase: "creating" })));
6698
6720
  sdk.on("wallet-unlocking", () => setSocialAuth((p) => ({ ...p, phase: "unlocking" })));
6699
6721
  sdk.on("connected", () => setSocialAuth((p) => ({ ...p, phase: null })));