1093 Commits

Author SHA1 Message Date
Taksh Kothari
ef84a3f153
Merge c1fd702821e0ecb01d870f67c63f2be611247696 into 04995f68e470a18d1fc99f86fa326c2a87bab4f2 2026-11-05 12:21:14 +05:30
callebtc
04995f68e4
Port the Android globe geohash picker to iOS (#1807)
* Port the Android globe geohash picker to iOS

Adds the 3D globe picker from bitchat-android: a map button next to the
geohash field opens a full-screen orthographic globe (Natural Earth land,
borders and cities, geohash grid, crosshair) with drag/fling, pinch, tap
and double-tap, precision buttons and a fly-in to the current geohash.
Selecting teleports like typing a geohash.

Beyond a straight port:
- Fix ocean painted as land: the point-in-ring test counted the
  antimeridian seam as a crossing for Eurasia, flipping its fill over the
  Pacific and Atlantic. Android has the same bug.
- Motion detail only steps down within one gesture, so layers no longer
  flash on and off while dragging.
- The geohash grid and city dots draw at every detail level instead of
  vanishing while the globe moves.

Extracts GeohashCoverage so the sheet and picker share the cell-size
string, and adds the picker strings in all locales.

* Let the globe reach polar targets past the drag limit

A polar cell's center can lie past the ±89° drag limit (zzzz is at
89.91°). The animated intro clamped its latitude there and selected
zzzf, while the Reduce Motion path kept zzzz. Animations now always
reach their target; dragging keeps the limit on the far side and never
snaps a polar view back to it.
2026-10-25 02:55:00 +02:00
jack
30c58eee34
Bump version to 1.8.0 (#1796)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v1.8.0
2026-10-23 22:17:57 +02:00
jack
44d6445bdf
Fix swift build on Xcode 27 and clear its Swift 6.4 warnings (#1795)
* Drop letterless string catalog keys so swift build works on Xcode 27
* Test that every manual catalog key can become a Swift symbol
* Silence Xcode 27's new import and capture warnings
* Drop the try markers Xcode 27 flags as unnecessary in tests
* Drop the try on the ECDH call that stopped throwing in #1782
* Tag the group hashtag with the app language and format the header count

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 22:17:42 +02:00
jack
e18c073c2c
Extend the Matrix backdrop into the safe area (#1794)
In dark mode the people sheet showed a dark-gray band over the
home-indicator inset, with the list rows scrolling across it. The App
Info and fingerprint sheets had the same band, and App Info also had a
gray strip under its navigation bar.

The gray is the sheet's own background: systemBackground at the elevated
level, which is #1C1C1E in dark mode. Since #1337 the Matrix backdrop is a
bare Color inside ThemedRootBackground. Passed to .background(_:) as a
view, it stops at the safe area, where the old Color background (a
ShapeStyle) extended into it. The glass gradient already ignores the
safe area, so give the Matrix branch the same modifier.

In light mode the band is white on white, which is why it only showed in
dark mode. It is not the iOS 26 scroll edge effect: hiding that effect
leaves the band pixel-identical.

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 21:23:23 +02:00
jack
27b6a4fddb
Tell my own messages apart by sender ID, not nickname (#1793)
* Tell my own messages apart by sender ID, not nickname
* Mute mention and hug alerts only for my own messages, by sender ID
* Keep my geo-DM rows mine when merging threads; sync receipts by ID
* Drop my memoized geochat sender ID on the switch to #mesh
* Keep my geo-DM threads out of a namesake's chat
* Cover my own rows from the real send paths
* Wipe the view model's own location manager on panic
* Keep my geo-DM threads out of a namesake's chat on migration
* Send through the composer's entry points in the send-path tests
* Say the restamp in consolidateMessages is defense in depth
* Pin that a thread with my replies stays out of a namesake's chat
* Judge my rows by sender ID when migrating a chat by nickname
* Count only the peer's rows as evidence in a geo-DM thread

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:24:44 +02:00
jack
044d1ea68c
Gate geochat scaling regressions in the performance floor check (#1791)
* Gate geochat scaling regressions in the performance floor check
* Base the geochat format floor on its first CI run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:24:27 +02:00
jack
88ee1ae6db
Fix geochat timeline scrolling and cut per-row render work (#1790)
* Remove the public batching flag that never suppressed animations
* Stop republishing unchanged composer state to every message row
* Scan message rows once and cache media row headers
* Keep media rows to mesh senders and single-component filenames
* Keep the message list where the reader left it
* Retry the scroll to the bottom only when it did not land
* Republish media capability only on change; keep bridged text as text
* Land timeline switches in one change and shrink the window at the bottom
* Follow only a message of mine that landed since the mark

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:24:06 +02:00
jack
14c6b0b47d
Stop rebuilding the geochat roster on every inbound event (#1789)
* Stop rebuilding the geochat roster on every inbound event
* Keep geochat names and counts current after the roster change
* Rebuild mesh rows from every peer snapshot
* Mark teleport only for activity that counts as presence

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:23:39 +02:00
jack
5fa0d3e733
Make the geochat people list linear in the participant count (#1788)
* Make the geohash people list linear in the participant count
* Keep GeohashPeopleList's equality nonisolated
* Give the palette tests their own location manager
* Keep the palette key's fields out of Periphery's assign-only check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:22:54 +02:00
Chris
ef38f4a369
build(deps): bump swift-secp256k1 from 0.21.1 to 0.24.0 (#1782)
Fixes permissionlesstech/bitchat#1755 via 0.24.0 because the latest release drops the SharedSourcesPlugin build tool that failed Xcode 27 plug-in validation and compiles under the Swift 6.4 toolchain.

Co-authored-by: csjones <637026+csjones@users.noreply.github.com>
2026-10-23 20:22:42 +02:00
Taksh
c1fd702821 fix: preserve authenticated state and bound negotiated media limits 2026-09-30 20:52:10 +05:30
Taksh
53dda159f4 Honour a negotiated ceiling when planning private media
Advertise our own reassembler's bound in authenticated peer state, keep
each peer's advertised bound pinned to the generation that stated it, and
size outbound transfers against it.

Two behaviour changes fall out of this:

The preflight no longer only inspects directed `fileTransfer`. An
advertised ceiling constrains encrypted media too, and a small
reassembler behind the 0x20 path is exactly the case the type proxy
cannot see. Peers that advertise nothing keep the old classification, so
released clients are unaffected.

The rejection message carries the real limit instead of a hardcoded 256,
which is no longer always the number in force. The existing key keeps
every locale's translation with only the numeral parameterized.

Retires TODO(#1434).
2026-09-25 21:34:54 +05:30
Taksh
a4581ff1d6 Add BLEFragmentCeilingPolicy for the per-recipient fragment bound
Turn the inline type check in broadcastPacket into a value: given the
packet type, whether it is directed, and whatever the recipient
advertised, decide the fragment bound and say which of the three reasons
produced it.

An advertised ceiling replaces the proxy in both directions. Below 256 is
the case the proxy gets wrong silently — we plan fragments the peer drops
and see no local failure. Above 256 is a peer telling us the deployed
Android assumption behind that cap does not describe it.

Every decision is clamped to what we would reassemble ourselves, so one
side raising its configuration cannot raise the other side's memory
exposure.

No caller yet; this commit is the decision and its tests.
2026-09-25 21:34:54 +05:30
Taksh
18c9f5a3ba Carry an explicit reassembly ceiling in authenticated peer state
The `.privateMedia` capability bit tells a sender that a peer understands
encrypted media. It says nothing about how much of it that peer can hold,
so senders have had to infer the ceiling from the packet type instead.

Add TLV 0x03 to the authenticated peer-state packet: a 2-byte big-endian
count of fragments the peer will reassemble for one packet. Absent means
"not advertised", which is what every already-released client sends, so
old peers keep decoding unchanged.

An unreadable 0x03 (zero, wrong width, duplicated) is rejected rather
than skipped like an unknown TLV. Skipping it would read as "said
nothing", and "said nothing" falls back to the permissive proxy — the
opposite of what a peer sending the field is asking for.

Name the receiver's own 10,000-fragment guard while here, so the number
we advertise and the number we enforce cannot drift apart.
2026-09-25 21:34:54 +05:30
Taksh Kothari
5e9287fae1
Keep composer drafts across mesh, geohash, and DM switches (#1569)
* feat: add ComposerDraftStore for per-conversation drafts

Keep unfinished composer text keyed by mesh, geohash, or DM peer so
channel switches stop silently discarding what someone was typing.

* feat: restore composer drafts across channel and DM switches

Save on leave and background, reload on enter, clear after send, and
wipe drafts during panic clear.

* test: cover ComposerDraftStore isolation, truncation, and reset

Pinned cases for mesh/geo/DM keys and the panic-wipe clear path.

* test: assert composer draft map stays within maxDraftCount

Newest keys win when the store is already full so prefs cannot grow without bound.

* fix: import BitFoundation so ComposerDraftStore sees PeerID

iOS target build failed without the module import that SPM resolved
transitively but Xcode did not. Also keep the eviction test inside the
test suite type.

* fix: clear in-memory composer draft on panic wipe

ComposerDraftStore.reset() alone left messageText in ContentView, so the
next background transition could persist the pre-wipe draft again.

* Address Jack review: keep composer drafts in memory only (#1569).

* ci: retrigger after unrelated SimulatedMesh flake

* ci: retrigger checks after simulator flake

* test: serialize ComposerDraftStoreTests

The in-memory draft map is process-global; parallel tests were racing
replaceAllForTesting and under-counting during eviction checks.
2026-09-24 09:35:50 +02:00
Rod Bahmanyari
e89fcbd7c4
docs: why rotating the service UUID does not work (#1704)
* Document why rotating the service UUID does not work

PEER-ID-ROTATION.md §2 lists "hiding that bitchat is in use" as a non-goal
and says the service UUID is "tracked separately." Nothing tracked it, so
the idea keeps coming back without its constraints. This is that document.

The conclusion is negative and worth writing down: hiding that bitchat is
running is not achievable for an open-source app that supports discovery
between strangers. Two independent reasons, either sufficient. iOS requires
background scanners to name the exact UUIDs they want, so any value a
stranger can pre-compute to find us, an adversary running the same source
derives identically — stranger discovery (G4) and invisibility to a
code-reading adversary are mutually exclusive in one advertisement. And
mechanically, third-party iOS apps cannot control advertisement contents at
all, cannot change advertised services while backgrounded, and have their
UUID collapsed into a 128-bit overflow bitmask in the background anyway —
so the real exposure is foreground, where iOS permits rotation least.

Also recorded: every comparable deployment (Exposure Notification, Find My,
Fast Pair, Eddystone-EID) and every comparable mesh app (Bridgefy, Berty,
qaul, Meshtastic) fixes the identifier and rotates the payload, if anything;
Briar is the only structurally different answer and it gets there by not
broadcasting. What survives any UUID change, ranked by how cheaply it can be
used — GATT connect-and-probe is decisive at ~3.7s/device on a Raspberry Pi,
and is invariant under rotation because app detection is a lookup, not a
discrimination problem. Three ways rotation would make things actively worse
(shrunken anonymity set, the restoration stale-identifier trap, anti-tracking
standardisation surfacing us as an "unknown tracker"). And what is actually
available instead, with peer-ID rotation ranked first because it targets the
far larger exposure: identifying a specific person, not merely a bitchat user.

Two load-bearing claims are undocumented by Apple and flagged for device
verification rather than asserted (§6). RF-fingerprinting is deliberately
described as a targeted tool rather than a dragnet; an earlier draft
overstated it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Correct the foreground-rotation reading; drop the DULT claim

Section 2.2 closed by saying rotation's value would sit where iOS
permits it least, which reverses the section's own argument. The only
mechanical constraint it cites on changing the UUID applies while
backgrounded; the foreground is precisely where CoreBluetooth allows
stopping advertising, swapping the service and starting again, a cycle
BLEService+LinkLayerPeripheralRole already runs. Retitled from
"forecloses" to "constrains", rewrote the closing passage, and softened
the "two independent reasons" framing, since independence was the point
of the objection. The conclusion is unchanged: foreground rotation
defeats a stale-list scanner but not an adversary running the public
derivation, and connect-and-probe identifies us regardless.

Section 5's third downside claimed anti-tracking standardisation might
flag us as an unknown tracker. DULT scopes to small location-tracking
accessories identified by a specific service-data UUID, and platform
alerts cover conformant tags rather than arbitrary advertisers; the spec
also mandates address rotation for those accessories, which makes
rotation a requirement of it rather than a trigger for it. Dropped, and
the section is now two ways. Nothing else referenced it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-24 09:35:39 +02:00
Sam
d9c6c2d456
ci: prevent manual source manifests from overwriting releases (#1636)
Co-authored-by: vekovius <vekovius@users.noreply.github.com>
2026-09-24 09:35:29 +02:00
Jozef Koval
eae01ef9d8
Validate relay-directory changes in PR CI (#1711)
* Validate relay-directory changes in PR CI

The weekly automation validates a relay snapshot before it pushes its
branch, but that check lives inside the scheduled job. A change to the
reviewed relay directory that arrives as a pull request is validated by
nothing at all, which is the ground two relay-data PRs were closed on:
"PR CI doesn't run the validator, and untraceable relay-directory
updates aren't something we can merge on faith" (#1632, also #1673).

This runs the validator on a pull request touching relays/ or the
validator itself, against the base branch's reviewed copy, and publishes
the row count, unique-relay count and SHA-256 to the job summary. The
hash is the point: the relay automation already publishes one for every
snapshot it proposes, so a reviewer can now match a proposed file
against it instead of taking provenance on faith.

The gate deliberately runs the base branch's validator rather than the
pull request's copy of it. Otherwise a change that edits the data and
the validator together certifies itself -- dropping 86% of the directory
passes if the same commit relaxes MIN_BASELINE_FRACTION, and the summary
still reports "validated". The scheduled job validates from a main
checkout for the same reason. The pull request's own validator is still
exercised by the unit-test step.

A pull_request run executes the workflow definition from the pull
request's own head, so a pull request can always edit this file and
change its own gate. That path is visible in the diff, which is what
review is for; what the reviewed-validator gate closes is the quiet one.

Read-only and never pull_request_target: the job runs PR-authored code,
so it holds no write scope and no secrets. checkout is @v5 like the
other read-only PR workflows rather than SHA-pinned, since that pin
exists to protect the write-capable token in fetch_georelays.yml.

What it catches: malformed rows, out-of-range coordinates, insecure
hosts, conflicting duplicate relays, and snapshots that lose half or
double the baseline's relays. What it does not: a re-ordered file whose
rows are each valid still passes -- with a different hash, which the
summary makes visible.

The accompanying test asserts the job's security-relevant shape as text,
following the precedent in test_fetch_georelays_workflow.py: the
trigger, the absent write scope, --output never pointed at the tracked
CSV, and that the gate reads the validator from the base branch.

* Split the gate from the code under review

Codex review on d627b9f found three holes, all confirmed by rehearsal.

The gate ran the base branch's validator, but read the candidate from the
worktree and ran the pull request's unit tests first. A test file that
rewrites relays/online_relays_gps.csv at import time therefore decided
what the gate validated: the summary reported 441 rows and the hash of a
file the pull request never proposed, exit 0, while the 60-row CSV in the
commit was what would merge. The published hash is the whole argument for
reviewing relay data on evidence, so a hash that can describe different
bytes than the ones merging is worse than no hash at all.

The workflow is now two jobs with an explicit split:

- gate is the trust boundary. It checks out the base commit, so nothing
  the pull request wrote is present to run, and reads the candidate as a
  git object pinned to the event's head SHA instead of from a worktree.
  Both inputs come from the event, so a base branch that advances while
  the job is queued cannot change the verdict.
- proposed-validator runs pull-request code, so it is not a trust
  boundary. It runs the unit tests and, new here, the proposed validator
  against the real directory. Without that a validator change is only
  ever exercised against small synthetic fixtures: capping MAX_ROWS at
  400 passes the unit tests and the gate, then breaks the weekly
  automation after merge with "CSV exceeds 400 data rows".

Checking out the base commit also removes last round's git show of the
validator -- at base.sha the reviewed validator is simply the one in the
workspace.

Rehearsed per case, with each branch's diff verified first: a malicious
PR that swaps the CSV from a test now exits 1 where it previously passed
green; the current automation snapshot still validates to the hash
published in #1617; a corrupt CSV, a stricter validator, and a CI-only
change all land where they should.
2026-09-24 09:35:18 +02:00
Eric Gang
49f388580f
Add golden test vectors for the courier wire format (#1472)
* Add golden test vectors for the courier wire format

The courier layer is only implementable from the Swift source today, and three
of the ways a second client gets it wrong fail silently — it builds, connects,
and delivers nothing, with no error at either end:

- `expiry` is milliseconds. Seconds makes every envelope read as long expired,
  so it is dropped at deposit with nothing logged.
- The signature does not cover the wire bytes. It covers a re-encoding with
  ttl zeroed, isRSR cleared and the signature omitted, which is then PKCS#7
  padded — a spray receipt is 46 bytes unsigned and unpadded, but 256 bytes
  signed. Signing the 46 produces a signature that never verifies.
- The signing key is Ed25519. CryptoKit spells it Curve25519.Signing, so
  reaching for a "Curve25519" primitive elsewhere yields X25519 key agreement.

Prose cannot defend against that class of bug; a fixture can. These vectors
pin the envelope TLV, the copies clamp, recipient-tag derivation, the
ciphertext hash, and the padded signing pre-image, and they are asserted from
the implementation so they cannot drift without a test failing.

Signature bytes are deliberately not pinned: CryptoKit's Ed25519 signing is
randomized rather than the deterministic RFC 8032 construction, so two
signatures over identical input differ and both verify. A second
implementation will not reproduce these bytes and does not need to — the
pre-image is what must match.

docs/courier-test-vectors.json carries the same values for implementers who
are not running Swift.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Courier vectors: use a real deposit frame and pin every byte

Both changes address the Codex review on #1472.

The signing vector used type 0x2a, which is not a MessageType on main — it is
the spray-receipt opcode from a separate unmerged branch, so the frame decoded
to nothing and was misleading as an end-to-end courier vector. It now encodes
an actual courierEnvelope deposit: type 0x04 carrying the encoded envelope
from the TLV vector as its payload. 14 header + 8 sender + 8 recipient + 74
envelope = 104 unsigned and unpadded, 256 signed, 168 on the wire. The
envelope is under the 100-byte compression threshold, so the compressed path
stays out of it.

The pre-image assertions checked only length, the first three bytes, the flags
byte and the padding suffix. A change to timestamp encoding, payload length or
field layout could have left the test green while the JSON went stale — which
made the claim that these cannot drift without a test failing untrue as
written. Both the unpadded and padded sequences are now compared in full.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Courier vectors: pin the pre-image in the signature test too

The signature test signed whatever pre-image it was handed and verified it,
which is self-consistent by construction — it would have passed over a wrong
canonicalization. Mutating an input (timestamp +1ms) proved it: the
comparison test failed and this one did not.

It now pins the pre-image before signing, so both tests fail on any change to
field layout, timestamp encoding or payload length.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Courier vectors: drive the tests from the published JSON

Addresses both asks in the #1472 review.

The tests duplicated every vector as a Swift literal, so a format change that
updated only the Swift side would have left docs/courier-test-vectors.json
silently stale — the document was published as authoritative but nothing
checked it. Each test now reads the file and asserts against what it says.

The NoiseTestVectors.json precedent does not transfer directly: that fixture
lives inside its test target and loads from the test bundle, whereas this one
lives at repo-root docs/, outside the package, so SwiftPM cannot carry it as a
resource. It resolves the path from #filePath instead, the way
bitchatTests/LocalizationCoverageTests already reaches the repo root. CI runs
this package with the full tree checked out, and the target is not in the
xcodeproj, so there is no bundle-only run to break.

Two things beyond a mechanical swap:

- The published `label` for the tag HMAC is now load-bearing. The
  implementation's context string is private, so the test recomputes the tag
  from the label in the file and compares — otherwise the document could name
  the wrong label and nothing would notice.
- A dedicated test fails loudly if the file is missing or has lost a key,
  rather than letting a rename skip every assertion while the suite reports
  green.

Also fixes the stale prose. The review caught "the finished 110-byte wire
packet"; the same deleted spray-receipt example had left three more wrong
numbers in packetSigning._comment — the padding worked example read 46 + 16 =
62 with shortfall 210 = 0xd2, where the real frame is 104 + 16 = 120 with
shortfall 152 = 0x98.

Proven by mutation, not by green: flipping a byte in envelopeTLV.encoded, a
byte in signingPreimage, and the HMAC label each fail the matching test, and
removing the file fails all seven.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Courier vectors: fail the length checks before indexing the bytes

Cross-model review (agy) on the previous commit.

The length assertions were #expect, so a frame of the wrong size reported the
mismatch and then kept going into `unpadded[2]` and the flags-offset reads.
Data subscripting past the end traps, so the process would die and take the
rest of the run's results with it — the failure mode where you learn least at
the moment you need to learn most. They are #require now.

Also marks the ciphertextHash vector as the weak one it is. Its derivation has
no consumer on main: the function that reads it arrives with the courier-spray
work, so the truncation is spelled out in the test rather than called, and a
future helper that truncates differently would not fail here. Said plainly in
the test rather than left for the next reader to discover.

Verified by mutation: declaring the wrong unsignedUnpaddedLength now fails both
signing tests with a reported expectation instead of a crash.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Courier vectors: move the ciphertext-hash vector to where it can be checked

The remaining piece of the spray-receipt example this PR already removed once.

`ciphertextHash` documents the envelope identity a spray receipt carries, and
nothing on main carries one — `CourierStore.ciphertextHash` arrives with the
courier-spray branch. So the test could not call the function the vector
describes; it re-spelled the truncation instead, which would have passed just
as green against a helper that truncated differently. A vector nobody can check
is worse than no vector, because it reads as verified.

It moves to the spray PR, where the production function exists and the
assertion can go through it.

Everything left in the file is now asserted against code that runs on main.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Courier vectors: decode the two keys nothing was reading

Cross-model review (codex) on the previous commits.

`packet.payloadIs` and `signature.verify` were the only non-comment keys the
Decodable shapes did not declare, so either could be renamed or deleted from the
published file and every test stayed green — the exact staleness this PR exists
to prevent, surviving in the two fields that tell a second implementer what to
feed the verifier.

Both are declared now, and `payloadIs` is checked rather than merely present:
it states a byte count, and that count is asserted against the real encoded
payload. Prose that states a number is a claim like any other.

Verified by mutation: renaming either key fails decoding, and stating 73 bytes
where the payload is 74 fails the length assertion alone.

Codex also read the pre-fix diff and re-reported the unchecked Data indexing
already fixed two commits ago, and claimed Ed25519 signing is deterministic so
the non-determinism assertion should fail. The latter is wrong for CryptoKit
specifically: `Curve25519.Signing` randomizes rather than following RFC 8032's
deterministic construction, which the test asserts and the suite confirms on
every run. No change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-24 09:35:08 +02:00
Taksh Kothari
711318787c
test(l10n): per-catalog attribution and file:line output for the coverage guard (#1679)
* test(l10n): report file and line for an untranslated key

The catalog guard named only the file a missing key was written in, so
finding it in a 900-line view meant grepping. Collect each literal
`String(localized:)` reference with its repo-relative path and line, and
print one `path:line key` per line instead of a comma-joined blob.

* test(l10n): check each target against the catalog it bundles

The guard accepted a key found in either catalog. The share extension
bundles only its own, so a key it references that lives solely in the app
catalog ships English there just as surely as one that exists nowhere -
which is the gap that let the share-extension strings drift.

Check `bitchat/` against the app catalog and `bitchatShareExtension/`
against the extension catalog, and say in the failure which of the two
cases it is.

* test: check shared sources against the extension catalog too

bitchat/Services/SharedContentHandoff.swift and bitchat/Services/
TransportConfig.swift are compiled into bitchatShareExtension as well
(project.pbxproj membership exceptions), so a key they reference has to
resolve in both catalogs -- each target bundles only its own.

The exception list is read from project.pbxproj rather than hardcoded,
so the check follows the set when it changes.
2026-09-24 09:34:58 +02:00
Felix-Ayush
d01c02788f
Compile mention autocomplete regex through SafeRegex (#1604)
* Compile mention autocomplete regex through SafeRegex.

try? NSRegularExpression silently disabled @-mentions on compile failure; SafeRegex logs and returns a never-matching pattern instead, matching MessageFormattingEngine.

* Route mention autocomplete through shared SafeRegex pattern.

Add MessageFormattingEngine.Patterns.mentionAutocomplete and use it from AutocompleteService so mention matching compiles through the same fail-closed helper as message formatting.
2026-09-24 09:34:47 +02:00
Taksh Kothari
d34098fc3c
fix: evict fully-aged-out geohashes from activity tracker (#1642)
messageTimes/lastMessages kept an entry for every geohash ever seen —
prune() only emptied a geohash's timestamp array, never dropped the
dictionary entry itself. roaming across many regions over a long
session leaked one entry per distinct geohash for the life of the
process. sweep other geohashes on each recorded message and drop the
ones that have fully aged out.
2026-09-24 09:34:36 +02:00
Taksh Kothari
c82e6d5ab0
fix: reject a signed byte pair in Data(hexString:) (#1687)
* fix: reject a signed byte pair in Data(hexString:)

UInt8(_:radix:) accepts a leading sign, so the two-character chunks this
parser feeds it let "+f" through as 0x0f. The doc comment already promises nil
for a string containing invalid hex characters, and it did not deliver that.

The cost is a second spelling for every identity-bearing hex string the app
parses -- Noise keys, Nostr pubkeys, fingerprints, signatures, routing IDs.
A 64-character peer ID of "+b" pairs passed PeerID.isValid, reported isHex
false and isNoiseKeyHex true at the same time, and resolved to the same
32-byte key and the same short routing ID as the genuine peer it shadowed.

Require two hex digits before parsing the pair.

* test: cover hex parsing and the PeerID validity it backs

DataHexTests covers what the parser accepts (plain, uppercase, 0x-prefixed,
whitespace-padded, every byte value round-tripped) alongside what it must
refuse, including the signed pairs that used to alias a genuine key.

PeerIDTests gains the 64-character negatives it was missing -- the short form
already had them -- and asserts isHex and isNoiseKeyHex agree.
2026-09-24 09:34:25 +02:00
krish rathi
5a10ba6bf9
Trigger Noise session rekey on absolute age, not just idle time (#1675)
* Trigger Noise session rekey on absolute age, not just idle time

needsRenegotiation() had two triggers: message count nearing the 1
billion-message ceiling, and lastActivityTime idle for longer than
sessionTimeout (24h). Neither fires for a session with steady traffic:
message count realistically never approaches a billion, and
lastActivityTime resets on every encrypt/decrypt, so a continuously
active conversation never looks idle.

Meanwhile encrypt/decrypt both hard-fail with sessionExpired once
sessionStartTime crosses the same 24h sessionTimeout, unconditionally,
with no rekey ever having been scheduled to prevent it. Two peers who
keep a conversation open past 24h (a stationary mesh node, or two
phones left open overnight) hit this simultaneously: every message
throws sessionExpired on both sides, isEstablished() still reports true
so the UI keeps showing the session as secured, MessageRouter never
falls back off the transport because canDeliverSecurely never goes
false, and nothing re-handshakes because the one self-heal path
(BLENoisePacketHandler's decrypt-failure recovery) requires an inbound
ciphertext to fail to decrypt for a session-establishment reason, not
sessionExpired specifically -- so it's excluded. The conversation is
silently and permanently dead until an app restart or a BLE
disconnect/reconnect forces revalidation.

Adds a third needsRenegotiation() trigger on sessionStartTime age
directly, firing at 90% of sessionTimeout -- the rekey timer polls
every 60s (NoiseEncryptionService.rekeyCheckInterval), leaving over two
hours of margin to complete a full handshake before the hard cutoff.

No Xcode/Swift toolchain available here, so this is verified by
tracing, not compiling: manually walked the new
continuouslyActiveSessionStillNeedsRenegotiationBeforeExpiry test's
inputs through both the pre-fix and post-fix needsRenegotiation() logic
(confirmed the pre-fix code returns false for a session with fresh
lastActivityTime and old sessionStartTime, and the fix flips it to
true), checked every other call site of needsRenegotiation() and
getSessionsNeedingRekey() in the test suite to confirm none depend on
the old always-false behavior at this age, and confirmed via
git apply -R / git apply that the source diff is exactly the traced
change with no other drift.

* Fix stale comment in needsRenegotiation idle time check
2026-09-24 09:34:14 +02:00
Taksh Kothari
25a3219a53
fix: refuse an ambiguous nickname instead of picking the first peer (#1689)
getPeerID(for:) and geohash geoNicknames.first(where:) returned the
first match, so /msg and /block could hit the wrong person when two
peers share a name. Accept an unsuffixed nick only when it is unique;
otherwise require the people-list #xxxx suffix.
2026-09-24 09:34:04 +02:00
jack
774c88ed97
Cap packet payload size per type and bound sync stores by bytes (#1719)
The decoder accepted a payload of any type up to the framed-file
ceiling, compressed or not, and the stores holding decoded packets
evicted by count only.

- New PacketPayloadLimits (BitFoundation): per-type decoded payload
  caps, enforced in BinaryProtocol.decodeCore for compressed and
  uncompressed payloads. Only fileTransfer and noiseEncrypted keep the
  framed-file cap; every other type is capped at >= 2x the largest
  payload current iOS and Android encoders produce.
- The unreachable 50,000:1 ratio guard becomes DEFLATE's 1032:1 bound.
- Fragment reassembly is limited by the claimed type's frame ceiling,
  and a reassembled packet of a different type is dropped.
- Gossip PacketStores, archive restore and the directed relay spool
  get byte budgets alongside their count caps.
- Broadcast file transfers are validated before being tracked for sync.
- Public mesh messages larger than a v1 frame are not delivered.

Receive-side only; senders and the wire format are unchanged.
Also: a re-delivered fragment replaces its index's bytes in the assembly
size projection instead of counting twice, and a test-harness race in
GossipSyncManagerTests.concurrentPacketIntakeAndSyncRequest is fixed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 20:19:59 +02:00
jack
1905ea7cc0
Bound future timestamps on sync replies and in the gossip store (#1717)
Sync replies (RSR) skipped the packet timestamp check, and nothing
downstream bounded future timestamps: the gossip freshness checks,
archive restore and the archived-echo key only handled the past.

- BLEIngressPacketGuard: RSR packets may still be old, but not dated
  beyond now + skew (TransportConfig.bleMaxTimestampSkewMs, 120 s).
- ChatPublicConversationCoordinator.archivedEchoKey is total for any
  Date instead of using a trapping UInt64 conversion.
- GossipSyncManager.isPacketFresh rejects packets dated beyond the same
  skew, which gates every store, sync serving and archive restore;
  restore rewrites the archive when it drops entries.
- BLEAnnounceHandler tracks only verified announces for sync.
- LocationNotesManager clamps note created_at to now.
- LocationNotesManager clamps future note timestamps to the board's
  clock-skew allowance (not to now), so bridged copies of board posts
  still dedupe in UnifiedNotices.merge.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 19:47:14 +02:00
jack
3257ced77e
Pin the stored creator on incoming private-group state (#1720)
applyGroupState authorized state only against the creator named in the
state itself, not the creator of the group already stored under that
groupID, and handled removal before any existing-group check.

- applyGroupState: for a group already held, require the stored
  creator's fingerprint and signing key, and a non-stale epoch, before
  the removal branch.
- GroupStore.upsert refuses to change an existing group's creator;
  updateRoster keeps the creator's entry pinned; loadFromDisk re-checks
  the same invariants and keeps one entry per groupID.
- First ChatGroupCoordinator tests.

Ports the approach from #1587 by @areebahmeddd.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 19:47:10 +02:00
jack
0b5cae856d
Keep the mesh peer ID out of geohash DMs; ack only after block checks (#1718)
The recipient-less Nostr encoders used for geohash DMs wrote the local
mesh peer ID into the embedded packet's sender field, and the inbound
geohash DM path sent the delivery ack before the block check.

- encodePMForNostrNoRecipient / encodeAckForNostrNoRecipient no longer
  take a sender ID and write fresh random bytes per envelope; the
  geohash transport no longer sets senderPeerID. No iOS or Android
  receiver reads this field.
- Inbound geohash DMs run the block check, then dedup, then the ack.
- The recipient-addressed (favorites) path is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 19:47:06 +02:00
jack
9b84b36122
Localize the last hardcoded UI strings; wire up two dead translations (#1656)
* Add 26 code-referenced keys to the catalog + a test that closes the gap

LocalizationCoverageTests validated the catalog but never the code: a
String(localized:) whose key is missing from every catalog compiles
fine and silently ships its English defaultValue to all 29 non-source
locales. That blind spot let 26 keys go untranslated while CI stayed
green: the entire notices/board composer (10), the private-media
encryption warnings and delivery-failure reasons (9), both
courier-header strings, two delivery states, two media failure
reasons, and the [? people] channel row.

- All 26 keys added with full 30-locale coverage.
- New everyCodeReferencedKeyExistsInACatalog scans the source for
  literal String(localized:) keys and fails on any key absent from
  both catalogs. (The audit's original count of 17 was itself an
  undercount — its scan missed multi-line String( localized: calls;
  the test's regex does not.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Localize CommandProcessor: all 48 command strings, 30 locales

CommandProcessor had zero String(localized:) calls — every command
error, usage hint, and the entire /help reference was hardcoded
English. The autocomplete panel (CommandInfo) is fully localized, so a
non-English speaker got localized suggestions while typing and English
the moment anything went wrong or they asked for help.

- 47 literal sites converted to String(localized:)/String(format:)
  with positional specifiers where languages reorder (%1$@, %2$lld).
- /trace's "hop"/"hops" pluralization split into path_one/path_many;
  the "you" chain label localized too.
- helpText and groupUsage become computed so they resolve per-locale.
- 49 command.* keys added with full 30-locale coverage (command
  syntax stays verbatim; only prose translates).
- Copy fix from the audit: "blocked X. you will no longer receive
  messages from them" → "…no longer see their messages" (blocking
  filters at display time; packets still arrive and relay).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Localize the last hardcoded UI strings; wire up two dead translations

The stragglers from the unlocalized-strings audit:

- Nearby push notification: "bitchatters nearby!" title and the
  hand-rolled English pluralization ("1 person around" / "N people
  around") now localize via body_one/body_many.
- Voice recording errors (mic permission, start/too-short/save
  failures) and the "Recording Error" alert title — also brought into
  the lowercase house voice.
- The recording HUD's Cancel label now uses common.cancel.
- "No image selected" in both image pickers.
- The DM screenshot echo "you took a screenshot" (the wire-format
  sibling stays English for Android compat).
- "Voice/Images are only available in mesh chats." had fully
  translated catalog entries in all 30 locales that were never looked
  up — the call sites passed the raw string instead of resolving the
  key. Wired up via String(localized:).

10 new keys x 30 locales.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 20:40:14 +02:00
jack
5c4b814c56
Localize CommandProcessor: all 48 command strings, 30 locales (#1657)
* Add 26 code-referenced keys to the catalog + a test that closes the gap

LocalizationCoverageTests validated the catalog but never the code: a
String(localized:) whose key is missing from every catalog compiles
fine and silently ships its English defaultValue to all 29 non-source
locales. That blind spot let 26 keys go untranslated while CI stayed
green: the entire notices/board composer (10), the private-media
encryption warnings and delivery-failure reasons (9), both
courier-header strings, two delivery states, two media failure
reasons, and the [? people] channel row.

- All 26 keys added with full 30-locale coverage.
- New everyCodeReferencedKeyExistsInACatalog scans the source for
  literal String(localized:) keys and fails on any key absent from
  both catalogs. (The audit's original count of 17 was itself an
  undercount — its scan missed multi-line String( localized: calls;
  the test's regex does not.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Localize CommandProcessor: all 48 command strings, 30 locales

CommandProcessor had zero String(localized:) calls — every command
error, usage hint, and the entire /help reference was hardcoded
English. The autocomplete panel (CommandInfo) is fully localized, so a
non-English speaker got localized suggestions while typing and English
the moment anything went wrong or they asked for help.

- 47 literal sites converted to String(localized:)/String(format:)
  with positional specifiers where languages reorder (%1$@, %2$lld).
- /trace's "hop"/"hops" pluralization split into path_one/path_many;
  the "you" chain label localized too.
- helpText and groupUsage become computed so they resolve per-locale.
- 49 command.* keys added with full 30-locale coverage (command
  syntax stays verbatim; only prose translates).
- Copy fix from the audit: "blocked X. you will no longer receive
  messages from them" → "…no longer see their messages" (blocking
  filters at display time; packets still arrive and relay).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 20:21:02 +02:00
jack
eca147191c
Add 26 code-referenced keys to the catalog + a test that closes the gap (#1654)
LocalizationCoverageTests validated the catalog but never the code: a
String(localized:) whose key is missing from every catalog compiles
fine and silently ships its English defaultValue to all 29 non-source
locales. That blind spot let 26 keys go untranslated while CI stayed
green: the entire notices/board composer (10), the private-media
encryption warnings and delivery-failure reasons (9), both
courier-header strings, two delivery states, two media failure
reasons, and the [? people] channel row.

- All 26 keys added with full 30-locale coverage.
- New everyCodeReferencedKeyExistsInACatalog scans the source for
  literal String(localized:) keys and fails on any key absent from
  both catalogs. (The audit's original count of 17 was itself an
  undercount — its scan missed multi-line String( localized: calls;
  the test's regex does not.)

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 20:03:23 +02:00
jack
dba67c1466
Deflake AppArchitectureTests: raise the local waitUntil to settleTimeout (#1653)
* Deflake AppArchitectureTests: raise the local waitUntil to settleTimeout

The file-local waitUntil defaulted to 3s — below the documented
minimumSettleTimeout floor — and the recent-chats geo-dedup wait
missed it on a loaded runner right after merge (the Combine hop
through receive(on: .main) was starved). Every caller waits for a
condition to become true, so green runs return immediately and never
pay the 30s deadline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fix the real geo-dedup race: re-assert tracker state on each poll

The 30s deadline didn't help — the recent-chats geo-dedup wait wasn't
slow, it was permanently broken under parallel swift-test load: the
view model's own channel binding delivers its initial .mesh selection
asynchronously and resets the active participant geohash when it lands
(GeohashSubscriptionManager → setActiveParticipantGeohash(nil)),
wiping the test's setup so the dedup could never happen. Reproduced
locally with `swift test --parallel`; standalone runs never hit it.

The wait now re-asserts setActiveGeohash + recordParticipant on every
poll (both idempotent) — the same self-healing pattern the geohash
timeline test already uses for singleton interference. Interference
heals on the next poll; a genuine dedup failure still times out.
6× full parallel runs green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 09:12:50 +02:00
jack
5b592c8bae
Add a persistent connectivity banner and stop the radar lying (#1597)
* Add a persistent connectivity banner and stop the radar lying

Two "the app looks fine while it isn't" problems from the UX audit:

- Bluetooth-off had exactly one signal: a dismissible alert. Once
  dismissed, the app looked completely normal — empty timeline, radar
  sweeping "searching for people" — while the radio was off. The radar
  animation now requires a radio that can actually scan, and a
  persistent red banner under the header carries the state instead:
  off (tap → settings), denied (tap → settings), or unsupported
  (mesh unavailable; location channels still work).
- A Tor bootstrap stall was only ever announced inside geohash
  timelines (addGeohashOnlySystemMessage), so someone sitting in #mesh
  or a DM whose messages route over Nostr got silence and hanging
  "sent" states. The stall now also drives a chrome-level torBlocked
  flag and the same banner: "tor can't connect — internet features are
  paused. mesh still works."

The banner renders nothing when everything is healthy, and .unknown/
.resetting radio states deliberately stay quiet — a false "bluetooth is
off" flash at launch would be the same kind of lie. Priority and
quiet-start behavior are pinned by ConnectivityIssueTests. 4 new
strings, all 30 locales.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Review fixes: banner in the sheet, real fix targets, tor-clear tests

- The people/DM sheet covers the root header, so the connectivity
  banner vanished exactly where people sit longest. It now mirrors
  into the sheet via a top safe-area inset over both the people list
  and the DM view.
- "tap to fix" for powered-off Bluetooth opened the macOS privacy
  permission pane, where an already-authorized person can't fix
  anything. New SystemSettings.bluetoothPower routes to the Bluetooth
  pane; denied still goes to the privacy anchor. The one-shot alert's
  settings button routes by state the same way.
- Tests pin that torBlocked clears on tor-ready and on preference
  change (no stale "tor can't connect" after toggling tor off).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 08:47:53 +02:00
jack
66fdea52ae
Make the panic wipe confirmable and its outcome visible (#1588)
* Make the panic wipe confirmable and its outcome visible

The triple-tap panic wipe fired instantly with no confirmation, on the
same 18pt logo whose single tap opens App Info — while the far less
destructive triple-tap-to-clear-chat 40pt below it asks first, and the
Settings-pane panic button has always confirmed. A fumbled tap on the
app's only help affordance could permanently destroy identity, keys,
and messages.

- Triple-tap now raises the same confirmation dialog the Settings pane
  uses (one extra tap under duress; zero accidental wipes).
- A successful wipe leaves a "all data wiped — new identity created"
  system message: in duress, "did it work?" must not be a guess — the
  natural response to uncertainty is tapping again.
- A wipe that does not commit (panicRecoveryBlocked) was previously
  invisible: the app looked wiped, sat silently offline, and keys could
  still be on disk. It now shows a persistent red banner under the
  header saying data may remain and a relaunch retries.
- Settings/privacy copy no longer says "instantly" (all 30 locales).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Review fixes: dismiss sheets on wipe; host the dialog durably

- Codex P1: the App Info danger-zone wipe left its sheet presented, so
  the failed-wipe banner (and the success message) rendered underneath
  an opaque modal. panicClearAllData now dismisses all chrome-owned
  presentation first; pinned by a new architecture test.
- Review nit: the confirmation dialog moved from the logo Text to the
  ContentView header stack, so a covered/removed header can't take a
  pending dialog down with it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 08:31:45 +02:00
jack
c6cb4210e4
Add a recent-chats section so DM conversations can't become unreachable (#1598)
* Add a recent-chats section so DM conversations can't become unreachable

The largest IA hole from the design/UX audit: a direct conversation
with someone who went offline (and isn't a mutual favorite) had no row
anywhere in the UI. The roster filters to connected/reachable/mutual-
favorite, the header envelope only exists while unread, and /msg can't
resolve offline strangers — read a DM from a passerby, close the
sheet, and the thread was still in memory with no way back to it.

- PeerListModel now derives RecentChatRow entries from the
  ConversationStore's direct conversations: people absent from the
  rosters above, newest activity first, unread flag, deduplicated by
  fingerprint across ephemeral/stable peer-ID mirrors (newest wins),
  groups and blocked peers excluded.
- A "chats" section (same header shape as #mesh/groups) renders them
  in the people sheet on both mesh and location channels — geoDMs from
  a channel since left stay reachable too. Tapping reopens the DM via
  the existing startConversation path; the section renders nothing
  when empty.
- Rebuilds are driven by direct-conversation store changes only, so
  public-timeline traffic doesn't churn the sheet.

2 new strings, all 30 locales. New architecture test pins that an
offline stranger's thread gets a row while group threads don't.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Review fixes: geo dedup and geoDM names in recent chats

- A person still visible in the geohash roster could also get a recent
  chat row (the builder only subtracted mesh rows). Visible geohash
  pubkeys now join the identity set via their PeerID(nostr_:) form, so
  the absent-from-rosters contract holds on location channels too.
- GeoDM rows went through resolveNickname, which only consults mesh
  identity sources and rendered nostr_… keys as an opaque anon
  fallback. They now resolve through geohashDisplayName (Nostr key
  mapping, bare-key fallback).

Both pinned in the recent-chats architecture test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 07:58:18 +02:00
jack
4f30433406
Remove the public-channel screenshot broadcast (#1596)
* Remove the public-channel screenshot broadcast

Taking a screenshot used to announce "* nickname took a screenshot *"
to the entire active public channel — a mesh broadcast, or on geohash
channels a mined ephemeral event published to the 5 nearest Nostr
relays, permanently timestamping that this nickname was present and
active at that place. Documenting something (or someone) is a core use
of a protest app; it must not out the person doing it.

- Public channels (mesh and geohash) no longer send anything on
  screenshot. The mined-event helper is deleted and the lifecycle
  context trimmed of its now-unused requirements.
- A geohash timeline screenshot instead raises the existing local
  location-privacy warning alert (same one the channel sheet uses) —
  warn the person, tell no one.
- DM screenshot notices remain, and the local "you took a screenshot"
  echo is now honest: it only appears when the notice actually went to
  the peer (it used to render even when no established session existed
  and nothing was sent).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Review fixes: pin the screenshot routing table

The geohash warn path lived only in AppRuntime with no coverage. The
decision is now a pure nonisolated table
(AppRuntime.resolveScreenshotResponse) pinned by tests: location sheet
or geohash timeline → local privacy alert (nothing sent), App Info →
nothing, mesh/DM → chat layer (where public channels stay silent).

Mesh deliberately gets no local alert: a mesh screenshot reveals no
place and triggers no send, so there is nothing actionable to warn
about — alerting on every screenshot would train people to dismiss the
one alert that matters. Rationale now documented on the response enum.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 07:57:25 +02:00
jack
4122a4dacd
Stop claiming encryption and privacy properties that aren't live (#1595)
* Stop claiming encryption and privacy properties that aren't live

Two of the app's most safety-critical signals could show more security
than actually existed:

1. getEncryptionStatus was sticky-optimistic: any peer whose fingerprint
   was ever persisted resolved to noiseSecured/noiseVerified even when
   the live Noise session was .none, .handshaking, or .failed. After a
   cold launch or a handshake failure the DM header showed a solid lock
   and the composer caption claimed "end-to-end encrypted" with no
   secure session in existence. The status now reflects only the live
   session; a remembered fingerprint decides what an established
   session upgrades to (verified vs secured), nothing more. Peers
   reachable only over Nostr keep the encrypted caption — gift-wrapped
   delivery is end-to-end without a Noise session.

2. Privacy copy told three lies (all 30 locales fixed):
   - "ephemeral identity — new peer ID generated regularly": the peer
     ID is stable until a panic wipe (rotation is spec-only). Now
     "local-only identity — your identity is a keypair created on this
     device; panic wipe replaces it instantly."
   - "no servers, accounts, or data collection": location channels and
     internet delivery go through Nostr relays. Now "no accounts, no
     phone numbers, no data collection."
   - location channels: "your IP address is hidden by routing all
     traffic over tor" — tor is a toggle. The description now says tor
     is the default, and the sheet shows the existing red tor-off
     warning at the point of joining whenever the toggle is off.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Review fixes: gate nostr availability on a stored recipient key

- Codex P2 / review: a mutual favorite with a nil peerNostrPublicKey
  still reported .nostrAvailable, so the DM caption could claim
  "end-to-end encrypted" with neither a Noise session nor a usable
  Nostr key. BitchatPeer.connectionState (and the header fallback in
  PrivateConversationModel) now require a stored recipient key —
  mirroring NostrTransport's reachability rule. Regression test:
  mutual + nil key → .offline; key present → .nostrAvailable.
- Copy: "local-only identity" → "device-local identity" (all 30
  locales) — once a fingerprint or QR is shared it isn't "only" local;
  device-local says where the keys live without over-claiming.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 07:56:33 +02:00
jack
6ef3945179
Deflake gift-wrap tests: settle deadlines, not latency budgets (#1651)
* Deflake gift-wrap tests: settle deadlines, not latency budgets

The gift-wrap round-trip tests failed three CI runs this week
(handleGiftWrap_privateMessageStoresConversationAndMapping,
handleGiftWrap_deliveredAckUpdatesExistingMessage,
handleGiftWrap_routesEmbeddedPrivateMessageAndDeduplicates), each with
the same signature: the async NIP-17 unwrap missed a 5s wait on a
loaded runner. 40 local iterations of both suites pass clean — the
failures are scheduler starvation, exactly the class
TestConstants.settleTimeout documents.

Every positive wait in ChatViewModelExtensionsTests and
ChatNostrCoordinatorContextTests now uses settleTimeout (30s): the
explicit 5.0s literals on the gift-wrap waits, the longTimeout media
waits, and the bare-default channel-switch waits. All are
expected-true waits, so passing runs return immediately and never pay
the deadline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Deflake SimulatedMesh TTL budget: settle discovery before the baseline

publicMessageRelaysAcrossLineTopologyWithinTTLBudget snapshotted its
frame baseline after a single 2s advance, but discovery is not quiet
by then: every first-seen peer schedules an afterglow re-announce at a
random 0.3-0.6s delay (BLEAnnounceHandler), and each of those can
cascade another relay round. Whether that traffic lands before or
after the snapshot depends on the draw — CI measured the "single
message" at 14 and 18 frames against a budget of 12.

The test now advances until the mesh goes a full window with no new
frames before taking the baseline, so the budget only ever measures
the message under test. 30 local iterations green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 07:56:12 +02:00
jack
f0249d9cd7
Make the Periphery scan blocking (#1648)
The job shipped with its own promotion condition — "drop
continue-on-error once the baseline proves stable" — and the baseline
has now been stable across a month of merges since it landed July 8
(#1410). Known macOS-scan false positives stay suppressed by the
committed baseline; --strict already fails the step on NEW dead code,
so the only change is that the failure now blocks instead of annotating.

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-09 11:39:03 +02:00
jack
6f961638f2
Timestamp sanity windows: future-dated QR codes and implausible Nostr DM rumors (#1647)
Two re-assessment findings:

- verifyScannedQR checked only staleness (now - ts > maxAge), so a
  future-dated timestamp bought a QR a longer validity window than a
  fresh one. The freshness check is now symmetric.

- Inbound Nostr DMs had no client-side created_at validation; the age
  bound relied entirely on relays honoring the subscription's `since`
  filter. Both gift-wrap decrypt paths now drop rumors outside
  [now - lookback - skew, now + skew]. The inner rumor timestamp is the
  sender's true send time (only the outer gift wrap is randomized per
  NIP-17), so the window mirrors exactly what an honest relay already
  guarantees — a dishonest relay can no longer inject stale or
  future-dated DMs. Existing mitigations (persistent gift-wrap dedup,
  relay-side since) are unchanged; this closes the malicious-relay gap.

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-09 11:39:00 +02:00
jack
2a9fb4d53f
Make SwiftLint blocking in CI now that the violation backlog is zero (#1646)
* Make SwiftLint blocking in CI now that the violation backlog is zero

The lint job has been advisory since #1361, with the backlog tracked in
#1088. That backlog is now down to 28 violations, so this clears it and
flips the job to enforcing instead of adding baseline machinery:

- Fix all remaining violations: closure parameters/capture lists joined
  onto their opening-brace line (BLEService, NoiseSessionManager,
  ChatMediaTransferCoordinator, BLENoisePacketHandlerTests), one
  trailing comma, one opening-brace spacing (both via swiftlint --fix).
- Move the two periphery:ignore comments above the doc blocks they were
  orphaning; verified with a periphery --strict scan that the commands
  still register (no new findings vs baseline).
- Disable the todo rule: the single TODO cites tracked issue #1434 and
  is a deliberate marker, not lint debt.
- Exclude .device-lab from local runs (untracked; CI never sees it).
- CI: drop continue-on-error and the "(advisory)" label; run with
  --strict so any new warning fails the job.

Full SwiftPM suite green (2,004 tests / 216 suites) after the
formatting changes; swiftlint lint --strict exits 0 with the same
0.65.0 the CI container pins.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fix is_disjoint violation introduced by #1542

The strict lint gate caught this on its first run: the mention-suggestion
key handler used modifierFlags.intersection([...]).isEmpty, which is
exactly the pattern isDisjoint(with:) expresses directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-08 12:12:30 +02:00
jack
9c84d4ce4f
Fail closed on unverifiable handshake peer IDs + check SecRandomCopyBytes results (#1645)
Two hardening fixes from the repo evaluation:

- NoiseSessionManager.authenticatedRemoteKey returned true for peer IDs
  that are neither 16-hex wire IDs nor full Noise-key IDs — an
  accept-any-key fallback kept for test harnesses. It now fails closed;
  the Noise/integration/E2E tests that relied on it address peers by
  key-derived wire IDs instead (the pattern NoiseCoverageTests already
  used), and a new regression test pins the rejection.

- Four SecRandomCopyBytes call sites discarded the return status. The
  two verification nonces now fail their operation on error, the Nostr
  device identity seed uses CryptoKit key generation (cannot fail, and
  can no longer silently persist an all-zero seed), and BIP-340 aux
  randomness throws on failure like the adjacent nonce path.

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-08 12:12:27 +02:00
Taksh Kothari
1f59e814f9
Keyboard navigation for @-mention suggestions (#1542)
* Tab and arrow keys for mention autocomplete

Highlight the selected suggestion and let Tab accept it. Up/down move
the selection when the mention panel is open; Tab otherwise still
cycles focus.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Retrigger CI after flaky GeoRelayDirectory iOS test

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: navigate mention suggestions with the same macOS key monitor as commands

Arrow keys never reach SwiftUI while the composer field editor has
focus, so adopt the NSEvent local monitor from #1504. Align accept
keys (Return or Tab), add Escape to dismiss, and match highlight opacity.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix dead key monitor: gate on live state, not a value-captured Bool

A synthetic-event harness against the extracted modifier showed the
realistic path broken: the panel is hidden when the composer appears, so
onChange(of: isActive) ran on the previous render's modifier value and
installed a monitor whose closure had captured isActive == false — it
passed every key through forever. Arrows/Tab/Escape never worked on a
real Mac.

Install the monitor once for the view's lifetime and gate each event on
an isActive closure that reads the reference-typed model live. Same fix
applies to the iOS onKeyPress guards for consistency. Harness now passes
all paths including deactivate/reactivate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-01 14:51:31 +02:00
Taksh Kothari
0152344554
feat: verification seal on private message sender rows (#1573)
* feat: show verification seal on private message sender rows

DM-only filled seal next to verified peers' names closes the remaining
UI gap from #1439 without dressing public mesh timelines.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: skip in-string verified ✓ on private rows with SF Symbol seal

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add verified_sender catalog entry (30 locales) + live seal repaint on verify

The accessibility label existed only in code, so VoiceOver read english
in 29 locales; the coverage test can't see source-only keys. Also forward
peerIdentityStore.$verifiedFingerprints into objectWillChange so toggling
verification repaints rows in an open DM instead of waiting for the next
unrelated invalidation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-01 14:51:28 +02:00
Taksh Kothari
681c180060
feat: share location channel invites via the system share sheet (#1513)
* feat: share location channel invites via the system share sheet

Adds text-first geohash invites (deep link + App Store URL) from
channel rows and the active-channel header, with an OpSec warning
for neighborhood-or-finer cells.

Closes #1497

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: add Localizable.xcstrings entries for channel share copy

Cover all six new share/done keys across the 30-locale catalog so
LocalizationCoverageTests and non-English builds stop falling back
to English defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: retrigger CI after unrelated VoiceRecorder flake

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 10:23:41 +01:00
Taksh Kothari
c66015d029
feat: local alias field on the fingerprint sheet (#1507)
* feat: let users set a local alias on the fingerprint sheet

Wire the existing localPetname field to a write path so peers can be
renamed locally; read paths already prefer the alias when present.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: make local aliases visible and localize the fingerprint field

Give local petnames display precedence over announced nicknames across
peer rows, DM headers, and resolveNickname; rebuild peer state after a
save so lists update immediately. Load the alias draft when the
fingerprint arrives, and add the three local-alias strings across all
30 locales.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: use macOS 13-compatible onChange for fingerprint alias sync

The two-parameter onChange API requires macOS 14; match the rest of the
views so release and Periphery builds stay green on the 13.0 deployment target.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 10:23:14 +01:00
Rod Bahmanyari
68edb34469
Location channels: locale-derived one-tap quick join (#1444)
The channels sheet grows a "quick join" row: one tap into the region-level
geohash channel around the device region's main population center — the
same path as typing the geohash and teleporting, no location access used.

Review of the first cut (a curated "heavily censored countries" roster)
called out that a hand-picked list invites inclusion disputes, goes stale
with politics, and is App Store / geopolitical exposure. The suggestion now
derives from the device locale under one neutral rule for every country:
ISO region → the 2-char geohash cell of the main population center (the
largest metro, not always the capital: US → New York, TR → Istanbul).
219 regions covered; the twelve cells the earlier roster shipped were
independently verified in review and reproduce unchanged.

The caption is deliberately blunt, per the same review: the cell belongs
to the main population center — it is not "your country's channel" and
not your location; the channel is public and well-known, so assume it is
watched; quick join is discovery — it hides nothing and bypasses nothing.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-01 10:22:26 +01:00
Felix-Ayush
2c9a4e07c6
Localize hardcoded macOS image picker copy. (#1478)
MacImagePickerView used English string literals, so it skipped the string catalog and localization coverage. Move the user-facing strings into Localizable.xcstrings for all supported locales.

Co-authored-by: jack <212554440+jackjackbits@users.noreply.github.com>
2026-08-01 10:03:52 +01:00