swift-crypto
swift-crypto copied to clipboard
Make Curve25519 `PublicKey`s conform to `Equatable`
Make Curve25519 PublicKeys conform to Equatable
Checklist
- [x] I've run tests to see all new and existing tests pass
- [x] I've followed the code style of the rest of the project
- [x] I've read the Contribution Guidelines
- [x] I've updated the documentation if necessary
If you've made changes to gyb files
- [ ] I've run
.script/generate_boilerplate_files_with_gyband included updated generated files in a commit of this pull request
Motivation:
When PublicKey's are used in struct's that are marked Equatable those structs cannot be auto-synthetized conform to Equatable since these PublicKeys before this PR do not conform to Equatable. This is rather annoying. And during the 5 years I've been working in the crypto industry I have added my own conformance to CryptoKit's PublicKeys to be Equatable probably more than 10 times!
There exists no security risk in making PublicKeys conform to Equatable, the current implementation does not use safeCompare, it could, but I deem it not necessary.
There is really no drawback in adding Equatable conformance.
Modifications:
- Make
Curve25519.Signing.PublicKeybeEquatable - Make
Curve25519.KeyAgreement.PublicKeybeEquatable - Add tests for these.
Result:
Curve25519.Signing.PublicKey and Curve25519.KeyAgreement.PublicKey now conform to Equatable.