tink-crypto / tink

Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.
https://developers.google.com/tink
Apache License 2.0
13.47k stars 1.18k forks source link

Export `ErrInvalidSignature` for use with `errors.Is`. #704

Closed DPJacques closed 1 year ago

DPJacques commented 1 year ago

This allows use of errors.Is(err, signature.ErrInvalidSignature) rather than strings.Contains(err.Error(), "verifier_factory: invalid signature")

tholenst commented 1 year ago

Hey Darren,

thank you for this PR. Can you open an issue instead and describe your use case in more details?

We mostly don't want to expose it like this; it might be that we want to distinguish sub cases even more. Instead, we might provide a method which allows you to distinguish, but it would be useful to know why you want this more.