Commit Graph
84 Commits
Author SHA1 Message Date
Kgothatso Ngako 61c6f0b68e Merge remote-tracking branch 'origin/bennu' into claude/taproot-group-hierarchy-spending-7a37ac
# Conflicts:
#	composeApp/schemas/com.machankura.bennu.compose.database.BennuDatabase/27.json
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/BennuDatabase.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/model/ChatMessage.kt
2026-10-23 17:41:56 +02:00
Kgothatso NgakoandClaude Opus 5.5 68a86b4d77 refactor: remove the unreachable nip30303 document screens (Phase 7, part 1)
Nothing navigated to the artifact, chapter, dialect or translation screens:
ArtifactDetailRoute, AddArtifactRoute and AddDialectRoute were never built,
and the other six were only reached from inside those screens. Removed with
their view models, UI states, routes, nav host entries, the repository behind
them, TranslationScaffold, DetailRow, and the 65 strings only they used. The
group details screen loses the document repository it stored and never read.

The string catalogue test now checks its escapes on a string that stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:42:15 +02:00
Kgothatso NgakoandClaude Opus 5.5 726adfc02c feat(dkg): a participant can abandon a key ceremony, and only a participant (Phase 5)
There was no way to end a ceremony: ChillDKG has no "no" short of it, and
the approval screens pointed at an abandon action on the ritual screen that
did not exist. ChillDkgRitualManager.abandon now ends a running ceremony this
device is in, filing and broadcasting the same FAILURE a fault sends, and the
ceremony screen offers it behind a confirmation.

record() now ignores a FAILURE from anyone outside the ceremony. In a
parent's room every member can read a subgroup's proposal, so any of them
could otherwise end it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:35:56 +02:00
Kgothatso NgakoandClaude Opus 5.5 cc01f4aab9 feat(dkg): one screen that starts a group's own key ceremony (Phase 3)
CreateSharedKeyScreen takes the quorum and a single button, and nothing
else. It refuses a Marmot room and a group of one with a reason, hands over
to a ceremony the group already has rather than offering a second, and
replaces itself with the ceremony once it is opened so back never returns to
an offer. The group details' Shared key button and the card shown when a
robust group was created without its ceremony both lead here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:27:15 +02:00
Kgothatso NgakoandClaude Opus 5.5 29328b4c5f fix(wallet): settle a spend whose coins another room's transaction took
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>
2026-10-23 16:12:48 +02:00
Kgothatso NgakoandClaude Opus 5.5 00df58c1f3 feat(wallet): an ancestor's quorum spends a descendant's coins through its leaf (Phase 7)
GroupSpend checks a spend as a guardian would sign it: every input under
the descendant's account, locked by the leaf's 12 blocks, signed over the
script-path sighash as the key the ancestor's walk reaches, and witnessed
with the leaf and its control block. The builder waits out the lock and
weighs the leaf; the signing manager proposes, accepts, signs and completes
it, and every signer reads the descendant's wallet from its own copy of the
statement. A guarded wallet row on the ancestor's wallet screen opens the
send form for it. Schema v27 adds GroupTransaction.guardedChatRoomId.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:37:21 +02:00
Kgothatso NgakoandClaude Opus 5.5 e7a1ad260f feat(wallet): a guarded wallet is told to the groups above, and they watch it (Phase 6)
A member in both rooms carries a descendant's signed guarded statement into
an ancestor's MLS room as a 30333 notice, and can pass one on a generation
further. Every ancestor device believes it only when its own guardian root
reaches the key the statement names for it. The wallet screen lists the
guarded wallets below the group with what is within its reach, and the
statements this device can still carry up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:26:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 cbe5330cac feat(wallet): a subgroup opens a guarded wallet, and spends from it as before (Phase 5)
A room whose certificate grants guardian keys is offered a guarded wallet,
with a plain one beside it, on test networks; mainnet waits behind
GroupWalletRollout.GUARDIANS_ON_MAINNET. A spend's account is the one the
statement opened, so its own spends sign the guarded addresses' key path,
and wallets are watched per descriptor rather than per xpub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:17:24 +02:00
Kgothatso Ngako 409be6db28 Merge remote-tracking branch 'origin/bennu' into claude/satoshi-amount-group-wallet-a12572
# Conflicts:
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/wallet/GroupOnchainWallet.kt
#	composeApp/src/jvmTest/kotlin/com/machankura/bennu/compose/wallet/GroupOnchainWalletJvmTest.kt
#	docs/README.md
2026-10-23 12:51:52 +02:00
Kgothatso NgakoandClaude Opus 5.5 affb90be41 Merge branch 'claude/receive-address-rotation-4731b9' into bennu
The group wallet's address list: every paid receive address, the
current one and the two after it, any unused one handed out as a QR
code, and the used change addresses -- docs/group-wallet-addresses.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:34:28 +02:00
Kgothatso NgakoandClaude Opus 5.5 9a319e1ef1 feat(wallet): the amount field says what can be spent and what is wrong (Phase 4)
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>
2026-10-23 12:31:00 +02:00
Kgothatso NgakoandClaude Opus 5.5 8e7782261f feat(wallet): send an amount from the group's wallet on every network (Phase 2)
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>
2026-10-23 12:26:10 +02:00
Kgothatso NgakoandClaude Opus 5.5 eb1f126adf feat(wallet): hand out any unused address as a QR code (Phase 3)
Tapping the current or a next address on the list opens it in a sheet
-- the receive card's QR code, selectable text and copy, titled with the
index so a member can say which one they gave. A used address has copy
and nothing else: copying is for checking, a QR code is for being paid.

The sheet closes itself, with "Address N was just paid", when Electrum
reports a payment to the address it is showing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:23:05 +02:00
Kgothatso NgakoandClaude Opus 5.5 5c77853cfa feat(wallet): change goes to an address the group can find (Phase 3)
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>
2026-10-23 12:22:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 5b06c84401 feat(wallet): a screen listing the group wallet's addresses (Phase 2)
GroupWalletAddressesScreen, pushed from an "All addresses" button in the
wallet screen's receive card: index, address, and what each has been
used for, newest first, with the current address on the secondary
container and a copy button on every row. Its view model reads the
wallet GroupOnchainWallets already holds, so the list costs no
subscriptions and agrees with the wallet screen about which address is
current.

FakeElectrum moves out of GroupOnchainWalletJvmTest so the view model's
test can drive a chain too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:19:47 +02:00
Kgothatso NgakoandClaude Opus 5.5 bc348419bc feat(wallet): read an amount as whole sats, or say why not (Phase 1)
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>
2026-10-23 12:15:17 +02:00
Kgothatso NgakoandClaude Opus 5.5 96055da584 feat(wallet): call it the group onchain wallet
The wallet screen's title, the room's detail row, the button that opens
one and the proposal summary a member agrees to all said "group wallet".
They now say "group onchain wallet", which is what it holds, and agrees
with GroupOnchainWallet in the code. Sentence case, as every string is.
Resource keys are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 11:51:36 +02:00
Kgothatso NgakoandClaude Opus 5.5 cd7aa36cd0 Merge remote-tracking branch 'origin/bennu' into claude/group-chain-wallet-plan-93f0e1
Every conflict was the curated-lists removal on bennu meeting a wallet
line added beside it: the removal is taken and the wallet lines kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 10:04:53 +02:00
Kgothatso NgakoandClaude Opus 5.5 f83fe35a45 feat(wallet): ship behind the rollout gates (Phase 10)
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>
2026-10-23 08:52:16 +02:00
Kgothatso NgakoandClaude Opus 5.5 0db1fe8fc8 feat(wallet): the group's spends on its wallet screen (Phase 9, part 2)
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>
2026-10-23 08:48:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 b1d5963b53 feat(wallet): a form to propose a spend from the group's wallet (Phase 8, part 2)
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>
2026-10-23 08:38:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 6d066e19c0 feat(wallet): build a spend and show it for approval (Phase 8, part 1)
GroupSpendBuilder: send-all, as Phoenix's final wallet does, and an
amount paid largest coin first with change to the next change address,
or to fees when it would be dust. Confirmed coins only, never one an
open spend already holds; the fee is exact before signing because every
witness is 64 bytes. Every built spend passes GroupSpend.check.

The signing screen draws a spend where it draws events: every output
with its address and amount, change labelled, the fee and feerate, and
the coins spent -- read from FrostSigningManager.checkedSpend, the
stored PSBT checked again, and unsignable when this device cannot check
it. The proposal list and the chat notice say "Spend from the group's
wallet". FrostSigningRepository gains proposeSpend, checkedSpend and
reservedOutPoints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:33:36 +02:00
Kgothatso NgakoandClaude Opus 5.5 24d06d2eee feat(wallet): a screen to open a group's wallet and receive into it (Phase 5)
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>
2026-10-23 08:11:47 +02:00
Kgothatso NgakoandClaude Opus 5.5 56a942c610 Remove the curated-lists feature
Bennu no longer speaks curare.to's list protocol. The schemas, templates,
entries and the suggestion queue go, with their six screens, routes, view
models, strings and tests, and the hooks into the group screen, the paste
proposal, proposal summaries, broadcast relay seeding, the chat repository
and the transcript.

The two transcript message types stay as private legacy names so rows
already stored still render as system lines rather than chat bubbles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 11:45:45 +02:00
Kgothatso NgakoandClaude Opus 5.5 b75d4b427f Rebrand Curare to Bennu under com.machankura.bennu
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>
2026-10-20 13:53:45 +02:00
Kgothatso NgakoandClaude Opus 5 72cfb561c4 feat(proposals): ask again about everything the filter is showing
The bulk control I argued against, built -- and the objection turned out to be
solvable rather than fatal, so it is worth recording what happened to it.

Half of it was already handled. Two resends in the same second do not collide
on the outbound row id: `broadcast` hashes that id over the session's own tags
and steps a second forward when it finds a collision rather than overwriting.
Different sessions were never at risk.

The other half was real. A resend publishes two messages, and `resend` keeps to
two deliberately because "publishing in bursts is what the skipped-keys bug
feeds on"; three proposals at once is six, in the same second that "two events
published in the same second race, and exactly one survives" was written about.
So the sessions are spaced rather than the budget quietly raised --
`resendAll` waits `RESEND_SPACING` between them, one second, which is the
resolution the protocol works in because `created_at` is stored to the second.

The pacing lives in the manager and not in the loop that wanted it, because
everything that justifies it does: MLS generations, relay ordering, outbound
ids. A caller that launched `resend` per session would put every burst into one
second, and the call site is the wrong place to know why that matters. There is
a test against the real manager that three sessions take longer than two
spacings and claim three different seconds.

What it acts on is `visible`, not the room: a bulk control reaching rows the
reader cannot see is its one unforgivable move. A cooling-down row is left out
of the count rather than included and skipped, because the count is what the
button says out loud and offering three while able to send two is a lie told
before the tap. Offered from two up: one is what the row's own button is for.

Every covered row goes quiet for the whole run rather than for its own turn --
a paced run means a row whose turn has not come is still about to publish, and
a row button offering to send it meanwhile would send it twice. A session
already in flight on its own is left out of the run for the same reason.

It is offered on any filter showing two it can act on, not only "being signed".
That filter is where it earns its place -- three rows stalled for one reason --
but the rule is about what is on screen, not about which chip put it there.

1419 jvm tests pass, the Android target compiles, all audit budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 16:04:13 -05:00
Kgothatso Ngako 1f82d66f57 Merge branch 'curated' into claude/proposal-state-filters-8cc06c 2026-10-08 14:56:24 -05:00
Kgothatso NgakoandClaude Opus 5 7c6e9b0a84 feat(proposals): say how far a proposal has got, not just what it is waiting for
A row said "waiting for 2 of 3 members to take part" on the day a proposal was
made and on the day before it completed. That is the rule, not the progress.
Now it says "1 of 3 members have offered to sign", and on the next stage "2 of
3 signatures are in" -- the fractions that actually move.

Nothing is counted once it has ended, which is both endings and not only the
happy one. A signed session has nothing left to gather; an abandoned one has
counts frozen where they stopped, and "2 of 3" beside a failure invites the
reader to wait for a third that is never coming. The failure reason is what
that row has to say.

The denominators are the ones the protocol gates on. `orderedNonces` returns
nothing until `threshold` nonces have arrived and then takes the first
`threshold` of them, so the threshold is both what is needed and what is used --
the room's size is a bigger number nothing waits for. Once the signer set
exists it is the set being waited on, which is the same count from the other
side.

The numerator is the part that had to be got right. A nonce or a partial
signature is recorded with no check on who sent it, unlike a refusal, and
`orderedNonces` drops the ones from members holding no share when it
aggregates. So the tally joins `DkgParticipantMessage` on HOST_KEY and counts
members rather than rows: a count including strangers would have a row read
ahead of the coordinator, saying the group has what it needs while the session
sits still. That is the one direction a progress figure must never be wrong in,
and there is a DAO test for it. A count that still runs ahead -- a nonce
landing before this device runs `advance` -- is clamped, because a fraction
over one reads as a bug rather than as a session about to move.

The counts travel as their own `GROUP BY` flow, combined with the sessions in
the view model. They change far more often than the rows do, and carrying the
messages themselves would carry every nonce payload the room has ever exchanged
to a screen that only wants to count them.

The progress is its own line rather than a clause, so a reader scanning for the
one that is nearly there does not have to read a sentence to find out. That
left `statusOf` saying only who the reader is in the proposal, and since this
adds user-facing text its remaining literals moved to the catalogue with it --
nine strings that had been raw in the screen since before the catalogue rule.

1367 jvm tests pass, the Android target compiles, all audit budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 14:53:59 -05:00
Kgothatso Ngako f0cbb2785b Merge branch 'curated' into claude/partial-signature-collection-d44dab 2026-10-08 14:38:13 -05:00
Kgothatso NgakoandClaude Opus 5 1e59fd2334 fix(frost): a knock past the nonces is for the signers, not the quiet
A resend had one idea of who it was for at every stage -- the share
holders it had heard nothing at all from -- and that is a question only
the first stage can answer. A session reaches
COLLECTING_PARTIAL_SIGNATURES because enough members offered a nonce, so
every member who could be holding it up has been heard from: the set came
back holding the members who were never chosen and owe nothing, while the
chosen signer whose partial signature went missing was named nowhere.
Once the unchosen had answered or refused the set was empty, and the
control gave up before it reached the branch written for the stall it was
meant to repair.

So the set asks what the stage can answer. Of the signers the coordinator
chose, who has yet to send a partial signature -- which is the half of a
resend only they can carry out, since a partial signature is read by
nobody but the coordinator and no other device can repeat it. COMPLETE
keeps the old reading, and correctly: the signature is the coordinator's
own and nobody answers it.

The screen now asks the manager who is owed rather than deriving it from
the rows beside the button, the way it already asks about approvals: the
same reading decides whether a resend publishes anything, and two copies
of a rule that changes with the stage is a screen offering a knock the
manager would refuse. The transcript line and the notice say what the
members named are short of, since past the nonces they have answered once
already.

The test that looked like it covered this passed because it wrote the
stage into the row with no nonce on file anywhere -- a state the protocol
cannot produce, and exactly the state that hid the bug. It now reaches
the stage by offering a real nonce.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 14:32:09 -05:00
Kgothatso NgakoandClaude Opus 5 13ae0a1def feat(proposals): tell the two open stages apart, because they are not alike
"In progress" was one chip over two situations that ask different things of
the reader, and collapsing them was the wrong call.

Short of members, a proposal can still die of indifference: refusals are
counted against `declinesThatAbandon`, so one more may end it, and a member who
is offline is indistinguishable from one who has not looked. It is also the
only stage the coordinator's resend is for. These are the proposals somebody
may have to do something about.

Once the signer set is written, none of that is true. `signerIds` is written
once and never revised, so no further refusal is counted against it, and what
is left is arithmetic the chosen devices have already committed to. Where one
asks whether this will happen, the other says it is happening.

So: WAITING_ON_MEMBERS and BEING_SIGNED, named for what the reader is waiting
on rather than for the protocol step -- "collecting nonces" is true and says
nothing. The icons carry it as well as the labels, people against machinery,
which is the only signal a monochrome display has.

What is *not* split, and the comments say why: whether this device was picked
to sign, and whether the reader agreed or declined. Those are facts about the
reader rather than states of the proposal, so they stay a sentence on the row.
Splitting on them would be splitting every state by who is looking.

The classification is now the stage plus one, which is the shape it was always
going to take -- the one being NEEDS_YOU, which no stage can express.

Six chips means the last two now sit past the fold at phone widths, so the
screen test measures order only over what the viewport lays out and the full
lifecycle order is pinned on the enum, where no viewport is involved.

1342 jvm tests pass, the Android target compiles, all audit budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 14:26:25 -05:00
Kgothatso NgakoandClaude Opus 5 ef2b461c5c feat(proposals): a chip row over the list, and four ways of being empty
Five chips under the app bar, each carrying its count, scrolling sideways. The
row is outside the list rather than its first item, because a control that
scrolls away is a control the reader has to scroll back for -- and the list it
filters is as long as the group's whole signing history. It scrolls rather than
wraps for the same reason from the other side: five counted chips do not fit
the sixty characters `readableContent` holds the column to at the largest text
size a reader can ask for, and a row reflowing to a second line moves the list
under the thumb about to tap it.

Unfiltered, the two sections stay. Filtered, they go: "waiting for you" against
"everything else" is a distinction the reader has already made by tapping, and
heading a single-state list with it would answer a question nobody asked.

A room with nothing in it gets no chips at all. Five chips reading 0 over an
empty screen would be five ways of saying what the empty state says once.

The screen also picks up the state widgets it never had -- `LoadingDataIndicator`,
`ErrorState` with an explicit `onRetry = null` because a room missing from this
device will not appear by looking again, and `EmptyState` with a message per
filter. That last one is the point: one shared default is how five different
absences here came to say one thing. A group never asked to sign and a queue
the reader has worked through are not the same fact, and the second is not an
absence at all -- it keeps the queue's own icon and reads as finished.

`initialFilter` reaches the screen and is applied in the view model's `init`,
so a `Loaded` handed in for a preview cannot open with its chips saying one
thing and its rows showing another. Nothing passes it yet.

Fourteen screen tests, and the audit's budgets all still met: 0 hardcoded
colours, 0 dp literals in spacing positions, 0 title-case strings, both floors
held. 1329 jvm tests pass; the Android target compiles.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 11:53:45 -05:00
Kgothatso NgakoandClaude Opus 5 aee19737f6 feat(frost): the knock, under the list of doors it is for
The resend gets its affordance on the signing screen, below the member list and
above the approval block. The list is already the screen's answer to whose door
to knock on; this is the knock.

Coordinator only, and the state says why rather than leaving it to the button:
`acceptProposal` takes a session's coordinator from the author of the proposal
that opened it, so a resend from anybody else would have a member who was
missing the session believe the resender coordinates -- and then drop the real
coordinator's signer set.

`silent` is derived on the UI state rather than collected. Everything it is made
of is already there -- the share holders, who offered a nonce, who signed, who
refused -- and a second flow would be a second thing that can disagree with the
rows the screen draws. A member who refused is not silent: they answered.

The cooldown disables the button rather than hiding the section, because a
control that vanishes after a tap reads as one that failed, and what happened is
that it worked. `resend` hands back whether anything went out, so the snackbar
says which: asked again, or everyone has since answered and there was nobody
left to ask.

The transcript line gets its own icon. A resend must not read as a second
proposal, which is the one thing a session can never have -- two proposals under
one session id would be asking for two signatures out of one secret nonce.

`ask_again` already existed in the catalogue for re-querying a list's relays and
means exactly this, so it is reused rather than duplicated.

m3Audit: all budgets met. jvmTest: 1260 tests, no failures.

Plan: docs/frost-session-resend.md, Phases 5-7.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-06 15:01:09 -05:00
Kgothatso NgakoandClaude Opus 5 30685924db feat(curated): the date field type, and an unknown type is kept aside rather than dropped
CuratedFieldType had no `date`, so a schema declaring one lost the field
at parse: entries were read without it, the accept flow copied a
suggestion into a canonical entry without it, validation never asked for
it, and the entry published cleanly -- and was refused by every client
that did know the type, for the required field it lacked. Fourteen of
bitcoin.necropolis.report's entries went out that way without a `died`.

`Date` is the NIP's tenth type: `YYYY`, `YYYY-MM` or `YYYY-MM-DD`, at
whatever precision the record allows, with `min` and `max` bounding the
year. `CuratedDate.parse` is the check -- month 1-12, day on the calendar
for that month and year, leap days included -- and the value is kept as
written. `checkValue` returns early the way the numeric branch does, so
`max` is a year and never a length cap. The value is not numeric, so
`isNumeric` stays false; `isBounded` is what the editor keys its min/max
inputs off instead, labelled as years for a date.

The root failure was wider than one type: any type this build does not
know was dropped the same way. A `field` tag of an unknown type is now
kept aside as CuratedUnsupportedField, the way CuratedFieldConfig.others
keeps unknown config keys. Reading is unchanged -- an entry is checked
against the fields a reader understands, which is the NIP's tolerance --
but the accept flow refuses to propose under a required one, naming the
type, and the schema editor carries it through an edit and writes it back
as it came, so re-signing a list here cannot change its rules unseen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:30:02 +02:00
Kgothatso NgakoandClaude Opus 5 984db0a180 Merge branch 'curated' into claude/quartz-1-15-2-compat-c8267f
Both sides had taken schema version 21: curated for the nullable
FrostSigningSession.signDeclinedAt (one refusal takes a member out of the n),
this branch for the Marmot current profile's three columns, with 22 and 23
behind it for the routing table and the publish obligations. Curated keeps 21.
This branch's three migrations move up one -- 21->22, 22->23, 23->24 -- and
the database is at 24; the comment on 22 says they moved and why.

The exported schemas for 22 and 23 could not be hand-edited, since each is a
snapshot of the whole entity set with an identity hash over it, and could
not be produced from the merged tree, which only exports its own version. So
each was regenerated the way the originals were: the tree of the commit that
introduced it (Phase 3 for 22, Phase 4 for 23), with curated's entity change
and its 21.json dropped in, the version bumped, and KSP run. The result is
what a device on curated's 21 migrates through: 22 adds the three columns
and nothing else, 23 adds MarmotRouting, 24 adds MarmotPublishObligation and
MarmotOutboundGate together with MarmotCommitResult.obligationId, and every
one of them carries signDeclinedAt. 24.json is the merged tree's own export.

Everything else merged itself: ChatMessage's kinds and line types, the
transcript's icons, the strings, the nav host. Full jvmTest 1220 green,
Android debug compile, M3 audit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 08:09:54 +02:00
Kgothatso NgakoandClaude Opus 5 a7f3917e65 fix(frost): one refusal takes a member out of the n; it takes n - t + 1 to abandon
"Don't sign" ended the session for everybody: decline() failed it locally and
broadcast a FAILURE, which every other device failed on arrival. In a group
whose whole reason for running a ceremony was that no one member is needed,
one member's no was everybody's.

A refusal is now its own kind, DECLINE (30330), and one FrostSignerMessage per
member, like a nonce. Every device counts the refusals it has received from
ceremony participants against the same arithmetic -- FrostSigningSession.
declinesThatAbandon(), which is n - t + 1 -- and fails the session only on the
refusal that leaves fewer than t who could still sign. Nobody broadcasts the
abandonment, because nobody has to: each device reaches it the way each writes
its own transcript, and a FAILURE sent to say so would blame one member for the
group's arithmetic. In a 2-of-3 group the first refusal changes nothing the
other two can do; the second ends it. FAILURE keeps meaning abandon-and-blame,
for the faults no quorum can work around, and a build predating the new kind
still sends its refusals that way and is honoured as it always was.

decline() takes approve()'s shape: the decision goes on the row, as the new
nullable signDeclinedAt (Room v21, an AutoMigration), and advance() publishes
it whenever the row says so and no copy is on file -- so a device killed
between deciding and sending says it on the next message rather than never. A
member who refused is not asked again, but the session stays open around them
and closes when the group's signature arrives. Refusals from a member holding
no share of the key are turned away at the door.

fail() now leaves a COMPLETE session alone. A member who refused before their
device had seen the signature has refused something that no longer needed
them, and a late FAILURE used to flip a signed session to failed.

The transcript gets a TYPE_FROST_DECLINED line for a refusal the session
survives, with the count -- "declined to sign. It takes 2 of 3 members, and 2
could still sign." -- and the tipping refusal is written as the FAILED line in
that member's name, saying both that they declined and that it was the one
that ended it. A reader's own refusal settles their request line, and only
theirs; nothing earns a tick. The signing screen marks who declined and says
how many could still sign, and the proposal list says "You declined." where it
said "You agreed."

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 07:37:29 +02:00
Kgothatso NgakoandClaude Opus 5 c4a46e892f feat(marmot): leaving, removal, disbanding, and captions derived from the state (v2 Phase 7)
The lifecycle of a current-profile room, through the publish gate. docs/marmot-v2.md,
Phase 7.

Leaving used to be a local flag and a "Left group" chat line: the group never
learned of it, and the leaf stayed in the tree holding the group's keys. A
current-profile room is now left the way v2 leaves: a standalone SelfRemove
proposal on the wire as a kind:445, the LEAVING gate raised first and durably,
the local state dropped, the room closed on this device with its own line. It
is not a commit, so it waits on no relay -- there is no state of ours it would
make canonical. An admin's device that receives the proposal commits it on
receipt, as the library expects, so a leaver is out of the tree without anyone
pressing anything; the commit goes through the gate like every other. The
library refuses a SelfRemove from an admin outright -- an admin self-demotes
first -- so an admin's leave is refused here before anything is raised or
dropped, in words a person can act on: hand over admin, or, for the only
admin, disband. Legacy rooms leave the way they always did.

An admin removes a member with stageRemoveMember through the gate; the library's
admin-depletion guard refuses a commit that would leave no admin. An admin
disbands with stageEnableDisbanding and stageDisband -- two commits when the
group predates the lifecycle component, one otherwise -- under the DISBANDING
gate, which is durable so a crash between raising it and publishing does not
lose the request; the second step is taken by continueDisband when the first
is accepted. Both are on the room detail screen, for a device that administers
a current-profile room: a remove action on every member row but its own, and a
disband button beside leave, with an explainer that says nobody rejoins. A
disbanded room says so and hides every write entrance.

The captions are derived, never received. v2 spells them as kind-1210 system
rows and is explicit that a row arriving over the wire is one member's
assertion, not a fact; here they are written by processGroupMembershipChanges
from the difference between the room's members before a commit and after it --
"X joined the group", "X left the group", "The group was disbanded", "You were
removed from the group" -- on every device that applies the commit, including
the one that made it, which is why an admin's own removal no longer writes a
line of its own: every device says the same thing at the same point. A commit
that removed our own leaf, or disbanded the group, closes the room here as well.
A commit this device made is applied at the relay's OK, where the room now
follows the state it gained. MarmotCommitResult.NO_INVITEE marks a commit that
invites nobody, so the OK sends no Welcome for it.

Tests: GroupLifecycleJvmTest, with quartz's own managers standing in for the
other member, covers an admin committing a member's leave on receipt and the
room saying they left; a removal applied on both sides once the commit lands; a
disband ending the group for everyone, closing the room and refusing what
follows; an admin's leave refused with its reason; and a member's leave sending
the proposal the other side stages, dropping the state and closing the room.
The stand-in is now one fixture, MarmotStandIn, shared with the interop test.
Full JVM suite: 1,182 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 23:43:11 +02:00
Kgothatso NgakoandClaude Opus 5 8e502aa857 feat(groups): a new curated schema starts from one of curare.to's templates
"Add schema" opened the editor on the two fields every list has and left the
member to build the rest. curare.to's /new page does it the other way round:
a "Start a list" picker of four shapes -- links & text, discussion, catalogue,
custom -- and an editor seeded from the one chosen. The button now pushes
SelectCuratedSchemaTemplateScreen, that picker on a phone, and a card pushes
the editor with the template's key, the same word the site takes as
?template=. Back from the editor is the picker and another shape; when a new
list's proposal goes out the signing session replaces both.

CuratedSchemaTemplate is lib/protocol/templates.ts field for field, with
CuratedDeriveRule for the [rule:<key>] mark the site records in the
identifier field's hint -- its own convention, not the NIP's, and the thing
that lets that site's form derive an entry's d for a list the group starts
here. The hint is written byte for byte as the site writes it; the app still
composes no suggestions and applies no rule. Null or an unknown key seeds
Custom, which is the bare two fields the editor opened on before, so a
screen handed no template behaves as it did.

The picker's one departure from the site: its cards list a template's
fields by label, the way the group's schema cards do, rather than counting
them -- what an entry asks for is what the choice is made on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 20:25:37 +02:00
Kgothatso Ngako f4b0347e90 Merge branch 'curated' into claude/chat-creation-profile-preview-ae07be 2026-09-13 13:39:54 +02:00
Kgothatso NgakoandClaude Opus 5 d2a4298d25 feat(groups): broadcast every accepted entry from one button, each to where its own would go
The entries screen had one "Broadcast" under each card, and each opened
`BroadcastGroupSignedEventScreen` for that one entry: a group that has accepted
twenty entries into its lists sent them with twenty trips through the relay
picker. This is the other button. "Broadcast all", an extended FAB in a bottom
bar, sends every entry on the screen, newest first, one after another, and says
under each card what its relays answered. Behind no gate, like the button under
each card: sending what the group has already signed takes no share of the key.

**Each entry goes where its own broadcast screen would have started.** The list
that screen seeds -- `defaultRelaysFor`: the group's General write relays or the
app's publish set, plus the list's own relays, minus what the group has blocked
-- is what a member who reads nothing and presses the button sends to, and this
button is that member with twenty entries. The group's relay lists are read
into the loaded state for it; the list's relays come off the entry, which
carries its schema, so the rule is handed that one schema rather than all of
the group's. Nothing is shown before the press, which is the difference from
the one-event screen and the reason that screen stays: a refusal is answered
there, where the relay can be changed and the send tried again.

**One entry at a time, on purpose.** The rows fill in top to bottom, so the
member can see where the batch is; and a public relay sent twenty events in
one burst answers "rate-limited" to most of them, which would make the button
worse than the presses it saves. Each entry's send has the same ceiling as a
single broadcast and the batch has no other, since a long list is meant to
take a while. It goes to the pool directly rather than through the queue, for
the reason `BroadcastGroupSignedEventViewModel` gives, and it is only as
durable as the press: leaving the screen ends it where it is.

**The send is shared rather than copied.** What a relay's answer becomes -- an
OK, a rejection in the relay's words, a failure, or no answer when the whole
send runs out of time -- was decided inside `broadcast()` on the one-event view
model. It is now `sendToRelays` on that model's companion, beside
`defaultRelaysFor` and `wireEventOf`, and `broadcast()` keeps only the state
around it; the thirteen tests on it pass unchanged. The words for an answer
moved the same way, out of the relay row and into `RelayOutcome.label()`, which
both screens now use.

**What the member is told.** A line above the cards -- "Sending entry 3 of
12…", then "Accepted by every relay for 11 of 12 entries." -- persistent rather
than a snackbar, because it is the answer the member came for and a snackbar
would be gone before the last card had been read. Under each card, "Accepted
by n of m relays." in the one-event screen's words, and one line per relay
that did not say OK, named with its reason, because "blocked: not on the allow
list" is something a member can act on and a count of two out of three is not.
An entry with nowhere to go -- everything the seed would name blocked -- is
marked so rather than sent to nobody. The FAB looks disabled while a batch is
out, and a second press is refused.

`GroupCuratedEntriesViewModelJvmTest` pins where each entry goes, that the next
waits for the last to settle, what the answers become, and the refusals; the
screen test drives the button end to end and checks that each answer sits
between its card and that card's own broadcast. The shared fixture entry now
carries the `a` root a real entry has -- without it the seed rule could not
find the list's relays, which the first run of these tests found.

Verified with :composeApp:m3Audit (all budgets met),
:composeApp:compileDebugKotlinAndroid and :composeApp:jvmTest (1085 tests,
7 new).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 13:31:32 +02:00
Kgothatso NgakoandClaude Opus 5 d649098504 feat(chat): the preview's button knows whether it can be pressed
Phase 4 of docs/npub-profile-preview.md. Phases 1-3 moved the twenty-second
dead end one screen later: a person found on an indexer, a press, and
InitiatingNewChat waiting for a key package that someone who has never opened
Curare will never have published. The preview now reads the answer before the
press. A room that already exists opens; a key package that is here enables
"Start new chat"; one that is not, once the relays have had their time,
disables it with the reason under it and a try-again that asks the DM relays
alone.

The existing-room check was a loop with a TODO inside initiateNewChat; it is
ChatRepository.findDirectMessageRoom now -- a room whose members are exactly
the two keys, or the one key when they are the same -- read by both screens and
pinned by a test on an in-memory database. The old size-one branch would have
opened any room the peer sat in alone, whoever they were.

Both halves are observed together, as the chat screen does: a key package
arriving after the profile touches a different table, and a collect on the
profile alone would never see it. A room is read once up front, because a key
package is meant to be used once and the relays need not hold a fresh one for
someone you already talk to.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 13:19:51 +02:00
Kgothatso NgakoandClaude Opus 5 923b59ec32 feat(ui): the new-chat dialog opens the person, and no longer starts the chat
Phase 3 of docs/npub-profile-preview.md, and the user-visible change: "Direct
message via npub" now shows who this is before anything is created. The
dialog's button reads "Find profile" and pushes ProfilePreviewRoute; the chat
is started from there.

The field keeps what it parsed rather than whether it parsed. Its check and its
decode used to be two different functions, which is how "nostr:npub1…" passed
the one and failed the other, closing the dialog with nothing to show for it;
CredentialParser.npubOrNull is the sign-in decode exposed for an address field
-- an nsec is null there, because a field asking whom to write to must never
take a secret for an answer -- and the enabled button and the route it pushes
read the same key. The nip05 branch still lands on the placeholder, and the
test says so. "Start chat" goes with its only reader.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 12:59:26 +02:00
Kgothatso NgakoandClaude Opus 5 8973c0058e feat(ui): the profile preview screen, reachable by nothing yet
Phase 2 of docs/npub-profile-preview.md. ProfilePreviewRoute is keyed by public
key, because that is all the entrance has, and ProfilePreviewScreen draws the
four states over a constant bar: the npub above the indicator while the relays
are asked, the person -- avatar, name, nip05, the whole of the about, the npub
that was pasted -- and under them "Start new chat", which hands over the route
the dialog pushes today and creates nothing here. Not found is the sign-in
screen's sentence with a try-again; a read-only identity is shown the person and
nothing to do, and ReadOnlyEntrancesJvmTest gains the row.

Registered in the host with the room replacing the preview, as it replaces the
profile detail. No button navigates to it until Phase 3.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 12:55:19 +02:00
Kgothatso NgakoandClaude Opus 5 2f42023081 feat(identity): adding a profile from inside, as a key and not a second wallet
Phase 5 of docs/multiple-profiles.md. The two entrances, and the two things
that were only safe with one profile.

Under the list, on the switcher and on the startup selector alike, two rows:
"sign in with a key", to the sign-in screen, and "create a new profile", to
the create screen. Both push a screen that has a back button. Landing is not
one of them -- it has no back button and clears the stack on its way out,
because it is the first-run screen, and pushing it from inside would make it
a pushed screen on some days and a root on others. A device with one profile
can now be given a second, which it could not: Landing showed only when the
device held nothing.

A profile created from inside is a bare key. CreateProfileScreen generated
twelve words behind its form -- a seed, a node, a wallet, and at the NIP-06
path the key that becomes the profile -- which is right for the first
profile on a device, the one the wallet will belong to, and wrong for the
second: a user who wants another profile has not asked for another
Lightning node, another set of channels, or a second phrase with funds
behind it. The screen now takes a NewProfileWriter and does not know which
it was given: seedProfileWriter from Landing, bareKeyProfileWriter from the
switcher, thirty-two random bytes written the way a pasted nsec is.
CreateProfileRoute carries the choice. The view model writes the secret
first, then the six bootstrap events for the key it derives, then hands the
id to the tail -- so the events are only ever queued for a key the device
holds, and they are in the database before the tail activates the identity,
an ordering the sign-in screen documents as load-bearing and the create flow
used to get away with by luck. The tail gains the popUpTo(0) the sign-in
tail has. A second wallet is not offered from inside; a pasted recovery
phrase still brings its own.

"End this" goes. It wiped the database -- every profile's rooms, MLS state,
key packages and queues -- from the screen whose purpose is to add a
profile; it was only ever a development exit, and with several profiles on
a device it was a way to lose the others. wipeDatabase leaves the view model
and stays on the repository for the tests that use it.

A key already on the device is refused with the id it is listed under.
WriteNostrCredentialResult.AlreadyExists and WritingSeedState.Error.
SeedAlreadyExists carry it -- the wallet's id where a seed derives the key
-- and the sign-in screen's error state gains one action, "switch to it",
which is the sign-in tail with that id. From Landing "already on this
device" was the whole message; from inside it is a sentence with an obvious
next step, and a duplicate paste becomes the fastest switch in the app.

Found on the way, and fixed in the jvm actuals: DataStoreManager caches one
GlobalPrefs per process behind an unsynchronised check-then-set, and
DataStore refuses a second instance over the same file. Two first calls at
once -- the listing on IO and a sign-in's write, or the startup screen on
Main -- could both see the empty cache and both build one, and the loser
threw "multiple DataStores active for the same file" at first use. The test
for this phase hit it one run in three. JvmGlobalPrefs is now the one way
the jvm target reaches the prefs, under a lock; Android goes through the
Application's single instance and never raced; the library's own callers
come at node start, when the cache is long populated.

Tests: AddProfileFromInsideJvmTest, through the real view models on an
in-memory database -- A open, B's nsec committed and switched to, and back,
both accounts intact with their own kind 0; A's key pasted again refused
with A's id; a profile made through the bare-key writer lists as a bare key
with the kind 0 first of its six bootstrap rows, none signed yet, and no
node ran. SignInToProfileViewModelJvmTest and IdentityWriterJvmTest assert
the ids the three refusals carry. ProfilesScreenJvmTest: the two rows call
their callbacks and switch nothing, under the caption that the open profile
stays. CreateProfileScreenJvmTest: the state that carried "end this" is
composed and the words are not there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 01:24:14 +02:00
Kgothatso NgakoandClaude Opus 5 25464595f4 feat(ui): the switcher, showing the nostr profile and what the device holds for it
Phase 4 of docs/multiple-profiles.md. One pushed screen, and the startup
selector brought up to match it.

ProfilesRoute, reached from the profile tab's row -- "Switch profile", where
it said "Change account" and went to the pending screen -- and drawn by
ProfilesScreen: a top app bar with a back button, and WalletsSelector as its
whole content with the open profile above the divider and the others below.
Tapping another row is switchToIdentity and nothing else; the observer
restarts the app as that identity through its lock gate, so the screen is
never around to see the result. Tapping the open row does nothing. Three
states, said so: loading while the list is read, which in practice is never
seen; an unreadable key file, through ErrorState with a retry that re-lists;
and the list. Empty cannot happen while something is signed in and the screen
does not pretend it can. One column at every width. The row is offered to
every kind: a read-only identity can leave for another profile the same way
a signing one can.

ProfilesViewModel joins the flows the app already holds -- the listing state,
the identities, the active identity, the wallet metadata -- to the profile
rows for the listed keys, through NostrRepository.observeProfilesOf, one map
that moves when any of them does. Nothing in it writes.

What a row shows changes. WalletsSelector showed "Default name" over a random
emoji for every row, because nothing in this app writes the wallet metadata's
name, and two profiles side by side both called Default name and told apart
by a bech32 string is not a switcher. The row now takes the nostr profile --
humanReadableNameOrPubkey over ProfileAvatar, the widgets the profile tab
draws itself with -- with the npub on the second line, and falls back to the
npub over the metadata's emoji for a key the device has no kind 0 for yet:
one just created, or a read-only one that was never found. And it says what
the device holds for the profile before the tap: "Wallet" for a seed
attached, beside the "Read only" that was already there, and nothing for the
plain case of a bare key. It is the difference between a profile that can be
signed out of and one whose sign-out is a wallet question, and between two
profiles with the same name. The startup screen draws the same widget and
gets the same map through rememberProfilesOf, so both lists look the same.
The selector's dead globalPrefs parameter goes with the rewrite.

Tests: ProfilesScreenJvmTest, on the unmerged tree, with a wallet-attached A
open, a bare B and a read-only C -- A by its nostr name with its npub and
"Wallet" under it, B and C by their npub with only C labelled, no "Default
name" anywhere, the open one drawn above the others; tapping A calls
nothing and tapping B calls the switch once with B's id; an unreadable key
file is an error whose retry is counted; the bar has a back button.
ReadOnlyEntrancesJvmTest asserts "Switch profile" for both kinds.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 00:50:37 +02:00
Kgothatso NgakoandClaude Opus 5 00fc996995 feat(identity): which profile opens, on launch and after a switch
Phase 3 of docs/multiple-profiles.md. The startup screen learns to agree with
the switch.

The table that picks what to open is lifted out of the screen's remember into
StartupChoice.resolve, where it can be read and tested, because its order was
the whole decision and it was wrong in the one way a switch would hit:
"!startWalletImmediately -> null" sat above "desiredWalletId != null", and
nothing ever set the flag back to true. So after the first visit to the
selector, every sign-in on that device landed on the selector instead of the
profile it had just signed in. Two rows move: what a switch or a sign-in
named goes above the user's earlier "show me the list", since it is the more
specific instruction; and the single-identity row drops below it, since when
both are set they name the same thing.

The default is written. GlobalPrefs.getDefaultWallet has been read by startup
since Phoenix and saved by nothing in this app, so a cold boot with two
profiles was the selector every time with no memory of which one was open.
setActiveIdentity now saves the id it activates -- every activation goes
through it, startup for all three kinds and the two tails through startup --
so the default is always the profile most recently open. The two forget tails
clear it, since the default is the one memory of an identity that would
otherwise outlive it. Both writes are wrapped: a default that could not be
recorded is a selector on the next boot, not a crash now. The screen reads
the saved value as a default only when it names a wallet, which is the one
thing left to decide at the call site.

The startup screen's literals go to the catalogue, and "wallet" goes with
them except in the one place a wallet is what is starting: "Starting wallet"
is shown from StartupViewState.StartingBusiness, which only the branch with
a wallet attached reaches, and stays. The rest become "Preparing profiles",
"Opening profile", "Decrypting", "Loading preferences", "Unlock to continue"
and "Could not load the profiles on this device"; the selector's title is
"Choose a profile", and select_a_wallet goes.

Tests: StartupChoiceTest in commonTest, one case per row and the two
orderings this phase is for -- a desired id opens even after the user once
asked for the list, and one identity with the list asked for still shows it.
IdentitySwitchJvmTest gains the cold boot: activate A then B, and a fresh
view model over the same directory resolves B without asking; forget the
default, and it resolves nothing. Found on the way and recorded in the test:
DataStoreManager caches the global preferences once per process, bound to
whichever directory was current when the first test in the JVM asked -- the
same trap the nsec plan recorded for user preferences -- so the test reads
the default through the view model's own instance rather than one of its
own.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 00:43:21 +02:00
Kgothatso Ngako 86cb876b77 Merge branch 'claude/npub-readonly-signin-ec4398' into curated 2026-09-12 22:24:40 +02:00
Kgothatso NgakoandClaude Opus 5 a586b7c116 feat(identity): two exits for an identity that holds no key
Phase 6 of docs/npub-sign-in.md. Leaving: one sequence, two doors.

ForgetIdentity is NostrSecretViewModel.forgetKey's sequence lifted out --
the credential out of the file, the metadata hidden, the account rows
gone, in that order so a failure partway leaves the credential on disk
rather than an identity the selector lists but nothing can open. Since the
credentials file the first step is the same call for both credential
kinds, so it is one function; a mnemonic identity is refused at the first
step, because removing a seed is a wallet question this does not answer.
The nsec view model calls it now and keeps only its own state.

Sign out on the profile tab does, for a read-only identity only, what its
colour has been promising: a confirmation naming the npub -- this device
holds no key for it, so there is nothing to lose; the profile stays on the
relays -- then the identity leaves the device and the nav host's tail
re-lists and clears the active identity, which shows the selector or, if
this was the last one, Landing. It is the first real sign out in the app.
For the other two kinds the button keeps its pending route. SignOutViewModel
owns the confirmation and the in-flight state; SignOutDependencies bundles
what the screen needs so that a caller with none of it -- previews, tests
-- passes nothing.

The not-found screen had, for a read-only identity, no exit: Phase 5 hid
the set-up form (a kind 0 has to be signed), the profile tab is not
reachable before ProfileLoaded, and a user whose npub was found on no relay
could try again for ever. So a third action, shown only where the second is
not: use a different key, which is the same sequence behind the same
dialog, reached from the other end of the identity's life.

Tests: the sequence and where it stops, the view model's states around it,
and the two screens composed as each kind -- the profile's sign out asking
first and naming the npub, the not-found screen offering the form to one
kind and the other key to the other.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-12 20:45:34 +02:00
Kgothatso NgakoandClaude Opus 5 e31033e857 feat(ui): what a read-only identity is shown, and what it is not
Phase 5 of docs/npub-sign-in.md -- the half the nsec plan called a
product.

One question, asked in one way. LocalCanSign is a composition local for the
snackbar host's reason: screens do not receive the identity,
MetadataEventDetail -- where follow and send message live -- is several
composables below anything that could be handed more, and a parameter
threaded through twenty-six lists is forgotten in the twenty-seventh.
ProvideSigningCapability sits once above the navigation suite. The default
is true rather than an error, the one way this differs from the snackbar
host: the provider cannot be forgotten per screen, so the only things
composed outside it are previews and tests. And it is a capability, not a
kind -- "can this identity sign?", not "is this an npub?" -- so that a
remote signer is not a fourth value in every when.

The inventory, hidden rather than disabled because the empty state beside
each says why: HomeScreen's New chat in both layouts, its sheet and its
npub dialog; MetadataEventDetail's follow, unfollow, follow back, edit
profile and send message (the "follows you" state still shows -- a fact,
not an action); ActiveProfileScreen's key package management and key
recovery; ShareProfileScreen's re-broadcast, which signs nothing but
queues a copy for the finder relays, and a read-only identity puts nothing
on a relay; SocialPreconditionScreen's invite and view invites, pending
today and writes when they exist; and the not-found screen's set-up form,
since a kind 0 has to be signed. Everything else that writes is behind a
chat room, which a read-only identity can never open.

The Messages tab, for a read-only identity, is an EmptyState where the
rooms would be -- one column at every width, since a two-pane layout is a
list beside a detail and there is no list -- whose message says which
absence it is and whose action is the upgrade: Sign in with the nsec,
which opens the same screen as landing's, hits the credentials file's
upgrade rule, and comes back through startup with rooms in it.
ChatRoomListViewModel is not composed, so the inbox sync and the MLS
negentropy it would queue are not queued.

Tests: ReadOnlyEntrancesJvmTest composes the home and profile screens
under each value of LocalCanSign and looks for the controls by text, on
the unmerged tree so that "does not exist" is not vacuous. The M3 audit's
budgets hold.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-12 20:38:18 +02:00
Kgothatso NgakoandClaude Opus 5 bfad1f39a2 feat(sign-in): an npub, recognised, confirmed as read-only, then written
Phase 4 of docs/npub-sign-in.md. The field accepts a third thing.

CredentialParser recognises npub1... and nostr:npub1... as
SignInCredential.NostrPublicKey: thirty-two bytes under the npub prefix
that name a point on the curve -- the counterpart of the isValid() a
secret is checked with, since not every x coordinate has a point above it.
PublicKeyOnly goes, and its string with it; an npub that does not decode,
or names no point, is InvalidKey. Hex stays a secret: a private key and an
x-only public key are the same size, the confirm step shows the derived
npub so a public key pasted as hex is visible for what it is, and guessing
would never fire when it mattered, since an x coordinate is almost always
also a valid scalar. The test pins the vector's own public key, pasted as
hex, landing on a different npub.

The confirm step's third arm says what the user is about to get and not
get, once, before the choice: this profile and the people it follows;
messages closed and nothing sent; paste the nsec later to open it. The
landing caption, the field's label and its placeholder name the third
input, the last with "to look around" for a user who does not know the
word read-only. The view model takes the third writer the way it takes the
other two and commits through one shared write-and-map.

signInToProfile is idempotent by pubkey. Until now nothing called it twice
for one key -- the writers refused a second sign-in before it got there.
Pasting the nsec of a key held read-only is the first path that signs in a
pubkey whose account already exists, and a second placeholder would be two
kind-0 rows for one pubkey, two accounts disagreeing about which is this
one. A repository test signs in twice and counts one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-12 20:32:54 +02:00