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

refactor: update account service to support sub accounts #264

Merged

Conversation

jackson-dean
Copy link
Contributor

Changes the way accounts are stored to support sub accounts.
An overview of the storage strategy:

  • We continue to store "root" accounts (accounts derived with account number 0)
    in a users key in local storage that is keyed on the public key of the root account.
  • All subaccounts are stored in a subAccounts property on the root account. These subaccounts
    consist of the following props: { accountNumber, lastLoginTimestamp, isHidden }. The public key
    can be derived from this information combined with the seed stored on the root user.
  • We have a reverse lookup map that maps subaccount public keys back to their root account public key.
    We need this to support look up by public key when a consuming application passes us a public key for
    the logged in user.

NOTE: There is nothing special about the root account. It is only for historical reasons that we key
the common data (seed, mnemonic, etc) under this account's public key. In practice, all accounts are
derived the same and all sub accounts are fully fledged and unique "owner" accounts that can be
issued their own derived keys and can sign with their own public/private keys.

@jackson-dean jackson-dean requested a review from a team as a code owner September 20, 2023 19:10
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch 3 times, most recently from d837316 to ee083ff Compare September 21, 2023 05:10
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch 2 times, most recently from 8d0c9d4 to 5e487db Compare September 21, 2023 19:15
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch from 5e487db to f334f81 Compare September 21, 2023 19:18
Base automatically changed from 09-20-chore_update_configs_only to main September 21, 2023 21:19
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch from f334f81 to 14e26d9 Compare September 21, 2023 23:34
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch from d30fa1c to 14e26d9 Compare September 22, 2023 04:51
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch from 14e26d9 to 656702e Compare September 22, 2023 05:40
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch from 656702e to 5ea24e3 Compare September 22, 2023 05:44
This was referenced Sep 22, 2023
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch from 25b37ce to 668ba78 Compare September 25, 2023 18:42
* feature: new component for sub account UI

* feature: add feature flag guard for new account select component (#268)

* feature: add feature flag guard for new account select component

* feature: backup seed component (#269)

* feature: backup seed component

* feature: add balance to account selector UI (#270)

* feature: add balance to account selector UI

* migrate swal to mat dialog (#273)

* migrate swal to mat dialog

* update button styles (#277)

* update button styles

* review feedback and bug fixes (#279)
@jackson-dean jackson-dean force-pushed the 09-20-refactor_update_account_service_to_support_sub_accounts branch from 668ba78 to 7027d24 Compare September 25, 2023 18:49
mosster and others added 5 commits September 27, 2023 00:49
* cleanup UI for multiple accout mgmt

* run prettier

* fix margin on metamask account

* formatting

* fix mobile

* fix scrolling on overlay

---------

Co-authored-by: Lazy Nina <>
#286)

* update cookie options in put and update logic for mustUseStorageAccess

* format

* fix sameSite none

* run format

* add testnet verify-captcha to caddyfile

* fix affiliateAddress for heroswap iframe in identity (#287)

Co-authored-by: Lazy Nina <>

---------

Co-authored-by: Lazy Nina <>
@lazynina lazynina merged commit c69817b into main Nov 26, 2023
0 of 2 checks passed
@lazynina lazynina deleted the 09-20-refactor_update_account_service_to_support_sub_accounts branch November 26, 2023 15:59
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.

3 participants