tari-project / universe

Other
8 stars 24 forks source link

feat: keyring access & Monereo address generation #926

Open brianp opened 4 days ago

brianp commented 4 days ago

Description

Revamp the way we handle keyring access and use it to store the monero seed and the tari seed passphrase.

Motivation and Context

The user could deny access to the system Keychain, if they do we wouldn't be able to successfully store needed credentials for the app. Provide a wrapper to encapsulate storing the credentials in either the system keychain, or fallback to file IO storage.

How Has This Been Tested?

Manually

What process can a PR reviewer use to test or verify this change?

There are (at least) 7 important scenarios that need to be covered.

  1. A new wallet is created and access to the keychain is denied
  2. A new wallet is created and access to the keychain is granted
  3. A new wallet is created and access to the keychain is granted, but on the next startup access to the keychain is denied
  4. An old wallet was created access is granted (from a previous version). The wallet is upgraded to this version, granted access, and continues to work
  5. An old wallet was created access is granted (from a previous version). The wallet is upgraded to this version, access is denied, and continues to work
  6. An old wallet was created, and access to the keychain is denied. The wallet is upgraded to this version, access is granted, and continues to work
  7. An old wallet was created, and access to the keychain is denied. The wallet is upgraded to this version, access is denied, and continues to work

Additional scenarios that don't require the grid:

  1. Create a new wallet, do what you will with the password, get your monero seed words, ensure they are unique between new wallet creations. Recovery the monero wallet using the monero GUI wallet, on Mainnet. Validate the recovered wallet has the same monero address we provided.
Scenario Old wallet Key Chain Access New wallet Key Chain Access Denied Unique Monero Address Monero Seed words visible Passed
1. New wallet, denied access N/A ✅ / ❌
2. New wallet, granted access N/A ✅ / ❌
3. New wallet, granted then denied N/A ✅ & ❌ ✅ / ❌
4. Old wallet, granted access, upgraded and granted access ✅ / ❌
5. Old wallet, granted access, upgraded and denied access ✅ / ❌
6. Old wallet, denied access, upgraded and granted access ✅ / ❌
7. Old wallet, granted access, upgraded and denied access ✅ / ❌

A FULL WALLET RESET, FROM THIS VERSION, is required between each scenario

Testing Steps

Scenario 1:

  1. Create a new wallet
  2. When prompted for a password to access secure storage / keychain select deny, and do not enter a password
  3. Validate you have a unique monero address
  4. Validate you can see the monero address seed words

Scenario 2:

  1. Create a new wallet
  2. When prompted for a password to access secure storage / keychain enter a password correctly (however many times prompted, or select Always Allow)
  3. Validate you have a unique monero address
  4. Validate you can see the monero address seed words

Scenario 3:

  1. Create a new wallet
  2. When prompted for a password to access secure storage / keychain enter a password correctly (however many times prompted, or select Always Allow)
  3. Validate you have a unique monero address
  4. Restart the application
  5. When prompted for a password deny, and do not enter a password
  6. Attempt to view monero seed words
  7. Receive an error because you did not provide the password

Scenario 4:

  1. Start with an old wallet that was created in a previous version.
  2. When prompted for a password to access secure storage / keychain enter a password correctly (however many times prompted, or select Always Allow)
  3. Upgrade the application to the current version.
  4. When prompted for a password to access secure storage / keychain, enter the correct password (or select Always Allow).
  5. Wallet should continue to operate without issue.
  6. Monero address should be the default monero community address. 44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A
  7. Monero seed words area should not be present to be viewed

Scenario 5:

  1. Start with an old wallet that was created in a previous version.
  2. When prompted for a password to access secure storage / keychain enter a password correctly (however many times prompted, or select Always Allow)
  3. Upgrade the application to the current version.
  4. When prompted for a password to access secure storage / keychain, deny access, and do not enter a password.
  5. Wallet should still operate
  6. Monero address should be the default monero community address. 44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A
  7. Monero seed words area should not be present to be viewed

Scenario 6:

  1. Start with an old wallet that was created in a previous version.
  2. When prompted for a password to access secure storage / keychain, deny access, and do not enter a password.
  3. Upgrade the application to the current version.
  4. When prompted for a password to access secure storage / keychain enter a password correctly (however many times prompted, or select Always Allow)
  5. Wallet should still operate
  6. Monero address should be the default monero community address. 44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A
  7. Monero seed words area should not be present to be viewed

Scenario 7:

  1. Start with an old wallet that was created in a previous version.
  2. When prompted for a password to access secure storage / keychain, deny access, and do not enter a password.
  3. Upgrade the application to the current version.
  4. When prompted for a password to access secure storage / keychain, deny access, and do not enter a password.
  5. Wallet should still operate
  6. Monero address should be the default monero community address. 44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A
  7. Monero seed words area should not be present to be viewed

Scenario 8:

  1. Create a new wallet
  2. When prompted for a password to access secure storage / keychain accept, or deny, dealers choice
  3. Validate you have a unique monero address
  4. Validate you can see the monero address seed words
  5. Run the monero wallet GUI
  6. Set the GUI to mainnet Screenshot 2024-10-24 at 10 13 17
  7. Recover with seed words Screenshot 2024-10-24 at 10 15 37
  8. Validate address matches Screenshot 2024-10-24 at 10 17 03

Breaking Changes