|
1 | | -# Kiwa Sample Application |
| 1 | +# Kiwa Sample Applications |
2 | 2 |
|
3 | | -This repository contains a sample holder application demonstrating the integration and usage of the Kiwa eLicense SDK and Sphereon's IDK (Identity Development Kit). The sample app |
4 | | -showcases how to build a mobile wallet application for storing, managing, and presenting digital credentials. |
| 3 | +This repository contains sample applications demonstrating integration with the Kiwa eLicense SDK. The samples showcase how to build mobile wallet applications for storing, managing, and presenting digital licenses. |
5 | 4 |
|
6 | | -## Overview |
7 | | - |
8 | | -This sample holder app demonstrates how to integrate with Kiwa eLicense platform for digital credential management. Built using Kotlin Multiplatform, it provides a practical |
9 | | -example of implementing a credential wallet that can securely store and present digital licenses, certificates, and other credentials on mobile devices. |
| 5 | +## Documentation |
10 | 6 |
|
11 | | -### Key Features Demonstrated |
| 7 | +For comprehensive documentation, guides, and API reference, visit: |
12 | 8 |
|
13 | | -* **Credential Storage**: Secure storage of digital credentials on mobile devices |
14 | | -* **Credential Presentation**: Present credentials for verification using QR codes or NFC |
15 | | -* **Offline Verification**: Demonstrate offline credential verification capabilities |
16 | | -* **Cross-Platform Support**: Single codebase for both Android and iOS |
| 9 | +**[https://docs.sphereon.com/kiwa/guides/getting-started](https://docs.sphereon.com/kiwa/guides/getting-started)** |
17 | 10 |
|
18 | | -## Sample App Structure |
| 11 | +## Sample Applications |
19 | 12 |
|
20 | | -### Holder App (`example/holder/`) |
| 13 | +| Sample App | Platforms | Language | Description | |
| 14 | +|------------|-----------|----------|-------------| |
| 15 | +| [Compose Multiplatform](#compose-multiplatform-app) | Android + iOS | Kotlin (KMP) | Full-featured cross-platform app with shared UI | |
| 16 | +| [Swift Simple](#swift-simple-app) | iOS only | Swift | Native iOS app with XCFramework integration | |
21 | 17 |
|
22 | | -The main sample application demonstrating: |
| 18 | +## Compose Multiplatform App |
23 | 19 |
|
24 | | -* **Mobile Wallet Implementation**: Complete wallet app for credential storage and presentation |
25 | | -* **Kiwa SDK Integration**: How to integrate with the Kiwa eLicense SDK |
26 | | -* **IDK Integration**: Usage of Sphereon's IDK (Identity Development Kit) for digital identity features |
27 | | -* **UI Components**: Example user interface for credential management |
| 20 | +Located at `example/holder/compose-sample-app/` - a full-featured e-license wallet built with Kotlin Multiplatform and Jetpack Compose. |
28 | 21 |
|
29 | | -## Technology Stack |
| 22 | +### Features |
30 | 23 |
|
31 | | -* **Kotlin Multiplatform (KMP)**: Cross-platform mobile development |
32 | | -* **Ktor**: HTTP client for network communication |
33 | | -* **Kiwa eLicense SDK**: Core SDK for interacting with Kiwa services |
34 | | -* **Sphereon IDK (Identity Development Kit)**: Digital identity capabilities |
35 | | -* **Gradle**: Build automation and dependency management |
36 | | -* **Detekt**: Code quality and static analysis |
| 24 | +- License retrieval, display, and verification |
| 25 | +- NFC and QR code engagement |
| 26 | +- BLE data transfer |
| 27 | +- Shared UI across Android and iOS |
37 | 28 |
|
38 | | -## Getting Started |
| 29 | +### Project Structure |
39 | 30 |
|
40 | | -### Prerequisites |
| 31 | +``` |
| 32 | +example/holder/compose-sample-app/ |
| 33 | +├── composeApp/ # Main KMP Compose module |
| 34 | +│ └── src/ |
| 35 | +│ ├── commonMain/ # Shared code |
| 36 | +│ ├── androidMain/ # Android-specific code |
| 37 | +│ └── iosMain/ # iOS-specific code (Kotlin) |
| 38 | +└── iosApp/ # iOS Xcode wrapper |
| 39 | +``` |
41 | 40 |
|
42 | | -* **Development Environment**: |
43 | | - - JDK 17 or higher |
44 | | - - Android Studio or IntelliJ IDEA |
45 | | - - Kotlin Multiplatform setup |
| 41 | +### Building |
46 | 42 |
|
47 | | -* **Platform Requirements**: |
48 | | - - Android SDK (API 28+) for Android development |
49 | | - - Xcode for iOS development |
50 | | - - Device with Bluetooth and NFC capabilities (for full feature testing) |
| 43 | +```bash |
| 44 | +# Android |
| 45 | +./gradlew :example:holder:compose-sample-app:composeApp:assembleDebug |
51 | 46 |
|
52 | | -### Running the Sample App |
| 47 | +# iOS - build framework then open Xcode |
| 48 | +./gradlew :example:holder:compose-sample-app:composeApp:linkDebugFrameworkIosSimulatorArm64 |
| 49 | +open example/holder/compose-sample-app/iosApp/iosApp.xcodeproj |
| 50 | +``` |
53 | 51 |
|
54 | | -1. **Clone the Repository** |
55 | | - ```bash |
56 | | - git clone <repository-url> |
57 | | - cd kiwa-sample |
58 | | - ``` |
| 52 | +## Swift Simple App |
59 | 53 |
|
60 | | -2. **Setup Dependencies** |
61 | | - ```bash |
62 | | - ./gradlew build |
63 | | - ``` |
| 54 | +Located at `example/holder/swift-sample-app/` - a native iOS app demonstrating direct XCFramework integration. |
64 | 55 |
|
65 | | -3. **Configure API Keys** |
| 56 | +### Features |
66 | 57 |
|
67 | | - Add your API configuration to the appropriate configuration files (refer to individual module documentation). |
| 58 | +- License activation via PIN entry |
| 59 | +- License storage and display |
| 60 | +- mDoc CBOR decoding |
| 61 | +- Native SwiftUI interface |
68 | 62 |
|
69 | | -4. **Run on Android** |
70 | | - ```bash |
71 | | - ./gradlew :example:holder:app:installDebug |
72 | | - ``` |
| 63 | +### Project Structure |
73 | 64 |
|
74 | | -5. **Run on iOS** |
| 65 | +``` |
| 66 | +example/holder/swift-sample-app/ |
| 67 | +├── kiwa-swift-sample.xcodeproj/ |
| 68 | +└── kiwa-swift-sample/ |
| 69 | + ├── KiwaSwiftSampleApp.swift |
| 70 | + ├── KiwaManager.swift |
| 71 | + ├── LicenseListView.swift |
| 72 | + └── PinEntryView.swift |
| 73 | +``` |
75 | 74 |
|
76 | | - Open the iOS project in Xcode and run on device or simulator. |
| 75 | +### Building |
77 | 76 |
|
78 | | -6. **Build iOS XCFramework** (optional) |
| 77 | +```bash |
| 78 | +open example/holder/swift-sample-app/kiwa-swift-sample.xcodeproj |
| 79 | +``` |
79 | 80 |
|
80 | | - For iOS distribution, a separate XCFramework build is available. See [XCFramework README](./example/holder/xcframework/README.md) for details. |
| 81 | +Requires `KiwaSdk.xcframework` - see [XCFramework](#xcframework-build) section. |
81 | 82 |
|
82 | | - ```bash |
83 | | - cd example/holder/xcframework |
84 | | - ./gradlew assembleXCFrameworkKiwaSdk |
85 | | - ``` |
| 83 | +## XCFramework Build |
86 | 84 |
|
87 | | - > **Note**: The XCFramework build is intentionally separated from the main build due to its long compilation time. |
| 85 | +Located at `example/holder/xcframework/` - a standalone Gradle project for building the iOS XCFramework. |
88 | 86 |
|
89 | | -### Sample Code Examples |
| 87 | +### Building |
90 | 88 |
|
91 | | -The sample app demonstrates key integration patterns: |
| 89 | +```bash |
| 90 | +cd example/holder/xcframework |
92 | 91 |
|
93 | | -**Initialize the SDK** |
| 92 | +# Build XCFramework |
| 93 | +./gradlew assembleXCFrameworkKiwaSdk |
94 | 94 |
|
95 | | -```kotlin |
96 | | -val kiwaConfig = KiwaConfiguration( |
97 | | - apiKey = "your-api-key", |
98 | | - environment = Environment.SANDBOX |
99 | | -) |
100 | | -val kiwaClient = KiwaElicenseClient(kiwaConfig) |
| 95 | +# Build release only |
| 96 | +./gradlew assembleReleaseXCFrameworkKiwaSdk |
101 | 97 | ``` |
102 | 98 |
|
103 | | -**Store a Credential** |
| 99 | +### Output |
104 | 100 |
|
105 | | -```kotlin |
106 | | -val storedCredential = walletService.storeCredential(credential) |
107 | 101 | ``` |
108 | | - |
109 | | -**Present a Credential** |
110 | | - |
111 | | -```kotlin |
112 | | -val presentationResult = walletService.presentCredential( |
113 | | - credential = credential, |
114 | | - presentationMode = PresentationMode.QR_CODE |
115 | | -) |
| 102 | +build/XCFrameworks/release/KiwaSdk.xcframework |
| 103 | +build/XCFrameworks/debug/KiwaSdk.xcframework |
116 | 104 | ``` |
117 | 105 |
|
118 | | -## Code Quality |
119 | | - |
120 | | -This project uses [Detekt](https://detekt.dev/) for static code analysis to maintain high code quality standards. The configuration is specifically tailored for Kotlin |
121 | | -multiplatform projects. |
| 106 | +### CocoaPods |
122 | 107 |
|
123 | | -### Running Code Analysis |
| 108 | +A podspec is generated for CocoaPods integration: |
124 | 109 |
|
125 | 110 | ```bash |
126 | | -# Run Detekt analysis on all modules |
127 | | -./gradlew detekt |
| 111 | +./gradlew generatePodspec |
| 112 | +``` |
128 | 113 |
|
129 | | -# Generate baseline file (suppress existing issues) |
130 | | -./gradlew detektBaseline |
| 114 | +The podspec is output to `build/cocoapods/KiwaSdk.podspec`. |
131 | 115 |
|
132 | | -# Run with auto-correction (where applicable) |
133 | | -./gradlew detekt --auto-correct |
134 | | -``` |
| 116 | +## Shared UI Components |
135 | 117 |
|
136 | | -### Using Convenience Scripts |
| 118 | +Located at `example/holder/ui/` - reusable UI modules shared across sample apps: |
137 | 119 |
|
138 | | -**Linux/macOS:** |
139 | | -```bash |
140 | | -./scripts/run-detekt.sh |
141 | | -``` |
| 120 | +- `auth/` - Authentication UI components |
| 121 | +- `card/` - Credential display components |
| 122 | +- `core/` - Core UI utilities |
| 123 | +- `elicense/` - eLicense-specific features |
142 | 124 |
|
143 | | -**Windows:** |
144 | | -```powershell |
145 | | -./scripts/run-detekt.ps1 |
146 | | -``` |
| 125 | +## Prerequisites |
147 | 126 |
|
148 | | -For detailed information about the Detekt configuration, see [`config/detekt/README.md`](./config/detekt/README.md). |
| 127 | +- **JDK 17** or higher |
| 128 | +- **Android Studio** with Kotlin Multiplatform plugin |
| 129 | +- **Xcode 15+** (for iOS builds) |
| 130 | +- **Kiwa SDK Access**: Nexus credentials for SDK repositories |
| 131 | +- **Subscription Key**: Valid `KIWA_SUBSCRIPTION_KEY` from Kiwa |
149 | 132 |
|
150 | | -## Project Structure |
| 133 | +### Configuration |
151 | 134 |
|
152 | | -``` |
153 | | -kiwa-sample/ |
154 | | -├── example/ |
155 | | -│ └── holder/ # Sample holder/wallet application |
156 | | -│ ├── app/ # Main application module (Android & iOS) |
157 | | -│ │ ├── composeApp/ # Kotlin Multiplatform Compose app |
158 | | -│ │ └── iosApp/ # iOS Xcode project |
159 | | -│ ├── ui/ # UI components and screens |
160 | | -│ └── xcframework/ # Standalone XCFramework build (see README) |
161 | | -├── config/ # Configuration files |
162 | | -├── gradle/ # Gradle configuration |
163 | | -└── scripts/ # Utility scripts |
| 135 | +Create or update `local.properties`: |
| 136 | + |
| 137 | +```properties |
| 138 | +nexusUsername=YOUR_NEXUS_USERNAME |
| 139 | +nexusPassword=YOUR_NEXUS_PASSWORD |
164 | 140 | ``` |
165 | 141 |
|
166 | | -> **Note**: The `xcframework/` directory is a standalone Gradle project excluded from the main build. See [XCFramework README](./example/holder/xcframework/README.md) for build instructions and licensing information. |
| 142 | +Set subscription key via environment variable: |
167 | 143 |
|
168 | | -## Documentation |
| 144 | +```bash |
| 145 | +export KIWA_SUBSCRIPTION_KEY=your_subscription_key |
| 146 | +``` |
169 | 147 |
|
170 | | -For comprehensive SDK documentation and API references: |
| 148 | +## Technology Stack |
171 | 149 |
|
172 | | -* **Kiwa eLicense SDK**: Refer to the official Kiwa SDK documentation |
173 | | -* **Sphereon IDK**: Visit the [Sphereon Documentation Portal](https://docs.sphereon.com/) |
174 | | -* **Sample App Modules**: Check individual `README.md` files in each module |
| 150 | +- **Kotlin Multiplatform (KMP)**: Cross-platform development |
| 151 | +- **Jetpack Compose / Compose Multiplatform**: Shared UI |
| 152 | +- **kotlin-inject + Anvil**: Compile-time dependency injection |
| 153 | +- **SKIE**: Enhanced Swift interoperability |
| 154 | +- **Ktor**: HTTP client |
175 | 155 |
|
176 | | -## Contributing |
| 156 | +## Platform Requirements |
177 | 157 |
|
178 | | -This is a sample application for demonstration purposes. For SDK-related issues or feature requests, please refer to the respective SDK documentation and support channels. |
| 158 | +| Platform | Minimum Version | |
| 159 | +|----------|-----------------| |
| 160 | +| Android | API 27 (Android 8.1) | |
| 161 | +| iOS | iOS 15+ / Xcode 15+ | |
179 | 162 |
|
180 | 163 | ## License |
181 | 164 |
|
182 | | -Please be aware this software is proprietary and requires a [LICENSE](./LICENSE.md). The example app and UI code is provided as permissive Open-Source using an Apache2 license. |
183 | | -However the SDK itself is not Open-Source, requires a license and does not allow redistribution! Source code licenses and other license options are available upon request. |
| 165 | +The sample app and UI code is provided as permissive Open-Source using an Apache 2.0 license. However, the Kiwa SDK itself is proprietary, requires a license, and does not allow redistribution. See [LICENSE.md](./LICENSE.md) for details. |
0 commit comments