@@ -12,12 +12,10 @@ use serde::ser::SerializeTuple;
12
12
13
13
use crate :: ffi:: types:: c_uint;
14
14
use crate :: ffi:: { self , CPtr } ;
15
- #[ cfg( all( feature = "global-context" , feature = "rand-std" ) ) ]
16
- use crate :: schnorr;
17
15
use crate :: Error :: { self , InvalidPublicKey , InvalidPublicKeySum , InvalidSecretKey } ;
18
- use crate :: { constants, from_hex, Scalar , Secp256k1 , Signing , Verification } ;
16
+ use crate :: { constants, from_hex, schnorr , Message , Scalar , Secp256k1 , Signing , Verification } ;
19
17
#[ cfg( feature = "global-context" ) ]
20
- use crate :: { ecdsa, Message , SECP256K1 } ;
18
+ use crate :: { ecdsa, SECP256K1 } ;
21
19
#[ cfg( feature = "bitcoin_hashes" ) ]
22
20
use crate :: { hashes, ThirtyTwoByteHash } ;
23
21
@@ -1316,6 +1314,16 @@ impl XOnlyPublicKey {
1316
1314
pub fn public_key ( & self , parity : Parity ) -> PublicKey {
1317
1315
PublicKey :: from_x_only_public_key ( * self , parity)
1318
1316
}
1317
+
1318
+ /// Checks that `sig` is a valid schnorr signature for `msg` using this public key.
1319
+ pub fn verify < C : Verification > (
1320
+ & self ,
1321
+ secp : & Secp256k1 < C > ,
1322
+ msg : & Message ,
1323
+ sig : & schnorr:: Signature ,
1324
+ ) -> Result < ( ) , Error > {
1325
+ secp. verify_schnorr ( sig, msg, self )
1326
+ }
1319
1327
}
1320
1328
1321
1329
/// Represents the parity passed between FFI function calls.
0 commit comments