Skip to content

docs(be,fe): design doc for persisting the multiple-accounts toggle#4003

Closed
MRmarioruci wants to merge 4 commits into
mainfrom
docs/persist-multi-accounts-toggle
Closed

docs(be,fe): design doc for persisting the multiple-accounts toggle#4003
MRmarioruci wants to merge 4 commits into
mainfrom
docs/persist-multi-accounts-toggle

Conversation

@MRmarioruci

@MRmarioruci MRmarioruci commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Problem

The "Enable multiple accounts" toggle on the authorize screen is in-memory only — it resets on every page load and on every identity switch. Account data is persisted backend-side, but the UI gate is not, so users who enable multi-account on a dapp lose their per-app account list on the next visit and have to re-toggle to see their own accounts.

Persisting the toggle backend-side also surfaces a second problem: every II canister call rides on a device-rooted delegation capped at ~30 minutes, so a returning user would pay a full WebAuthn ceremony just to render their persisted preference.

Changes

Adds docs/persist-multiple-accounts-toggle.md — a design doc in two parts:

  • Part 1: per-(anchor, application) persistence of the toggle by extending the existing AnchorApplicationConfig stable structure. Covers context, alternatives considered (incl. why not localStorage), backend Candid surface, frontend wiring, and upgrade-safety considerations.
  • Addendum — scoped session delegations: ceremony-free authentication for low-stakes calls (get_accounts, get/set_anchor_application_config, get/set_default_account). II stamps a longer-lived delegation (default 7 days) on a principal derived from (salt, anchor, scope, epoch), recognized by re-derivation in a new opt-in authz branch — the existing check_authorization is untouched, so everything else stays full-auth by construction. Revocation is an additive epoch field on the anchor, bumped on any auth-method removal or explicitly. Zero new stable-memory structures; includes a mermaid flow diagram, failure modes, security analysis, and the stored-rows alternative with its adoption trigger.

No code changes.

Tests

Doc only.

🤖 Generated with Claude Code

@MRmarioruci MRmarioruci marked this pull request as ready for review June 10, 2026 15:17
@MRmarioruci MRmarioruci requested a review from a team as a code owner June 10, 2026 15:17
Copilot AI review requested due to automatic review settings June 10, 2026 15:17
@zeropath-ai

zeropath-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to cd2927e.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► persist-multiple-accounts-toggle.md
    Persist the "multiple accounts" toggle in the backend
► scoped-session-delegations.md
    Scoped session delegations for low-stakes II calls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a design document proposing how to persist the “Enable multiple accounts” toggle server-side so it survives reloads, identity switches, and device changes by storing the preference per (anchor, application) alongside existing per-application account configuration.

Changes:

  • Proposes extending the stable AnchorApplicationConfig (CBOR map) with an additive multiple_accounts_enabled field for upgrade-safe persistence.
  • Proposes adding dedicated Candid endpoints to read/write per-application config (including the toggle).
  • Describes frontend wiring in ContinueView.svelte, rollout/rollback considerations, and suggested unit/E2E tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +96 to +99
get_anchor_application_config :
(IdentityNumber, FrontendHostname) ->
(variant { Ok : AnchorApplicationConfigInfo;
Err : GetAnchorApplicationConfigError }) query;
Comment on lines +101 to +104
set_anchor_application_config :
(IdentityNumber, FrontendHostname, AnchorApplicationConfigInfo) ->
(variant { Ok;
Err : SetAnchorApplicationConfigError });
@MRmarioruci MRmarioruci requested review from aterga and sea-snake June 11, 2026 08:49
@MRmarioruci

Copy link
Copy Markdown
Contributor Author

Closing this in favor of the implementation in #4014

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.

2 participants