Closed Bug 1661407 Opened 4 years ago Closed 4 years ago

Refactor FxAccountsKeys.jsm to use "scoped keys" as the primary interface concept

Categories

(Firefox :: Firefox Accounts, task)

task

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: rfkelly, Assigned: rfkelly)

References

Details

Attachments

(1 file)

FxA consumers in Desktop Firefox currently access key material stored as top-level fields in the account state, such as kSync and kXCS. In the broader FxA ecosystem we're moving towards a more structured approach based on scoped keys, making Desktop Firefox the odd one out.

As prep work for consolidating more code and concepts in the FxA ecosystem, let's refactor key-handling so be more scoped-keys-shaped internally.

Broad plan:

  • Delete fxa.keys.getKeys() and fxa.keys.canGetKeys(), which kind of assume there is a single set of keys that everyone has access to.
  • Create new fxa.keys.getScopedKey(scope) and fxa.keys.canGetScopedKey(scope) methods, so that consumers need to specify which key they're actually interested in.
  • Deprecate the top-level account fields kSync, kXCS, kExtSync and kExtKbHash, but do not remove them yet as there might be unexpected consumers.
  • When loading keys from disk, check for the presence of the scopedKeys field in the account data; if it is not present then create it using the existing key fields listed above.
  • Fix up consumers so they use the new interfaces.
Blocks: 1647588
Attachment #9175976 - Attachment description: Bug 1661407 - refactor FxA key handling to use "scoped keys". → Bug 1661407 - refactor FxA key handling to use "scoped keys". r?markh
See Also: → 1637465

Update of existing account:

  • Build off latest central, ./mach run and sign in to existing account.
    • Confirm that data synced down correctly, then quit Firefox.
  • Checkout my branch, ./mach build and ./mach run.
    • Confirm that I remained signed in and syncing correctly.
    • Use the browser console to inspect fxAccounts._internal.currentAccountState.getUserAccountData() and confirm that it contains the scopedKeys field with two entries
  • Signed in to the same account on a new profile of current Firefox nightly
    • Confirm that data successfully syncs between the two Firefoxes
    • Confirm that I can send and receive tabs in both directions

Sign in to existing account:

  • Delete the profile from my local build and ./mach run to get a clean one
  • Sign in to the existing account that I used above
    • Confirm that data successfully syncs between this and the existing Firefox signed in to that account
    • Confirm that I can send and receive tabs in both directions

Create new account:

  • With a fresh profile using my local build, sign in creating a new account.
  • Check about:sync-log to convince myself that sync was working correctly.

Pairing:

  • Sign in to my local build with an existing account
  • Use sync-settings -> connect-another-device to show the pairing code
  • Freshly install Firefox on my Andriod device
  • Scan the code from Android
  • Confirm that I can send tabs back and forth

So I think it's in pretty good shape!

Pushed by rkelly@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/38ee4af29718 refactor FxA key handling to use "scoped keys". r=markh
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: