apple / swift-crypto

Open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms.
https://apple.github.io/swift-crypto
Apache License 2.0
1.47k stars 165 forks source link

Add Sendable annotation to Crypto Extras #208

Closed 0xTim closed 4 months ago

0xTim commented 1 year ago

New API Proposal: Sendable Support

Motivation:

Use Swift Crypto types in concurrency contexts invariably starts to hit issues as no types are Sendable. I'm aware there are issues around the main Crypto target as that has match CryptoKit (or does it? Could we add Sendable conformance on Linux?) but it would be great to add it to the types in Crypto Extras

Importance:

It's possible to achieve this with a mix of @preconcurrency and @unchecked Sendable but neither of these are ideal for obvious reasons.

Lukasa commented 1 year ago

Yes, the goal is that the Crypto API exactly matches the CryptoKit one. This avoids users needing to deal with platform-specific imports or other logic.

For CryptoExtras, this can definitely be done separately. @rnro want to take a look at CryptoExtras?

rnro commented 1 year ago

Yep, sure.

0xTim commented 4 months ago

Fixed in #211