@@ -168,6 +168,37 @@ variable.forEach((testVariable) => {
168168 assert ( pubkey2 . eq ( publicKeyPoint ) ) ;
169169 } ) ;
170170
171+ await t . test ( "#able to sign batch" , async function ( ) {
172+ const coreKitInstance = newCoreKitInstance ( ) ;
173+ await coreKitInstance . init ( { handleRedirectResult : false , rehydrate : false } ) ;
174+ const localToken = await mockLogin2 ( email ) ;
175+ await coreKitInstance . loginWithJWT ( {
176+ verifier : "torus-test-health" ,
177+ verifierId : email ,
178+ idToken : localToken . idToken ,
179+ } ) ;
180+ const msg = "hello world" ;
181+ const msgBuffer = Buffer . from ( msg ) ;
182+ const msgHash = keccak256 ( msgBuffer ) ;
183+ const secp256k1 = new EC ( "secp256k1" ) ;
184+
185+ const buffers = [ ] ;
186+ buffers . push ( msgHash ) ;
187+ buffers . push ( msgHash ) ;
188+
189+ const hashed = [ ] ;
190+ hashed . push ( true ) ;
191+ hashed . push ( true ) ;
192+
193+ const signatures = await coreKitInstance . sign_batch ( buffers , hashed )
194+ for ( let i = 0 ; i < signatures . length ; i ++ ) {
195+ const signature = sigToRSV ( signatures [ i ] ) ;
196+ const pubkey = secp256k1 . recoverPubKey ( msgHash , signature , signature . v ) as EllipticPoint ;
197+ const publicKeyPoint = bufferToElliptic ( coreKitInstance . getPubKey ( ) ) ;
198+ assert ( pubkey . eq ( publicKeyPoint ) ) ;
199+ }
200+ } ) ;
201+
171202 await t . test ( "#Login and sign with different account/wallet index" , async function ( ) {
172203 const vid = stringGen ( 10 ) ;
173204 const coreKitInstance = newCoreKitInstance ( ) ;
0 commit comments