dfinity / dfinity/examples

vetkeys: remove #120 IdbStorage/LocalStorage workaround once icp-js-auth#137 is released

Open
#1,467 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
613
Forks
434
Avg merge
8h 28m
Merged PRs (30d)
9

Description

Background

The vetkeys examples currently carry a localhost-only workaround for dfinity/icp-js-auth#120: on localhost they swap the default secure IdbStorage + ECDSA key for LocalStorage + Ed25519, because the default IdbStorage threw InvalidStateError: ... The database connection is closing on Vite dev servers.

The upstream fix is dfinity/icp-js-auth#137 (recovers from force-closed IndexedDB connections + memoizes the storage connection + awaits session hydration before signIn/signOut writes). It has been verified to resolve #120 (bug reproduces on @icp-sdk/auth@8.0.3, gone on the PR branch).

Task

Once #137 is merged and released, in each affected example:

  1. Bump @icp-sdk/auth to the release that contains the fix.
  2. Remove the #120 workaround — drop the isLocalEnv ? { storage: new LocalStorage(), keyType: "Ed25519" } : {} override (and the now-unused LocalStorage import) so localhost uses the default secure IdbStorage + ECDSA, same as production.

Affected examples (11)

Files containing the workaround (grep -rl "icp-js-auth/issues/120"):

  • motoko/vetkeys/basic_bls_signing/frontend/src/main.ts
  • motoko/vetkeys/basic_ibe/frontend/src/main.ts
  • motoko/vetkeys/encrypted_notes_app_vetkd/frontend/src/store/auth.ts
  • motoko/vetkeys/password_manager/frontend/src/store/auth.ts
  • motoko/vetkeys/password_manager_with_metadata/frontend/src/store/auth.ts
  • rust/vetkeys/basic_bls_signing/frontend/src/main.ts
  • rust/vetkeys/basic_ibe/frontend/src/main.ts
  • rust/vetkeys/basic_timelock_ibe/frontend/src/main.ts
  • rust/vetkeys/encrypted_notes_app_vetkd/frontend/src/store/auth.ts
  • rust/vetkeys/password_manager/frontend/src/store/auth.ts
  • rust/vetkeys/password_manager_with_metadata/frontend/src/store/auth.ts

(basic_vetkd motoko + rust don't carry the workaround.)

Verify after removal

Log in on a localhost dev server, then exercise reload churn / login-logout cycles — the InvalidStateError must no longer appear, confirming the default IdbStorage path is safe again.

Blocked on dfinity/icp-js-auth#137.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

After dfinity/icp-js-auth#137 is released, use the listed 11 affected vetkeys entry points and grep for the #120 workaround. Bump @icp-sdk/auth, remove the LocalStorage/Ed25519 override and unused import, then verify localhost login, reload churn, and login-logout cycles no longer produce InvalidStateError.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, typescript
Domain
authentication, frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.