1- import { Experimental , Crypto , createForeignCurve , Bytes , assert , createEcdsa } from 'o1js' ;
1+ import { Bytes , Crypto , Experimental , createEcdsa , createForeignCurve } from 'o1js' ;
22const { ZkFunction } = Experimental ;
33
4- export { Secp256k1 , Ecdsa , Bytes32 , reserves } ;
4+ export { Bytes32 , Ecdsa , Secp256k1 , reserves } ;
55
66class Secp256k1 extends createForeignCurve ( Crypto . CurveParams . Secp256k1 ) { }
77class Ecdsa extends createEcdsa ( Secp256k1 ) { }
@@ -12,7 +12,7 @@ const reserves = ZkFunction({
1212 publicInputType : Bytes32 ,
1313 privateInputTypes : [ Ecdsa , Secp256k1 ] ,
1414 main : ( message : Bytes32 , signature : Ecdsa , publicKey : Secp256k1 ) => {
15- assert ( signature . verify ( message , publicKey ) ) ;
15+ signature . verify ( message , publicKey ) . assertTrue ( ) ;
1616 } ,
1717} ) ;
1818
@@ -31,5 +31,6 @@ console.timeEnd('prove');
3131
3232console . time ( 'verify' ) ;
3333let isValid = await reserves . verify ( proof , verificationKey ) ;
34- assert ( isValid , 'verifies' ) ;
3534console . timeEnd ( 'verify' ) ;
35+
36+ if ( ! isValid ) throw Error ( 'verification failed!' ) ;
0 commit comments