Skip to content

feat(vault): migrate the remaining wallet callers to useSessionSigning (A6-T3b) - #396

Merged
ety001 merged 2 commits into
next-devfrom
feat/a6-t3b-remaining-callers
Nov 21, 2026
Merged

ety001 merged 2 commits into
next-devfrom
feat/a6-t3b-remaining-callers

Conversation

@ety001

@ety001 ety001 commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Part of #381

Summary

A6-T3b: migrates the four remaining wallet-domain callers onto the unified useSessionSigning() entry, closing every wallet-domain vault-session signing gap. Vault identity sessions now sign claim rewards, community creation (creator-paid steps), password change and recovery-account counter-requests through the per-key password dialog; privateKey behavior is preserved exactly (no pre-check, no extra network calls, same key resolution order). Operation tuples are byte-identical to the retired SteemSigner.* builders; broadcast routes and payloads unchanged.

Per-caller role floors and classifier state:

  • claim-rewards-banner — claim_reward_balance at the posting floor (table entry claim_reward_balance: 'posting'). privateKey sessions resolve posting → active → owner through the hook — exactly the fix(wallet): sign claim rewards with any session key per chain semantics #378 session-key remainder; the device-remembered posting-key restore (fix(wallet): make Redeem Rewards actionable without a session posting key #375/fix(wallet): sign claim rewards with any session key per chain semantics #378) keeps its slot between posting and active and still signs directly with the restored key (device-storage material that exists in no session the unified entry can read; privateKey sessions only — a vault session never reads it, invariant 21, pinned with the storage-prototype spy). Vault sessions get the password dialog directly: the "skip restore → re-auth dialog → vaultUnsupported notice" chain is retired and the keyless hint hides. The keyless privateKey path still opens the classic re-auth dialog.
  • communities-section — account_create at the active floor (table entry; same resolution as the previous useActiveSigningKey); the community subscribe custom_json (payload-based: required_posting_auths non-empty, required_auths empty) at the posting floor. The hivemind setup ops (setRole/updateProps) keep signing directly with the NEW community owner's freshly derived active key — an account created seconds earlier whose key exists in no session. The activeKeyRequired gate widens for a page-matching vault session.
  • change-password-section — account_update carrying rotated owner/active/posting authorities is owner-class by payload inspection → role: 'owner'. The form's ACCOUNT password still derives and verifies the new keys (lib/wallet/change-password.ts unchanged); the VAULT password the signing dialog asks for is a separate secret — kept apart by a vault-session-only note (vaultPasswordNote, four locales) and pinned by tests (exact request shape {operations, accountName, role} — no password material rides along; a pending/wrong-password dialog never touches derivation state).
  • recovery-warning-banner — change_recovery_account at the owner floor (table entry). The owner-key gate widens for a page-matching vault session; keyless privateKey sessions keep the disabled submit + notice; needsClassicReauth surfaces the existing owner-key copy.

Round-1 review fixes (second commit)

  • Docs: the change-password privateKey key-source change is now recorded in 09-vault.md's A6 progress block (a keyless-owner session re-authenticates with the master password / owner WIF — which derives the same owner key — instead of silently signing with the form-derived owner key), the "keyless privateKey sessions keep the pre-existing gates" clause is corrected per-caller (change-password's ownerKeySessionRequired gate is NEW — there was no gate before), and 02-auth.md carries the change-password inventory entry.
  • lib/wallet/change-password.ts: buildAccountUpdateForPasswordChange is now OPERATION-ONLY — it no longer materializes an owner WIF via resolveOwnerSigningKey that every caller discarded; the current-password check lives in verifyCurrentPasswordMatchesAccount alone, and a lib test pins the non-derivation (mutation-guarded).
  • Cancel-path tests added for claim-rewards-banner and recovery-warning-banner (matching communities/change-password coverage): cancelled → silent return, no broadcast, surface stays usable.
  • The dropped thrown-error display test is back in the claim suite, pinning both residual catch blocks (remembered-key direct-path sign rejection → inline error; hook-signed broadcast transport throw → inline error).
  • Inventory correction: recover-account-step-1-page.tsx's verify helpers (isValidPrivateKey / privateKeyToPublicKey / derivePrivateKeyFromPassword) added to the non-signing direct-SteemSigner helpers below; the e2e spec header no longer overclaims the remembered-key non-read (that invariant is pinned by the unit suite's Storage spy, not the spec).

Implementation notes

  • Remaining direct SteemSigner consumers ("who still signs directly") after this PR:
    • T4 (not migrated yet): market-page-client.tsx (signLimitOrderCreate/signLimitOrderCancel), proposals-page-client.tsx (signUpdateProposalVotes), proposals/proposal-creator-dialog.tsx (signCreateProposal), proposals/proposal-remove-dialog.tsx (signRemoveProposal), witness-vote-form.tsx (signWitnessVote/signWitnessProxy).
    • Permanent/deliberate: login-form.tsx (signChallenge + key derivation helpers), recover-account-confirmation-page.tsx (signRecoverAccount dual old+new owner signatures — invariant 20; the recovery pages were NOT touched and verified to still use the dedicated dual-sign path), plus NON-SIGNING helpers that derive/validate only and never broadcast: recover-account-step-1-page.tsx verify helpers (isValidPrivateKey/privateKeyToPublicKey/derivePrivateKeyFromPassword), account-keys.ts, change-password.ts.
    • T3b deliberate no-session-key remnants: claim-rewards-banner.tsx remembered-posting-key branch and communities-section.tsx hivemind setup ops (keys that exist in no session).
  • Classifier needed no code changes: claim_reward_balance / account_create / change_recovery_account were already in OPERATION_AUTHORITY_CLASSES and account_update / custom_json are payload-based. New pin tests guard the exact T3b caller shapes (including the previously unpinned account_create).
  • The hook needed no changes — resolveSessionSigningRole already resolves any floor; a new pin covers the posting-floor chain (posting → active → owner).
  • privateKey deviation (documented trade-off, recorded in the docs per the round-1 review): change-password previously derived its signing key from the form's account password (so an active-key-only session could still change the password by typing the master password). Through the unified entry the privateKey path signs with the SESSION owner key; a session without one gets the new explicit ownerKeySessionRequired guidance instead of a silent success. Whenever both keys exist (master-password or owner-WIF login) the same key signs as before. Communities subscribe now signs with the least-privileged session key at-or-above posting (previously always the active key — chain-equivalent per posting/active/owner downward coverage).
  • i18n: 3 new wallet.changePasswordPage.* keys (ownerKeySessionRequired, signingFailed, vaultPasswordNote) ×4 locales.
  • Docs: 09-vault.md (module map + invariant 21 consequences + known-gaps list + A6 progress with the direct-signer inventory), 02-auth.md (signing-entry inventory, change-password key-source note, claim convention), 06-frontend.md (key-selection rule status).

Test plan

  • pnpm verify green (type-check + lint + unit tests + coverage ≥ thresholds + build). Lint's 3 warnings are pre-existing in untouched files.
  • New tests/unit/wallet-t3b-session-signing.test.tsx: communities / change-password / recovery-warning × session shapes (privateKey-with-key signs the byte-identical tuple; vault session gets the action and completes; keyless privateKey keeps the old gate) + tuple pins (account_create payload, subscribe custom_json, authority-rotating account_update with derived new keys, change_recovery_account tuple) + the separation trap + the recovery cancel path.
  • tests/unit/claim-rewards-banner.test.tsx: exact posting-floor tuple pin, typed-error/cancel paths, remembered-key direct signing pinned (incl. remembered-beats-active ordering and the thrown-sign-error display), broadcast transport-throw display, and the extended invariant-21 vault test (never reads the remembered key, no direct sign/broadcast, no re-auth dialog/notice). claim-rewards-reauth-flow.test.tsx updated for the hook path.
  • tests/unit/change-password.test.ts: operation-only builder pinned, including the mutation guard that fails if eager owner-key derivation is restored inside the builder.
  • vault-signer.test.ts: classifier pin for all T3b shapes; use-session-signing.test.tsx: posting-floor chain pin.
  • pnpm e2e green — including the new vault-session claim flow in vault-session-signing.spec.ts (posting floor offers BOTH stored keys as radios, posting key picked, byte-identical full-pending claim tuple broadcast, zero /api/auth/* traffic).

Not verified or known limits

  • The vault claim/communities/change-password/recovery-warning flows are unit- and hook-matrix-tested, and claim is e2e-tested end-to-end; communities/change-password/recovery-warning vault flows have no dedicated browser e2e (the dialog itself is covered by the existing e2e transfer/delegate/claim journeys and the hook suite).
  • The remembered-posting-key branch keeps a direct SteemSigner call by design (see Implementation notes) — a future task could dispatch the restored key into the session instead, at the cost of a new sanitized Redux action.
  • The change-password privateKey deviation above is intentional under the unified-entry rule (session keys sign); flagging in case the silent active-key-session flow was load-bearing for anyone.
  • Vault sessions without a stored key at-or-above the floor see the dialog's existing no-keys notice + vault-management shortcut (no new copy added).
  • Documented follow-ups NOT implemented now (round-1 triage): embedded re-auth dialog for change-password (capability preserved via full re-login; post-A6 polish), vault dialog autoComplete hint semantics (product decision), account_create tuple pin strengthening, client.ts deprecated-builder batch cleanup (post-T4).

…g (A6-T3b)

Migrates the four remaining wallet-domain callers onto the unified
useSessionSigning entry, closing the vault-session signing gaps for claim
rewards, community creation, change password and the recovery-account
warning.

- claim-rewards-banner: claim_reward_balance signs at the posting floor
  (privateKey: the #378 session-key chain posting -> active -> owner via
  the hook; vault: the per-key password dialog, so the "skip restore ->
  re-auth dialog -> vaultUnsupported notice" chain is gone and the
  keyless hint hides). The device-remembered posting-key restore
  (#375/#378) stays a privateKey-session affordance that signs directly
  with the restored key: it sits between posting and active in the
  resolution order and exists in no session the unified entry could
  read; vault sessions never read it (invariant 21, pinned with the
  storage-prototype spy).
- communities-section: account_create at the active floor and the
  community subscribe custom_json at the posting floor (payload-based
  classifier: required_posting_auths). The hivemind setup ops (setRole /
  updateProps) keep signing directly with the NEW community owner's
  freshly derived active key (a key that exists in no session). The
  activeKeyRequired gate widens for a page-matching vault session.
- change-password-section: account_update (owner-class by payload
  inspection) at the owner floor. The ACCOUNT password in the form still
  derives and verifies the new keys (unchanged); the VAULT password the
  signing dialog asks for is a separate secret, kept apart by a
  vault-session-only note (four locales) and pinned by tests. A keyless
  privateKey session now gets explicit owner-key guidance
  (ownerKeySessionRequired) instead of silently signing with the
  form-derived owner key.
- recovery-warning-banner: change_recovery_account at the owner floor;
  the owner-key gate widens for a page-matching vault session, keyless
  privateKey sessions keep the disabled submit + notice.

Classifier pins added for the T3b operation shapes (claim tuple,
account_create, community custom_json, authority-rotating account_update,
change_recovery_account); the hook's posting-floor chain
(posting -> active -> owner) pinned in its suite; docs refreshed with
the remaining direct-SteemSigner inventory (T4 market/proposals/witness,
permanent login-challenge/recovery paths, the two no-session-key
remnants).

Part of #381
- docs(09-vault/02-auth): record the change-password privateKey key-source
  change (a keyless-owner session now re-authenticates with the master
  password / owner WIF — deriving the same owner key — instead of silently
  signing with the form-derived owner key); correct the "keyless privateKey
  sessions keep the pre-existing gates" clause per-caller (change-password's
  ownerKeySessionRequired gate is NEW — there was no gate before); add the
  change-password entry to 02-auth's signing inventory.
- change-password: buildAccountUpdateForPasswordChange is now
  OPERATION-ONLY — it no longer materializes an owner WIF every T3b caller
  discarded; the current-password check lives in
  verifyCurrentPasswordMatchesAccount alone, and a lib test pins the
  non-derivation (mutation-guarded: restoring the eager
  resolveOwnerSigningKey inside the builder fails two tests).
- tests: cancel-path coverage for claim-rewards-banner and
  recovery-warning-banner (cancelled -> silent return, no broadcast,
  surface stays usable), matching the communities/change-password suites;
  restore the thrown-error display pins for the claim banner's two residual
  catch blocks (remembered-key direct-path sign rejection and the
  hook-signed broadcast transport throw).
- e2e spec header: stop overclaiming the remembered-key non-read (that
  invariant is pinned by the unit suite's Storage-prototype spy, not the
  spec).

Part of #381
@ety001
ety001 merged commit 867ca59 into next-dev Nov 21, 2026
2 of 3 checks passed
@ety001
ety001 deleted the feat/a6-t3b-remaining-callers branch November 21, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant