Skip to content

feat(profile-metrics-controller): add proof of ownership API pre-requisites#8974

Merged
mathieuartu merged 10 commits into
mainfrom
ma/profile-metrics-poo-step1
Jun 4, 2026
Merged

feat(profile-metrics-controller): add proof of ownership API pre-requisites#8974
mathieuartu merged 10 commits into
mainfrom
ma/profile-metrics-poo-step1

Conversation

@mathieuartu
Copy link
Copy Markdown
Contributor

@mathieuartu mathieuartu commented Jun 2, 2026

Explanation

References

Related to: https://consensyssoftware.atlassian.net/browse/MUL-1843

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Introduces authenticated nonce batching and optional cryptographic proofs sent to the auth API; behavior is well-tested but touches account-verification and bearer-token flows.

Overview
Adds proof-of-ownership plumbing in @metamask/profile-metrics-controller so later callers can verify accounts with the auth API.

ProfileMetricsService gains fetchNonces (ProfileMetricsService:fetchNonces), calling POST …/nonce/batch with bearer auth, credentials: 'omit', optional entropy-source scoping, and 50-identifier chunking merged in parallel. Responses are validated with superstruct and rejected if identifiers are missing, extra, duplicated, or malformed (same retry/circuit policy as submitMetrics).

submitMetrics account payloads may include an optional proof (nonce + signature); JSON includes it only when set.

New canonicalizeAddress (and ProofUnsupportedNamespaceError) normalizes addresses per namespace (eip155, solana, tron, bip122) for auth API canonical forms—utility + tests only in this PR, not yet wired into the controller polling path.

Reviewed by Cursor Bugbot for commit 5796ec4. Bugbot is set up for automated code reviews on this repo. Configure here.

@mathieuartu mathieuartu self-assigned this Jun 2, 2026
@mathieuartu mathieuartu requested review from a team as code owners June 2, 2026 14:37
Comment thread packages/profile-metrics-controller/src/ProfileMetricsService.ts
@mathieuartu mathieuartu changed the title feat: add proof of ownership API pre-requisites feat(profile-metrics-controller): add proof of ownership API pre-requisites Jun 2, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a8b3301. Configure here.

Comment thread packages/profile-metrics-controller/src/ProfileMetricsService.ts
Comment thread packages/profile-metrics-controller/src/utils/canonicalize.ts Outdated
Comment thread packages/profile-metrics-controller/src/ProfileMetricsService.ts
Comment thread packages/profile-metrics-controller/src/utils/canonicalize.ts
Copy link
Copy Markdown
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

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

LGTM!

@mathieuartu mathieuartu enabled auto-merge June 4, 2026 12:45
@mathieuartu mathieuartu added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit 8ddd27b Jun 4, 2026
370 checks passed
@mathieuartu mathieuartu deleted the ma/profile-metrics-poo-step1 branch June 4, 2026 13:45
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.

4 participants