The member's device makes a random key, works out every ancestor leaf
and both descriptors, and only then asks the group. The group's quorum
signs a member wallet certificate of its own kind (30334) rather than a
birth certificate, since every reader of 30329 assumes a room. Ancestors
list the wallet as @name, and the group's page opens the member's profile.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
subgroup-wallet-policy.md is marked built, with a table of where the
build chose differently. group-wallet-guardians.md's "why it is still the
child's choice" becomes "whose choice it is": the parent decides, the
chain still does not enforce it, and an older certificate still leaves it
to the child. subgroups.md gains the wallet tag and the policy as the
second value the coordinator picks for other people.
The three-emulator run is still to do by hand.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The coordinator picks guarded or unguarded on the subgroup picker, the
parent's quorum signs the choice into the birth certificate, and the
child's admins agree to it by joining and again when they sign the key
state. Every honest client then offers, signs, derives and watches only
the wallet the certificate allows. An unguarded certificate carries no
guardian keys, and a guarded group can only make guarded subgroups.
Not built: Phase 0's decisions and nine phases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FrostSigningEvents.DECLINE and MarmotDirectMessage.ENVELOPE_KIND are both
30330. Recognising protocol kinds first (ceremony-creation Phase 6) returned
before the direct-message branch, so every direct message in a
current-profile room was dropped unopened. A 30330 that holds a gift wrap is
an envelope; only one that does not is a decline.
ProtocolKindDispatchJvmTest now opens an envelope through
fromGroupEventResult, which no test did before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GroupWalletRollout.GUARDIANS_ON_MAINNET is on, lifted by decision ahead of
the signet run its condition named. The mixed-version risk stays open and
is said so in the gate and the guardians note; guardian spends on mainnet
are held to MAINNET_CAP like every other spend.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The group's detail screen loses its "Nostr profile", "Relays" and "Posts"
rows, and the six screens behind them go with them: the profile, its
editor, the relay lists, their editor, the posts and the composer. So do
the readers they stood on (GroupNostrProfile, GroupRelayList, GroupPost),
their ChatRepository methods, and 97 strings.
Two things go that were not named, because nothing else reaches them.
BroadcastGroupSignedEventScreen was only opened from those three screens,
so the app no longer sends a group-signed event to a relay, and
EventPublishTransport goes with it. "Propose event" accepted only a
profile, a post or a relay list, so it would refuse every paste;
ProposeGroupEventScreen and GroupEventProposal are removed, and with them
the detail screen's canEditNostrProfile gate. What is left of that block
is the wallet row, shown in Marmot rooms only.
The transcript keeps what it already holds. The three message types stay
as private legacy names in GROUP_IDENTITY_TYPES, as the curated-lists
types did, so rows already written stay system lines. A profile or relay
list arriving in a room now applies to nothing, so a signing session an
older build opened for one ends without a raw-JSON bubble. A kind:1 falls
through to "unsupported", which is what it was before posts existed.
ProposedEvent no longer describes the three kinds.
GroupSignedWorkRowsJvmTest now covers the wallet row and the absence of
the removed rows. The chronicle tests still use a profile, a relay list
and a post as their kinds; they compare GroupSignedEvent rows, which are
unchanged, so only ChronicleTestKinds' account of why is corrected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found on the emulators: refusing a Marmot room left the app bar reading
"Shared key for " and nothing. It reads "Shared key" until the room is
loaded. The plan now records what was checked on the three emulators that
found the bug, and what was not.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shared-key-ceremony.md says where a ceremony starts and how one ends early;
subgroups.md points its Phase 10 here; member-chronicle.md says the chronicle
is built and carries nothing; the batch-signing, skipped-keys and Material
notes mark their document examples as removed; the plan records the ten
places the build chose differently.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Joining a subgroup's ceremony could open a second, whole-room ceremony in the
parent's Marmot room: the shared-key screen showed a ceremony, asked for
approvals and offered to start one from the same button slot. The plan
separates starting from showing, guards proposeRitual, and removes the
unreachable nip30303 document code whose kinds collide with the ceremony's,
keeping the member chronicle as an empty, quiet shell.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A guarded wallet's coins have a spender outside the room: a guardian can
take a coin the child's open spend wants, and the child can move one a
guardian's wants. Neither winner is a row in the loser's room, so the loser
sat signed and rebroadcast forever. The watcher now asks the chain, for a
signed spend Electrum has not heard of, which transaction took each coin;
once that one confirms, recordReplaced marks the spend replaced and settles
every other spend of the coin, as recordConfirmed does for the room's own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guardians note records what was built against the plan, what is left to
do by hand before the mainnet gate lifts, and the conflicting-spend gap. The
subgroups and wallet notes each change the one sentence the plan said they
would.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The parent signs a guardian key for the child into its birth certificate,
beside its own ancestors' keys derived one step further, and the child's
guarded wallet puts each in a 12-block leaf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The audit and the JVM suite ran after every phase. The two-device regtest
walkthrough has not been done; the note lists each of its steps beside
the automated test that comes closest and what that test cannot show.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every place a spend is described -- the proposal list and the wallet's
spend rows through ProposedSpend.summarize, the approval screen through
isChange, and the signed and confirmed transcript lines through
amountSent -- already reported the payment rather than payment plus
change. Nothing needed fixing; ProposedSpendTest and the end-to-end
spend test now hold each of them to it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The amount field shows its unit, how many sats are confirmed and free to
spend, and on mainnet the cap; a problem with the amount -- not whole,
too large, more than the group has, too small, over the cap -- is said on
the field in its error state instead of under the form. The send-everything
row is one 48dp toggleable target, and turning it off again finds the
amount typed. The wording of every reason is one function shared by the
field and the preview.
GroupSendScreenJvmTest types into the form on regtest and mainnet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Marks the plan built, with a table of the nine places the build chose
differently, and points the group-chain-wallet note's gap-limit
paragraph and the docs index at it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SEND_AN_AMOUNT kept every network on send-all until a release had shipped
with no mislabelled change, which no release could do while the gate was
closed. It is removed: the send screen always offers the switch and the
amount, and on mainnet the existing 100,000 sat cap bounds what a change
bug could put at risk. Phase 3's end-to-end test is what stands in for
the release the gate was waiting for.
The view model test no longer branches on the constant, and a mainnet
test holds an amount to the cap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two open spends with change both paid to the first unused change
address, since a spend waiting for signatures has not used it yet.
Change indices are now reserved like coins: reservedChangeIndices reads
the claims of every open spend, and the builder takes the lowest watched,
unused, unheld index. It chooses among generated addresses only, so
change never lands outside the window; CHANGE_LOOKAHEAD rises to 10 and
past it a spend with change returns TooManyOpen.
The change branch not having answered is FindingChange rather than
NothingToSpend, and change too small to send back is reported as
Built.absorbed and said in the preview.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gated amount field read its text by dropping every non-digit, so
21000.5 became 210,005 sats and 0.0005 became 5. parseSats accepts
thousands grouping and refuses decimals, grouping that groups nothing,
non-ASCII digits and more sats than exist; the preview reports which.
The field shows plain digits grouped and keeps what was typed.
Also plans the rest in docs/group-send-an-amount.md: send-an-amount
opens on every network at once, held on mainnet by the existing cap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Modelled on Phoenix's swap-in addresses screen: every paid receive
address, the current one, and the two after it, read off the receive
mini-wallet's state with nothing stored and nothing new subscribed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
And its registry, GroupChainWallets, is GroupOnchainWallets, with the
files, the test and the plan's references following.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GroupWalletRollout holds the three gates, each with what lifts it. The
flag is on, its condition met. Send-an-amount is off, so the form sends
everything confirmed to one address and says so. A spend proposed from
this device on mainnet may send at most 100,000 sats; test networks
have no cap. The gates are on the composer and nothing else: a device
behind them still accepts, shows and signs what another member
proposes, through every check GroupSpend makes.
The plan is marked built, with its table of where the build chose
differently. Full JVM suite: 1474 tests, none failing; the Android
target compiles; every M3 budget is met.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every spend the room proposed, newest first, for every member whether
or not they have a node: what it sends and where it has got to --
waiting for signatures, abandoned, signed, sent (reported back by
Electrum, not merely broadcast), confirmed, or replaced by a later
spend. A signed spend Electrum has not reported can be sent again; a
signed, unconfirmed one can be bumped to twice its feerate, a new
session over the same coins that whichever confirms settles. Each row
opens its signing session.
Full JVM suite: 1473 tests, none failing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GroupSendRoute and GroupSendScreen, behind a Send button on the wallet
screen for a member who holds a share and has a node to see the coins
with. Address, amount or send everything, and a feerate prefilled from
Electrum's six-block estimate. The preview is GroupSpendBuilder over the
same inputs the proposal is built from -- what leaves, the fee, what
comes back as change, or why it cannot be built -- and proposing moves
onto the signing session, replacing the form.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kind 30332 opens a session over a PSBT, one item per input, each its own
FROST instance over that input's BIP341 sighash with its own nonce seed
and its own tweak cache. proposeSpend and acceptSpendProposal run the
same GroupSpend checks: every input derives under the account the
room's verified statement gives -- looked up under the ceremony's own
key -- default sighash only, no script-path fields, replaceable, change
only where its claim derives, and a fee under a ceiling. A second
proposal under one id is ignored. completeSpend checks each signature
against its coin's output key and the whole transaction with
correctlySpends before writing it.
An old build does not route 30332, so it never signs a transaction it
cannot show. Resend repeats the PSBT byte for byte. Two-device test:
a quorum spends two coins and both devices hold a transaction that
correctlySpends; each check refuses a hand-built proposal outright.
Full JVM suite: 1458 tests, none failing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FrostSigningSession.subject, NOT NULL with a default of EVENTS, says
what a session's items are messages of; FrostSigningItem.inputIndex
names the input a transaction item signs, with message and payload as
getters over the existing columns. GroupTransaction holds a spend from
proposal on: the PSBT, written once with IGNORE, the txid fixed before
signing, and the signed transaction, broadcast, seen and confirmed.
AutoMigration(25, 26) is three ADD COLUMNs and a CREATE TABLE -- no
rebuild of either signing table, so no cascade fires.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GroupWalletRoute and GroupWalletScreen, reached from a Group wallet row
on the group's screen. A group that has not opened a wallet gets an
empty state with, for a member who can sign, what opening one asks of
everybody -- including that shares are unencrypted at rest -- and the
button that proposes the statement. An open wallet shows the balance,
confirmed and on the way said apart, the next receive address as a
BIP21 QR code, selectable text and a copy button, the coins, and an
export of the two watch-only descriptors with what they give away.
The wallets are watched on the identity's own Electrum client and made
per PhoenixBusiness in BennuNavHost; a profile with no node sees the
wallet and is told it cannot watch the chain.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GroupChainWallet is Phoenix's FinalWallet for a group: two
ElectrumMiniWallets, one per BIP44 branch since a mini-wallet holds one
generator, gap-limited at 10 for receive and 3 for change, on the shared
client. GroupWalletState gives the coins with the derivation that spends
each, the confirmed and pending balances, the next receive address and
change index, and derivationOf -- bounded by the addresses the wallet
has generated, which is how far a check of a claim will look.
Tested against a fake IElectrumClient: a payment moves the receive
address on, change is counted and never offered, and two groups on one
client see only their own coins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kind 30331, inner only: the account xpub, the network, the account
number and both descriptors. A reader believes one only when the room
signed it and the room's threshold key rederives every value it
carries -- GroupWallet.of, used by the repository and by the transcript
arm alike. The broadcast screen refuses the kind twice, at the loader
and in sendToRelays, because the xpub on a relay is the whole balance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GroupWalletDerivation: a public account step -- a tagged HMAC over the
threshold key, the network and an account number -- gives a depth-0 xpub,
and below it BIP86's own unhardened tail, /<change>/<index>, with the
key-path tweak on top. Each address is computed twice, as points and as
tweaks on a FROST cache, and refused if the two disagree.
Tests: BIP86's published vectors through the cache prove the tail; a
pinned vector freezes the account step; a sweep covers both parities.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Modelled on Phoenix's final wallet, phased. The path is BIP86's
unhardened tail under a public account step over the ChillDKG key, so
the group can export a standard tr() descriptor; each input is a batch
item with its own tweak cache, and a member checks seven things before
signing a spend. Shares are used as they are at rest, for now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the packages to com.machankura.bennu.{compose,android,desktop}, the
Android applicationId to com.machankura.bennu.android and the iOS bundle
id to com.machankura.bennu.ios. The root project, launcher label, iOS
product, desktop window, user-facing strings, client tags and the
Curare* classes all say Bennu now.
Left alone on purpose: the mantra/ derivation tags, the `curated` desktop
data directory, the mantra.press relay and the curare.to references.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The resend narrowed its NIP-17 p-tags to the members it was for, on the
reasoning that a wrap is sealed per recipient so repeating one for the whole
room wastes wraps. Both halves of that were wrong.
A receiver does not read the p-tags as a recipient list. It hashes them together
with the sender to work out which room the payload belongs to --
`GiftWrapPayload.aggregatedParticipantsPublicKey`, via
`ChatRoom.deriveChatRoomId`, which is what `GiftWrapSeal.decryptGiftWrapPayload`
files an inbound payload under. Leave a member out and the id changes, so the
resend is filed under a room that does not exist; `getOrCreateChatRoom` then
mints that room rather than rejecting it. A repaired session would have become a
phantom two-person conversation in the reader's list, and the session would have
stayed stalled.
There was no saving to trade against it either: `sealGiftWrapPayload` wraps for
every participant of the room it looks up, not for the p-tags it was handed, so
a narrowed payload cost exactly as many wraps as a full one.
Who a resend is for travels in `frost_silent`, which is not part of that hash,
so nothing is lost by naming everybody.
Marmot was never affected -- a group event names nobody and is routed by its
h-tag.
The two tests that asserted the narrowing now assert the opposite, which is the
property worth having: the p-tag set does not change between a publish and its
repeat. The p-tags were the right thing to assert all along; they just mean
something other than what they look like.
Found while answering whether this is backwards compatible with older receivers.
It is -- no new kind, an unknown tag that old builds ignore, and every
duplicate-folding gate in `record` and `acceptProposal` predates this work. This
bug was never a compatibility bug; it broke old and new receivers identically.
1279 tests, no failures. m3Audit: all budgets met.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`broadcast` now says whether it queued anything, and `publishOwn` records the
local copy only when it did. The copy is what stops `advance` from publishing
that message again, so writing one for a message that never went out is a
message the group waits on forever -- the exact opposite of the trade the
queue-then-record order exists to make. The comment on `publishOwn` had that
trade written down in one direction only.
Reachable only through the id-collision guard added with the resend, which
refuses after four tries rather than overwriting a sent row. Four consecutive
seconds of the same message is not something a person with a button can do, but
"unreachable" and "safe when reached" are different claims.
Also brings the docs up to what was built: the resend note is in the index, the
skipped-keys note points at it as the recovery for the failure it describes --
a new message is encrypted at a generation the receiver has not passed, which is
the whole mechanism -- and the plan records the two things landing it turned up,
plus `ask_again` being reused from the catalogue rather than duplicated.
1279 tests, no failures. m3Audit: all budgets met.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A proposer can resend what the proposer wrote and nothing else. A nonce or a
refusal relayed by somebody else is filed under the relayer -- `record` keys a
signer's message on the inner event's own pubkey -- and for a refusal that is a
way to manufacture one, which in an n-of-n group abandons a session nobody
refused.
So a resent proposal names the quiet members instead, and their own devices
republish what they already said, under the keys that said it. This is the tag
that names them: `frost_silent`, all-or-nothing like `frost_signers`, because a
list naming the wrong people is worse than no list at all.
Additive on the wire. A build that does not know the tag ignores it and accepts
the proposal it rides on, which is the half of a resend that fixes the common
case -- a member who never saw the proposal because MLS dropped the generation
it arrived at (docs/mls-skipped-keys.md) or a disappearing-message group expired
it off the relay.
Plan: docs/frost-session-resend.md, Phase 1.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
In an expanded window the transcript beside the room list showed the
first room opened and stayed there: pick another room and the list
moved on while the pane did not. HomeScreen wraps the pane in
key(chatRoomId), which rebuilds the composition when the selection
changes, but viewModel() does not read composition keys. It scopes to
the nearest ViewModelStoreOwner, and in the pane that is the home
destination's one back stack entry for every room, so the second room's
viewModel(factory = ...) got the first room's ChatRoomMessagingViewModel
and ChatMessageListViewModel back with its factory ignored. A phone never
showed it because a pushed room is its own entry with its own store.
The pane now provides LocalViewModelStoreOwner with
rememberViewModelStoreOwner() under the room key: a store per room,
cleared when the selection moves on, and parked in the home entry's
store so that it survives a rotation. Keying the two viewModel() calls
on the room would have unstuck the pane too, at the price of keeping
every room ever opened -- four DB collectors each -- in the home entry's
store for as long as the home screen lives.
ChatPaneSelectionJvmTest opens two rooms and comes back to the first,
told apart by what was said in them since a name is on the row as well
as the bar; its third case checks the room left behind stops collecting,
which is the case the keyed alternative fails. The conformance doc's
account of the hand-built pair records the trap.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs/marmot-v2.md, Phase 9. The phase has no code in it; it is the rollout,
and the rollout is a flip and a retirement that wait on the people this
app's users invite. What the phase owes the document is the repo's
convention for a plan that has been built: the status paragraph, the table
of where the implementation chose differently, the thing found on the way
that belongs to nobody's phase, and the commit the account was written
against. All four are here now, and the phases themselves are kept as
written, because they are the reasoning and the code reads better against
the argument it came from than against a summary of itself.
The table has twenty-two rows, and the first is the one to read before any
of the code: the plan said the library's engine replaces the app's pipeline,
and the build made a room's profile pick its pipeline instead -- legacy
rooms keep the app's path, comparator and cache included, and retire with
the profile; current-profile rooms go through `MarmotEngine`. The library's
processor has no carve-out for the bare gift wrap a legacy direct message is
carried in, so under it every one of those would have stopped decrypting,
and the legacy pipeline is frozen anyway. Most of the other rows follow from
that one: one store rather than four, no message-id column, the rotation
manager constructed and unused, the engine hanging off the database rather
than an identity's scope. The rest record the smaller turns -- the envelope's
kind, the chronicle cap measured escaped, the KeyPackage not last-resort, the
admin refused before a leave is attempted, captions from the participants
diff rather than a snapshot column, no rename, the two non-chat kinds only,
the four Phase 8 scenarios spread over four tests -- and the three
follow-ups that closed lines the phases' own commits had missed: the
outbound hold while a pass is open, the rejected commit discarded, and the
1210/1009 bubbles.
The thing found on the way is quartz 1.15.2's: its convergence rebuilds a
candidate branch by replaying its commits against the retained parent, and
a member cannot replay a commit it authored, so a fork this device is half
of is scored with its own branch stale and two committers swap branches
rather than agree. Every device that only observed still agrees, which is
the case the app depends on and the first fork test holds; the second pins
the swap and says what to do the day it fails. The paragraph says the
practical exposure is small and why, and that the Phase 5 follow-up on
withdrawing a losing branch's rows waits on the same fix.
Phase 9's own section gains "Where it stands": everything ships built and
unflipped -- `DEFAULT_FOR_NEW_ROOMS` is legacy, both slots are published, no
room is on the current profile unless a caller asked by name -- so the first
of the three one-way doors is behind us and the other two wait on the flip.
The README's row and reading-order paragraph now say the plan has been
built and point at the table's first and last rows.
One code change, a comment: the plan's Phase 5 asked that the two library
gaps the rewrite does not close -- the retained-epoch decrypt without sender
verification, and the skipped keys that do not survive `saveState` -- be
said where the new code is, rather than let the rewrite look like it closed
them. `MarmotEngine`'s class doc now says both.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
What goes into MLS is now the Marmot app event the spec defines: six members and
no `sig`. The rumor serialised as an Event carried `"sig":""`, which a conformant
decoder refuses outright -- a payload with a signature would be a standalone relay
event, republishable as a signed statement by its author. The id does not move,
because NIP-01 never hashed the signature, so every row filed under an inner
event's id stays valid; and the build already in the field reads the new shape,
because Event.fromJsonOrNull defaults a missing signature. This switch alone needs
no gating and is made everywhere at once. The `encoding` tag comes off the
application kind:445 while here -- transports/nostr.md forbids it on every shape.
docs/marmot-v2.md, Phase 2.
A direct message could not make that switch as it was. Its payload is a NIP-59
wrap signed by a throwaway key, which a conformant peer refuses twice over: for
the sig member and for an author that is not the MLS sender. In a current-profile
room the wrap now travels inside an envelope -- an unsigned app event of kind
30330 authored by the sender, one `p` tag for the recipient, the wrap's JSON as
content. The envelope passes the author check like any payload, so the carve-out
in mip03Rejection that admitted bare wraps is confined to legacy rooms by a new
`legacyRoom` flag: in a current-profile room a bare kind:1059 is refused as every
other conformant client refuses it. Every property the throwaway key was chosen
for survives -- the envelope is unsigned and so a claim rather than a proof, the
wrap inside is still signed by nobody, and the seal-to-leaf binding in classify
still decides who wrote the words. The line for a message this device cannot read
now hangs off the row the payload was filed under (the envelope's id in a
current-profile room), which ChatMessage's foreign key requires.
The envelope is gated, and the gate is the room's profile: an old build renders
it as a raw-JSON bubble, so a legacy room keeps sending the bare wrap, and a
current-profile room -- which admits only leaves carrying an identity proof,
which only a build past Phase 3 can make -- never holds an old build. That is the
flag for every wire change after this one.
A conformant decoder bounds the whole app payload at 64 KiB, and a chronicle page
rides inside one as JSON-escaped content. The new bounds test caught what the
arithmetic missed: dense JSON payloads escape to half again their size, so a 48
KiB page became a 70 KiB app event. The packer now measures a page by
ChronicleEvent.escapedByteSize -- the bytes it will occupy inside the envelope --
against MAX_PAGE_BYTES, lowered from 64 to 48 KiB, and MAX_PAGE_EVENTS drops from
128 to 96 so the count cap still binds under it, as the comment on the two caps
insists. The receiver's raw-bytes check is unchanged and now holds by
construction.
Tests: MarmotMip03CarveOutTest becomes the test that the exemption is confined to
legacy rooms and that an envelope passes the ordinary check; MarmotDirectMessageTest
round-trips the envelope through the strict decoder and opens the wrap inside;
MarmotPayloadBoundsTest asserts the largest chronicle pages and an envelope are
conformant app events, including the dense-content page measured the way the
packer measures it. The ingest test's tamper case flips a decoded byte rather
than the base64 tail, which could change nothing but padding. Full JVM suite:
1,148 tests pass. The direct-message and chronicle notes record the changes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
quartz 1.15.2 implements the restructured Marmot spec, and bumping the version
gives this app almost none of it: the pipeline that reads, forks, publishes and
persists group state is the app's own, driving MlsGroup directly with Room as
the store, while everything v2 lives in the library's managers behind four store
interfaces the app has never implemented. This note is what would have to change,
in the order it can safely change.
Nine rules reach the app, tabled against what it does today: unsigned six-member
payloads, component-based group state with per-leaf identity proofs, a random
routing id, dedup by the Marmot message id, convergence in place of the
created_at-then-event-id rule, publish-before-apply, SelfRemove and derived
captions, NIP-65 KeyPackage relays, no encoding tag. Two constraints shape the
phases: adopt the library's engine rather than re-implement it (convergence is
two thousand lines whose only value is agreeing with every other implementation),
and split the room's derived id -- the group's FROST key, per the derivation
note -- from the routing address v2 says must never be derived.
Nine phases, ordered so that the ones that reach other clients come before the
ones that make the app's own forks settle the way theirs do. Two findings from
the research shaped them: the build already in the field reads a canonical
payload because Event.fromJsonOrNull defaults a missing sig, so the payload
switch needs no gating; and the app picks a peer's KeyPackage by newest
created_at, so the two-slot transition has to stamp the legacy package later or
old builds break on a framed one.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
curated gained ExtendedFab while the preview was being built: every screen's
bottom-bar action, with an enabled that borrows the disabled colours, marks the
node disabled and drops the press. The preview had chosen a Button for exactly
the reason that widget removes -- a FAB had no disabled state -- so after the
merge it was the one screen whose primary action was shaped somewhere else.
Now it is that FAB in a bottom bar, the indicator in its icon slot while the
key package is still owed, and the reason line stays in the body above it.
Hidden, bar and all, for a read-only identity.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Twenty screens end their bottom bar in an `ExtendedFloatingActionButton` --
twenty-one buttons, one screen having two -- and eighteen of those were built
from the content-lambda overload with an `Icon` directly followed by a `Text`.
That overload puts nothing between the two, so the icon touched the label on
every one of them: visible in any render, and unnoticed because every FAB in
the app looked the same. Thirteen of the eighteen also carried the same
twenty-line block for looking disabled, because M3 gives a FAB no `enabled`.
**`ExtendedFab`, once, in widgets/buttons.** A label, an icon slot, `enabled`
and `onClick`. It draws `space150` between icon and label, which is the 12dp
M3 names `ExtendedFabEndIconPadding`; it borrows the disabled colours every
other button in the app uses, marks the node disabled so a screen reader does
not announce a button it is happy to press, and drops the press -- so the
thirteen call sites lose their `if (!canX) return@…` guards along with the
block and the `buttonColors` each of them declared. An icon slot rather than
an image, because two screens put a progress indicator where the icon was
while the action they started is out, and they still do.
**Not M3's `text`/`icon` overload, which would have spaced them for free.**
Its source wraps the label in `clearAndSetSemantics {}`: the label leaves the
merged semantics tree, a screen reader is told only what the icon says, and a
test cannot find the button by what it says -- five screen tests do. The
three FABs that were on that overload move to the widget too, and two of them,
Home's "New chat" and "Start the key ceremony", had a decorative icon beside
the cleared label and so no accessible name at all until now.
`ReadOnlyEntrancesJvmTest` had gone to the unmerged tree to find "New chat"
for this reason; the habit is harmless and stays. Every icon's description is
as it was, since several tests reach their FAB by it.
`ExtendedFabJvmTest` pins the decision: found by its label in the merged tree,
the icon before the label with a gap between, and disabled both announced and
refusing the press. The two docs that recorded the old state -- the
conformance account's "left alone" and the npub plan's unmerged-tree note --
each say what superseded them.
Verified with :composeApp:m3Audit (all budgets met, 0 dp literals in spacing
positions), :composeApp:compileDebugKotlinAndroid and :composeApp:jvmTest
(1088 tests, 3 new).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two strings that already existed, a room rule that follows the old code's
intent rather than its branch, a retry that never takes an open chat back to
checking, the flag the ordering cases asked for, and the test harness the other
view models use.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The "Direct message via npub" option goes straight from a pasted string to an
MLS room. The plan puts a screen between them, keyed by public key because that
is all the dialog has, and keeps the room's creation where it is: four decisions
-- where the preview lives, what "found" means when a row can be a placeholder,
that the button hands over rather than creates, and that it waits for the key
package so the twenty-second dead end is answered before the press -- and four
commit-sized phases with the tests for each.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Phases 1–8 are implemented, in order, one commit each; Phase 9 is the
rollout and stays as written. The plan's phases are kept as the reasoning,
and the table at the top says where the build chose differently: the
repair reads before it writes and hands the listing its result; one
WalletAttached outcome with two ways in; the node stop and the relay scope
injected for their tests; the default save that cannot crash; a
ProfilesViewModel over flows; a NewProfileWriter and a route flag where the
plan expected the create screen's existing writer to serve; the colliding
id on the outcome rather than on the enum; the DAO's own requests left
unowned because they fetch public kinds; the inbox reopened by re-indexing
each wrap in its own transaction rather than by lifting the unseal branch
out; and the round trip's A made through the create view model with a
never-started PhoenixBusiness for the switch to stop.
Three things found on the way and in no phase are recorded beside the
table: the library's unsynchronised global-preferences cache, reached by
two threads at once for the first time, now behind JvmGlobalPrefs on the
jvm target; the same cache's consequence for tests that construct the
sovereign view model; and the gift wrap seal's link to its wrap, a foreign
key that existed and was never written until the inbox sweep asked the
question it answers.
The README's row and reading order say the note is built, and name
switchToIdentity where they named switchToWallet.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Phase 1 of docs/multiple-profiles.md. No library change: the file format, the
encrypted writer and the manager all exist, and the app already wrote the
credentials file from the seed writer -- to delete a public entry a seed
superseded. This changes what it writes there, and what the listing believes.
Until now a seed's nostr key was never in nostr-credentials.dat. It was
derived from the words at listing, to know which npub to show, and from the
running node at activation, to know which key to sign with -- so a seed-backed
profile existed only as a derivation, and the app had to start a Lightning node
to find out who it was. Both sign-in plans made "one key, one file" an
invariant, and it was the wrong one: it said a wallet is a profile. Now the
credentials file is the list of profiles and a seed is a wallet attached to the
entry its key derives.
writeMnemonic writes two things, credential first: a Secret for the derived key
under its x-only pubkey, replacing a public entry where there is one, and then
the seed. Credential first because a crash between the two leaves a bare-key
profile the phrase completes, which is a valid thing to hold and says the model
out loud -- the profile exists, then a wallet is attached to it. The one
refusal it drops is the phrase of a key held as a bare secret, SeedAlreadyExists
under the nsec plan: the device did not have that wallet, so this is the
profile acquiring the wallet that derives it. The entry stays a secret for the
same key, the id becomes the wallet's, and the bare key's preference files go
with the old id -- the profile's preferences are the wallet's now, fresh, which
is right since there is a new secret to back up. The same seed twice is still
refused, by wallet id, and is the only way a profile with a wallet attached is
offered its phrase again.
SeedCredentials.reconcile is the repair for every seed already on a device,
beside migrateFromNostrKeys in listIdentities and shaped like it: a named,
idempotent write, one file write for however many seeds are missing, nothing at
all on a device with none or one already repaired. A failed write is a result,
not a throw, and carries the map that was read: the listing goes on with it and
merge derives the key of a seed that has no credential, so a seed this could
not repair is still listed. A failed write must never hide a wallet. The plan
had the repair running before the credentials file was read; it runs after,
and hands the listing what it returns, so the file is decrypted once -- the
doc now says so.
StoredIdentity.merge inverts: the credentials are the list, and each seed is
attached to the Secret its key derives -- listed once, as Mnemonic under the
wallet's id, carrying the credential's key -- where before the seeds were the
list and a secret for a seed's key was listed twice under two ids. Mnemonic
gains privateKey. A Public for a seed's key is skipped with a log line, since
the next repair upgrades it; a seed with no credential is listed by derivation,
with a log line. IdentityKind.Mnemonic's doc changes to what the kind now
means: the name records the attachment, not the source.
setActiveWallet takes the StoredIdentity.Mnemonic and builds the identity from
the credential's key, with the node's derivation as a cross-check -- a check(),
because a node disagreeing with the credentials file is the one corruption
worth refusing to run under, and it cannot fail for a file the repair wrote.
The node still starts for a profile with a wallet attached: not for the key any
more, but for what startNewBusiness does besides -- metadata, preferences,
last-used build, and on Android the channel watcher a restored Phoenix phrase
may need. Making it lazy is now one branch and is named as its own decision.
forgetNostrCredential refuses a second thing: a key a seed derives. The seed
would derive it again and the next repair would write it back, so a forget
that succeeded would undo itself. NotACredential becomes WalletAttached in the
writer's result and ForgetIdentity's outcome, since that is now the only reason
a signing profile cannot be forgotten -- a key not in the file at all can, since
the repair, only be a seed's key the repair could not write.
The two sign-in docs' tables each gain a row pointing here for the invariant
this supersedes.
Tests: SeedCredentialsJvmTest against a device from before -- seed.dat written
directly, no credentials -- writes exactly what is missing in one write; a
device already repaired is not written to again, checked by the file's bytes
since a rewrite would carry a fresh iv; a public entry for a seed's key is
upgraded; bare keys are untouched; and a write that fails, with the key store
locked, is reported with the map that was read and the wallet is still listed.
IdentityWriterJvmTest drives the callback-shaped seed writer through a
CompletableDeferred on a real Main dispatcher, since it reports after a real
one-second delay: a phrase writes both files, its nsec and npub are then
duplicates and its forget is WalletAttached; the same phrase twice is refused;
the phrase of a bare key attaches, under the wallet's id, with the bare key's
preferences gone; the phrase of a key held read-only attaches and the entry
becomes a secret. StoredIdentityJvmTest lists a secret-plus-seed once with the
credential's key, a seed without a credential by derivation, and a public entry
for a seed's key as the wallet only. Not under test: the activation's
cross-check, because a PhoenixBusiness cannot be built without a node.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>