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.cjs CHANGED
@@ -2271,6 +2271,15 @@ var Storage = class {
2271
2271
  async getShare(userId) {
2272
2272
  return (await this._db).get(STORE, userId) ?? null;
2273
2273
  }
2274
+ /**
2275
+ * Every share this browser holds. Needed because signing out clears the
2276
+ * remembered identity while deliberately leaving the share behind, so the
2277
+ * userId that keys it is no longer known and the share can only be found by
2278
+ * enumeration. See passkeyDeviceCandidate().
2279
+ */
2280
+ async listShares() {
2281
+ return (await this._db).getAll(STORE);
2282
+ }
2274
2283
  async putShare(share) {
2275
2284
  await (await this._db).put(STORE, share);
2276
2285
  }
@@ -2291,14 +2300,15 @@ init_errors();
2291
2300
 
2292
2301
  // ../../infra/tee-measurement.json
2293
2302
  var tee_measurement_default = {
2294
- signerVersion: "0.1.3",
2303
+ signerVersion: "0.2.10",
2295
2304
  acceptedMrtd: [
2305
+ '["fb14dc139f33d6fcf474bc8332cac001259fb31cfbcb6b34d4ceeb552a2c4466884a0cbde45ad98a05c5c060c23ad65a","07e6f51aa763abfe75c3ddfbf4f425fe3f0ceff66d807a75e049303dce9addf68e7218729bd419638af63a370f65878c","a2a58c9a959a4fa44bd6da0c97a2270c051faf12084cfe91ae900e4fdff6cdd4f69a82005e04ee920f231497894d677f","a76a81147b7f733cb400914c8791ec149bb3a31f3727b1c1e12ec22e9c1a183b6e617e78636dca37075f5a695afd46c2"]',
2296
2306
  '["68102e7b524af310f7b7d426ce75481e36c40f5d513a9009c046e9d37e31551f0134d954b496a3357fd61d03f07ffe96","07e6f51aa763abfe75c3ddfbf4f425fe3f0ceff66d807a75e049303dce9addf68e7218729bd419638af63a370f65878c","a2a58c9a959a4fa44bd6da0c97a2270c051faf12084cfe91ae900e4fdff6cdd4f69a82005e04ee920f231497894d677f","a76a81147b7f733cb400914c8791ec149bb3a31f3727b1c1e12ec22e9c1a183b6e617e78636dca37075f5a695afd46c2"]'
2297
2307
  ],
2298
- primaryMrtd: '["68102e7b524af310f7b7d426ce75481e36c40f5d513a9009c046e9d37e31551f0134d954b496a3357fd61d03f07ffe96","07e6f51aa763abfe75c3ddfbf4f425fe3f0ceff66d807a75e049303dce9addf68e7218729bd419638af63a370f65878c","a2a58c9a959a4fa44bd6da0c97a2270c051faf12084cfe91ae900e4fdff6cdd4f69a82005e04ee920f231497894d677f","a76a81147b7f733cb400914c8791ec149bb3a31f3727b1c1e12ec22e9c1a183b6e617e78636dca37075f5a695afd46c2"]',
2299
- capturedAt: "2026-07-20T10:08:58.717Z",
2308
+ primaryMrtd: '["fb14dc139f33d6fcf474bc8332cac001259fb31cfbcb6b34d4ceeb552a2c4466884a0cbde45ad98a05c5c060c23ad65a","07e6f51aa763abfe75c3ddfbf4f425fe3f0ceff66d807a75e049303dce9addf68e7218729bd419638af63a370f65878c","a2a58c9a959a4fa44bd6da0c97a2270c051faf12084cfe91ae900e4fdff6cdd4f69a82005e04ee920f231497894d677f","a76a81147b7f733cb400914c8791ec149bb3a31f3727b1c1e12ec22e9c1a183b6e617e78636dca37075f5a695afd46c2"]',
2309
+ capturedAt: "2026-09-07T07:19:30.544601Z",
2300
2310
  tcbStatus: "UpToDate",
2301
- _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."
2311
+ _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."
2302
2312
  };
2303
2313
 
2304
2314
  // src/social/attestation.ts
@@ -4023,7 +4033,15 @@ async function createDecaneConnect(config) {
4023
4033
  }
4024
4034
  async function passkeyLoginCandidate() {
4025
4035
  if (!persisted?.userId || !isPasskeySupported()) return null;
4026
- const stored = await storage.getShare(persisted.userId);
4036
+ return usablePasskeyShare(await storage.getShare(persisted.userId));
4037
+ }
4038
+ async function passkeyDeviceCandidate() {
4039
+ if (!isPasskeySupported()) return null;
4040
+ if (persisted?.userId) return passkeyLoginCandidate();
4041
+ const candidates = (await storage.listShares()).map(usablePasskeyShare).filter(Boolean);
4042
+ return candidates.length === 1 ? candidates[0] : null;
4043
+ }
4044
+ function usablePasskeyShare(stored) {
4027
4045
  if (!stored || stored.unlockMethod !== "passkey") return null;
4028
4046
  if (!stored.credentialId || !stored.prfSalt) return null;
4029
4047
  return stored;
@@ -4182,10 +4200,10 @@ async function createDecaneConnect(config) {
4182
4200
  return handleAuthResult(result);
4183
4201
  },
4184
4202
  async canSignInWithPasskey() {
4185
- return await passkeyLoginCandidate() !== null;
4203
+ return await passkeyDeviceCandidate() !== null;
4186
4204
  },
4187
4205
  async signInWithPasskey() {
4188
- const candidate = await passkeyLoginCandidate();
4206
+ const candidate = await passkeyDeviceCandidate();
4189
4207
  if (!candidate) throw new NewDeviceError();
4190
4208
  return passkeyLogin(candidate);
4191
4209
  },
@@ -6762,7 +6780,11 @@ function DecaneKit({ config, children }) {
6762
6780
  "session-expired",
6763
6781
  () => setSocialAuth((p) => ({ ...p, isUnlocked: false, sessionExpiresAt: null }))
6764
6782
  );
6765
- sdk.on("disconnected", () => setSocialAuth(DEFAULT_SOCIAL));
6783
+ sdk.on("disconnected", () => {
6784
+ setSocialAuth(DEFAULT_SOCIAL);
6785
+ sdk.canSignInWithPasskey().then((can) => setSocialAuth((p) => ({ ...p, canUsePasskey: can }))).catch(() => {
6786
+ });
6787
+ });
6766
6788
  sdk.on("wallet-creating", () => setSocialAuth((p) => ({ ...p, phase: "creating" })));
6767
6789
  sdk.on("wallet-unlocking", () => setSocialAuth((p) => ({ ...p, phase: "unlocking" })));
6768
6790
  sdk.on("connected", () => setSocialAuth((p) => ({ ...p, phase: null })));