Skip to content

feat(stellar-wallet-snap): add signProofOfOwnership client request RPC - #186

Open
stanleyyconsensys wants to merge 5 commits into
mainfrom
feat/stellar/signproof
Open

feat(stellar-wallet-snap): add signProofOfOwnership client request RPC#186
stanleyyconsensys wants to merge 5 commits into
mainfrom
feat/stellar/signproof

Conversation

@stanleyyconsensys

@stanleyyconsensys stanleyyconsensys commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Explanation

Adds a new Stellar Wallet Snap SIP-31 onClientRequest method, signProofOfOwnership, to silently sign a constrained proof-of-ownership message (SEP-0053) for MetaMask client usage (e.g., profile-metrics ownership proofs).

Changes:

Introduces signProofOfOwnership JSON-RPC method, request/response validation structs, and handler wiring.
Adds parsing/validation for metamask:proof-of-ownership:{nonce}:{address} messages (nonce supports colons).
Adds unit tests, docs for the new handler flow, and a changelog entry.

References

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Stellar Wallet Snap SIP-31 onClientRequest method, signProofOfOwnership, to silently sign a constrained proof-of-ownership message (SEP-0053) for MetaMask client usage (e.g., profile-metrics ownership proofs).

Changes:

  • Introduces signProofOfOwnership JSON-RPC method, request/response validation structs, and handler wiring.
  • Adds parsing/validation for metamask:proof-of-ownership:{nonce}:{address} messages (nonce supports colons).
  • Adds unit tests, docs for the new handler flow, and a changelog entry.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/stellar-wallet-snap/src/handlers/clientRequest/utils.ts Adds proof-of-ownership message parsing + Stellar address validation helper.
packages/stellar-wallet-snap/src/handlers/clientRequest/signProofOfOwnership.ts Implements the silent signing handler and enforces message-address matches signing account.
packages/stellar-wallet-snap/src/handlers/clientRequest/signProofOfOwnership.test.ts Adds unit tests covering success and address-mismatch failure behavior.
packages/stellar-wallet-snap/src/handlers/clientRequest/api.ts Adds method enum entry plus request/response structs (including coercion of nonce/address from message).
packages/stellar-wallet-snap/src/handlers/clientRequest/api.test.ts Adds struct validation tests for the new request/response shapes.
packages/stellar-wallet-snap/src/context.ts Registers the new handler in the client request routing table.
packages/stellar-wallet-snap/snap.manifest.json Updates bundle shasum for the new build output.
packages/stellar-wallet-snap/docs/use-cases/README.md Adds the new use-case entry to the handler documentation index.
packages/stellar-wallet-snap/docs/use-cases/client-request/signProofOfOwnership.md Documents the new handler’s behavior, constraints, and flow.
packages/stellar-wallet-snap/CHANGELOG.md Adds an Unreleased changelog entry describing the new client request method.
Suppressed comments (1)

packages/stellar-wallet-snap/docs/use-cases/client-request/signProofOfOwnership.md:43

  • This step says BaseClientRequestHandler resolves the account + wallet, but SignProofOfOwnershipHandler extends BaseHandler and resolves via AccountResolver directly. Updating this avoids confusion when tracing the implementation.
3. **Resolve** — `BaseClientRequestHandler` loads keyring account and wallet only (`RESOLVE_ACCOUNT_KEYRING_AND_WALLET`). The destination account does not need to be activated on-chain.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/stellar-wallet-snap/src/handlers/clientRequest/api.ts
@stanleyyconsensys
stanleyyconsensys marked this pull request as ready for review August 25, 2026 09:49
@stanleyyconsensys
stanleyyconsensys requested a review from a team as a code owner August 25, 2026 09:49
* @returns The parsed nonce and Stellar address.
* @throws Error if the message format is invalid.
*/
export function parseProofOfOwnershipMessage(message: string): {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

align the same method as solana


1. **Route** — `onClientRequest` dispatches to `SignProofOfOwnershipHandler`.
2. **Validate** — Request must match `SignProofOfOwnershipJsonRpcRequestStruct` (prefix, nonce, Stellar address). `nonce` and `address` are coerced from `message`.
3. **Resolve** — `BaseClientRequestHandler` loads keyring account and wallet only (`RESOLVE_ACCOUNT_KEYRING_AND_WALLET`). The destination account does not need to be activated on-chain.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Replace BaseClientRequestHandler with SignProofOfOwnershipHandler (or AccountResolver). That class is the one that actually calls resolveAccount with RESOLVE_ACCOUNT_KEYRING_AND_WALLET.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yup the doc is not update, let me update it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants