WIP IV improve UX [snapshot task 2]
This commit is contained in:
1 parent
28c90d1d71
commit
58c3e2af86
16 files changed
+779
-36
No files matched your search
@@ -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/
|
||||
Reference in new issue
Block a user