From 58c3e2af86551ea625fdc48636745ffa631c673a Mon Sep 17 00:00:00 2001 From: Schluffe Date: Sat, 17 Oct 2026 00:59:12 +0200 Subject: [PATCH] WIP IV improve UX [snapshot task 2] --- CHANGELOG.md | 5 + README.md | 31 ++++++- docs/connection-investigation.md | 20 ++++ docs/device-identities.md | 90 ++++++++++++++++++ docs/ux-roadmap.md | 33 ++++--- scripts/browser-check.ts | 147 +++++++++++++++++++++++++++++- src/App.vue | 2 +- src/components/DeviceSettings.vue | 108 ++++++++++++++++++++++ src/components/TransferPanel.vue | 81 ++++++++++++++-- src/lib/identity.ts | 141 ++++++++++++++++++++++++++++ src/lib/session.ts | 44 ++++++++- src/lib/webrtc.ts | 19 ++-- src/style.css | 3 + tests/identity.test.ts | 49 ++++++++++ tests/session.test.ts | 26 ++++++ tests/webrtc.test.ts | 16 +++- 16 files changed, 779 insertions(+), 36 deletions(-) create mode 100644 docs/device-identities.md create mode 100644 src/components/DeviceSettings.vue create mode 100644 src/lib/identity.ts create mode 100644 tests/identity.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d61b3a4..69397e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +- Add opt-in hosted device identities and saved contacts, with fresh mutual + signatures bound to both connection fingerprints before remembered verification. +- Add contact removal, identity reset, and password-encrypted backup/restore. + Identity-enabled signaling uses v4; temporary v3 sessions remain available. + - Keep verified sessions open for “Send another file”, with separate acceptance and storage for each file. - Preserve the previous memory download until the next file is accepted. diff --git a/README.md b/README.md index 98ab362..0f35690 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ explicit opt-in by both people; no relay is configured automatically. Your fingerprint must equal their “Their fingerprint”, and vice versa. Compare every byte. Cancel on any mismatch. Both people must explicitly confirm before the app sends the filename, size, MIME metadata, or contents. + On later connections, a remembered device’s fresh proof can replace manual + comparison (see Remembered devices below). 4. The receiver sees the filename and size and explicitly accepts the file. On the hosted app (HTTPS or localhost), **Receive as download** shows the incoming file size and streams into the browser's download manager using a same-origin service worker. It requires transferable streams and service-worker support; Chromium and @@ -60,7 +62,7 @@ Keep both tabs open. Switching browser tabs or apps does not explicitly cancel the session, although browsers and mobile operating systems can suspend pages. Pending verification/acceptance expires after five minutes; stalled transfers expire after one minute. Idle verified sessions stay open. Lost connections need -fresh codes. Both peers must use protocol **v3**; older connection codes are +fresh codes. File transfers use protocol **v3**; pre-v3 connection codes are rejected before connecting. The local HTML supports the same manual flow. If an answer is rejected as invalid, correct the pasted answer and click Connect @@ -93,6 +95,33 @@ ports plus a 20-second answer delay; it is **not a cross-device test**. Add `--normal-candidates` to preserve the real candidate ports. No firewall changes, TURN credentials or public STUN service are required. +## Remembered devices + +On the hosted app, expand **Remembered devices** and choose **Create device +identity** on both browsers. Enable **Use my device identity for this connection**, +exchange codes, and compare both full fingerprints for the first pairing. Once +connected, give the peer a local nickname and choose **Remember device**. + +For later connections, enable your identity and select the **Expected device** +on each side before exchanging fresh codes. HellCon checks fresh signed proofs +bound to both device keys and both connection fingerprints. A matching saved key +can replace manual fingerprint comparison; file acceptance is still required. +A changed or missing identity requires manual comparison and never overwrites a +saved contact. Nicknames stay local. Public identities in codes can link sessions. + +Use **Forget** to remove a contact, or explicitly delete your identity and contacts. +Encrypted backup/restore includes both, protected by a password of at least 12 +characters. Keep that password separately. Clearing site data loses saved trust; +restoring a backup on another browser gives it the same identity. Browser-stored +keys remain accessible to trusted app code and are not protection against a +malicious host. Identity use defaults off after reload. Storage failure leaves +temporary connections available; downloaded local HTML stays manual. + +Identity-enabled codes use signaling version **4** and require the new build. +Temporary codes retain version **3**. If only one peer enables identity, the +current build uses manual comparison without remembering that connection. +See [the identity protocol and backup format](docs/device-identities.md). + ## Network privacy and optional TURN STUN discovers externally reachable addresses. Its operator can see your public diff --git a/docs/connection-investigation.md b/docs/connection-investigation.md index c3bd44b..dd3f1d4 100644 --- a/docs/connection-investigation.md +++ b/docs/connection-investigation.md @@ -98,3 +98,23 @@ and current-without-immediate-cleanup all delivered the fixed probe at roughly receiver did not report checking until the delayed answer was applied on the sender, unlike the reported physical-device attempt. It does not reproduce that attempt or establish that its answer-exchange timing is safe. + +## Subsequent successful transfer report + +The next supplied receiver/sender logs show a completed transfer. The receiver +created its answer at 0.1 s, sampled two in-progress pairs with no incoming checks +or responses through 12.0 s, then connected at 13.3 s. The sender applied the +answer at 40.3 s on its own clock and connected by 40.4 s. These are independent +time origins; the initial zero-response samples alone do not establish failure. + +Both final snapshots show one selected, nominated, succeeded srflx/UDP to +srflx/UDP pair, with DTLS connected and no relay candidates. The receiver reports +download storage and transfer done at 36.9 s; the sender reports awaiting-receipt +followed by done at 64.0 s. This establishes successful direct connectivity and +application-level completion for this attempt. The user also confirmed that the downloaded file saved and opened correctly. + +The supplied logs do not identify the browser, STUN provider, or whether any +network/setup settings changed. This success does not identify the cause of the +earlier failures or demonstrate a connectivity fix in the diagnostic changes. +The user identified the accompanying console warnings as stale and unrelated; +they are excluded from this result. diff --git a/docs/device-identities.md b/docs/device-identities.md new file mode 100644 index 0000000..e14ffae --- /dev/null +++ b/docs/device-identities.md @@ -0,0 +1,90 @@ +# Remembered-device protocol and storage + +Phase 3 adds optional hosted-browser identities. Temporary sessions still use +manual fingerprint comparison. The local HTML never opens identity storage. +This is an application protocol design and implementation review, not an +independent cryptographic audit. + +## Authentication transcript + +A device has an ECDSA P-256 key pair. An identity-enabled connection code uses +signaling envelope version 4 with a public key (65-byte uncompressed point, +lowercase hex) and a fresh 32-byte cryptographically random nonce. Both local +and remote SDP fingerprints continue to be validated as full SHA-256 values. +Temporary codes use version 3. Old builds reject version 4 before connecting. +Current builds accept both; if either participant uses a temporary identity, +both must manually verify fingerprints and no device is remembered. + +When both codes advertise identities, each FileSession ready frame includes an +ECDSA/SHA-256 signature. The signed UTF-8 bytes are JSON.stringify of this ordered +array, with no optional fields: + +``` +["HellCon device proof", 1, 4, role, + offerPublicKey, offerNonce, answerPublicKey, answerNonce, + offerFingerprint, answerFingerprint] +``` + +The role is `offerer` or `answerer`. Fingerprints are uppercase hex bytes separated +by one space. Signatures use Web Crypto's 64-byte P1363 encoding, lowercase hex. +The recipient verifies the other role with the other public key. Both keys, +both fresh nonces, and both DTLS certificate fingerprints are bound to the proof. +Roles and domain/version separation prevent reflection and cross-protocol use; +fresh contributions from both peers prevent replay into a new connection. +The signed fingerprints bind the identity to the encrypted transport. A proof +from another connection cannot authenticate an attacker-controlled DTLS peer. + +A local user either compares both full fingerprints or explicitly selects an +expected saved public key. A nickname alone has no protocol meaning. A matching +expected key permits local verification to proceed automatically, but metadata +and file data stay gated until the peer's fresh signature verifies. Unknown, +changed, missing, or downgraded identities require manual fingerprint comparison. +A changed key never replaces a saved contact automatically. An invalid or missing +signature in a negotiated identity session closes the session. Each file still +requires acceptance. The session receive queue is bounded to 2 MiB while signature +verification is pending and throughout transfers; the existing 1 MiB send windows +remain unchanged. + +Contacts may only be saved after both peers' ready frames pass verification. +Manual first pairing therefore authenticates the keys through the compared +transport fingerprints and proofs. Public identities in codes are linkable; +the UI makes this explicit before opt-in. No identities or nicknames are added +to diagnostic logs, and nicknames are not sent to peers. + +## Storage and recovery + +IndexedDB holds a CryptoKey private key, the public key, and at most 100 contacts. +Keys are extractable to support user-requested backups. Browser storage does not +protect against compromised app code, a hostile host, or compromised browser. +The identity-use checkbox defaults off after page load. Clearing site data loses +identity and contacts; an empty store never creates trust automatically. Storage +errors leave temporary sessions available. Unreadable storage can be explicitly +cleared before restoring a backup. Atomic revision checks reject stale writes +from other tabs instead of overwriting a newer identity or contact list. Controls for deletion/restoration +require explicit replacement consent and are disabled during a session. +Before each identity-enabled connection, settings are read again from storage. +A contact forgotten in another tab loses automatic verification on the next +connection; a replaced or deleted local identity requires opting in again. +A failed refresh stops setup instead of using cached trust. + +The v1 backup is JSON containing `format: "hellcon-identity"`, `version: 1`, +`iterations: 600000`, a 16-byte random salt, 12-byte random IV, and ciphertext. +Salt, IV, and ciphertext use lowercase hex. PBKDF2-HMAC-SHA-256 with 600,000 +iterations derives an AES-256-GCM key from the password (12–1024 characters, +UTF-8 without normalization). AES-GCM uses the default 128-bit authentication +tag and additional authenticated data `HellCon backup v1`. The encrypted JSON +contains the private JWK, public key, and contacts. Passwords are cleared from +the UI after operations and are never stored. Backup input is capped at 100 KB; +unsupported versions/iteration counts, malformed fields, wrong passwords, failed +authentication tags, invalid contacts, and mismatched private/public keys are +rejected before replacing stored data. Restoring a backup clones that identity; +there is no central revocation service. Contacts must forget a compromised key. + +Review checks: both role directions, substitution of either identity, alteration +of either nonce or fingerprint, forged signatures, replay into fresh contexts, +metadata gating during asynchronous verification, backup tampering and incorrect +passwords, and persistence/reconnection with real browser CryptoKeys. These +checks do not replace an independent protocol review. + +Web Crypto algorithm and key-storage reference: +https://www.w3.org/TR/WebCryptoAPI/ diff --git a/docs/ux-roadmap.md b/docs/ux-roadmap.md index 7826a82..61ccf6a 100644 --- a/docs/ux-roadmap.md +++ b/docs/ux-roadmap.md @@ -45,24 +45,27 @@ queues, empty files, separate acceptance, removal, decline, stale IDs/receipts, queue caps, storage cancellation, and verification gates. Browser checks exercise both directions, real bytes, accessibility, streaming downloads, and the local HTML. -## 3. Remember trusted devices +## 3. Remember trusted devices — implemented -Add opt-in local device identity and a contact list on the hosted app, backed by -browser storage. After authenticated first pairing, offer “Remember this device” -and a local nickname. Store public identities for contacts and protect the local -private identity using available browser cryptographic storage; this does not -protect against compromised app JavaScript. Temporary sessions remain available. +The hosted app offers opt-in device identities and up to 100 named contacts in +browser storage. First pairing requires manual fingerprint comparison; contacts +can be saved only after successful mutual verification. Later connections can +select an expected saved public key and verify fresh signed proofs bound to both +keys, both nonces, both DTLS fingerprints, and participant roles. Nicknames and +saved codes never authenticate a peer. Changed or missing identities require +manual comparison and never replace saved contacts automatically. -Specify and review mutual proof of identity bound to fresh session information, -both DTLS fingerprints, participant roles, and replay protection before building -automatic verification. Never infer trust from a nickname or saved connection -code. Changed identities require explicit re-verification. Continue requiring -file acceptance. Add contact removal, identity reset, storage-unavailable behavior, -and password-encrypted identity export/import with a reviewed backup format. +Temporary sessions remain the default, and every file still requires acceptance. +Contact removal, identity deletion, encrypted backup/restore, storage failure +fallback, unreadable-storage recovery, and conflicting-tab write protection are +implemented. The local HTML remains manual. Identity-enabled signaling uses v4; +temporary connections retain v3. Browser keys remain accessible to app code. -Test impersonation, replay, identity changes, wrong backup passwords, storage -loss, and mixed-version peers. Local HTML may remain temporary/manual; do not -block delivery on persistent identity support for file URLs. +Tests cover proof forgery and replay, altered session bindings, metadata gating, +wrong backup passwords and tampering, persistence across reload, changed identities, +storage denial/recovery, and protocol-version validation. Design and review notes +are in [the device identity protocol](device-identities.md); this is not an +independent cryptographic audit. ## 4. Shareable invitations diff --git a/scripts/browser-check.ts b/scripts/browser-check.ts index 5381a39..6d0a6b4 100644 --- a/scripts/browser-check.ts +++ b/scripts/browser-check.ts @@ -125,7 +125,7 @@ const enableTurn = (session: string) => evaluate(session, () => { const checkbox = window.__hellcon.element('.checkbox input'); if (!checkbox.checked) checkbox.click(); }); -async function connect(sender: string, receiver: string, size: number) { +async function connect(sender: string, receiver: string, size: number, changedIdentity = false) { await evaluate(sender, (size: number) => window.__hellcon.chooseFile(size, 'browser-test.bin'), size); await input(sender, '#stun-provider', provider); await input(receiver, '#stun-provider', provider); @@ -150,6 +150,7 @@ async function connect(sender: string, receiver: string, size: number) { const rf = await evaluate(receiver, () => [...document.querySelectorAll('.fp-row code')].map(e => e.textContent)); assert.equal(sf[0], rf[1]); assert.equal(sf[1], rf[0]); assert.equal(sf[0]?.split(' ').length, 32); assert.equal(await evaluate(receiver, () => !!document.querySelector('.incoming')), false); + if (changedIdentity) assert.ok(await evaluate(sender, () => document.body.textContent?.includes('Device identity differs from the expected contact'))); await click(sender, 'Both fingerprints match — confirm'); await new Promise(resolve => setTimeout(resolve, 100)); assert.equal(await evaluate(receiver, () => !!document.querySelector('.incoming')), false); @@ -324,6 +325,150 @@ try { await click(receiver, 'Receive in memory (up to 64 MiB)'); await wait(sender, () => window.__hellcon.element('[role=status]').textContent?.includes('confirmed the complete file')); console.log('PASS: fresh code exchange after a failed transfer succeeds without reloading either page.'); + if (!turn) { + const identitySender = await page(); + const identityReceiver = await page(origin.replace('127.0.0.1', 'localhost')); + await click(identityReceiver, 'Receive'); + for (const session of [identitySender, identityReceiver]) { + await evaluate(session, () => { const details = [...document.querySelectorAll('details')].find(el => el.querySelector('summary')?.textContent === 'Remembered devices'); if (details) details.open = true; }); + await wait(session, () => [...document.querySelectorAll('button')].some(button => button.textContent === 'Create device identity' && !button.disabled)); + await click(session, 'Create device identity'); + await wait(session, () => document.querySelector('#use-device-identity')?.checked); + } + await connect(identitySender, identityReceiver, 2048); + for (const session of [identitySender, identityReceiver]) { + await wait(session, () => !!document.querySelector('#contact-name')); + await input(session, '#contact-name', 'Paired device'); + await click(session, 'Remember device'); + await wait(session, () => !document.querySelector('#contact-name')); + } + await checkAccessibility(identitySender, 'remembered identity'); + await click(identityReceiver, 'Receive in memory (up to 64 MiB)'); + await wait(identitySender, () => document.body.textContent?.includes('The receiver confirmed the complete file.')); + await click(identitySender, 'Disconnect'); + await wait(identityReceiver, () => [...document.querySelectorAll('button')].some(button => button.textContent === 'Reset')); + // Reload both pages to exercise persisted CryptoKeys and contacts. + for (const [session, url] of [[identitySender, origin], [identityReceiver, origin.replace('127.0.0.1', 'localhost')]]) { + await call('Page.navigate', { url }, session); + await wait(session, () => !!document.querySelector('#stun-provider')); + } + await click(identityReceiver, 'Receive'); + for (const session of [identitySender, identityReceiver]) { + await wait(session, () => !!document.querySelector('#use-device-identity')); + assert.equal(await evaluate(session, () => document.querySelector('#use-device-identity')!.checked), false, 'Reload defaults to a temporary connection'); + await evaluate(session, () => document.querySelector('#use-device-identity')!.click()); + const key = await evaluate(session, () => document.querySelector('#expected-device')!.options[1]!.value); + await input(session, '#expected-device', key); + await input(session, '#stun-provider', 'none'); + } + await evaluate(identitySender, () => window.__hellcon.chooseFile(4096, 'remembered.bin')); + await click(identitySender, 'Create code'); await wait(identitySender, () => !!document.querySelector('#output-code')); + const offer = await evaluate(identitySender, () => window.__hellcon.element('#output-code').value); + assert.equal(JSON.parse(atob(offer)).version, 4); + await input(identityReceiver, '#offer-input', offer); await click(identityReceiver, 'Accept & create answer'); + await wait(identityReceiver, () => !!document.querySelector('#output-code')); + const answer = await evaluate(identityReceiver, () => window.__hellcon.element('#output-code').value); + await input(identitySender, '#answer-input', answer); await click(identitySender, 'Connect'); + await wait(identityReceiver, () => !!document.querySelector('.incoming')); + for (const session of [identitySender, identityReceiver]) assert.ok(await evaluate(session, () => document.body.textContent?.includes('Remembered device authenticated'))); + await click(identityReceiver, 'Receive in memory (up to 64 MiB)'); + await wait(identitySender, () => document.body.textContent?.includes('The receiver confirmed the complete file.')); + const rememberedBytes = await evaluate(identityReceiver, async () => { const bytes = new Uint8Array(await (await fetch(window.__hellcon.element('a.download').href)).arrayBuffer()); return { length: bytes.length, valid: bytes.every(byte => byte === 123) }; }); + assert.deepEqual(rememberedBytes, { length: 4096, valid: true }); + console.log('PASS: identities and contacts persist across reload; fresh mutual proofs authenticate remembered devices and transfer exact bytes without manual reconfirmation.'); + + await click(identitySender, 'Disconnect'); + await wait(identityReceiver, () => !document.querySelector('.incoming')); + await click(identitySender, 'Reset'); await click(identityReceiver, 'Reset'); + for (const forgottenSide of [identitySender, identityReceiver]) { + const editor = await page(forgottenSide === identitySender ? origin : origin.replace('127.0.0.1', 'localhost')); + await wait(editor, () => !!document.querySelector('#expected-device')); + await click(editor, 'Forget'); + await wait(editor, () => document.querySelector('#expected-device')?.options.length === 1); + assert.ok(await evaluate(forgottenSide, () => document.querySelector('#expected-device')!.value), 'Original tab still has the stale expected contact before connection setup'); + + await evaluate(identitySender, () => window.__hellcon.chooseFile(128, 'forgotten-contact.bin')); + await click(identitySender, 'Create code'); await wait(identitySender, () => !!document.querySelector('#output-code')); + const freshOffer = await evaluate(identitySender, () => window.__hellcon.element('#output-code').value); + await input(identityReceiver, '#offer-input', freshOffer); await click(identityReceiver, 'Accept & create answer'); + await wait(identityReceiver, () => !!document.querySelector('#output-code')); + const freshAnswer = await evaluate(identityReceiver, () => window.__hellcon.element('#output-code').value); + await input(identitySender, '#answer-input', freshAnswer); await click(identitySender, 'Connect'); + await wait(forgottenSide, () => document.body.textContent?.includes('New device. Compare both fingerprints manually')); + assert.equal(await evaluate(forgottenSide, () => document.querySelector('#expected-device')!.value), ''); + assert.equal(await evaluate(forgottenSide, () => document.querySelector('#expected-device')!.options.length), 1); + assert.equal(await evaluate(identityReceiver, () => !!document.querySelector('.incoming')), false, 'Forgotten trust must not release file metadata'); + await click(forgottenSide, 'Both fingerprints match — confirm'); + await wait(identityReceiver, () => !!document.querySelector('.incoming')); + await click(identityReceiver, 'Receive in memory (up to 64 MiB)'); + await wait(identitySender, () => document.body.textContent?.includes('The receiver confirmed the complete file.')); + await input(forgottenSide, '#contact-name', 'Paired device'); await click(forgottenSide, 'Remember device'); + await wait(forgottenSide, () => !document.querySelector('#contact-name')); + await click(identitySender, 'Disconnect'); + await wait(identityReceiver, () => !document.querySelector('.incoming')); + await click(identitySender, 'Reset'); await click(identityReceiver, 'Reset'); + const key = await evaluate(forgottenSide, () => document.querySelector('#expected-device')!.options[1]!.value); + await input(forgottenSide, '#expected-device', key); + } + console.log('PASS: forgetting a device in another tab removes stale trust before either role reconnects; manual confirmation gates metadata and permits pairing again.'); + + await evaluate(identitySender, () => { indexedDB.open = () => { throw new DOMException('Storage denied during refresh', 'SecurityError'); }; }); + await evaluate(identitySender, () => window.__hellcon.chooseFile(1, 'storage-failure.bin')); + await click(identitySender, 'Create code'); + await wait(identitySender, () => document.body.textContent?.includes('Storage denied during refresh')); + assert.equal(await evaluate(identitySender, () => !!document.querySelector('#output-code')), false, 'Failed storage refresh must not use cached trust'); + await evaluate(identitySender, () => { Reflect.deleteProperty(indexedDB, 'open'); }); + await click(identitySender, 'Reset'); + console.log('PASS: unreadable storage during connection setup cannot reuse a cached identity or contact.'); + + await evaluate(identityReceiver, () => { + const label = [...document.querySelectorAll('label')].find(el => el.textContent?.includes('Replace or delete')); + label?.querySelector('input')?.click(); + }); + await click(identityReceiver, 'Delete identity and contacts'); + await wait(identityReceiver, () => [...document.querySelectorAll('button')].some(button => button.textContent === 'Create device identity')); + await click(identityReceiver, 'Create device identity'); + await wait(identityReceiver, () => document.querySelector('#use-device-identity')?.checked); + await connect(identitySender, identityReceiver, 512, true); + await click(identityReceiver, 'Receive in memory (up to 64 MiB)'); + await wait(identitySender, () => document.body.textContent?.includes('The receiver confirmed the complete file.')); + assert.equal(await evaluate(identitySender, () => document.querySelector('#expected-device')!.options.length), 2, 'Changed identity must not replace or append saved contacts automatically'); + console.log('PASS: replaced peer identity requires manual comparison and preserves the original saved contact.'); + const stale = await page(); + await wait(stale, () => !!document.querySelector('#use-device-identity')); + await evaluate(stale, async () => { + const db = await new Promise((resolve, reject) => { const request = indexedDB.open('hellcon-devices', 1); request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error); }); + await new Promise((resolve, reject) => { + const tx = db.transaction('settings', 'readwrite'), store = tx.objectStore('settings'), request = store.get('state'); + request.onsuccess = () => store.put({ ...request.result, revision: crypto.randomUUID() }, 'state'); + tx.oncomplete = () => resolve(); tx.onabort = () => reject(tx.error); + }); db.close(); + }); + await click(stale, 'Forget'); + await wait(stale, () => document.body.textContent?.includes('Device settings changed in another tab')); + await evaluate(stale, async () => { + const db = await new Promise(resolve => { const request = indexedDB.open('hellcon-devices', 1); request.onsuccess = () => resolve(request.result); }); + await new Promise(resolve => { const tx = db.transaction('settings', 'readwrite'); tx.objectStore('settings').put({ identity: null, contacts: 'broken', revision: 'broken' }, 'state'); tx.oncomplete = () => resolve(); }); db.close(); + }); + await call('Page.navigate', { url: origin }, stale); + await wait(stale, () => document.body.textContent?.includes('Invalid contact list')); + await evaluate(stale, () => [...document.querySelectorAll('label')].find(label => label.textContent?.includes('Delete unreadable device storage'))?.querySelector('input')?.click()); + await click(stale, 'Clear device storage'); + await wait(stale, () => [...document.querySelectorAll('button')].some(button => button.textContent === 'Create device identity' && !button.disabled)); + console.log('PASS: stale contact edits cannot overwrite newer settings; unreadable storage can be cleared with explicit consent.'); + const denied = await page(); + await call('Page.addScriptToEvaluateOnNewDocument', { source: "indexedDB.open = () => { throw new DOMException('Storage denied', 'SecurityError'); };" }, denied); + await call('Page.navigate', { url: origin }, denied); + await wait(denied, () => document.body.textContent?.includes('Storage denied')); + await evaluate(denied, () => window.__hellcon.chooseFile(1, 'temporary.bin')); + await input(denied, '#stun-provider', 'none'); await click(denied, 'Create code'); + await wait(denied, () => !!document.querySelector('#output-code')); + const temporary = await evaluate(denied, () => window.__hellcon.element('#output-code').value); + assert.equal(JSON.parse(atob(temporary)).version, 3); + await click(denied, 'Cancel connection'); + console.log('PASS: denied identity storage still allows temporary v3 connection setup.'); + + } if (turn) console.log(`PASS: forced TURN over ${transport.toUpperCase()}, relay candidates at both ends, exact file bytes and receipt.`); assert.deepEqual(browserErrors, []); } diff --git a/src/App.vue b/src/App.vue index 09d0915..3265781 100644 --- a/src/App.vue +++ b/src/App.vue @@ -40,7 +40,7 @@ const canDownloadApp = import.meta.env.PROD && !isLocal;