Skip to content

feat(sdk-coin-xdc): add signXdcKycMessage utility#9136

Merged
Doddanna17 merged 1 commit into
masterfrom
SI-921-sign-xdc-kyc-message
Jun 29, 2026
Merged

feat(sdk-coin-xdc): add signXdcKycMessage utility#9136
Doddanna17 merged 1 commit into
masterfrom
SI-921-sign-xdc-kyc-message

Conversation

@bitgo-ai-agent-dev

Copy link
Copy Markdown

What

  • Add buildXdcKycMessage(params) — constructs the canonical KYC message string
    "[XDCmaster KYC <ISO-timestamp>] Upload KYC for <account>" expected by the
    XinFin masternode IPFS API.
  • Add signXdcKycMessage(wallet, account, walletPassphrase) — generates a fresh
    timestamp, builds the message, signs it via wallet.signMessage() with
    MessageStandardType.EIP191, and returns { kycAccount, kycMessage, kycSignature }.
  • Export both functions and related types from modules/sdk-coin-xdc/src/lib/index.ts.
  • 5 unit tests covering: correct format string, timestamp non-determinism, correct
    signMessage call params, correct return value mapping, and error propagation.

Why

  • The XinFin masternode IPFS API (/api/ipfs/addKYC) now requires three signed-message
    headers (x-kyc-account, x-kyc-message, x-kyc-signature) to prove wallet
    ownership before accepting KYC file uploads.
  • The staking-service and frontend (SI-922, SI-923) need a ready-made utility to
    build and sign this message via the existing TSS wallet.signMessage() flow,
    without requiring any changes to wallet-platform (XDC already has
    supportsMessageSigning() = true).

Test plan

  • buildXdcKycMessage — correct format string with account + timestamp
  • buildXdcKycMessage — different timestamps produce different strings
  • signXdcKycMessage — calls wallet.signMessage with correct messageRaw
    and messageStandardType: MessageStandardType.EIP191
  • signXdcKycMessage — returns kycAccount, kycMessage, kycSignature
    mapped correctly from SignedMessage
  • signXdcKycMessage — propagates error if wallet.signMessage throws
  • All 62 existing XDC unit tests still pass

Ticket: SI-921

Add signXdcKycMessage and buildXdcKycMessage as standalone utility
functions in modules/sdk-coin-xdc/src/lib/xdcKycMessage.ts.

The XinFin masternode IPFS API (/api/ipfs/addKYC) now requires
EIP-191 signed message headers to prove wallet ownership. The message
format is "[XDCmaster KYC <ISO-timestamp>] Upload KYC for <account>".

signXdcKycMessage generates a fresh timestamp, builds the canonical
message string, and signs it via wallet.signMessage() with
MessageStandardType.EIP191, which routes through the WP /msgrequests
TSS ceremony. Returns kycAccount, kycMessage, and kycSignature ready
to send as staking-service request fields.

Unit tests cover: correct format string, timestamp non-determinism,
correct signMessage call params, correct return value mapping, and
error propagation when signing fails.

Ticket: SI-921
Session-Id: c8a118ce-e817-497d-b221-aa0d0dccba73
Task-Id: 400c947f-58b8-40eb-a364-e807f68fd299
@linear-code

linear-code Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

SI-921

@Doddanna17 Doddanna17 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.

Reviewed against SI-921. Implementation is correct and complete.

  • Message format matches XinFin foundation spec exactly: [XDCmaster KYC <ISO-timestamp>] Upload KYC for <account>
  • MessageStandardType.EIP191 enum over raw string — good call
  • Timestamp generated inside signXdcKycMessage so kycMessage and the signed payload are always in sync
  • Standalone utility pattern (not on the Xdc class) matches the signAccountBasedMidnightClaimMessages precedent
  • All 5 test cases from the ticket are covered, including error propagation and the kycMessage/messageRaw consistency assertion
  • Zero deletions — no regressions to existing XDC tests

SI-921 complete. Unblocks SI-922 (staking-service) and SI-923 (frontend).

@Doddanna17 Doddanna17 marked this pull request as ready for review June 29, 2026 15:45
@Doddanna17 Doddanna17 requested a review from a team as a code owner June 29, 2026 15:45

@abhijit0943 abhijit0943 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.

LG

@Doddanna17 Doddanna17 merged commit b8bfe00 into master Jun 29, 2026
24 checks passed
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.

2 participants