15 December 2022
A new sample project for the Android libProofMode library has been posted.
This sample shows how to generate and share proof generated by the libProofMode Android library from ProofMode.org. There is a simple Kotlin-based Android project with a floating button used for selecting a photo, and then a second button for sharing the generated proof as a zip file.
Add the Guardian Project Maven repo hosted on Github
maven { url "https://raw.githubusercontent.com/guardianproject/gpmaven/master" }
Add the dependency libraries
//add the libProofMode library
implementation 'org.witness:android-libproofmode:1.0.18'
//add Google SafetyNet
implementation 'com.google.android.gms:play-services-safetynet:18.0.1'
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
//add Timber logging
implementation 'com.jakewharton.timber:timber:5.0.1'
//add OpenTimestamps
implementation('com.eternitywall:java-opentimestamps:1.20') {
exclude group: 'org.bitcoinj'
exclude group: 'com.google.protobuf'
exclude group: 'org.slf4j'
exclude group: 'net.jcip'
exclude group: 'commons-cli'
exclude group: 'org.json'
exclude group: 'com.sun.xml'
exclude group: 'org.glassfish.jaxb'
}
//add BouncyCastle crypto libs
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.72'
implementation 'org.bouncycastle:bcprov-jdk15to18:1.72'
implementation 'org.bouncycastle:bcpg-jdk15to18:1.71'
ProofMode requires one simple call for generating proof - just the Uri of the media. All proof is stored in internal app storage, in a folder using the generated sha256 hash value.
//generate proof for a URI
var proofHash = ProofMode.generateProof(this,uriMedia)
//get the folder that proof is stored
var proofDir = ProofMode.getProofDir(this, proofHash)
If you want to include all Proofmode values, you’ll need to add and request additional permissions to your app
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
tools:remove="android:maxSdkVersion" />
<uses-permission
android:name="android.permission.ACCESS_BACKGROUND_LOCATION"
tools:remove="android:maxSdkVersion" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"
tools:remove="android:maxSdkVersion" />
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:remove="android:maxSdkVersion" />