Let one session hold both the posting and active key: each operation signs with the key it needs, adding the missing key to safe storage once (shared origin; posts signed with an active key are rejected today)
Rewritten 2026-10-15 by Dan: the scope changed from "the Blog should check the key type and offer Switch to posting key" to "a session can hold both keys and each operation uses the one it needs". @akociubinski's reproduction below is unchanged.
Problem and intended result
On https://denser.discuss.peerverity.info the Blog and Wallet share one session, and a session today counts as one key type. Reported by @akociubinski (develop f3f40a776d, Chrome 155, guest4test, site storage cleared first), following #1192 (closed) / #1197 (closed) / #1198 (closed):
- Log in on
/walletwith the active key (safe storage). As #1197 (closed) intends, the shared session is nowkeyType: activein both apps. - On
/blog, open the editor (/blog/submit.html), write a post and click Submit.
What happened (UTC, from an event log in the page):
- 10:02:38 "Enter your password" (safe-storage unlock)
- 10:03:08 the post is signed with the active key and broadcast; the node answers
missing required posting authority - 10:03:09 toast "This operation needs your posting key. Sign in with it and try again."
- 10:03:21 "Sign In - Sign in to your account using your posting key" / "Unlocked with posting key"
- 10:03:24 password field again
- 10:03:27 "Add New Key to Safe Storage - Add new posting key for user guest4test"
- 10:03:46 "Key Added"
- 10:04:33 second Submit, broadcast OK
One post took a password, a rejected broadcast, a sign-in dialog, a second password, adding the posting key and a second submit.
Intended result: a user can have both keys in one session. Blog operations sign with the posting key and Wallet operations with the active key, with no session switch. The first time an operation needs a key the session does not hold yet, the user is asked for that key once, and with safe storage it is kept for later.
What already exists (read from the code, Dan + Claude, 2026-10-15)
Most of the mechanism is in the signer already; it is just not used by the Blog:
TransactionService.processHiveAppOperation/signTransaction(packages/transaction/index.ts) accept a per-transactionrequiredKeyTypeand pass it to the signer.- Safe storage (
packages/smart-signer/lib/signer/signer-hbauth.ts):signDigest(..., requiredKeyType)callsrequireOtherKey(l.263) whenrequiredKeyType !== keyType. If that key is not in safe storage yet, it asks for it once,registers it next to the other key and signs with it. Later operations sign with it directly. - Keychain, PeakVault, MetaMask and Google Drive signers sign with
requiredKeyType ?? this.keyType. - Only about four Wallet mutations pass
requiredKeyTypetoday (e.g. RC delegation:posting). No Blog operation passes it, so an active-key session signs Blog operations with the active key and the node rejects them. - The Wallet's entry check from #1197 (closed) (
lacksRequiredKeyType,packages/smart-signer/lib/auth/required-key-type.ts) looks only at the session'skeyType, so a posting session is blocked even when the active key is available.
Required behavior
- Every broadcast names the key it needs. Preferably
processHiveAppOperationderives the defaultrequiredKeyTypefrom the built transaction's required authorities (posting-only operations →posting; any active-authority operation →active), so no call site can forget it. An explicitrequiredKeyTypeorsingleSignKeyTypefrom a caller still wins. Blog posting operations (post, comment, edit, vote, reblog, follow/mute, community subscribe and the like) must end up signing with the posting key. - Safe storage: add the missing key once. With safe storage, an operation needing a key not yet stored goes through
requireOtherKey: one prompt for the key, stored, then signed. After that, both apps sign with the right key without prompting for a key again. One unlock per flow: no second password prompt within the same operation. - The Wallet's entry check counts an available active key. A posting-key session counts as signed in to the Wallet when the active key is available to its signer (stored in safe storage, or a signer that holds every key, such as Keychain or PeakVault). A posting session without it keeps today's #1197 (closed) behaviour, except that its message offers to add the active key (the
requireOtherKeypath) as well as switching. - Badge and menu (#1198 (closed)) show what the session can sign with. When both keys are available they show both (e.g. "Posting + active key"). "Switch to posting/active key" becomes "Add active key"/"Add posting key" where adding is possible, and is hidden when both are present.
- Signers that hold only one key (WIF login, HiveAuth if it is bound to one key type): never broadcast with the wrong key. Before signing, show the existing "This operation needs your posting/active key" message with a way to switch, instead of letting the node reject it.
Acceptance criteria
- With a safe-storage session that signed in with the active key on
/wallet, submitting a post on/blogprompts once for the posting key (not the password a second time), stores it, and the broadcast succeeds. Nomissing required posting authorityerror reaches the user. - After that, a vote on
/blogand a transfer on/walletin the same session both succeed with no key prompt and no session switch. - With a safe-storage session that signed in with the posting key on
/blog, opening/walletoffers to add the active key. After adding it, the Wallet's signed-in pages open and a transfer succeeds, while Blog operations still sign with the posting key. - With both keys stored, the avatar badge and account menu show both, and no "Switch to … key" item is offered.
- A WIF login with only a posting key that tries a transfer gets the "needs your active key" message before any broadcast, not a node rejection.
- Unit tests cover the default
requiredKeyTypederived from operations (a posting-only transaction → posting; a transfer → active; a caller-supplied value overrides) and the Wallet entry check with an available-but-not-session active key. They fail on today's code.
Verification
Unit tests for the key derivation and the entry check. Fixture/Playwright specs for the badge/menu states and the add-key prompt where the fixture setup allows. The full cross-app flow needs real broadcasts: Dan will check it live on peerverity with guest4test after promote (posting and active keys available to him).
Integration points
packages/transaction/index.ts—processHiveAppOperationderives the defaultrequiredKeyTypefrom the transaction's required authoritiespackages/smart-signer/lib/signer/signer-hbauth.ts—signDigest/requireOtherKeyadd the missing key once, with a single password prompt per flowpackages/smart-signer/lib/auth/required-key-type.ts— the Wallet entry check accepts an available active key, not only an active session- The account avatar badge and account menu (#1198 (closed)) — show both keys and offer "Add … key"
packages/smart-signer/lib/signer/signer-wif.ts— a one-key signer refuses before broadcast when the operation needs the other key
Scope boundary
- Not the post-publish redirect to
/blog/blog/...(filed separately), nor the Polish wallet notice (#1210 (closed)). - Owner-key operations (e.g. change password) keep their current single-sign flow.