enKrypt icon indicating copy to clipboard operation
enKrypt copied to clipboard

feat: export private keys

Open kvhnuke opened this issue 3 months ago • 2 comments

Summary by CodeRabbit

  • New Features
    • Add “Export private key” option in Accounts, with password confirmation dialog.
  • Networks
    • Added TAC and COTI Testnet; switched zkSync Goerli to zkSync Sepolia.
    • Removed Form (mainnet/testnet), SKALE Chaos, CAGA Ankara, and Opal.
    • Updated Sanko balances to use Blockscout; refreshed explorer endpoints.
  • Swaps
    • Removed Binance and Matic from gas estimation support.
  • Name Resolution
    • Disabled Space ID (SID) resolution paths.
  • Chores
    • Updated Node.js/runtime images and multiple dependencies.
  • Tests
    • Skipped SID suite; adjusted related expectations.

kvhnuke avatar Sep 10 '25 20:09 kvhnuke

Walkthrough

Repository-wide updates include Node.js/runtime version bumps, dependency upgrades, and multiple network registry changes (additions/removals/renames). A new private-key export flow is added end-to-end (UI → background → keyring). Name-resolution disables SID paths. Tests/settings updated accordingly.

Changes

Cohort / File(s) Summary
CI/Runtime version bumps
.github/workflows/test-all.yml, .github/workflows/test-swap.yml, .nvmrc, Dockerfile
Node.js updated to 22.18.x across CI, .nvmrc, and Docker base image; workflows otherwise unchanged.
Tooling and deps upgrades
root package.json, packages/*/package.json (extension, extension-bridge, hw-wallets, keyring, name-resolution, request, signers/*, storage, swap, types, utils)
Widespread dev/runtime dependency version updates (TypeScript, ESLint, Node types, various libs). No code changes in these files except manifests.
Vitest config adjustments
packages/extension/configs/vitest.config.mts
Node polyfills limited to 'crypto'; added resolve.alias with customResolver for vite-plugin-node-polyfills shims; minor formatting cleanups.
Background/internal: export private key
packages/extension/src/libs/background/index.ts, .../internal/get-private-key.ts, .../internal/index.ts, packages/extension/src/types/messenger.ts, packages/extension/src/libs/keyring/keyring.ts, packages/keyring/src/index.ts
New InternalMethods.getPrivateKey; background handler module added; wiring in background switch; KeyRingBase and KeyRing expose getPrivateKey.
UI: export private key flow
packages/extension/src/ui/action/views/accounts/components/accounts-list-item-menu.vue, .../accounts-list-item.vue, .../export-account-form.vue, packages/extension/src/ui/action/views/accounts/index.vue
New Export action in account menu; plumb exportable prop and action:export event; new export modal to request password and display private key; parent view integrates the flow.
Ethereum networks: add/replace/remove
packages/extension/src/providers/ethereum/networks/index.ts, .../tac.ts, .../zksepolia.ts, removed: .../zkgoerli.ts, .../form.ts, .../form-testnet.ts, .../cagaAnkara.ts, .../skale/chaos.ts, .../skale/index.ts, .../coti-devnet.ts, added: .../coti-testnet.ts
Added TAC and zkSync Sepolia; removed zkGoerli, Form (main/test), Caga Ankara, SKALE Chaos; switched COTI Devnet → COTI Testnet; exports updated accordingly.
Types: network enum updates
packages/types/src/networks.ts
NetworkNames changes: add TAC; replace ZkSyncGoerli → zkSyncSepolia; remove SkaleChaos, Opal, Form(FormTestnet), CagaAnkara; rename CotiDevnet → CotiTestnet.
Etherscan endpoints
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts
Removed SkaleChaos, ZkSyncGoerli, Form(FormTestnet) endpoints; added TAC endpoint.
Assets handler (MEW)
packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts
For Sanko, set bsEndpoint: true and clear tbName, switching to Blockscout balances.
Common new-features flag
packages/extension/src/providers/common/libs/new-features.ts
newNetworks changed from [CoreDAO] to [TAC].
Polkadot networks: removal
packages/extension/src/providers/polkadot/networks/index.ts, removed: .../unique/opal.ts
Removed Opal network import and export; deleted its definition file.
Name-resolution: disable SID
packages/name-resolution/src/index.ts, packages/name-resolution/tests/resolver.test.ts, packages/name-resolution/tests/sid.test.ts
Commented out SID init and resolution paths; resolveAddress third param renamed to _paymentIdChain; tests updated to expect null and skipped SID suite.
Swap updates
packages/swap/src/common/estimateGasList.ts, packages/swap/src/index.ts
Removed Binance and Matic from gas estimation networks; re-exported ToTokenType.
Polkadot signer derivation
packages/signers/polkadot/src/index.ts
mnemonicToMiniSecret now called with rounds=2048 (added fifth argument).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as Accounts View / Export Modal
  participant BG as Background Internal Handler
  participant KR as KeyRingBase / KeyRing
  participant Store as Key Storage / Signer

  rect rgb(240,248,255)
    note over User,UI: Export private key flow (new)
    User->>UI: Click "Export" on account
    UI->>UI: Prompt for extension password
    UI->>BG: InternalMethods.getPrivateKey([account, password])
    BG->>KR: getPrivateKey(options, password)
    KR->>Store: Retrieve/derive private key
    Store-->>KR: privateKey (string)
    KR-->>BG: privateKey
    BG-->>UI: { result: JSON.stringify(privateKey) }
    UI->>UI: Show private key in modal
  end

  rect rgb(255,240,240)
    alt Error
      Store-->>KR: throw Error
      KR-->>BG: Error
      BG-->>UI: { error }
      UI->>User: Display error message
    end
  end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60–90 minutes

Possibly related PRs

  • enkryptcom/enKrypt#721 — Adds a private-key export feature with background handler, keyring method, and UI hooks; overlaps the new getPrivateKey flow.
  • enkryptcom/enKrypt#745 — Introduces TAC network and updates enums/exports; aligns with added tac.ts and NetworkNames.TAC.
  • enkryptcom/enKrypt#704 — Modifies name-resolution to handle provider/paymentIdChain and SID; relates to disabling SID and signature tweak here.

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “feat: export private keys” succinctly captures the primary feature added by this pull request—enabling private key export—without extraneous detail, file lists, or vague wording, making it immediately clear to reviewers what the main change is.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title "feat: export private keys" succinctly and accurately summarizes the main feature introduced in this changeset, matching the addition of private key export functionality across background handlers, keyring APIs, and UI components.
✨ Finishing touches
  • [ ] 📝 Generate Docstrings
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch feat/export-private-keys

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Sep 10 '25 20:09 coderabbitai[bot]

:briefcase: Build Files chrome: enkrypt-chrome-f5878e6e.zip firefox: enkrypt-firefox-f5878e6e.zip

:syringe: Virus total analysis chrome: f5878e6e firefox: f5878e6e

github-actions[bot] avatar Sep 10 '25 20:09 github-actions[bot]