feat(sdk-coin-xdc): add signXdcKycMessage utility#9136
Merged
Conversation
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
Contributor
c97912b to
e4729d1
Compare
Doddanna17
approved these changes
Jun 29, 2026
Doddanna17
left a comment
Contributor
There was a problem hiding this comment.
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.EIP191enum over raw string — good call- Timestamp generated inside
signXdcKycMessagesokycMessageand the signed payload are always in sync - Standalone utility pattern (not on the
Xdcclass) matches thesignAccountBasedMidnightClaimMessagesprecedent - 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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
buildXdcKycMessage(params)— constructs the canonical KYC message string"[XDCmaster KYC <ISO-timestamp>] Upload KYC for <account>"expected by theXinFin masternode IPFS API.
signXdcKycMessage(wallet, account, walletPassphrase)— generates a freshtimestamp, builds the message, signs it via
wallet.signMessage()withMessageStandardType.EIP191, and returns{ kycAccount, kycMessage, kycSignature }.modules/sdk-coin-xdc/src/lib/index.ts.signMessagecall params, correct return value mapping, and error propagation.Why
/api/ipfs/addKYC) now requires three signed-messageheaders (
x-kyc-account,x-kyc-message,x-kyc-signature) to prove walletownership before accepting KYC file uploads.
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 + timestampbuildXdcKycMessage— different timestamps produce different stringssignXdcKycMessage— callswallet.signMessagewith correctmessageRawand
messageStandardType: MessageStandardType.EIP191signXdcKycMessage— returnskycAccount,kycMessage,kycSignaturemapped correctly from
SignedMessagesignXdcKycMessage— propagates error ifwallet.signMessagethrowsTicket: SI-921