[WIP][PAY-3414] Remove UserStateManager and switch to loading account from v1 endpoint
Description
NOTE: WIP PR, not everything below is true yet!
While it would be nice to fully remove the stateful ID references in libs, I got about 1/3 of the way down this path before realizing it would mean half-migrating pretty much everything to passing in userIds directly.
Many calls are in places that are not properly type-checked due to libs often being typed as any, so it was wildly unsafe to try and do that.
However! We can update the two classes in libs that even care about the current user id and/or wallet to just accept them via config. And since we already call AudiusBackend.setup as part of our account fetching flow, it's easy enough to read those values off the newly fetched account and pass them in.
Functionally equivalent, moves us to the new /account endpoint, gets rids of UserStateManager, and sets us up to continue deleting AudiusBackend endpoints and their corresponding libs dependencies.
How Has This Been Tested?
TBD. 😅
⚠️ No Changeset found
Latest commit: fa534e0b3d3c3ec5860cd5ef0d4136c74230bd32
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
⚠️ GitGuardian has uncovered 7 secrets following the scan of your pull request.
Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.
🔎 Detected hardcoded secrets in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 9412812 | Triggered | Generic Password | f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 | cmd/core/infra/docker-compose.yml | View secret |
| 11648676 | Triggered | Generic High Entropy Secret | f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 | cmd/core/infra/dev_config/dev-sandbox.env | View secret |
| 11648679 | Triggered | Generic High Entropy Secret | f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 | cmd/core/infra/dev_config/standalone-console.env | View secret |
| 11648676 | Triggered | Generic High Entropy Secret | f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 | cmd/core/infra/dev_config/sandbox-one.env | View secret |
| 11648676 | Triggered | Generic High Entropy Secret | f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 | cmd/core/infra/dev_config/stage-sandbox.env | View secret |
| 11648676 | Triggered | Generic High Entropy Secret | f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 | cmd/core/infra/dev_config/prod-sandbox.env | View secret |
| 14086629 | Triggered | Generic Password | 4a48adbd7e25374e30113dfe3342e3428d198680 | cmd/audiusd/entrypoint.sh | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Preview this change https://demo.audius.co/switch-account-endpoint
I ran this against staging, and reposting isn't working at all -- nothing even makes it to the confirmer. is there some connection that's missing somewhere? strange :(
staging.audius.co seems ok though
Good catch. I missed initializing EntityManager with the current user information in the case that we use a cached account. FIx incoming
It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @dylanjeffers @sliptype
Preview this change https://demo.audius.co/switch-account-endpoint
It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @dylanjeffers @sliptype
Preview this change https://demo.audius.co/switch-account-endpoint
It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @dylanjeffers @sliptype
Preview this change https://demo.audius.co/switch-account-endpoint
It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @dylanjeffers @sliptype
It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @dylanjeffers @sliptype
Preview this change https://demo.audius.co/switch-account-endpoint