Trait/force build swift crypto api #424
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Package trait to bypass the use of CryptoKit in order to use all of the API's on all available Apple operating systems
Checklist
If you've made changes to
gybfiles./scripts/generate_boilerplate_files_with_gyb.shand included updated generated files in a commit of this pull requestMotivation:
_MLKEM is a power tool that SwiftCrypto has made available to the community. Unfortunately on Apple Platforms it is only support on Apple Operating Systems 26 and up. SwiftCrypto however is much more flexible. Ideally it would be nice to use CryptoKit on 26 and up for Apple systems and Swift Crypto bellow 26; however the design of SwiftCrypto makes that a bit difficult without a chunk of work. A compromise is to add a package trait that will force build the SwiftCrypto API on all Apple Operating Systems. This is also an attractive feature for those who do not want to rely on the Apple specific implementation of CryptoKit alleviating concerns of potential bugs in 2 different implementations, consumers can trust 1 source of truth as an alternative if they so choose. _
Modifications:
In Package.swift if the device can import Darwin we pass the needed trait to the
swiftSettings:[]and the neededdefine()blocksResult:
When passing the trait in the consuming product to swift-crypt, the trait influences to build only the SwiftCrypto API