swift-crypto icon indicating copy to clipboard operation
swift-crypto copied to clipboard

Rename CryptoKit errors

Open 0xTim opened this issue 1 year ago • 3 comments

New API Proposal: CryptoError

Motivation:

CryptoKit errors are publicly exposed in the API which is confusing since from the outside CryptoKit is an implementation detail so it would be nice to rename this to reflect the name of the package. A typealias would help for those that want the backwards compatibility

Importance:

Not major but definitely a paper cut

0xTim avatar Oct 12 '24 01:10 0xTim

The issue with renaming CryptoKitError is that on Apple platforms these errors actually come from CryptoKit. Changing the error there is pretty hard: it would represent an ABI break to rename completely, even with the typealias, so that’s not tenable, meaning there’d be two similar errors only one of which is thrown.

While I agree this is a paper cut, I don’t think this issue is severe enough to warrant a change. But I’d be happy to hear disagreement.

Lukasa avatar Oct 12 '24 06:10 Lukasa

Adding a typealias for CryptoKitError to CryptoError wouldn't break anything right? All the original stuff would continue to work but people using Swift Crypto would be able to catch and deal with CryptoErrors instead of knowing about CryptoKit

0xTim avatar Oct 12 '24 18:10 0xTim

Yes, the typealias in the reverse direction will work.

Lukasa avatar Oct 13 '24 07:10 Lukasa