feat(sdk-core): add EdDSA MPCv2 offline signing helper utils#8793
feat(sdk-core): add EdDSA MPCv2 offline signing helper utils#8793vibhavgo wants to merge 1 commit into
Conversation
73179bb to
f4ebbae
Compare
| * @returns void | ||
| * @throws {Error} if the adata or cyphertext is invalid | ||
| */ | ||
| private validateAdata(adata: string, cyphertext: string, roundDomainSeparator: string): void { |
There was a problem hiding this comment.
This is byte-for-byte identical to EcdsaMPCv2Utils.validateAdata. Both classes share the same baseTSSUtils<KeyShare> ancestor, so this should be lifted there to eliminate the duplication. This is the most straightforward extraction — same signature, same body, no ECDSA/EdDSA differences.
f4ebbae to
2188290
Compare
2188290 to
6340d35
Compare
| }); | ||
| }); | ||
|
|
||
| describe('External Signing Helpers', function () { |
There was a problem hiding this comment.
These utility helper tests (getSignableHexAndDerivationPath, validateAdata, getBitgoAndUserGpgKeys) do not belong in createKeychains.ts — this file is for testing the keychain creation flow.
More importantly, these methods now live on baseTSSUtils in sdk-core, so they should be tested there, not through an EdDSA subclass in the bitgo module. The right place is a new dedicated file: modules/sdk-core/test/unit/bitgo/utils/tss/baseTSSUtils.ts, consistent with how addressVerification.ts, ecdsaMPCv2.ts, and eddsaMPCv2.ts each have their own focused files in that directory.
6340d35 to
2facaea
Compare
Ticket: WCI-386 Centralizes shared MPCv2 helper logic in BaseTssUtils for reuse across ECDSA and EdDSA, and moves misplaced helper tests from the EdDSA keychain creation test to a dedicated BaseTssUtils test file in sdk-core. - Move getSignableHexAndDerivationPath() into BaseTssUtils for shared ECDSA and EdDSA MPCv2 transaction extraction - Move validateAdata() into BaseTssUtils to eliminate duplicated authenticated data validation - Move getBitgoAndUserGpgKeys() into BaseTssUtils with v1 (SJCL) and v2 (Argon2id) envelope support; accepts a userGpgKeyDomainSeparator arg - Remove redundant private getBitgoAndUserGpgKeys() from EcdsaMPCv2Utils and EddsaMPCv2Utils; delegate to base class - Remove unused MPS_DSG_SIGNING_USER_GPG_KEY constant and isV2Envelope import from EddsaMPCv2Utils - Remove misplaced External Signing Helpers tests from createKeychains.ts - Add sdk-core/test/unit/bitgo/utils/tss/baseTSSUtils.ts with lean, strictly typed tests for all extracted helpers and ECDSA delegation Co-authored-by: Cursor <cursoragent@cursor.com>
2facaea to
53a09b0
Compare
Adds shared private utility methods to EddsaMPCv2Utils that will be used across all three createOfflineRound1/2/3Share methods. These are prerequisite helpers that centralize transaction payload extraction, GPG key handling, and authenticated data validation to prevent code duplication.
Ticket: WCI-386