Summary
auto_interop_generator v0.2.4 is close to working. Only 1 Dart analysis error in generated code (down from 12 in v0.2.3, 214 in v0.2.1). Swift glue now includes decoder helpers and type conversions, but several Swift-side issues prevent compilation.
Generator version: 0.2.4
Target package: CryptoSwift ~> 1.8 (CocoaPods, resolved to 1.8.4)
Flutter: 3.41.2 / Dart 3.11.0
Platform: iOS (iPhone 17 Pro simulator)
What's Fixed from v0.2.3 (Issue #3)
- ✅ HMACVariant — Now a proper enum (was broken sealed class with missing subclasses)
- ✅ GCM.create() syntax — `List??` double-optional fixed to `List?`
- ✅ Swift decoder helpers generated — `decodeSHA2Variant()` and `decodePadding()` now present
- ✅ Swift type conversion — `[Any].map { $0 as! Int }` added for List parameters
`flutter analyze` output (1 error in generated code)
```
error • Undefined class 'Mode' • lib/generated/cryptoswift.dart:406:131 • undefined_class
```
Plus 2 errors in user code (wrong import path — expected, user code needs updating once generated API stabilizes).
Issue 1 (DART): Undefined class `Mode` in `GCM.create()`
File: `lib/generated/cryptoswift.dart` line 406
```dart
static Future create({required List iv, required List authenticationTag, List? additionalAuthenticatedData, Mode? mode}) async {
```
The `Mode` opaque stub class (present in v0.2.3) was removed from v0.2.4, but `GCM.create()` still references it as a parameter type. Either:
- Keep `Mode` as an opaque stub (like `Variant`, `ArraySlice`, etc.)
- Or generate a proper `GCMMode` enum (like `SHA2Variant` and `HMACVariant` were generated):
```dart
enum GCMMode {
combined,
detached;
}
```
Issue 2 (SWIFT): `decodeSHA2Variant()` returns `SHA2Variant` but CryptoSwift uses `SHA2.Variant`
File: `ios/Runner/CryptoswiftPlugin.swift` line 41
```swift
private func decodeSHA2Variant(_ value: String) -> SHA2Variant {
```
CryptoSwift defines the variant as a nested type `SHA2.Variant`, not a top-level `SHA2Variant`:
```swift
// CryptoSwift source:
public struct SHA2: DigestType {
public enum Variant: RawRepresentable {
case sha224, sha256, sha384, sha512
}
}
```
The generated return type `SHA2Variant` doesn't exist in CryptoSwift's namespace. Should be:
```swift
private func decodeSHA2Variant(_ value: String) -> SHA2.Variant {
switch value {
case "sha224": return .sha224
// ...
}
}
```
Issue 3 (SWIFT): Type conversions produce `[Int]` instead of `[UInt8]`
File: `ios/Runner/CryptoswiftPlugin.swift` lines 73, 174, 235, etc.
```swift
let keyTyped = (key as [Any]).map { $0 as! Int } // Produces [Int]
```
CryptoSwift expects `Array` (i.e. `[UInt8]`) for keys, IVs, plaintext, etc. Should be:
```swift
let keyTyped = (key as [Any]).map { UInt8($0 as! Int) } // Produces [UInt8]
```
Affected cases: `AES._create`, `HMAC._create`, `HMAC.authenticate`, `SHA2.calculate`, `SHA2.callAsFunction`, `GCM._create`, `Authenticator.authenticate`.
Issue 4 (SWIFT): HMAC variant passed as `[String: Any]?` instead of `HMAC.Variant`
File: `ios/Runner/CryptoswiftPlugin.swift` line 175
```swift
case "HMAC._create":
let variant = args["variant"] as? [String: Any]
let instance = HMAC(key: keyTyped, variant: variant) // variant should be HMAC.Variant
```
CryptoSwift HMAC expects `variant: HMAC.Variant` (e.g., `.sha256`). Need a `decodeHMACVariant()` helper similar to `decodeSHA2Variant()`:
```swift
private func decodeHMACVariant(_ value: String) -> HMAC.Variant {
switch value {
case "sha256": return .sha256
case "sha384": return .sha384
case "sha512": return .sha512
case "md5": return .md5
case "sha1": return .sha1
default: fatalError("Unknown HMAC variant: \(value)")
}
}
```
Issue 5 (SWIFT): GCM mode passed as `[String: Any]?` instead of `GCM.Mode`
File: `ios/Runner/CryptoswiftPlugin.swift` line 306
```swift
let instance = GCM(iv: ivTyped, authenticationTag: authenticationTagTyped, additionalAuthenticatedData: additionalAuthenticatedDataTyped, mode: mode)
```
`mode` is `[String: Any]?` but CryptoSwift expects `GCM.Mode` enum (`.combined` or `.detached`).
Issue 6 (SWIFT): Missing `try` on throwing CryptoSwift initializers
```swift
case "AES._create":
let instance = AES(key: keyTyped, ...) // Should be: try AES(key: keyTyped, ...)
case "HMAC._create":
let instance = HMAC(key: keyTyped, ...) // Should be: try HMAC(key: keyTyped, ...)
```
Issue 7 (REMAINING): Generated Swift files not added to Xcode project
Same as v0.2.2 and v0.2.3. `CryptoswiftPlugin.swift` and `RegisterAutoInteropPlugins.swift` not in build phases.
Progress Summary
| Issue |
v0.2.1 |
v0.2.2 |
v0.2.3 |
v0.2.4 |
| Doc comment formatting |
❌ 150 errors |
✅ |
✅ |
✅ |
| Duplicate create methods |
❌ |
✅ |
✅ |
✅ |
| Interface class with fields |
❌ |
✅ |
✅ |
✅ |
| Dart create() factories |
N/A |
❌ |
✅ |
✅ |
| Create cases return handles |
N/A |
❌ |
✅ |
✅ |
| Swift init() constructors |
❌ |
❌ |
✅ |
✅ |
| HMACVariant definition |
N/A |
N/A |
❌ sealed |
✅ enum |
| GCM.create() syntax |
N/A |
N/A |
❌ `??` |
✅ Fixed |
| Swift decoder helpers |
N/A |
N/A |
❌ |
✅ Added |
| Swift type conversion |
❌ |
❌ |
❌ |
⚠️ [Int] not [UInt8] |
| Undefined class Mode |
N/A |
N/A |
N/A |
❌ NEW |
| Swift SHA2Variant vs SHA2.Variant |
N/A |
N/A |
N/A |
❌ NEW |
| Swift HMAC/GCM enum decoding |
❌ |
❌ |
❌ |
❌ |
| Swift files in Xcode |
❌ |
❌ |
❌ |
❌ |
| Dart analysis errors |
214 |
0 |
12 |
1 |
Environment
- macOS 15.5 (Darwin 25.3.0)
- Flutter 3.41.2 / Dart 3.11.0
- Xcode 26.2
- CocoaPods 1.16.2
- CryptoSwift 1.8.4
- auto_interop 0.2.2
- auto_interop_generator 0.2.4
Summary
auto_interop_generatorv0.2.4 is close to working. Only 1 Dart analysis error in generated code (down from 12 in v0.2.3, 214 in v0.2.1). Swift glue now includes decoder helpers and type conversions, but several Swift-side issues prevent compilation.Generator version: 0.2.4
Target package: CryptoSwift ~> 1.8 (CocoaPods, resolved to 1.8.4)
Flutter: 3.41.2 / Dart 3.11.0
Platform: iOS (iPhone 17 Pro simulator)
What's Fixed from v0.2.3 (Issue #3)
`flutter analyze` output (1 error in generated code)
```
error • Undefined class 'Mode' • lib/generated/cryptoswift.dart:406:131 • undefined_class
```
Plus 2 errors in user code (wrong import path — expected, user code needs updating once generated API stabilizes).
Issue 1 (DART): Undefined class `Mode` in `GCM.create()`
File: `lib/generated/cryptoswift.dart` line 406
```dart
static Future create({required List iv, required List authenticationTag, List? additionalAuthenticatedData, Mode? mode}) async {
```
The `Mode` opaque stub class (present in v0.2.3) was removed from v0.2.4, but `GCM.create()` still references it as a parameter type. Either:
```dart
enum GCMMode {
combined,
detached;
}
```
Issue 2 (SWIFT): `decodeSHA2Variant()` returns `SHA2Variant` but CryptoSwift uses `SHA2.Variant`
File: `ios/Runner/CryptoswiftPlugin.swift` line 41
```swift
private func decodeSHA2Variant(_ value: String) -> SHA2Variant {
```
CryptoSwift defines the variant as a nested type `SHA2.Variant`, not a top-level `SHA2Variant`:
```swift
// CryptoSwift source:
public struct SHA2: DigestType {
public enum Variant: RawRepresentable {
case sha224, sha256, sha384, sha512
}
}
```
The generated return type `SHA2Variant` doesn't exist in CryptoSwift's namespace. Should be:
```swift
private func decodeSHA2Variant(_ value: String) -> SHA2.Variant {
switch value {
case "sha224": return .sha224
// ...
}
}
```
Issue 3 (SWIFT): Type conversions produce `[Int]` instead of `[UInt8]`
File: `ios/Runner/CryptoswiftPlugin.swift` lines 73, 174, 235, etc.
```swift
let keyTyped = (key as [Any]).map { $0 as! Int } // Produces [Int]
```
CryptoSwift expects `Array` (i.e. `[UInt8]`) for keys, IVs, plaintext, etc. Should be:
```swift
let keyTyped = (key as [Any]).map { UInt8($0 as! Int) } // Produces [UInt8]
```
Affected cases: `AES._create`, `HMAC._create`, `HMAC.authenticate`, `SHA2.calculate`, `SHA2.callAsFunction`, `GCM._create`, `Authenticator.authenticate`.
Issue 4 (SWIFT): HMAC variant passed as `[String: Any]?` instead of `HMAC.Variant`
File: `ios/Runner/CryptoswiftPlugin.swift` line 175
```swift
case "HMAC._create":
let variant = args["variant"] as? [String: Any]
let instance = HMAC(key: keyTyped, variant: variant) // variant should be HMAC.Variant
```
CryptoSwift HMAC expects `variant: HMAC.Variant` (e.g., `.sha256`). Need a `decodeHMACVariant()` helper similar to `decodeSHA2Variant()`:
```swift
private func decodeHMACVariant(_ value: String) -> HMAC.Variant {
switch value {
case "sha256": return .sha256
case "sha384": return .sha384
case "sha512": return .sha512
case "md5": return .md5
case "sha1": return .sha1
default: fatalError("Unknown HMAC variant: \(value)")
}
}
```
Issue 5 (SWIFT): GCM mode passed as `[String: Any]?` instead of `GCM.Mode`
File: `ios/Runner/CryptoswiftPlugin.swift` line 306
```swift
let instance = GCM(iv: ivTyped, authenticationTag: authenticationTagTyped, additionalAuthenticatedData: additionalAuthenticatedDataTyped, mode: mode)
```
`mode` is `[String: Any]?` but CryptoSwift expects `GCM.Mode` enum (`.combined` or `.detached`).
Issue 6 (SWIFT): Missing `try` on throwing CryptoSwift initializers
```swift
case "AES._create":
let instance = AES(key: keyTyped, ...) // Should be: try AES(key: keyTyped, ...)
case "HMAC._create":
let instance = HMAC(key: keyTyped, ...) // Should be: try HMAC(key: keyTyped, ...)
```
Issue 7 (REMAINING): Generated Swift files not added to Xcode project
Same as v0.2.2 and v0.2.3. `CryptoswiftPlugin.swift` and `RegisterAutoInteropPlugins.swift` not in build phases.
Progress Summary
Environment