You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our goal is to generate CryptoKit APIs bindings used for encryption and decryption. We aim to replace the existing Objective-C bindings with direct calls into Swift.
Dev template
The CryptoKit framework implements enum types with inner structs. Besides the Swift primitive types, the framework depends on Data frozen struct from Foundation framework. Additionally, the implementation contains generics and optional parameters in function signatures. To implement the C# projections, we identified the following implementation phases.
Frozen structs: Utilize runtime lowering support within the runtime to project parameters as UnsafeRawBufferPointer/UnsafeMutableBufferPointer<T> and call into a Swift wrapper that calls the CryptoKit API.
Surface type constructors: Surface type constructors for symmetric key and nonce, making them accessible as C# types. This requires support for SwiftSelf in instance methods and SwiftError for methods that can throw errors.
letnonce=try!ChaChaPoly.Nonce(data: nonceBuffer)letsymmetricKey=SymmetricKey(data: keyBuffer)
guard let result =try!ChaChaPoly.seal(plaintextBuffer, using: symmetricKey, nonce: nonce, authenticating: aadBuffer)
Implement optional and generics projections: Implement direct calls into Swift methods by adding implicit metadata parameters and protocol witness tables for generics. This includes changes from dotnet/runtime#100543.
The text was updated successfully, but these errors were encountered:
Objective
Our goal is to generate
CryptoKit
APIs bindings used for encryption and decryption. We aim to replace the existing Objective-C bindings with direct calls into Swift.Dev template
The
CryptoKit
framework implements enum types with inner structs. Besides the Swift primitive types, the framework depends onData
frozen struct fromFoundation
framework. Additionally, the implementation contains generics and optional parameters in function signatures. To implement the C# projections, we identified the following implementation phases.Frozen structs: Utilize runtime lowering support within the runtime to project parameters as
UnsafeRawBufferPointer/UnsafeMutableBufferPointer<T>
and call into a Swift wrapper that calls the CryptoKit API.Surface type constructors: Surface type constructors for symmetric key and nonce, making them accessible as C# types. This requires support for
SwiftSelf
in instance methods andSwiftError
for methods that can throw errors.Implement optional and generics projections: Implement direct calls into Swift methods by adding implicit metadata parameters and protocol witness tables for generics. This includes changes from dotnet/runtime#100543.
The text was updated successfully, but these errors were encountered: