Skip to content

functionland/wnfs-android

Repository files navigation

WNFS-lib For Android

Webnative Filesystem(WNFS) wrapper for Android.

Usage

Exposed endpoint: mkdir, writeFile, writeFileFromPath, readFile, readFileToPath, readFilestreamToPath, rm, cp, mv

Manual Build

Prerequisites

Use Ubuntu (on Windows it complains about openssl)

  • Kotlin toolchain
  • Android SDK + NDK (latest)
  • python3 and Python command available
  • Cargo and CMake
  • java
  • gradle
  • rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android

Common Errors

  • Make sure the build.gradle shows the correct ndk version you have if you see:
[CXX1104] NDK from ndk.dir at /.../ndk/25.2.9519653 had version [25....] which disagrees with android.ndkVersion [25.1.8937393]
  • Make sure you define a local.properties file in the project root with the below line in it if you see NDK not found:
ndk.dir=/paht-to-ndk/ndk/25.....

Debug

Make sure you have switch to debug profile in cargo config, which could be found at lib/build.gradle

Run the command to build

./gradlew lib:assemble

Connect to a device or setup an AVD and check the functionality.

./gradlew appmock:connectedCheck

Build

Before make a release build, ensure you have set profile = "release" in cargo config.

./gradlew lib:assemble

The generated release build is lib/build/outputs/aar/lib-release.aar

Publish New Version

Ensure you have committed your changes.

./gradlew release

Then simply push to the repo.

Roadmap

Please note the following might not be done in order:

  • Initial version with all functions included
  • Add WNFS tree encryption key generation from an input (deterministically)
  • add error catching
  • add metadata to ls and make it array
  • Improve read function to use a stream. ( 💯 v1 Release here )
  • remove dependancy to custom version of wnfs