Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Extension - Add view and import Spending Key #1744

Merged
merged 7 commits into from
Feb 27, 2025

Conversation

jurevans
Copy link
Collaborator

@jurevans jurevans commented Feb 25, 2025

Resolves #1720

  • User can import Spending Key (similar to Private Key import)
  • User can view Spending Key
  • User is prompted to authenticate to view Spending Key (similar to View Seed Phrase)

Testing

NOTE I think it's a good idea while running this locally, to take an existing dev extension installation based on main (or older), then loading it with this branch, just to simulate an upgrade. I didn't change any values in storage for this branch, but I think it's good to confirm the logic in place is correct for all existing accounts! That's a good practice for any Keychain update.

We want to make sure that the viewing key (and default address) we derived from a mnemonic matches what is imported when we import the spending key directly. Also, and most critically, we need to ensure that this works with previous extension data in place, and doesn't affect the normal account flows in any way!

Since the PR introduces "Access Spending Key", we can test with any mnemonic import:

  1. Import mnemonic
  2. In Keychain popup -> View Keys -> Access Spending Key - copy this value and make note of Viewing key and payment address (default address)
  3. Delete this account from keychain (avoiding duplicates)
  4. Import Spending Key
  5. Verify that Viewing Key & Payment address are the same (since we are using deterministic payment addresses for now)

Testing accounts

Here are a few accounts we can test with:

Mnemonic code: equip will roof matter pink blind book anxiety banner elbow sun young
  • Using HD derivation path m/32'/877'/0'
    • Viewing key: zvknam1q080khy2qqqqpqp3qmymr4d28kgmwy0frpv89csgpd0azueh2deuu6t97cztywgh3mgkp4zhvjfxy2zjuk6y7j5w45f2mk94cnd4kqsndjtp6e7ezv59rm8czavrwjpw0dqtmmq6lrfnvrj57qspy2vlrv7gkmw3zktr5yyplmmp5hsf3reqnnuyfdt30zpkxzjdkq9t3d79z2cwx7y99dtdtrr48n9q7wphhwqxg9lxnass4njj6v09j48atd49kfj589ej5rk0gpswcm8qf
    • Spending key: zsknam1q080khy2qqqqpqp3qmymr4d28kgmwy0frpv89csgpd0azueh2deuu6t97cztywgh36uz5vhuw5wg5en4vlprudwkshg9t435c9stne4dvt64n02z2susqewexquafzcsplgd37d5wzta4ypmfamx43vxsde2p63r2y34xngflmmp5hsf3reqnnuyfdt30zpkxzjdkq9t3d79z2cwx7y99dtdtrr48n9q7wphhwqxg9lxnass4njj6v09j48atd49kfj589ej5rk0gpsc8tuen
  • Using HD derivation path m/32'/877'/1'
    • Viewing key: zvknam1q080khy2qyqqpqr5w2asdwt4knzw92c5zenpz0ccj2f6m8u4t670wgja23hh38xwc07qjt96pze42mhyw3wrxglj2anjwffafl3ggkuutpwde7rftp7ekkzdznm577wdrkheacgglrqpfasnyw7ecknqpqzzcack0ng6vny33nt7z0hyw647g8gw9sr2585732d7cnfvmvkwqsd3efw96haa4k2pnmfmyh2rf9uknstm6dzwe97nkqw3nxltzj9pwrm06zmzqxlwt3g45ts0e
    • Spending key: zsknam1q080khy2qyqqpqr5w2asdwt4knzw92c5zenpz0ccj2f6m8u4t670wgja23hh38xwcw08c7cp64hauuf8uv44d3uy4gh6zwr9c6cegsy66exmgah2rlqseydkzl5rydtz3sr6dtm0yxhd4eagmre8vjrpyppzjpcm98ynx6gz3nt7z0hyw647g8gw9sr2585732d7cnfvmvkwqsd3efw96haa4k2pnmfmyh2rf9uknstm6dzwe97nkqw3nxltzj9pwrm06zmzqxlwt3g47ty63
  • Using HD derivation path m/32'/877'/2'
    • Viewing key: zvknam1q080khy2qgqqpqrp6vhyc2d39vpn5rty473yzycelycdlmlzxkj6jyevtw4x4ycm2jujg3463hx2nlgwuw45yfgl2dr86te7u4t4s6p57fzuvsxmkumk8mwpafv8cfdqcalrt9h2vngqag3q2hae0mp6ptv3zdgyjh0ycv38j07f0ckn9mkszd4kc6t3lpn37engast5lct67ef6dg3uezqzmxpmps43xlvgfjkxhlhd07k8c5klqhl0ymxpk0wlvr22wnshnqvuc0crg6tme
    • Spending key: zsknam1q080khy2qgqqpqrp6vhyc2d39vpn5rty473yzycelycdlmlzxkj6jyevtw4x4ycm2smstj8dh97jssumgnz6zx9me40fz4yvfgv26jp20anf0yct2p3smjaqtydk6zd3u96c5v4y95e4dplygxzywn8m8nknfu52kjcf6lqgj07f0ckn9mkszd4kc6t3lpn37engast5lct67ef6dg3uezqzmxpmps43xlvgfjkxhlhd07k8c5klqhl0ymxpk0wlvr22wnshnqvuc0cd753f6

Screenshots

Spending Key auth prompt:
image

Spending Key view (Pending final copy):
image

Button appears before Viewing Key and should only display on non-Ledger shielded accounts:
image

Spending Key Import - New Tab:
image

@jurevans jurevans self-assigned this Feb 25, 2025
@jurevans jurevans added this to the Phase 3 milestone Feb 25, 2025
@jurevans jurevans force-pushed the feat/add-view-spending-key branch 3 times, most recently from e8ded1d to edea9b9 Compare February 25, 2025 17:12
@brentstone brentstone modified the milestones: Phase 3, Future Upgrades Feb 26, 2025
@jurevans jurevans force-pushed the feat/add-view-spending-key branch 3 times, most recently from 9acf0a8 to 0c7e882 Compare February 26, 2025 14:57
@jurevans jurevans marked this pull request as ready for review February 26, 2025 15:44
@jurevans jurevans requested review from mateuszjasiuk, pedrorezende and euharrison and removed request for mateuszjasiuk and pedrorezende February 26, 2025 15:44
Copy link
Collaborator

@mateuszjasiuk mateuszjasiuk left a comment

Choose a reason for hiding this comment

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

Tested! LGTM

@jurevans jurevans force-pushed the feat/add-view-spending-key branch from 889cc23 to c362e50 Compare February 27, 2025 13:15
@jurevans jurevans merged commit 8306f47 into main Feb 27, 2025
7 checks passed
@jurevans jurevans deleted the feat/add-view-spending-key branch February 27, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keychain: add ability to view spending key
4 participants