|
2 | 2 |
|
3 | 3 | This is a standalone Gradle project for building the Kiwa SDK as an iOS XCFramework. |
4 | 4 |
|
| 5 | +--- |
| 6 | + |
| 7 | +## IMPORTANT: Licensing and Redistribution |
| 8 | + |
| 9 | +**WARNING: This XCFramework contains proprietary software.** |
| 10 | + |
| 11 | +The generated `KiwaSdk.xcframework` includes the **Kiwa Holder SDK** (both public API and implementation modules), which is proprietary software owned by Sphereon International B.V. |
| 12 | + |
| 13 | +- **License Required**: A valid commercial license agreement with Sphereon/Kiwa is required to use this SDK. |
| 14 | +- **Redistribution Prohibited**: Redistribution of this SDK/XCFramework, in whole or in part, is strictly forbidden without explicit written permission. |
| 15 | +- **Internal Use Only**: This framework is intended solely for the licensee's internal business purposes as outlined in the license agreement. |
| 16 | + |
| 17 | +By building and using this XCFramework, you acknowledge that you have read, understood, and agreed to the terms of your license agreement with Sphereon/Kiwa. |
| 18 | + |
| 19 | +For licensing inquiries, contact Sphereon International B.V. |
| 20 | + |
| 21 | +--- |
| 22 | + |
5 | 23 | ## Purpose |
6 | 24 |
|
7 | | -This project creates a Swift/XCFramework with the baseName `KiwaSdk` that includes all necessary dependencies from the Kiwa Holder SDK and Sphereon Identity Development Kit. |
| 25 | +This project creates a dynamic XCFramework named `KiwaSdk` that bundles: |
8 | 26 |
|
9 | | -## Building the XCFramework |
| 27 | +1. **Kiwa Holder SDK** - The core e-license SDK for license holder operations |
| 28 | +2. **Sphereon Identity Development Kit (IDK)** - Cryptographic operations, mDoc handling, and transport protocols |
| 29 | + |
| 30 | +The XCFramework supports all iOS targets: |
| 31 | +- `iosArm64` - Physical iOS devices (iPhone, iPad) |
| 32 | +- `iosX64` - iOS Simulator on Intel Macs |
| 33 | +- `iosSimulatorArm64` - iOS Simulator on Apple Silicon Macs |
| 34 | + |
| 35 | +## Why a Separate Project? |
10 | 36 |
|
11 | | -This project is independent from the main root project. Running `./gradlew clean build` in the root project will **not** automatically build this framework (due to the time it takes). |
| 37 | +Building an XCFramework is a time-consuming process that involves: |
| 38 | +- Compiling Kotlin/Native code for multiple iOS architectures |
| 39 | +- Running SKIE for Swift interop enhancements |
| 40 | +- Linking all dependencies into a single framework |
| 41 | +- Assembling the final XCFramework bundle |
12 | 42 |
|
13 | | -To build the XCFramework: |
| 43 | +To avoid this overhead on every build of the main project, this XCFramework build is intentionally separated. The main project at the repository root will **not** build this framework automatically. |
| 44 | + |
| 45 | +## Building the XCFramework |
| 46 | + |
| 47 | +### Quick Start |
14 | 48 |
|
15 | 49 | ```bash |
16 | 50 | cd example/holder/xcframework |
17 | | -./gradlew assembleKiwaSdkXCFramework |
| 51 | +./gradlew assembleXCFrameworkKiwaSdk |
18 | 52 | ``` |
19 | 53 |
|
| 54 | +### Build Output |
| 55 | + |
20 | 56 | The generated XCFramework will be located at: |
21 | 57 | ``` |
22 | 58 | build/XCFrameworks/release/KiwaSdk.xcframework |
| 59 | +build/XCFrameworks/debug/KiwaSdk.xcframework |
23 | 60 | ``` |
24 | 61 |
|
25 | | -## Build Tasks |
| 62 | +### Available Build Tasks |
| 63 | + |
| 64 | +| Task | Description | |
| 65 | +|------|-------------| |
| 66 | +| `assembleXCFrameworkKiwaSdk` | Build XCFramework for all iOS targets (debug + release) | |
| 67 | +| `assembleReleaseXCFrameworkKiwaSdk` | Build release XCFramework only | |
| 68 | +| `assembleDebugXCFrameworkKiwaSdk` | Build debug XCFramework only | |
| 69 | +| `linkReleaseFrameworkIosArm64` | Build release framework for iOS devices | |
| 70 | +| `linkDebugFrameworkIosSimulatorArm64` | Build debug framework for Apple Silicon simulators | |
| 71 | +| `clean` | Clean the build directory | |
| 72 | +| `tasks` | List all available tasks | |
26 | 73 |
|
27 | | -- `./gradlew assembleKiwaSdkXCFramework` - Builds the XCFramework for all iOS targets (iosX64, iosArm64, iosSimulatorArm64) |
28 | | -- `./gradlew clean` - Cleans the build directory |
29 | | -- `./gradlew tasks` - Lists all available tasks |
| 74 | +## Dependencies Included |
30 | 75 |
|
31 | | -## Dependencies |
| 76 | +The XCFramework exports and bundles the following dependencies: |
32 | 77 |
|
33 | | -The XCFramework exports the following dependencies: |
34 | | -- Kiwa Holder SDK (public and impl) |
35 | | -- Sphereon Core API |
36 | | -- Sphereon Data Link HTTP Client |
37 | | -- Sphereon mDoc Core and Data Transfer |
38 | | -- Sphereon Transport modules (NFC, BLE, REST API, OID4VP) |
39 | | -- Sphereon Logger |
| 78 | +### Kiwa SDK (Proprietary) |
| 79 | +- `kiwa-holder-sdk-public` - Public API interfaces and models |
| 80 | +- `kiwa-holder-sdk-impl` - Implementation and DI components |
| 81 | + |
| 82 | +### Sphereon Identity Development Kit |
| 83 | +- `lib-core-api-public` / `lib-core-api-default` - Core API abstractions |
| 84 | +- `lib-data-link-http-client-public` / `lib-data-link-http-client-impl` - HTTP client |
| 85 | +- `lib-mdoc-core-public` / `lib-mdoc-core-impl` - mDoc/mDL core functionality |
| 86 | +- `lib-mdoc-datatransfer-public` / `lib-mdoc-datatransfer-impl` - mDoc data transfer |
| 87 | +- `lib-mdoc-transport-ble` - Bluetooth Low Energy transport |
| 88 | +- `lib-mdoc-transport-restapi` - REST API transport |
| 89 | +- `lib-mdoc-transport-oid4vp` - OpenID4VP transport |
| 90 | +- `lib-core-loggers-mobile-logger` - Mobile logging |
40 | 91 |
|
41 | 92 | ## Requirements |
42 | 93 |
|
43 | | -- JDK 17 or higher |
44 | | -- macOS with Xcode installed |
45 | | -- Gradle 8.x |
46 | | -- Access to Kiwa and Sphereon repositories (credentials required) |
| 94 | +### Build Environment |
| 95 | +- **macOS** with Xcode 15+ installed (required for iOS compilation) |
| 96 | +- **JDK 17** or higher |
| 97 | +- **Gradle 8.x** (included via wrapper) |
| 98 | + |
| 99 | +### Repository Access |
| 100 | +Access to private Kiwa and Sphereon Maven repositories is required. Credentials must be configured via: |
| 101 | + |
| 102 | +**Environment Variables (recommended):** |
| 103 | +```bash |
| 104 | +export KIWA_REPO_USER="your-username" |
| 105 | +export KIWA_REPO_PASSWORD="your-password" |
| 106 | +``` |
| 107 | + |
| 108 | +**Or Gradle Properties** (`~/.gradle/gradle.properties`): |
| 109 | +```properties |
| 110 | +kiwaRepoUser=your-username |
| 111 | +kiwaRepoPassword=your-password |
| 112 | +``` |
| 113 | + |
| 114 | +Alternative environment variables also supported: |
| 115 | +- `NEXUS_USERNAME` / `NEXUS_PASSWORD` |
| 116 | + |
| 117 | +## Integration with iOS Projects |
| 118 | + |
| 119 | +### Adding to Xcode |
| 120 | + |
| 121 | +1. Build the XCFramework using the commands above |
| 122 | +2. In Xcode, go to your target's **General** tab |
| 123 | +3. Under **Frameworks, Libraries, and Embedded Content**, click **+** |
| 124 | +4. Click **Add Other...** > **Add Files...** |
| 125 | +5. Navigate to `build/XCFrameworks/release/KiwaSdk.xcframework` |
| 126 | +6. Set **Embed** to **Embed & Sign** |
47 | 127 |
|
48 | | -## Configuration |
| 128 | +### Swift Usage |
49 | 129 |
|
50 | | -Repository credentials should be set via environment variables or gradle properties: |
51 | | -- `KIWA_REPO_USER` or `kiwaRepoUser` |
52 | | -- `KIWA_REPO_PASSWORD` or `kiwaRepoPassword` |
| 130 | +```swift |
| 131 | +import KiwaSdk |
| 132 | + |
| 133 | +// Create services instance |
| 134 | +let kiwaServices: KiwaServices = ... |
| 135 | + |
| 136 | +// Request wallet certificate |
| 137 | +let options = GetWalletCertificateRequestOptions( |
| 138 | + alias: "myDeviceAlias", |
| 139 | + environment: .acceptance |
| 140 | +) |
| 141 | +let result = await kiwaServices.auth.commands.getWalletCertificate.execute(args: options) |
| 142 | + |
| 143 | +// Issue a license |
| 144 | +let issueResult = await kiwaServices.holder.commands.issue.execute( |
| 145 | + args: IssueLicenseRequest(environment: .acceptance) |
| 146 | +) |
| 147 | +``` |
53 | 148 |
|
54 | 149 | ## Version Management |
55 | 150 |
|
56 | | -This project references the root project's `gradle/libs.versions.toml` file to avoid duplication and ensure version consistency. Any dependency version updates made in the root project will automatically be reflected in the XCFramework build. |
| 151 | +This project references the root project's `gradle/libs.versions.toml` file to ensure version consistency. Dependency version updates in the root project are automatically reflected here. |
| 152 | + |
| 153 | +Current versions are defined in: |
| 154 | +``` |
| 155 | +../../../gradle/libs.versions.toml |
| 156 | +``` |
| 157 | + |
| 158 | +## Troubleshooting |
| 159 | + |
| 160 | +### Build Fails with "No KIWA_REPO_USER environment..." |
| 161 | +Ensure repository credentials are configured. See the **Repository Access** section above. |
| 162 | + |
| 163 | +### Build Fails on Non-macOS Systems |
| 164 | +XCFramework compilation requires macOS with Xcode. The Kotlin/Native compiler needs access to iOS SDKs. |
| 165 | + |
| 166 | +### Out of Memory Errors |
| 167 | +Increase Gradle JVM memory in `gradle.properties`: |
| 168 | +```properties |
| 169 | +org.gradle.jvmargs=-Xmx8092M |
| 170 | +``` |
| 171 | + |
| 172 | +### Stale Cache Issues |
| 173 | +Clean and rebuild: |
| 174 | +```bash |
| 175 | +./gradlew clean |
| 176 | +./gradlew assembleXCFrameworkKiwaSdk --rerun-tasks |
| 177 | +``` |
0 commit comments