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

Periocal refresh of credential auth keys #386

Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
jcenter.bintray.com:443

- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142 # v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: gradle

Expand Down
6 changes: 3 additions & 3 deletions appholder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.android.identity.wallet
import android.app.Application
import com.android.identity.android.util.AndroidLogPrinter
import com.android.identity.util.Logger
import com.android.identity.wallet.util.PeriodicKeysRefreshWorkRequest
import com.android.identity.wallet.util.PreferencesHelper
import com.google.android.material.color.DynamicColors

Expand All @@ -13,5 +14,6 @@ class HolderApp: Application() {
Logger.setLogPrinter(AndroidLogPrinter())
DynamicColors.applyToActivitiesIfAvailable(this)
PreferencesHelper.initialize(this)
PeriodicKeysRefreshWorkRequest(this).schedulePeriodicKeysRefreshing()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ private fun DocumentInfoScreenContent(
)
}
}
val pagerState = rememberPagerState()
val pagerState = rememberPagerState(
initialPage = 0,
pageCount = { screenState.authKeys.size }
)
HorizontalPager(
modifier = Modifier
.fillMaxWidth(),
state = pagerState,
pageCount = screenState.authKeys.size
) { page ->
val key = screenState.authKeys[page]
AuthenticationKeyInfo(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.android.identity.wallet.util

import android.content.Context
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import java.util.concurrent.TimeUnit

class PeriodicKeysRefreshWorkRequest(context: Context) {

private val workManager = WorkManager.getInstance(context)

fun schedulePeriodicKeysRefreshing() {
val workRequest = PeriodicWorkRequestBuilder<RefreshKeysWorker>(1, TimeUnit.DAYS)
.build()
workManager.enqueue(workRequest)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.android.identity.wallet.util

import android.content.Context
import androidx.work.Worker
import androidx.work.WorkerParameters
import com.android.identity.wallet.document.DocumentManager

class RefreshKeysWorker(
context: Context,
params: WorkerParameters
) : Worker(context, params) {

private val documentManager = DocumentManager.getInstance(context)
private val provisioningUtil = ProvisioningUtil.getInstance(context)

override fun doWork(): Result {
documentManager.getDocuments().forEach { documentInformation ->
val credential = documentManager.getCredentialByName(documentInformation.docName)
credential?.let { provisioningUtil.refreshAuthKeys(it, documentInformation) }
}
return Result.success()
}
}
6 changes: 3 additions & 3 deletions appverifier/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class ShowDocumentFragment : Fragment() {
// Get primary color from theme to use in the HTML formatted document.
val color = String.format(
"#%06X",
0xFFFFFF and requireContext().theme.attr(R.attr.colorPrimary).data
0xFFFFFF and requireContext().theme.attr(androidx.appcompat.R.attr.colorPrimary).data
)
sb.append("<h3>Doctype: <font color=\"$color\">${doc.docType}</font></h3>")
val certPath =
Expand Down
26 changes: 14 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
[versions]
compile-sdk = "33"
compile-sdk = "34"
min-sdk = "26"
kotlin = "1.8.20"
gradle-plugin = "7.4.0"
core-ktx = "1.10.1"
gradle-plugin = "8.1.1"
core-ktx = "1.12.0"
appcompat = "1.6.1"
material = "1.9.0"
material = "1.10.0"
constraint-layout = "2.1.4"
lifecycle = "2.2.0"
lifecycle-ktx = "2.6.1"
fragment = "1.6.0"
compose-bom = "2023.06.00"
lifecycle-ktx = "2.6.2"
fragment = "1.6.1"
compose-bom = "2023.10.00"
kotlin-compiler-extension = "1.4.6"
kotlinx-serialization-version = "1.5.0"
legacy-support-v4 = "1.0.0"
androidx-preference = "1.2.0"
androidx-annotation = "1.6.0"
androidx-preference = "1.2.1"
androidx-annotation = "1.7.0"
coroutines-version = "1.7.1"
zxing = "3.4.0"
volley = "1.2.1"
biometrics = "1.2.0-alpha05"
cbor = "0.9"
exif = "1.3.6"
bouncy-castle = "1.67"
bouncy-castle = "1.70"
sonar-gradle-plugin = "3.4.0.2513"
jacoco = "0.47.0"
navigation = "2.6.0"
navigation = "2.7.4"
work_version = "2.8.1"
navigation_plugin = "2.5.3"
code_scanner = "2.1.0"
junit-android-test = "1.1.5"
Expand All @@ -41,6 +42,7 @@
androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragment" }
androidx-legacy-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacy-support-v4" }
androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "androidx-preference" }
androidx-work = { module = "androidx.work:work-runtime-ktx", version.ref = "work_version" }

androidx-lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "lifecycle" }
androidx-lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycle-ktx" }
Expand Down Expand Up @@ -83,7 +85,7 @@
truth = { module = "com.google.truth:truth", version.ref = "truth" }

[bundles]
androidx-core = ["androidx-core-ktx", "androidx-appcompat", "androidx-material", "androidx-contraint-layout", "androidx-fragment-ktx", "androidx-legacy-v4", "androidx-preference-ktx"]
androidx-core = ["androidx-core-ktx", "androidx-appcompat", "androidx-material", "androidx-contraint-layout", "androidx-fragment-ktx", "androidx-legacy-v4", "androidx-preference-ktx", "androidx-work"]
androidx-lifecycle = ["androidx-lifecycle-extensions", "androidx-lifecycle-livedata", "androidx-lifecycle-viewmodel"]
androidx-navigation = ["androidx-navigation-ktx", "androidx-navigation-ui-ktx"]
compose = ["compose-ui", "compose-foundation", "compose-material", "compose-ui-tooling", "compose-preview", "compose-icons"]
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jun 18 17:10:41 CEST 2020
#Mon Oct 16 13:07:44 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
6 changes: 3 additions & 3 deletions identity-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

namespace "com.android.identity"
Expand Down
35 changes: 19 additions & 16 deletions testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}

android {
namespace 'com.android.identity.testapp'
compileSdk 33
compileSdk libs.versions.compile.sdk.get() as int

defaultConfig {
applicationId "com.android.identity.testapp"
minSdk 24
targetSdk 33
minSdk libs.versions.min.sdk.get() as int
targetSdk libs.versions.compile.sdk.get() as int
versionCode 1
versionName "1.0"

Expand All @@ -23,24 +23,27 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}
}

dependencies {
implementation project(':identity')
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation "androidx.biometric:biometric:1.2.0-alpha05"
implementation project(path: ':identity-android')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

implementation libs.bundles.androidx.core
implementation libs.bundles.androidx.lifecycle
implementation libs.bundles.androidx.navigation
implementation libs.bundles.androidx.crypto

androidTestImplementation libs.bundles.ui.testing

testImplementation libs.bundles.unit.testing
}
Loading