Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/profile-metrics-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add proof of ownership API wiring pre-requisites ([#8974](https://github.com/MetaMask/core/pull/8974))
- Add `ProfileMetricsService:fetchNonces` messenger action wrapping `POST /api/v2/nonce/batch`.
- Add optional `proof` field on accounts submitted via `ProfileMetricsService:submitMetrics` so that the auth API can use it to mark accounts as `verified: true`.

## [3.1.6]

### Changed
Expand Down
1 change: 1 addition & 0 deletions packages/profile-metrics-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@metamask/messenger": "^1.2.0",
"@metamask/polling-controller": "^16.0.6",
"@metamask/profile-sync-controller": "^28.1.1",
"@metamask/superstruct": "^3.1.0",
"@metamask/transaction-controller": "^66.0.1",
"@metamask/utils": "^11.9.0",
"async-mutex": "^0.5.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@

import type { ProfileMetricsService } from './ProfileMetricsService';

/**
* Fetch single-use nonces from the auth API, one per identifier.
*
* Requests larger than {@link MAX_NONCE_BATCH_SIZE} are split into multiple
* `POST /api/v2/nonce/batch` calls fired in parallel; the resulting maps are
* merged into a single record. Each chunk independently goes through the
* service policy (retry, circuit-breaker, degraded). If any chunk ultimately
* fails, the whole call rejects so the caller can soft-degrade the entire
* entropy-source batch consistently.
*
* The returned record is keyed by the auth API's echoed `identifier` field
* (`response[i].identifier -> response[i].nonce`). The call asserts that
* the response identifier set is exactly the requested set; any mismatch
* (missing, extra, or duplicated identifier) causes the chunk to throw so
* the caller never silently proceeds with partial nonces.
*
* @param data - The identifiers to mint nonces for, plus the optional
* entropy source ID used to scope the bearer token.
* @returns A map of identifier -> nonce.
* @throws {RangeError} if no identifiers are provided.
*/
export type ProfileMetricsServiceFetchNoncesAction = {
type: `ProfileMetricsService:fetchNonces`;
handler: ProfileMetricsService['fetchNonces'];
};

/**
* Submit metrics to the API.
*
Expand All @@ -20,4 +46,5 @@ export type ProfileMetricsServiceSubmitMetricsAction = {
* Union of all ProfileMetricsService action types.
*/
export type ProfileMetricsServiceMethodActions =
ProfileMetricsServiceSubmitMetricsAction;
| ProfileMetricsServiceFetchNoncesAction
| ProfileMetricsServiceSubmitMetricsAction;
Loading
Loading