Skip to content

Add SEP-53 message signing/verification to Keypair - #1513

Merged
quietbits merged 5 commits into
mainfrom
issue-1492
Jul 7, 2026
Merged

Add SEP-53 message signing/verification to Keypair#1513
quietbits merged 5 commits into
mainfrom
issue-1492

Conversation

@quietbits

Copy link
Copy Markdown
Contributor

Adds Keypair.signMessage(message) and Keypair.verifyMessage(message, signature) for signing and verifying arbitrary messages per SEP-53.

  • message (a UTF-8 string or Buffer) is prefixed with the fixed "Stellar Signed Message:\n" marker, hashed once with SHA-256, and that hash is signed/verified with the keypair's ed25519 key.
  • Composes entirely from existing primitives — the shipped hash() (single-round SHA-256) and Keypair.sign/verify — via a small private _hashMessage helper.
  • signMessage inherits sign()'s "no secret key" throw; verifyMessage inherits verify()'s resilient false on bad input. No new failure modes.
const kp = Keypair.fromSecret("S...");
const sig = kp.signMessage("Hello, World!");          // Buffer (64-byte ed25519)

const pub = Keypair.fromPublicKey("G...");
pub.verifyMessage("Hello, World!", sig);              // boolean

Copilot AI review requested due to automatic review settings July 7, 2026 12:55
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Jul 7, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds SEP-53-compliant arbitrary message signing and verification to Keypair, along with test vectors and API reference documentation updates.

Changes:

  • Introduces Keypair.signMessage(message) and Keypair.verifyMessage(message, signature) plus a private _hashMessage helper using the SEP-53 fixed prefix and single-round SHA-256.
  • Adds unit tests covering SEP-53 published test vectors, round-trip behavior, and failure cases.
  • Updates the Keys reference docs to include the new APIs and adjusts source references.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/base/keypair.ts Adds SEP-53 message prefix constant, message-hash helper, and signMessage/verifyMessage APIs.
test/unit/base/keypair.test.ts Adds SEP-53 test vectors and behavioral tests for signing and verification.
docs/reference/core-keys.md Documents the new APIs and updates source links/line references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/base/keypair.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread src/base/keypair.ts
@quietbits
quietbits requested a review from Ryang-21 July 7, 2026 14:33

@Ryang-21 Ryang-21 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.

Awesome work 👍

@quietbits
quietbits merged commit becb237 into main Jul 7, 2026
12 checks passed
@quietbits
quietbits deleted the issue-1492 branch July 7, 2026 15:32
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Feature Request: Add SEP-53 message signing and verification to Keypair

3 participants