pynacl icon indicating copy to clipboard operation
pynacl copied to clipboard

BadSignatureError is now in nacl.exceptions not in ~nacl.signing.BadSignatureError

Open Blackstareye opened this issue 8 months ago • 0 comments

    def verify(
        self,
        smessage: bytes,
        signature: Optional[bytes] = None,
        encoder: encoding.Encoder = encoding.RawEncoder,
    ) -> bytes:
        """
        Verifies the signature of a signed message, returning the message
        if it has not been tampered with else raising
        :class:`~nacl.signing.BadSignatureError`.

        :param smessage: [:class:`bytes`] Either the original messaged or a
            signature and message concated together.
        :param signature: [:class:`bytes`] If an unsigned message is given for
            smessage then the detached signature must be provided.
        :param encoder: A class that is able to decode the secret message and
            signature.
        :rtype: :class:`bytes`
        """

https://github.com/pyca/pynacl/blob/9ffa598e47242bf783aae23c20c31e876c438f1a/src/nacl/signing.py#L107

I migrated from ed25519 used by keygen-sh to pynacl. While migrating I fixed the example so that it can be run with python 3.12~. One thing that was missing was the BadSignatureError.

I looked that up and saw that it is now in

nacl.exceptions 

so I think the PyDoc needs to be adapted ?

Blackstareye avatar Feb 22 '25 22:02 Blackstareye