WIP IV improve UX [snapshot task 2]

This commit is contained in:
Schluffe committed 2026-10-17 00:59:12 +02:00
1 parent 28c90d1d71
commit 58c3e2af86
16 files changed
+779 -36

No files matched your search

+20
View File
@@ -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.
+90
View File
@@ -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/
+18 -15
View File
@@ -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