@@ -121,7 +121,7 @@ describe('TSS ECDSA TESTS', function () {
121121 } ) ;
122122
123123 describe ( 'ECDSA Signing' , async function ( ) {
124- let config : { signerOne : ECDSA . KeyCombined ; signerTwo : ECDSA . KeyCombined ; hash ?: Hash } [ ] ;
124+ let config : { signerOne : ECDSA . KeyCombined ; signerTwo : ECDSA . KeyCombined ; hash ?: string ; shouldHash ?: boolean } [ ] ;
125125
126126 before ( async ( ) => {
127127 const [ A , B , C , D , E , F ] = keyShares ;
@@ -137,11 +137,14 @@ describe('TSS ECDSA TESTS', function () {
137137 { signerOne : F , signerTwo : D } ,
138138
139139 // Checks with specific hashing algorithm
140- { signerOne : A , signerTwo : B , hash : createKeccakHash ( 'keccak256' ) } ,
140+ { signerOne : A , signerTwo : B , hash : 'keccak256' } ,
141+
142+ // checks with no hashing
143+ { signerOne : A , signerTwo : B , shouldHash : false } ,
141144 ] ;
142145 } ) ;
143146
144- for ( let index = 0 ; index < 3 ; index ++ ) {
147+ for ( let index = 0 ; index < 8 ; index ++ ) {
145148 it ( `should properly sign the message case ${ index } ` , async function ( ) {
146149 // Step One
147150 // signerOne, signerTwo have decided to sign the message
@@ -213,9 +216,24 @@ describe('TSS ECDSA TESTS', function () {
213216 // and finally signs the message using their private OShare
214217 // and delta share received from the other signer
215218
219+ const hashGenerator = ( hashType ?: string ) : Hash | undefined => {
220+ return hashType === 'keccak256' ? createKeccakHash ( 'keccak256' ) : undefined ;
221+ } ;
216222 const [ signA , signB ] = [
217- MPC . sign ( MESSAGE , signCombineOne . oShare , signCombineTwo . dShare , config [ index ] . hash ) ,
218- MPC . sign ( MESSAGE , signCombineTwo . oShare , signCombineOne . dShare , config [ index ] . hash ) ,
223+ MPC . sign (
224+ MESSAGE ,
225+ signCombineOne . oShare ,
226+ signCombineTwo . dShare ,
227+ hashGenerator ( config [ index ] . hash ) ,
228+ config [ index ] . shouldHash ,
229+ ) ,
230+ MPC . sign (
231+ MESSAGE ,
232+ signCombineTwo . oShare ,
233+ signCombineOne . dShare ,
234+ hashGenerator ( config [ index ] . hash ) ,
235+ config [ index ] . shouldHash ,
236+ ) ,
219237 ] ;
220238
221239 // Step Eight
@@ -226,7 +244,7 @@ describe('TSS ECDSA TESTS', function () {
226244 // Step Nine
227245 // Verify signature
228246
229- const isValid = MPC . verify ( MESSAGE , signature , config [ index ] . hash ) ;
247+ const isValid = MPC . verify ( MESSAGE , signature , hashGenerator ( config [ index ] . hash ) , config [ index ] . shouldHash ) ;
230248 isValid . should . equal ( true ) ;
231249 } ) ;
232250 }
0 commit comments