@@ -12,12 +12,10 @@ use serde::ser::SerializeTuple;
1212
1313use crate :: ffi:: types:: c_uint;
1414use crate :: ffi:: { self , CPtr } ;
15- #[ cfg( all( feature = "global-context" , feature = "rand-std" ) ) ]
16- use crate :: schnorr;
1715use 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 } ;
1917#[ cfg( feature = "global-context" ) ]
20- use crate :: { ecdsa, Message , SECP256K1 } ;
18+ use crate :: { ecdsa, SECP256K1 } ;
2119#[ cfg( feature = "bitcoin_hashes" ) ]
2220use crate :: { hashes, ThirtyTwoByteHash } ;
2321
@@ -1316,6 +1314,16 @@ impl XOnlyPublicKey {
13161314 pub fn public_key ( & self , parity : Parity ) -> PublicKey {
13171315 PublicKey :: from_x_only_public_key ( * self , parity)
13181316 }
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+ }
13191327}
13201328
13211329/// Represents the parity passed between FFI function calls.
0 commit comments