credible
credible is a native mobile wallet that supports w3c verifiable credentials and decentralized identifiers built on didkit and flutter. we packaged the didkit library written in rust into a flutter application running on both android and ios, using c bindings and dart’s ffi capabilities. this is the wallet counterpart to the rich, growing toolkit supplied by didkit, the two pillars of a reference architecture for creating trusted interactions at scale.
maturity disclaimer
in the v0.1 release on february 10, 2021, credible has not yet undergone a formal security audit and to desired levels of confidence for suitable use in production systems. this implementation is currently suitable for exploratory work and experimentation only. we welcome feedback on the usability, architecture, and security of this implementation and are committed to a conducting a formal audit with a reputable security firm before the v1.0 release. we are also working on large stability improvements through a continuous integration testing process across android and ios.
we are setting up a process to accept contributions. please feel free to open issues or prs in the interim, but we cannot merge external changes until this process is in place.
we are also in the process of listing credible on the ios testflight and android play beta programs, and eventually their respective app marketplaces plus f-droid.
common dependencies
to manually build credible for either android or ios, you will need to install the following dependencies:
- rust
- java 7 or higher
- flutter (
dev
channel) - didkit/ssi
wasm-pack
(web)binaryen
(web and targeting asm.js)
rust
it is recommended to use rustup to manage your rust installation.
java
on ubuntu you could run:
# apt update
# apt install openjdk-8-jdk
for more information, please refer to the documentation of your favorite flavour of java and your operating system/package manager.
flutter
please follow the official instalation instructions available here to install flutter, don’t forget to also install the build dependencies for the platform you will be building (android sdk/ndk, xcode, etc).
we currently only support build this project using the dev
channel of flutter.
to change your installation to the dev
channel, please execute the following command:
$ flutter channel dev
$ flutter upgrade
to confirm that everything is setup correctly, please run the following command and resolve any issues that arise before proceeding to the next steps.
$ flutter doctor
wasm-pack
(required for both web targets)
to build the wasm target you will need wasm-pack
, it can be obtained running:
$ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -ssf | sh
binaryen
to build credible for web using asm.js you will need binaryen, which allows the conversion of didkit wasm to asm.js. this is necessary when you don’t have wasm support and need to run your page in pure javascript. more detailed instructions on how to build binaryen
can be found here.
if you are in a unix-like distribution you just have to download the repo and build, we recommend cloning into your ${home}
, to avoid having to specify the ${binaryen_root}
variable:
$ webassembly/binaryen ~/binaryen
$ cd ~/binaryen
$ cmake . && make
didkit and ssi
this project also depends on two other spruce projects, didkit
and ssi
.
these projects are all configured to work with relative paths by default, so it is recommended to download them all under the same root directory, for example $home/spruceid/{didkit,ssi,credible}
.
target-specific dependencies
android dependencies
to build credible for android, you will require both the android sdk and ndk.
these two dependencies can be easily obtained with android studio, which install further dependencies upon first being opened after installation. installing the appropriate android ndk (often not the newest) in android studio can be accomplished by going to settings > appearance & behavior > system settings > android sdk and selecting to install the “ndk (side by side)”. an alternative method of installing sdk and ndk without android studio can be found in the optional install_android_dependencies.sh script included here.
if your android sdk doesn’t live at $home/android/sdk
you will need to set android_sdk_root
like so:
$ export android_sdk_root=/path/to/android/sdk
:::note some users have experienced difficulties with cross-compilation artefacts missing from the newest ndk, which is downloaded by default in the installation process. if you experience errors of this kind, you may have to manually downgrade or install multiple ndk versions as [shown here])(img/ndk_downgrade.png) in the android studio installer (screengrabbed from an ubuntu installation). alternately, running all or parts of the install_android_dependencies.sh script may be helpful.
if your build-tools
and/or ndk
live in different locations than the default ones inside /sdk/, or if you want to specify a specific ndk or build-tools version, you can manually configure the following two environment variables:
$ export android_tools=/path/to/sdk/build-tools/xx.x.x/
$ export android_ndk_home=/path/to/sdk/ndk/xx.x.xxxxx/
:::
ios dependencies
to build credible for ios you will need to install cocoapods, which can be done with homebrew on macos.
$ brew install cocoapods
building didkit for different targets
android
to build didkit
for the android targets, you will go to the root of didkit
and run:
$ make -c lib install-rustup-android
$ make -c lib ../target/test/java.stamp
$ make -c lib ../target/test/aar.stamp
$ make -c lib ../target/test/flutter.stamp
$ cargo build
this may take some time as it compiles the entire project for multiple targets
android apk
$ flutter build apk
android app bundle
$ flutter build appbundle
ios
to build didkit for the ios targets, you will go to the root of didkit
and run :
$ make -c lib install-rustup-ios
$ make -c lib ../target/test/ios.stamp
$ cargo build
web using wasm
$ make -c lib ../target/test/wasm.stamp
web using asm.js
if you have installed bynarien
somewhere other than $home, you will have to set bynarien_root
as shown below, otherwise, just run the make
command.
$ export binaryen_root=/path/to/binaryen
$ make -c lib ../target/test/asmjs.stamp
building credible
you are now ready to build or run credible.
run on emulator
if you want to run the project on your connected device, you can use:
$ flutter run
run on browser
if you want to run the project on your browser, you can use:
$ flutter run -d chrome --csp --release
otherwise, flutter allows us to build many artifacts for android, ios and web, below you can find the most common and useful commands, all of which you should run from the root of credible.
ios .app for simulator
$ flutter build ios --simulator
ios .app for devices
$ flutter build ios --no-codesign
ios ipa
$ flutter build ipa
web
$ flutter build web
--csp
--release
if you don’t have support for wasm, you’ll probably need to provide your own canvaskit
dependency without wasm as well as didkit, to do that you need to specify the flutter_web_canvaskit_url
in the build command like below.
$ flutter build web
--csp
--dart-define=flutter_web_canvaskit_url=vendor/
--release
for more details about any of these commands you can run
$ flutter build $subcommand --help
note about canvaskit
since by default canvaskit
comes in a wasm
build, in order to the asm.js
be fully supported canvaskit
was manually built for this target.
a prebuilt canvaskit
is already included in the credible web folder. if you want to build it by yourself, however, follow these steps:
- install
emscripten
- download skia repository and pull its dependencies
git download https://skia.googlesource.com/skia.git –depth 1 –branch canvaskit/0.22.0
cd skia
python2 tools/git-sync-deps - modify build script
modules/canvaskit/compile.sh
diff –git a/modules/canvaskit/compile.sh b/modules/canvaskit/compile.sh
index 6ba58bfae9..51f0297eb6 100755
— a/modules/canvaskit/compile.sh
+++ b/modules/canvaskit/compile.sh
@@ -397,6 +397,7 @@ emcc_debug=1 ${emcxx}
-s modularize=1
-s no_exit_runtime=1
-s initial_memory=128mb- -s wasm=1
- -s wasm=0
- -s no_dynamic_execution=1
$strictness
-o $build_dir/canvaskit.js
- build
canvaskit
$ cd modules/canvaskit
$ make debug - replace this line on
$skia/modules/canvaskit/canvaskit/bin/canvaskit.js
618c618
< var isnode = !(new function(‘try {return this===window;}catch(e){ return false;}’)());var isnode = false;
- copy
$skia/modules/canvaskit/canvaskit/bin/canvaskit.js
to$credible/web/vendor/
- build credible as described above.
troubleshooting
if you encounter any errors in the build process described here, please first try clean builds of the projects listed.
for instance, on flutter, you can delete build files to start over by running:
$ flutter clean
also, reviewing the install_android_dependencies.sh script may be helpful.
Comments are closed.