Lengthen codes and keep going after a failed security check

The security check compares 8 instead of 5 fingerprint bytes, too many to
brute force matching certificates. The tracker code has 8 digits, making
collisions between concurrent senders 100x less likely.

A "Codes don't match" button, or a peer leaving before the transfer
starts, ends that connection without ending the share: the tracker sender
answers the next (or a queued) offer, the receiver replaces its used up
offers. Both codes are aligned below each other.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SchluffeandClaude Opus 5.5 committed 2026-10-23 01:01:45 +02:00
1 parent 9282865a8c
commit 08b9f659c2
4 files changed
+228 -54

No files matched your search

+18 -9
View File
@@ -23,20 +23,20 @@ const answer = ref('');
const receiveCode = ref('');
const check = ref<Check>();
const confirmCheck = ref<() => void>();
const confirmed = ref(false);
const log = ref<string[]>([]);
const events: Events = {
log: (message) => log.value.push(`${new Date().toISOString().slice(11, 23)} ${message}`),
check: (result, confirm) => {
check: (result) => {
check.value = result;
confirmCheck.value = confirm;
confirmed.value = false;
},
};
function onConfirm() {
confirmCheck.value?.();
confirmCheck.value = undefined;
confirmed.value = true;
check.value?.confirm();
}
let acceptAnswer: ((answer: string) => Promise<void>) | undefined;
@@ -98,10 +98,19 @@ function onReceive() {
<main>
<aside v-if="check" role="alert">
<p>
Security check, you: <output id="check-local">{{ check.local }}</output>, peer:
<output id="check-remote">{{ check.remote }}</output>. The other side must show the same two codes swapped. Both sides confirm, nothing is transferred before.
Security check: the other side must show the same two codes, swapped. Both sides confirm, nothing is
transferred before.
</p>
<button v-if="confirmCheck" id="confirm" @click="onConfirm">Codes match</button>
<dl>
<dt>You</dt>
<dd><output id="check-local">{{ check.local }}</output></dd>
<dt>Peer</dt>
<dd><output id="check-remote">{{ check.remote }}</output></dd>
</dl>
<div v-if="!confirmed">
<button id="confirm" @click="onConfirm">Codes match</button>
<button id="reject" @click="check.reject()">Codes don't match</button>
</div>
</aside>
<article>
@@ -153,7 +162,7 @@ function onReceive() {
</section>
<section>
<h3>Tracker <small>optional</small></h3>
<h3>Tracker</h3>
<div role="group">
<input id="receive-code" v-model="receiveCode" placeholder="Code" />
<button id="receive" @click="onReceive">Receive</button>