-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding sample for a simple age-verification reader app demonstrating
use of the MdocReaderPrompt class, which allows any app to easily act as a reader app for the common age-verification use case. This class abstracts much of the VerificationHelper details for a simpler API which only requires an MdocReaderSettings object as input before it can be shown. The MdocReaderPrompt object, once created, has a `show` method which will show relevant UI on-screen for in-person verification. Data from the transaction is not passed back to the app Signed-off-by: Suzanna Jiwani <[email protected]>
- Loading branch information
1 parent
ca5956a
commit 0c1b7f0
Showing
33 changed files
with
1,570 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
plugins { | ||
alias(libs.plugins.android.application) | ||
alias libs.plugins.kotlin.android | ||
} | ||
|
||
android { | ||
namespace 'com.example.simple_verifier' | ||
compileSdk 34 | ||
|
||
defaultConfig { | ||
applicationId "com.example.simple_verifier" | ||
minSdk 29 | ||
targetSdk 34 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables { | ||
useSupportLibrary true | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_11 | ||
targetCompatibility JavaVersion.VERSION_11 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '11' | ||
} | ||
buildFeatures { | ||
compose true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion '1.4.5' | ||
} | ||
packagingOptions { | ||
resources { | ||
excludes += '/META-INF/{AL2.0,LGPL2.1}' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation platform(libs.compose.bom) | ||
implementation libs.bundles.androidx.core | ||
implementation libs.bundles.androidx.lifecycle | ||
implementation libs.bundles.androidx.navigation | ||
implementation libs.bundles.androidx.crypto | ||
implementation libs.bundles.androidx.activity.compose | ||
implementation libs.androidx.navigation.compose | ||
implementation libs.bundles.bouncy.castle | ||
implementation libs.bundles.compose | ||
implementation libs.code.scanner | ||
|
||
implementation("com.android.identity:identity-credential-android:20231002") | ||
implementation("com.android.identity:identity-credential:20231002") | ||
|
||
androidTestImplementation libs.androidx.test.ext.junit | ||
androidTestImplementation libs.androidx.test.espresso | ||
androidTestImplementation platform(libs.compose.bom) | ||
testImplementation libs.bundles.unit.testing | ||
testRuntimeOnly libs.junit.jupiter.engine | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
...mple-verifier/src/androidTest/java/com/example/simple_verifier/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.example.simple_verifier | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.example.simple_verifier", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-feature | ||
android:name="android.hardware.bluetooth_le" | ||
android:required="true" /> | ||
<uses-feature | ||
android:name="android.hardware.camera" | ||
android:required="true" /> | ||
<uses-feature | ||
android:name="android.hardware.nfc" | ||
android:required="true" /> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<!-- As of API 31 BLE doesn't need location permission, but WiFi aware still requires it. --> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.CAMERA" /> | ||
<uses-permission android:name="android.permission.NFC" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> | ||
|
||
<!-- Legacy bluetooth permissions --> | ||
<uses-permission android:name="android.permission.BLUETOOTH" | ||
android:maxSdkVersion="30" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" | ||
android:maxSdkVersion="30" /> | ||
|
||
<!-- Bluetooth permissions for Android 12+ --> | ||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" | ||
android:usesPermissionFlags="neverForLocation" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> | ||
|
||
<uses-permission android:name="android.permission.VIBRATE"/> | ||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.IdentityCredential"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true" | ||
android:label="@string/app_name" | ||
android:theme="@style/Theme.IdentityCredential"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.