Repository navigation
Set banks up from Settings, with forms their plugins describe - #31
Merged
Merged
Conversation
This was referenced Oct 19, 2026
IAmJSD
added this pull request to stack #29
October 19, 2026 17:29
IAmJSD
force-pushed
the
bank/6-setup
branch
2 times, most recently
from
October 19, 2026 21:28
e5f039a to
8ad7598
Compare
Each bank plugin's factory now describes its own settings form (fields, hints, secrets, choices, keys the form can make, and fields that can't change while cards are open), what its cards are, and where to top it up. Settings → Bank adds, edits and removes any of them from that, checking the settings with the provider before saving them and loading the bank without a restart. The server's environment is now only a fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rm opens - With no bank when the server starts, the minute-by-minute card check never started, so a bank set up later never had its used single-use cards closed, killed wallets swept, or spending read. It now starts as soon as there's a bank. - Card events no longer refetch the banks' status, so the form fetches it when it opens, for the open cards that lock a bank's fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 6 of 7 in the bank stack, on #28.
What this adds
Banks are set up from Settings → Bank now, not the server's
.env.The plugins describe the UI. Each bank factory declares:
fields): labels, hints, which are secret, choices (Bitcoin's network), keys the form can make, and fields that can't change while cards are openinstrument: card or wallet)fundAt: a treasury's address)The web app renders whatever a server's plugins say, with no bank-specific code. That's because one web app (including app.nibblets.dev) talks to many servers, and it can't know their plugins when it's built.
Saving checks first. Each plugin gains
check(), which asks its provider something harmless:Only
BankErrormessages reach the form. Anything else is logged, since it could carry an RPC URL's key.No restart. Saved settings go in the
settingstable (banks). The server reloads its plugins into the runningBankand publishesbank_changed. Nibblets see the card tools from their next request.Keys made in the browser. "Make one" fills a treasury key with 32 random bytes from
crypto.getRandomValues. It's shown once so it can be copied, and afterwards it's only ever shown masked.Cards hold their bank. A bank can't be removed while it has cards that aren't closed, and its locked fields (a treasury's key and network, a chain's id and coin) can't change either. Its cards depend on them.
The environment is a fallback. A bank with nothing saved still loads from variables named like its fields, so existing setups keep working. Saving in Settings takes over from them.
API:
bank.configure,bank.remove, andkindsonbank.status.Fixed the mock counting closing cards for what they've spent instead of in full.
#32 lets several banks share one plugin.
Screenshots
All from the mock server (
?mock=1), which fakes the providers: Slash refuses the keywrong.No bank yet, then Add a bank
Slash: a key Slash refuses, then one it takes, being checked
Bitcoin: the empty form, then signet with a key made here
Both set up, with where to top the new treasury up
While a bank has open cards, its key and network are locked, and it can't be removed
Phone width
Review fixes
Checks
pnpm format:check,pnpm -r typecheck,pnpm --filter @nibblet/web buildandpnpm testpass. New tests:apps/server/src/banks.test.ts: saving, masked secrets, refusals, locked fields, removal, and the environment fallbackcheckandfundAt🤖 Generated with Claude Code