Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Reader App #449

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.gradle
/local.properties
.DS_Store
/build
*/build/
/captures
.externalNativeBuild
.idea/
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ samples are included
- `age-verifier-mdl` - a simple mDL reader for age attestations.
- This application is just requesting the `age_over_21` and `portrait`. It's intended
to be used with the `preconsent-mdl` sample for performance evaluation.
- `simple-verifier` - a simple mDL reader for age attestations.
- This application requests either {`age_over_21` and `portrait`} or
{`age_over_18` and `portrait`}. It's intended to demonstrate use of the
`MdocReaderPrompt` class, which allows any app to easily act as a reader app for
the common age-verification use case.

## ISO 18013-7 Reader Website

Expand Down
1 change: 1 addition & 0 deletions samples/simple-verifier/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
69 changes: 69 additions & 0 deletions samples/simple-verifier/build.gradle
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.6'
}
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
}
21 changes: 21 additions & 0 deletions samples/simple-verifier/proguard-rules.pro
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
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)
}
}
57 changes: 57 additions & 0 deletions samples/simple-verifier/src/main/AndroidManifest.xml
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>
Loading
Loading