@@ -205,12 +205,38 @@ describe('EdDSA MPS DKG', function () {
205205 ) ;
206206 assert ( Buffer . isBuffer ( bitgoReduced ) && bitgoReduced . length > 0 , 'BitGo reduced key share should be non-empty' ) ;
207207
208- const userPub = Buffer . from ( MPSTypes . getDecodedReducedKeyShare ( userReduced ) . pub ) . toString ( 'hex' ) ;
209- const backupPub = Buffer . from ( MPSTypes . getDecodedReducedKeyShare ( backupReduced ) . pub ) . toString ( 'hex' ) ;
210- const bitgoPub = Buffer . from ( MPSTypes . getDecodedReducedKeyShare ( bitgoReduced ) . pub ) . toString ( 'hex' ) ;
208+ const userDecoded = MPSTypes . getDecodedReducedKeyShare ( userReduced ) ;
209+ const backupDecoded = MPSTypes . getDecodedReducedKeyShare ( backupReduced ) ;
210+ const bitgoDecoded = MPSTypes . getDecodedReducedKeyShare ( bitgoReduced ) ;
211+
212+ const userPub = Buffer . from ( userDecoded . pub ) . toString ( 'hex' ) ;
213+ const backupPub = Buffer . from ( backupDecoded . pub ) . toString ( 'hex' ) ;
214+ const bitgoPub = Buffer . from ( bitgoDecoded . pub ) . toString ( 'hex' ) ;
211215
212216 assert . strictEqual ( userPub , backupPub , 'User and backup should have same public key in reduced share' ) ;
213217 assert . strictEqual ( backupPub , bitgoPub , 'Backup and BitGo should have same public key in reduced share' ) ;
218+
219+ // keyShare must be present and non-empty (opaque WASM bincode needed for DSG)
220+ assert ( userDecoded . keyShare . length > 0 , 'User reduced share must include keyShare' ) ;
221+ assert ( backupDecoded . keyShare . length > 0 , 'Backup reduced share must include keyShare' ) ;
222+ assert ( bitgoDecoded . keyShare . length > 0 , 'BitGo reduced share must include keyShare' ) ;
223+
224+ // rootChainCode must be 32 bytes
225+ assert . strictEqual ( userDecoded . rootChainCode . length , 32 , 'User rootChainCode must be 32 bytes' ) ;
226+ assert . strictEqual ( backupDecoded . rootChainCode . length , 32 , 'Backup rootChainCode must be 32 bytes' ) ;
227+ assert . strictEqual ( bitgoDecoded . rootChainCode . length , 32 , 'BitGo rootChainCode must be 32 bytes' ) ;
228+
229+ // All parties derive the same chaincode
230+ assert . strictEqual (
231+ Buffer . from ( userDecoded . rootChainCode ) . toString ( 'hex' ) ,
232+ Buffer . from ( backupDecoded . rootChainCode ) . toString ( 'hex' ) ,
233+ 'User and backup should have same rootChainCode'
234+ ) ;
235+ assert . strictEqual (
236+ Buffer . from ( backupDecoded . rootChainCode ) . toString ( 'hex' ) ,
237+ Buffer . from ( bitgoDecoded . rootChainCode ) . toString ( 'hex' ) ,
238+ 'Backup and BitGo should have same rootChainCode'
239+ ) ;
214240 } ) ;
215241 } ) ;
216242
0 commit comments