diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 00000000..8f2b0338 --- /dev/null +++ b/.cargo/config @@ -0,0 +1,11 @@ +[target.i686-linux-android] +linker = "i686-linux-android16-clang" + +[target.armv7-linux-androideabi] +linker = "armv7a-linux-androideabi16-clang" + +[target.aarch64-linux-android] +linker = "aarch64-linux-android21-clang" + +[target.x86_64-linux-android] +linker = "x86_64-linux-android21-clang" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4ab21d6..d2803c5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', '**.rs') }} + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', 'lib/Makefile', '**.rs') }} restore-keys: | ${{ runner.os }}-cargo- @@ -40,3 +40,43 @@ jobs: - name: Test run: cargo test --verbose --workspace + + - name: Install Rust Android targets + run: make -C lib install-rustup-android + + - name: Install JDK + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Install Flutter + uses: subosito/flutter-action@v1 + run: | + dart --disable-analytics + flutter --suppress-analytics config --no-analytics + + - name: Install Android SDK + uses: android-actions/setup-android@v2 + + - name: Cache Android NDK + id: ndk-cache + uses: actions/cache@v2 + with: + path: ${{ env.ANDROID_SDK_ROOT }}/ndk-bundle + key: ${{ runner.os }}-ndk-bundle + + - name: Install Android NDK + if: steps.ndk-cache.outputs.cache-hit != 'true' + run: $ANDROID_SDK_ROOT/tools/bin/sdkmanager ndk-bundle + + - name: Test C FFI + run: make -C lib target/test/c.stamp + + - name: Test JNI + run: make -C lib target/test/java.stamp + + - name: Test Dart/Flutter plugin + run: make -C lib target/test/flutter.stamp + + - name: Build Android Archive + run: make -C lib target/test/aar.stamp diff --git a/Cargo.toml b/Cargo.toml index c89ed57d..a550c79d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,4 +3,5 @@ members = [ "http", "cli", "lib", + "lib/cbindings" ] diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 00000000..ceeb05b4 --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1 @@ +/tmp diff --git a/lib/Cargo.toml b/lib/Cargo.toml index bbccfa07..ca504b40 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -6,3 +6,7 @@ edition = "2018" [dependencies] ssi = { path = "../../ssi" } +jni = "0.17" + +[lib] +crate-type = ["lib", "cdylib"] diff --git a/lib/FFI.md b/lib/FFI.md new file mode 100644 index 00000000..2dc442e1 --- /dev/null +++ b/lib/FFI.md @@ -0,0 +1,8 @@ +## FFI + +The DIDKit library is written in Rust, but has bindings for other languages and environments: + +- [C](c/) +- [Java](java/) +- [Android](android/) +- [Flutter](flutter/) diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 00000000..c3158c3b --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,102 @@ +# didkit/lib/Makefile + +TARGET=../target + +.PHONY: test +test: $(TARGET)/test/c.stamp \ + $(TARGET)/test/java.stamp \ + $(TARGET)/test/aar.stamp \ + $(TARGET)/test/flutter.stamp + +## Setup + +android/res $(TARGET)/test $(TARGET)/jvm: + mkdir -p $@ + +## Rust + +RUST_SRC=Cargo.toml $(wildcard src/*.rs src/*/*.rs src/*/*/*.rs) + +$(TARGET)/didkit.h: cbindgen.toml cbindings/build.rs cbindings/Cargo.toml $(RUST_SRC) + cargo build -p didkit-cbindings + test -s $@ && touch $@ + +$(TARGET)/release/libdidkit.so: $(RUST_SRC) + cargo build --lib --release + strip $@ + +## C + +$(TARGET)/test/c.stamp: $(TARGET)/cabi-test $(TARGET)/release/libdidkit.so | $(TARGET)/test + $(TARGET)/cabi-test + touch $@ + +$(TARGET)/cabi-test: c/test.c $(TARGET)/didkit.h + $(CC) -I$(TARGET) $< -ldl -o $@ + +## Java + +JAVA_SRC=$(wildcard java/*/*.java java/*/*/*.java java/*/*/*/*.java) + +$(TARGET)/test/java.stamp: $(TARGET)/jvm/com/spruceid/DIDKit.class $(TARGET)/release/libdidkit.so | $(TARGET)/test + java -Djava.class.path=$(TARGET)/jvm \ + -Djava.library.path=$(TARGET)/release \ + com.spruceid.DIDKit + touch $@ + +$(TARGET)/jvm/com/spruceid/DIDKit.class: java/com/spruceid/DIDKit.java | $(TARGET)/jvm + javac $^ -d $(TARGET)/jvm -source 1.7 -target 1.7 + +$(TARGET)/com_spruceid_DIDKit.h: java/com/spruceid/DIDkit.java + javac -h $(TARGET) $< + +$(TARGET)/didkit.jar: $(TARGET)/jvm/com/spruceid/DIDKit.class + jar -cf $@ -C $(TARGET)/jvm $(patsubst $(TARGET)/jvm/%,%,$^) + +## Android + +.PHONY: install-rustup-android +install-rustup-android: + rustup target add i686-linux-android armv7-linux-androideabi aarch64-linux-android x86_64-linux-android + +ANDROID_SDK_ROOT ?= ~/Android/Sdk +ANDROID_TOOLS ?= $(lastword $(wildcard $(ANDROID_SDK_ROOT)/build-tools/*)) +ANDROID_NDK_HOME ?= $(lastword $(wildcard \ + $(ANDROID_SDK_ROOT)/ndk/* \ + $(ANDROID_SDK_ROOT)/ndk-bundle)) +OS_NAME=$(shell uname | tr '[:upper:]' '[:lower:]') +TOOLCHAIN=$(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(OS_NAME)-x86_64 +ANDROID_LIBS=\ + $(TARGET)/i686-linux-android/release/libdidkit.so\ + $(TARGET)/armv7-linux-androideabi/release/libdidkit.so\ + $(TARGET)/aarch64-linux-android/release/libdidkit.so\ + $(TARGET)/x86_64-linux-android/release/libdidkit.so + +$(TARGET)/test/aar.stamp: $(TARGET)/didkit.aar | $(TARGET)/test + rm -rf tmp/test-aar + mkdir -p tmp/test-aar + cd tmp/test-aar && unzip -q ../../$< || unzip -l ../../$< + cd tmp/test-aar && unzip -qo classes.jar com/spruceid/DIDKit.class || unzip -l classes.jar + javap tmp/test-aar/com/spruceid/DIDKit.class | grep -q 'public class com.spruceid.DIDKit' + touch $@ + +$(TARGET)/didkit.aar: $(TARGET)/didkit.jar android/AndroidManifest.xml android/R.txt $(ANDROID_LIBS) | android/res + $(ANDROID_TOOLS)/aapt package -f -S android/res -F $@ --ignore-assets '.*:*~:README.md' android + +$(TARGET)/%/release/libdidkit.so: $(RUST_SRC) + PATH=$(TOOLCHAIN)/bin:$(PATH) \ + cargo build --lib --release --target $* + $(TOOLCHAIN)/bin/llvm-strip $@ + +## Flutter + +$(TARGET)/test/flutter.stamp: flutter/lib/didkit.dart $(TARGET)/release/libdidkit.so | $(TARGET)/test + cd flutter && LD_LIBRARY_PATH=$$PWD \ + flutter --suppress-analytics test + touch $@ + +## Cleanup + +.PHONY: clean +clean: + cargo clean diff --git a/lib/android/AndroidManifest.xml b/lib/android/AndroidManifest.xml new file mode 100644 index 00000000..ff4665ec --- /dev/null +++ b/lib/android/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/lib/android/R.txt b/lib/android/R.txt new file mode 100644 index 00000000..e69de29b diff --git a/lib/android/README.md b/lib/android/README.md new file mode 100644 index 00000000..972b9226 --- /dev/null +++ b/lib/android/README.md @@ -0,0 +1,17 @@ +# DIDKit - Android + +[Android Library (AAR file)][AAR] for DIDKit. The AAR file includes Java class files using [JNI][], and binary shared libraries for Android's supported architectures (x86, armeabi-v7a, arm64-v8a, x86\_64). It can be added to existing Android projects using Android Studio or Gradle. + +## Requires + +Android SDK and NDK, for Linux x86\_64 + +## Build + +In the parent directory, run: +``` +make target/didkit.aar +``` + +[AAR]: https://developer.android.com/studio/projects/android-library.html#aar-contents +[JNI]: https://en.wikipedia.org/wiki/Java_Native_Interface diff --git a/lib/android/classes.jar b/lib/android/classes.jar new file mode 120000 index 00000000..ed750ac6 --- /dev/null +++ b/lib/android/classes.jar @@ -0,0 +1 @@ +../../target/didkit.jar \ No newline at end of file diff --git a/lib/android/jni/arm64-v8a/libdidkit.so b/lib/android/jni/arm64-v8a/libdidkit.so new file mode 120000 index 00000000..8a1285c6 --- /dev/null +++ b/lib/android/jni/arm64-v8a/libdidkit.so @@ -0,0 +1 @@ +../../../../target/aarch64-linux-android/release/libdidkit.so \ No newline at end of file diff --git a/lib/android/jni/armeabi-v7a/libdidkit.so b/lib/android/jni/armeabi-v7a/libdidkit.so new file mode 120000 index 00000000..274b819b --- /dev/null +++ b/lib/android/jni/armeabi-v7a/libdidkit.so @@ -0,0 +1 @@ +../../../../target/armv7-linux-androideabi/release/libdidkit.so \ No newline at end of file diff --git a/lib/android/jni/x86/libdidkit.so b/lib/android/jni/x86/libdidkit.so new file mode 120000 index 00000000..dc0974bd --- /dev/null +++ b/lib/android/jni/x86/libdidkit.so @@ -0,0 +1 @@ +../../../../target/i686-linux-android/release/libdidkit.so \ No newline at end of file diff --git a/lib/android/jni/x86_64/libdidkit.so b/lib/android/jni/x86_64/libdidkit.so new file mode 120000 index 00000000..a250510b --- /dev/null +++ b/lib/android/jni/x86_64/libdidkit.so @@ -0,0 +1 @@ +../../../../target/x86_64-linux-android/release/libdidkit.so \ No newline at end of file diff --git a/lib/c/README.md b/lib/c/README.md new file mode 100644 index 00000000..aafa2dbe --- /dev/null +++ b/lib/c/README.md @@ -0,0 +1,14 @@ +# DIDKit - C + +Shared Library for DIDKit. Intended to be compatible with C. + +## Build + +In the parent directory, run: +``` +make ../target/release/libdidkit.so +``` + +## Android + +To build the C shared library for Android targets, build the [DIDKit Android library](../android/). diff --git a/lib/c/test.c b/lib/c/test.c new file mode 100644 index 00000000..09143e7d --- /dev/null +++ b/lib/c/test.c @@ -0,0 +1,15 @@ +#include +#include +#include +#include "didkit.h" + +int main() { + void *lib = dlopen("../target/release/libdidkit.so", RTLD_NOW); + if (lib == NULL) errx(1, "dlopen: %s", dlerror()); + const char *(*didkit_get_version)() = dlsym(lib, "didkit_get_version"); + if (didkit_get_version == NULL) errx(1, "unable to find version function"); + const char *version = didkit_get_version(); + printf("C libdidkit version: %s\n", version); + int rc = dlclose(lib); + if (rc < 0) errx(1, "dlclose: %s", dlerror()); +} diff --git a/lib/cbindgen.toml b/lib/cbindgen.toml new file mode 100644 index 00000000..34b61af7 --- /dev/null +++ b/lib/cbindgen.toml @@ -0,0 +1,3 @@ +language = "C" +autogen_warning = "// didkit.h - autogenerated by cbindgen" +pragma_once = true diff --git a/lib/cbindings/Cargo.toml b/lib/cbindings/Cargo.toml new file mode 100644 index 00000000..412f6db3 --- /dev/null +++ b/lib/cbindings/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "didkit-cbindings" +version = "0.1.0" +authors = ["Charles E. Lehner "] +edition = "2018" +publish = false + +[build-dependencies] +#didkit = { path = "../" } +cbindgen = "0.14" diff --git a/lib/cbindings/README.md b/lib/cbindings/README.md new file mode 100644 index 00000000..bb756cd2 --- /dev/null +++ b/lib/cbindings/README.md @@ -0,0 +1,5 @@ +# cbindings for didkit + +This crate builds a C header file for the didkit crate. It is a separate crate so that it runs after the didkit crate is built, rather than blocking compilation of the didkit crate. If there are syntax errors, the Rust compiler gives more useful output than would the failing build script using cbindgen. + +Related issue: [Cargo post-build script execution](https://github.com/rust-lang/cargo/issues/545) diff --git a/lib/cbindings/build.rs b/lib/cbindings/build.rs new file mode 100644 index 00000000..b7240410 --- /dev/null +++ b/lib/cbindings/build.rs @@ -0,0 +1,23 @@ +extern crate cbindgen; + +use std::env; +use std::path::Path; + +fn main() { + let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); + let lib_dir = Path::new(&crate_dir).parent().unwrap(); + let workspace_dir = lib_dir.parent().unwrap(); + + // Docs say to output into OUT_DIR, but then how do we use that? + // https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script + // https://stackoverflow.com/questions/63928113/is-there-a-way-to-change-out-dir-for-a-build-rs + // let out_dir = env::var("OUT_DIR").unwrap(); + let out_dir = workspace_dir.join("target"); + let out_file = out_dir.join("didkit.h"); + + cbindgen::generate(lib_dir) + .expect("Unable to generate bindings") + .write_to_file(&out_file); + + println!("cargo:rerun-if-changed={:?}", &out_file); +} diff --git a/lib/cbindings/src/lib.rs b/lib/cbindings/src/lib.rs new file mode 100644 index 00000000..269e1e9f --- /dev/null +++ b/lib/cbindings/src/lib.rs @@ -0,0 +1 @@ +// placeholder for build-only crate diff --git a/lib/flutter/.gitignore b/lib/flutter/.gitignore new file mode 100644 index 00000000..e9dc58d3 --- /dev/null +++ b/lib/flutter/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +.dart_tool/ + +.packages +.pub/ + +build/ diff --git a/lib/flutter/.metadata b/lib/flutter/.metadata new file mode 100644 index 00000000..28776579 --- /dev/null +++ b/lib/flutter/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 6b39acdc53bad8b3d51d1618e3df4e299b344d7c + channel: master + +project_type: plugin diff --git a/lib/flutter/CHANGELOG.md b/lib/flutter/CHANGELOG.md new file mode 100644 index 00000000..41cc7d81 --- /dev/null +++ b/lib/flutter/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/lib/flutter/LICENSE b/lib/flutter/LICENSE new file mode 100644 index 00000000..ba75c69f --- /dev/null +++ b/lib/flutter/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/lib/flutter/README.md b/lib/flutter/README.md new file mode 100644 index 00000000..d8e79e30 --- /dev/null +++ b/lib/flutter/README.md @@ -0,0 +1,16 @@ +# DIDKit - Flutter + +[Flutter plugin][packages-plugins] for the DIDKit library. Includes Dart bindings, and functionality for Android and iOS. + +## Usage + +You can depend on this plugin as a [path dependency][path-packages]. + +You will also need to build the DIDKit library for your target platforms. +To do that for Android, trigger building the AAR file - in the parent directory: +``` +make ../target/didkit.aar +``` + +[path-packages]: https://dart.dev/tools/pub/dependencies#path-packages +[packages-plugins]: https://flutter.dev/developing-packages/ diff --git a/lib/flutter/android/.gitignore b/lib/flutter/android/.gitignore new file mode 100644 index 00000000..c6cbe562 --- /dev/null +++ b/lib/flutter/android/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/lib/flutter/android/build.gradle b/lib/flutter/android/build.gradle new file mode 100644 index 00000000..28dd6dae --- /dev/null +++ b/lib/flutter/android/build.gradle @@ -0,0 +1,33 @@ +group 'com.spruceid.DIDKit' +version '1.0' + +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.0' + } +} + +rootProject.allprojects { + repositories { + google() + jcenter() + } +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion 29 + + defaultConfig { + minSdkVersion 16 + } + lintOptions { + disable 'InvalidPackage' + } +} diff --git a/lib/flutter/android/gradle.properties b/lib/flutter/android/gradle.properties new file mode 100644 index 00000000..94adc3a3 --- /dev/null +++ b/lib/flutter/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/lib/flutter/android/gradle/wrapper/gradle-wrapper.properties b/lib/flutter/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..01a286e9 --- /dev/null +++ b/lib/flutter/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/lib/flutter/android/settings.gradle b/lib/flutter/android/settings.gradle new file mode 100644 index 00000000..7fcf27dd --- /dev/null +++ b/lib/flutter/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'DIDKit' diff --git a/lib/flutter/android/src/main/AndroidManifest.xml b/lib/flutter/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..ff4665ec --- /dev/null +++ b/lib/flutter/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/lib/flutter/android/src/main/java/com/spruceid/DIDKit/DIDKitFlutterPlugin.java b/lib/flutter/android/src/main/java/com/spruceid/DIDKit/DIDKitFlutterPlugin.java new file mode 100644 index 00000000..fe05213f --- /dev/null +++ b/lib/flutter/android/src/main/java/com/spruceid/DIDKit/DIDKitFlutterPlugin.java @@ -0,0 +1,18 @@ +package com.spruceid.DIDKit; + +import androidx.annotation.NonNull; + +import io.flutter.embedding.engine.plugins.FlutterPlugin; + +/** DIDKitFlutterPlugin */ +public class DIDKitFlutterPlugin implements FlutterPlugin { + /// This class is required by Flutter, but does not do anything. + /// All functionality is in the FFI between Dart and the C shared library. + @Override + public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { + } + + @Override + public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { + } +} diff --git a/lib/flutter/android/src/main/jniLibs b/lib/flutter/android/src/main/jniLibs new file mode 120000 index 00000000..48882acb --- /dev/null +++ b/lib/flutter/android/src/main/jniLibs @@ -0,0 +1 @@ +../../../../android/jni \ No newline at end of file diff --git a/lib/flutter/didkit.iml b/lib/flutter/didkit.iml new file mode 100644 index 00000000..ebe8b325 --- /dev/null +++ b/lib/flutter/didkit.iml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/flutter/example/.gitignore b/lib/flutter/example/.gitignore new file mode 100644 index 00000000..9d532b18 --- /dev/null +++ b/lib/flutter/example/.gitignore @@ -0,0 +1,41 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json diff --git a/lib/flutter/example/.metadata b/lib/flutter/example/.metadata new file mode 100644 index 00000000..fee8bd7e --- /dev/null +++ b/lib/flutter/example/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 6b39acdc53bad8b3d51d1618e3df4e299b344d7c + channel: master + +project_type: app diff --git a/lib/flutter/example/README.md b/lib/flutter/example/README.md new file mode 100644 index 00000000..056084c8 --- /dev/null +++ b/lib/flutter/example/README.md @@ -0,0 +1,8 @@ +# didkit_example + +Demonstrates how to use the didkit plugin. + +This example app is not used but is required by Flutter. + +More info: +https://flutter.dev/docs/development/packages-and-plugins/developing-packages diff --git a/lib/flutter/example/android/.gitignore b/lib/flutter/example/android/.gitignore new file mode 100644 index 00000000..0a741cb4 --- /dev/null +++ b/lib/flutter/example/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/lib/flutter/example/android/app/build.gradle b/lib/flutter/example/android/app/build.gradle new file mode 100644 index 00000000..3dfc452a --- /dev/null +++ b/lib/flutter/example/android/app/build.gradle @@ -0,0 +1,54 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 29 + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.spruceid.didkit_example" + minSdkVersion 16 + targetSdkVersion 29 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} diff --git a/lib/flutter/example/android/app/src/debug/AndroidManifest.xml b/lib/flutter/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000..d4c22505 --- /dev/null +++ b/lib/flutter/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/lib/flutter/example/android/app/src/main/AndroidManifest.xml b/lib/flutter/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..28572a87 --- /dev/null +++ b/lib/flutter/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + diff --git a/lib/flutter/example/android/app/src/main/java/com/spruceid/didkit_example/MainActivity.java b/lib/flutter/example/android/app/src/main/java/com/spruceid/didkit_example/MainActivity.java new file mode 100644 index 00000000..0006c4b5 --- /dev/null +++ b/lib/flutter/example/android/app/src/main/java/com/spruceid/didkit_example/MainActivity.java @@ -0,0 +1,6 @@ +package com.spruceid.didkit_example; + +import io.flutter.embedding.android.FlutterActivity; + +public class MainActivity extends FlutterActivity { +} diff --git a/lib/flutter/example/android/app/src/main/res/drawable/launch_background.xml b/lib/flutter/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/lib/flutter/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/lib/flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/lib/flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..db77bb4b Binary files /dev/null and b/lib/flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/lib/flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/lib/flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..17987b79 Binary files /dev/null and b/lib/flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/lib/flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/lib/flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..09d43914 Binary files /dev/null and b/lib/flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/lib/flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/lib/flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..d5f1c8d3 Binary files /dev/null and b/lib/flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/lib/flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/lib/flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..4d6372ee Binary files /dev/null and b/lib/flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/lib/flutter/example/android/app/src/main/res/values-night/styles.xml b/lib/flutter/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..449a9f93 --- /dev/null +++ b/lib/flutter/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/lib/flutter/example/android/app/src/main/res/values/styles.xml b/lib/flutter/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..d74aa35c --- /dev/null +++ b/lib/flutter/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/lib/flutter/example/android/app/src/profile/AndroidManifest.xml b/lib/flutter/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 00000000..d4c22505 --- /dev/null +++ b/lib/flutter/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/lib/flutter/example/android/build.gradle b/lib/flutter/example/android/build.gradle new file mode 100644 index 00000000..e0d7ae2c --- /dev/null +++ b/lib/flutter/example/android/build.gradle @@ -0,0 +1,29 @@ +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.0' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/lib/flutter/example/android/gradle.properties b/lib/flutter/example/android/gradle.properties new file mode 100644 index 00000000..94adc3a3 --- /dev/null +++ b/lib/flutter/example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/lib/flutter/example/android/gradle/wrapper/gradle-wrapper.properties b/lib/flutter/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..296b146b --- /dev/null +++ b/lib/flutter/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/lib/flutter/example/android/settings.gradle b/lib/flutter/example/android/settings.gradle new file mode 100644 index 00000000..44e62bcf --- /dev/null +++ b/lib/flutter/example/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/lib/flutter/example/ios/.gitignore b/lib/flutter/example/ios/.gitignore new file mode 100644 index 00000000..e96ef602 --- /dev/null +++ b/lib/flutter/example/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/lib/flutter/example/ios/Flutter/AppFrameworkInfo.plist b/lib/flutter/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 00000000..f2872cf4 --- /dev/null +++ b/lib/flutter/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 9.0 + + diff --git a/lib/flutter/example/ios/Flutter/Debug.xcconfig b/lib/flutter/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000..592ceee8 --- /dev/null +++ b/lib/flutter/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/lib/flutter/example/ios/Flutter/Release.xcconfig b/lib/flutter/example/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000..592ceee8 --- /dev/null +++ b/lib/flutter/example/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/lib/flutter/example/ios/Runner.xcodeproj/project.pbxproj b/lib/flutter/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..43314e09 --- /dev/null +++ b/lib/flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,495 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.spruceid.DIDKitExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.spruceid.DIDKitExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.spruceid.DIDKitExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/lib/flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/lib/flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/lib/flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..a28140cf --- /dev/null +++ b/lib/flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/lib/flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/lib/flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/lib/flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/lib/flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/lib/flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/lib/flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/lib/flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/lib/flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/lib/flutter/example/ios/Runner/AppDelegate.swift b/lib/flutter/example/ios/Runner/AppDelegate.swift new file mode 100644 index 00000000..70693e4a --- /dev/null +++ b/lib/flutter/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d36b1fab --- /dev/null +++ b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 00000000..dc9ada47 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000..28c6bf03 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000..f091b6b0 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000..4cde1211 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000..d0ef06e7 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000..dcdc2306 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000..c8f9ed8f Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000..75b2d164 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000..c4df70d3 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000..6a84f41e Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 00000000..d0e1f585 Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/lib/flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/lib/flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/lib/flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..f2e259c7 --- /dev/null +++ b/lib/flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/flutter/example/ios/Runner/Base.lproj/Main.storyboard b/lib/flutter/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000..f3c28516 --- /dev/null +++ b/lib/flutter/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/flutter/example/ios/Runner/Info.plist b/lib/flutter/example/ios/Runner/Info.plist new file mode 100644 index 00000000..9fc0ad41 --- /dev/null +++ b/lib/flutter/example/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + didkit_example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/lib/flutter/example/ios/Runner/Runner-Bridging-Header.h b/lib/flutter/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000..308a2a56 --- /dev/null +++ b/lib/flutter/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/lib/flutter/example/lib/main.dart b/lib/flutter/example/lib/main.dart new file mode 100644 index 00000000..6c2baa82 --- /dev/null +++ b/lib/flutter/example/lib/main.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; + +import 'package:flutter/services.dart'; +import 'package:didkit/didkit.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatefulWidget { + @override + _MyAppState createState() => _MyAppState(); +} + +class _MyAppState extends State { + String _platformVersion = 'Unknown'; + + @override + void initState() { + super.initState(); + initPlatformState(); + } + + // Platform messages are asynchronous, so we initialize in an async method. + Future initPlatformState() async { + String platformVersion; + // Platform messages may fail, so we use a try/catch PlatformException. + try { + platformVersion = await DIDKit.platformVersion; + } on PlatformException { + platformVersion = 'Failed to get platform version.'; + } + + // If the widget was removed from the tree while the asynchronous platform + // message was in flight, we want to discard the reply rather than calling + // setState to update our non-existent appearance. + if (!mounted) return; + + setState(() { + _platformVersion = platformVersion; + }); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Plugin example app'), + ), + body: Center( + child: Text('Running on: $_platformVersion\n'), + ), + ), + ); + } +} diff --git a/lib/flutter/example/pubspec.lock b/lib/flutter/example/pubspec.lock new file mode 100644 index 00000000..eb427d5a --- /dev/null +++ b/lib/flutter/example/pubspec.lock @@ -0,0 +1,167 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.0-nullsafety" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.2" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0-nullsafety.2" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.10-nullsafety" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.2" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.2" + didkit: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.0.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0-nullsafety" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.19-nullsafety" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.2" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.2" +sdks: + dart: ">=2.10.0-0.0.dev <2.10.0" diff --git a/lib/flutter/example/pubspec.yaml b/lib/flutter/example/pubspec.yaml new file mode 100644 index 00000000..42c1ff42 --- /dev/null +++ b/lib/flutter/example/pubspec.yaml @@ -0,0 +1,71 @@ +name: didkit_example +description: Demonstrates how to use the DIDKit plugin. + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +environment: + sdk: ">=2.7.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + + didkit: + # When depending on this package from a real application you should use: + # didkit: ^x.y.z + # See https://dart.dev/tools/pub/dependencies#version-constraints + # The example app is bundled with the plugin so we use a path dependency on + # the parent directory to use the current plugin's version. + path: ../ + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.0 + +dev_dependencies: + flutter_test: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/lib/flutter/example/test/widget_test.dart b/lib/flutter/example/test/widget_test.dart new file mode 100644 index 00000000..ce906d17 --- /dev/null +++ b/lib/flutter/example/test/widget_test.dart @@ -0,0 +1,27 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:didkit_example/main.dart'; + +void main() { + testWidgets('Verify Platform version', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(MyApp()); + + // Verify that platform version is retrieved. + expect( + find.byWidgetPredicate( + (Widget widget) => widget is Text && + widget.data.startsWith('Running on:'), + ), + findsOneWidget, + ); + }); +} diff --git a/lib/flutter/ios/.gitignore b/lib/flutter/ios/.gitignore new file mode 100644 index 00000000..aa479fd3 --- /dev/null +++ b/lib/flutter/ios/.gitignore @@ -0,0 +1,37 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/Generated.xcconfig +/Flutter/flutter_export_environment.sh \ No newline at end of file diff --git a/lib/flutter/ios/Assets/.gitkeep b/lib/flutter/ios/Assets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/lib/flutter/ios/Classes/DIDKitFlutterPlugin.h b/lib/flutter/ios/Classes/DIDKitFlutterPlugin.h new file mode 100644 index 00000000..2625da56 --- /dev/null +++ b/lib/flutter/ios/Classes/DIDKitFlutterPlugin.h @@ -0,0 +1,4 @@ +#import + +@interface DIDKitFlutterPlugin : NSObject +@end diff --git a/lib/flutter/ios/Classes/DIDKitFlutterPlugin.m b/lib/flutter/ios/Classes/DIDKitFlutterPlugin.m new file mode 100644 index 00000000..9e58545a --- /dev/null +++ b/lib/flutter/ios/Classes/DIDKitFlutterPlugin.m @@ -0,0 +1,8 @@ +#import "DIDKitFlutterPlugin.h" + +#import "didkit.h" + +@implementation DIDKitFlutterPlugin ++ (void)registerWithRegistrar:(NSObject*)registrar { +} +@end diff --git a/lib/flutter/ios/Classes/didkit.h b/lib/flutter/ios/Classes/didkit.h new file mode 120000 index 00000000..5db79f9a --- /dev/null +++ b/lib/flutter/ios/Classes/didkit.h @@ -0,0 +1 @@ +../../../../target/didkit.h \ No newline at end of file diff --git a/lib/flutter/ios/didkit.podspec b/lib/flutter/ios/didkit.podspec new file mode 100644 index 00000000..eed38da5 --- /dev/null +++ b/lib/flutter/ios/didkit.podspec @@ -0,0 +1,23 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint didkit.podspec' to validate before publishing. +# +Pod::Spec.new do |s| + s.name = 'didkit' + s.version = '0.0.1' + s.summary = 'DIDKit Flutter plugin - iOS implementation' + s.description = <<-DESC +DIDKit Flutter plugin - iOS implementation + DESC + s.homepage = 'https://github.com/spruceid/didkit/tree/main/lib/flutter' + s.license = { :file => '../LICENSE' } + s.author = { 'Spruce Systems, Inc.' => 'hello@spruceid.com' } + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.public_header_files = 'Classes/**/*.h' + s.dependency 'Flutter' + s.platform = :ios, '8.0' + + # Flutter.framework does not contain a i386 slice. + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } +end diff --git a/lib/flutter/ios/libdidkit.a b/lib/flutter/ios/libdidkit.a new file mode 120000 index 00000000..7eedeff4 --- /dev/null +++ b/lib/flutter/ios/libdidkit.a @@ -0,0 +1 @@ +../../../target/universal/release/libdidkit.a \ No newline at end of file diff --git a/lib/flutter/lib/didkit.dart b/lib/flutter/lib/didkit.dart new file mode 100644 index 00000000..d0b10337 --- /dev/null +++ b/lib/flutter/lib/didkit.dart @@ -0,0 +1,23 @@ +library DIDKit; + +import 'dart:ffi'; +import 'dart:io'; +import 'package:ffi/ffi.dart'; + +typedef get_version_func = Pointer Function(); +typedef GetVersion = Pointer Function(); + +// TODO: support macOS +final DynamicLibrary lib = Platform.isAndroid || Platform.isLinux + ? DynamicLibrary.open("libdidkit.so") + : DynamicLibrary.process(); + +final GetVersion get_version = lib + .lookup>('didkit_get_version') + .asFunction(); + +class DIDKit { + static String getVersion() { + return Utf8.fromUtf8(get_version()); + } +} diff --git a/lib/flutter/libdidkit.so b/lib/flutter/libdidkit.so new file mode 120000 index 00000000..3e79ab96 --- /dev/null +++ b/lib/flutter/libdidkit.so @@ -0,0 +1 @@ +../../target/release/libdidkit.so \ No newline at end of file diff --git a/lib/flutter/pubspec.lock b/lib/flutter/pubspec.lock new file mode 100644 index 00000000..d8b633d8 --- /dev/null +++ b/lib/flutter/pubspec.lock @@ -0,0 +1,153 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.0-nullsafety.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0-nullsafety.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + ffi: + dependency: "direct main" + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + flutter: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.10-nullsafety.1" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.3" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0-nullsafety.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.19-nullsafety.2" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.3" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.3" +sdks: + dart: ">=2.10.0-110 <=2.11.0-185.0.dev" diff --git a/lib/flutter/pubspec.yaml b/lib/flutter/pubspec.yaml new file mode 100644 index 00000000..843eaa1c --- /dev/null +++ b/lib/flutter/pubspec.yaml @@ -0,0 +1,24 @@ +name: didkit +description: A new flutter plugin project. +version: 0.0.1 +author: Charles E. Lehner +homepage: https://github.com/spruceid/didkit/tree/main/lib/flutter + +environment: + sdk: ">=2.7.0 <3.0.0" + +dependencies: + ffi: ^0.1.3 + +dev_dependencies: + flutter_test: + sdk: flutter + +flutter: + plugin: + platforms: + android: + package: com.spruceid.DIDKit + pluginClass: DIDKitFlutterPlugin + ios: + pluginClass: DIDKitFlutterPlugin diff --git a/lib/flutter/test/didkit_test.dart b/lib/flutter/test/didkit_test.dart new file mode 100644 index 00000000..bb347b0d --- /dev/null +++ b/lib/flutter/test/didkit_test.dart @@ -0,0 +1,11 @@ +import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:didkit/didkit.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + test('getVersion', () async { + expect(DIDKit.getVersion(), isInstanceOf()); + }); +} diff --git a/lib/java/README.md b/lib/java/README.md new file mode 100644 index 00000000..3a7f4f07 --- /dev/null +++ b/lib/java/README.md @@ -0,0 +1,22 @@ +# DIDKit - Java + +Java bindings for DIDKit, using [JNI][]. The [JAR][] file includes Java class files. To use this in an application, you must also include the shared library (`libdidkit.so`) in your application in your Java Library Path. + +## Build + +In the parent directory, run: +``` +make ../target/didkit.jar +``` + +To build the shared library: +``` +make ../target/release/libdidkit.so +``` + +## Android + +For Android, you can use the separate [Android library (AAR file)](../android/) which includes the Java class files and compiled shared libraries. + +[JAR]: https://en.wikipedia.org/wiki/JAR_(file_format) +[JNI]: https://en.wikipedia.org/wiki/Java_Native_Interface diff --git a/lib/java/com/spruceid/DIDKit.java b/lib/java/com/spruceid/DIDKit.java new file mode 100644 index 00000000..f65942a3 --- /dev/null +++ b/lib/java/com/spruceid/DIDKit.java @@ -0,0 +1,14 @@ +package com.spruceid; + +public class DIDKit { + public static native String getVersion(); + + static { + System.loadLibrary("didkit"); + } + + public static void main(String[] args) { + String version = DIDKit.getVersion(); + System.out.println("Java libdidkit version: " + version); + } +} diff --git a/lib/src/lib.rs b/lib/src/lib.rs index e69de29b..1efafd47 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -0,0 +1,22 @@ +// pub use ssi::vc::Credential as VerifiableCredential; + +use std::os::raw::c_char; + +pub static VERSION: &str = env!("CARGO_PKG_VERSION"); +pub static VERSION_C: &str = concat!(env!("CARGO_PKG_VERSION"), "\0"); + +#[no_mangle] +pub extern "C" fn didkit_get_version() -> *const c_char { + VERSION_C.as_ptr() as *const c_char +} + +use jni::objects::JClass; +use jni::sys::jstring; +use jni::JNIEnv; + +#[no_mangle] +pub extern "system" fn Java_com_spruceid_DIDKit_getVersion(env: JNIEnv, _class: JClass) -> jstring { + env.new_string(VERSION) + .expect("Unable to create Java string") + .into_inner() +} diff --git a/lib/tests/vc.rs b/lib/tests/vc.rs new file mode 100644 index 00000000..f8ebd1f6 --- /dev/null +++ b/lib/tests/vc.rs @@ -0,0 +1,16 @@ +use didkit::VerifiableCredential; + +#[test] +fn verify_credential() { + let vc_str = r###"{ + "@context": "https://www.w3.org/2018/credentials/v1", + "id": "http://example.org/credentials/3731", + "type": ["VerifiableCredential"], + "issuer": "did:example:30e07a529f32d234f6181736bd3", + "issuanceDate": "2020-08-19T21:41:50Z", + "credentialSubject": { + "id": "did:example:d23dd687a7dc6787646f2eb98d0" + } + }"###; + let cred = VerifiableCredential::from_json_unsigned(vc_str).unwrap(); +}