@@ -8,11 +8,13 @@ use thiserror::Error;
8
8
9
9
use super :: { CertificateRetriever , CertificateRetrieverError } ;
10
10
use crate :: crypto_helper:: {
11
- key_decode_hex, ProtocolGenesisError , ProtocolGenesisVerifier , ProtocolMultiSignature ,
11
+ ProtocolAggregateVerificationKey , ProtocolGenesisError , ProtocolGenesisVerifier ,
12
+ ProtocolMultiSignature ,
12
13
} ;
13
14
use crate :: entities:: {
14
15
Certificate , CertificateSignature , ProtocolMessage , ProtocolMessagePartKey , ProtocolParameters ,
15
16
} ;
17
+ use crate :: StdError ;
16
18
17
19
#[ cfg( test) ]
18
20
use mockall:: automock;
@@ -25,8 +27,8 @@ pub enum CertificateVerifierError {
25
27
VerifyMultiSignature ( String ) ,
26
28
27
29
/// Error raised when encoding or decoding of data to hex fails.
28
- #[ error( "codec hex error: '{0}'" ) ]
29
- Codec ( String ) ,
30
+ #[ error( "codec hex error: '{0:? }'" ) ]
31
+ Codec ( StdError ) ,
30
32
31
33
/// Error raised when encoding or decoding of data to genesis type.
32
34
#[ error( "codec genesis error: '{0}'" ) ]
@@ -151,7 +153,8 @@ impl MithrilCertificateVerifier {
151
153
message. encode_hex:: <String >( )
152
154
) ;
153
155
let aggregate_verification_key =
154
- key_decode_hex ( aggregate_verification_key) . map_err ( CertificateVerifierError :: Codec ) ?;
156
+ ProtocolAggregateVerificationKey :: from_json_hex ( aggregate_verification_key)
157
+ . map_err ( CertificateVerifierError :: Codec ) ?;
155
158
156
159
multi_signature
157
160
. verify (
@@ -287,8 +290,7 @@ mod tests {
287
290
use super :: CertificateRetriever ;
288
291
use super :: * ;
289
292
290
- use crate :: crypto_helper:: tests_setup:: * ;
291
- use crate :: crypto_helper:: { key_encode_hex, ProtocolClerk } ;
293
+ use crate :: crypto_helper:: { tests_setup:: * , ProtocolClerk } ;
292
294
use crate :: test_utils:: MithrilFixtureBuilder ;
293
295
294
296
mock ! {
@@ -321,7 +323,7 @@ mod tests {
321
323
322
324
let first_signer = & signers[ 0 ] . protocol_signer ;
323
325
let clerk = ProtocolClerk :: from_signer ( first_signer) ;
324
- let aggregate_verification_key = clerk. compute_avk ( ) ;
326
+ let aggregate_verification_key = clerk. compute_avk ( ) . into ( ) ;
325
327
let multi_signature = clerk
326
328
. aggregate ( & single_signatures, & message_hash)
327
329
. unwrap ( )
@@ -334,7 +336,7 @@ mod tests {
334
336
. verify_multi_signature(
335
337
& message_tampered,
336
338
& multi_signature,
337
- & key_encode_hex ( & aggregate_verification_key) . unwrap( ) ,
339
+ & aggregate_verification_key. to_json_hex ( ) . unwrap( ) ,
338
340
& fixture. protocol_parameters( ) ,
339
341
)
340
342
. is_err( ) ,
@@ -344,7 +346,7 @@ mod tests {
344
346
. verify_multi_signature (
345
347
& message_hash,
346
348
& multi_signature,
347
- & key_encode_hex ( & aggregate_verification_key) . unwrap ( ) ,
349
+ & aggregate_verification_key. to_json_hex ( ) . unwrap ( ) ,
348
350
& fixture. protocol_parameters ( ) ,
349
351
)
350
352
. expect ( "multi signature verification should have succeeded" ) ;
0 commit comments