Skip to content
Open
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
5 changes: 5 additions & 0 deletions packages/profile-metrics-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `ProofOfOwnershipService` for signing chain-native proofs of account ownership ([#9016](https://github.com/MetaMask/core/pull/9016))
- Exposes `ProofOfOwnershipService:sign({ account, nonce })`, dispatching by the CAIP-2 namespace of the account's first scope.
- EVM accounts are signed via `KeyringController:signPersonalMessage` (EIP-191); Solana, Tron, and Bitcoin accounts are signed via `SnapController:handleRequest` with the `onClientRequest` handler against the snap declared in `account.metadata.snap.id`, which keeps the request silent and client-internal.
- The non-EVM snaps are expected to implement a `signProofOfOwnership` JSON-RPC method that validates the message prefix `metamask:proof-of-ownership:` before signing.
- Add `profileMetricsServiceName` alias for the existing `serviceName` export, to disambiguate it from the new `proofOfOwnershipServiceName`. The original `serviceName` export is unchanged.
- 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`.
Expand Down
6 changes: 5 additions & 1 deletion packages/profile-metrics-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@
"@metamask/messenger": "^1.2.0",
"@metamask/polling-controller": "^16.0.6",
"@metamask/profile-sync-controller": "^28.1.1",
"@metamask/snaps-controllers": "^19.0.0",
"@metamask/snaps-sdk": "^11.0.0",
"@metamask/snaps-utils": "^12.1.2",
"@metamask/superstruct": "^3.1.0",
"@metamask/transaction-controller": "^67.0.0",
"@metamask/utils": "^11.9.0",
"async-mutex": "^0.5.0"
"async-mutex": "^0.5.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"@metamask/auto-changelog": "^6.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import { TransactionControllerTransactionSubmittedEvent } from '@metamask/transa
import { Duration, inMilliseconds } from '@metamask/utils';
import { Mutex } from 'async-mutex';

import type { ProfileMetricsServiceMethodActions } from '.';
import type { ProfileMetricsControllerMethodActions } from '.';
import type { ProfileMetricsControllerMethodActions } from './ProfileMetricsController-method-action-types';
import type { AccountWithScopes } from './ProfileMetricsService';
import type { ProfileMetricsServiceMethodActions } from './ProfileMetricsService-method-action-types';

/**
* The name of the {@link ProfileMetricsController}, used to namespace the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@metamask/superstruct';
import type { IDisposable } from 'cockatiel';

import type { ProfileMetricsServiceMethodActions } from '.';
import type { ProfileMetricsServiceMethodActions } from './ProfileMetricsService-method-action-types';

/**
* The shape of an entry in the `POST /api/v2/nonce/batch` response body.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* This file is auto generated.
* Do not edit manually.
*/

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

/**
* Sign a proof of ownership for the given account and server-issued nonce.
*
* The returned proof is shaped to drop directly into
* `AccountWithScopes.proof` for `ProfileMetricsService:submitMetrics`.
*
* @param data - The account to prove ownership of and the nonce to bind
* the proof to.
* @returns The proof of ownership (nonce echo + signature).
* @throws {ProofUnsupportedNamespaceError} if the account's first scope
* carries a namespace this service does not know how to sign for, or if
* the account has no scopes.
* @throws if the underlying signer (keyring or snap) rejects, or if the
* snap returns a malformed response.
*/
export type ProofOfOwnershipServiceSignAction = {
type: `ProofOfOwnershipService:sign`;
handler: ProofOfOwnershipService['sign'];
};

/**
* Union of all ProofOfOwnershipService action types.
*/
export type ProofOfOwnershipServiceMethodActions =
ProofOfOwnershipServiceSignAction;
Loading
Loading