Repository navigation
feat(crypto): domain-separate wallet signatures and add cross-chain replay tests - #282
Conversation
|
Hi maintainers — thanks for assigning #273! This PR is open, conflict-free, and all CI checks are green. Ready for review ahead of the Nov 25 Wave 11 deadline; happy to address any feedback quickly. |
4fc663f to
f80e47f
Compare
|
@ocakciomursel-pixel Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Thanks for merging #279, #280, and #281! Rebased this PR onto latest develop (693c29a), resolved the conflicts in etc/*.api.md, BUNDLE_SIZE.md, and packages/test-vectors (checksums regenerated), and verified pnpm build, pnpm api:check, pnpm size, pnpm test:types, pnpm test (1,628 tests), and pnpm format:check all pass locally. Ready for review and merge ahead of the Wave 11 deadline! |
f80e47f to
4c4c6ac
Compare
truthixify
left a comment
There was a problem hiding this comment.
The canonical encoding still truncates oversized domain values. u256be serializes only the low 256 bits, so nonce 0 and nonce 2^256 produce identical authorization bytes; u64be similarly truncates expiry and the generic EVM chain ID. Reject nonce values above 2^256-1 and expiry/chain ID values above 2^64-1 before encoding, and add overflow/collision regressions.
|
@truthixify Good catch — addressed in
All 27/27 CI checks are green on |
truthixify
left a comment
There was a problem hiding this comment.
Head 9f90606 passed malware screening and issue #273 ownership matches @ocakciomursel-pixel. The prior integer-width blocker is resolved and the required checks are green. This head became conflicting after #287 advanced develop, so it needs a clean rebase and fresh CI; the rebased SHA will require a new remote security scan before merge.
Summary
Inventories all SDK-generated wallet and off-chain authorization signatures, introduces canonical cross-chain domain separation (
chain,chainId,network,contract,operation,nonce,expiry) across EVM, Stellar, Solana, and CKB, publishes deterministic positive + negative replay vectors in@wraith-protocol/test-vectors, and preserves v1 compatibility with a documented migration path.Changes
src/auth/domain.ts, exported from@wraith-protocol/sdk):SignatureDomain,ReplayRejectionReason,encodeDomainAuthorizationBytes(WRAITH-DOMAIN-SIG-V14-byte length-prefixed framing preventing variable-length concatenation collisions),buildDomainStealthSigningMessage, andcheckDomainGuards.src/chains/{evm/names,stellar/auth,solana/auth,ckb/auth}.ts):computeEvmDomainSeparator,computeEvmNameAuthorizationDigest,signDomainNameAuthorization, andverifyDomainNameAuthorization(bindingchainId,verifyingContract,salt = keccak256(network),operationHash,nonce, andexpiry). Marks unscoped v1signNameRegistration,signNameRegistrationOnBehalf,signNameUpdate, andsignNameRelease@deprecatedwhile preserving byte-identical 1.x behavior.compute{Stellar,Solana}AuthorizationDigest,sign{Stellar,Solana}DomainAuthorization, andverify{Stellar,Solana}DomainAuthorization(supporting both 32-byte seeds and stealth scalars).ckb-default-hashblake2bcomputeCkbAuthorizationDigest,signCkbDomainAuthorization, andverifyCkbDomainAuthorization.packages/test-vectors/vectors/wallet-signatures.json,test/conformance/signature-replay.test.ts,docs/security/signature-domains.md,MIGRATING.md):EVM <-> CKBon secp256k1,Stellar <-> Solanaon ed25519), cross-network, cross-contract, altered-operation (name.registerreplayed asname.updateon identical name/meta-address), expired, nonce-reuse, and forged-domain claim substitutions../chains/stellarbundle budgets (33 KB -> 34.5 KBESM,41 KB -> 42.5 KBCJS) inpackage.jsonandBUNDLE_SIZE.mdfor the new Stellar domain-authorization helpers (with zero cross-chain imports).Semver Impact
@deprecatedannotations and migration steps inMIGRATING.md.Verification
pnpm build&pnpm api:checkpnpm format:check,pnpm test:types,pnpm size,pnpm pack:check,pnpm audit:cipnpm --filter @wraith-protocol/test-vectors differentialpnpm test(includingtest/conformance/signature-replay.test.ts)Closes #273