This commit is contained in:
Adam Velebil 2024-07-03 16:29:23 +02:00
commit c90ba130ce
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10
20 changed files with 34 additions and 50 deletions

View File

@ -94,23 +94,16 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'
// Lifecycle
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.3'
implementation "androidx.core:core-ktx:1.13.0"
implementation 'androidx.fragment:fragment-ktx:1.6.2'
implementation "androidx.core:core-ktx:1.13.1"
implementation 'androidx.fragment:fragment-ktx:1.8.1'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.github.tony19:logback-android:3.0.0'
implementation('commons-codec:commons-codec') {
version {
// use version 1.15 for compatibility reasons
strictly '1.15'
}
}
// testing dependencies
testImplementation "junit:junit:$project.junitVersion"
testImplementation "org.mockito:mockito-core:$project.mockitoVersion"

View File

@ -37,7 +37,7 @@ import android.os.Build
* @param sdkVersion the version this instance uses for compatibility checking. The release app
* uses `Build.VERSION.SDK_INT`, tests use appropriate other values.
*/
@Suppress("MemberVisibilityCanBePrivate", "unused")
@Suppress("MemberVisibilityCanBePrivate")
class CompatUtil(private val sdkVersion: Int) {
/**
* Wrapper class holding values computed by [CompatUtil]

View File

@ -231,7 +231,7 @@ class MainActivity : FlutterFragmentActivity() {
startNfcDiscovery()
}
val usbManager = getSystemService(Context.USB_SERVICE) as UsbManager
val usbManager = getSystemService(USB_SERVICE) as UsbManager
if (UsbManager.ACTION_USB_DEVICE_ATTACHED == intent.action) {
val device = intent.parcelableExtra<UsbDevice>(UsbManager.EXTRA_DEVICE)
if (device != null) {
@ -495,7 +495,7 @@ class MainActivity : FlutterFragmentActivity() {
}
"hasCamera" -> {
val cameraService =
getSystemService(Context.CAMERA_SERVICE) as CameraManager
getSystemService(CAMERA_SERVICE) as CameraManager
result.success(
cameraService.cameraIdList.any {
cameraService.getCameraCharacteristics(it)

View File

@ -19,7 +19,6 @@ package com.yubico.authenticator.fido
import com.yubico.authenticator.DialogIcon
import com.yubico.authenticator.DialogManager
import com.yubico.authenticator.DialogTitle
import com.yubico.authenticator.MainViewModel
import com.yubico.authenticator.device.DeviceManager
import com.yubico.authenticator.fido.data.YubiKitFidoSession
import com.yubico.authenticator.yubikit.withConnection

View File

@ -210,7 +210,7 @@ class FidoManager(
currentSession
)
val sameDevice = currentSession.equals(previousSession)
val sameDevice = currentSession == previousSession
if (device is NfcYubiKeyDevice && (sameDevice || resetHelper.inProgress)) {
connectionHelper.invokePending(fidoSession)

View File

@ -32,11 +32,11 @@ data class Options(
val alwaysUv: Boolean
) {
constructor(infoData: InfoData) : this(
infoData.getOptionsBoolean("clientPin") ?: false,
infoData.getOptionsBoolean("credMgmt") ?: false,
infoData.getOptionsBoolean("credentialMgmtPreview") ?: false,
infoData.getOptionsBoolean("clientPin") == true,
infoData.getOptionsBoolean("credMgmt") == true,
infoData.getOptionsBoolean("credentialMgmtPreview") == true,
infoData.getOptionsBoolean("bioEnroll"),
infoData.getOptionsBoolean("alwaysUv") ?: false,
infoData.getOptionsBoolean("alwaysUv") == true,
)
companion object {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Yubico.
* Copyright (C) 2022-2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -70,7 +70,7 @@ class FlutterLog(messenger: BinaryMessenger) {
}
private fun logLevelFromArgument(argValue: String?): Log.LogLevel? =
Log.LogLevel.values().firstOrNull { it.name == argValue?.uppercase() }
Log.LogLevel.entries.firstOrNull { it.name == argValue?.uppercase() }
private fun loggerError(message: String) {
log(Log.LogLevel.ERROR,"FlutterLog", message, null)

View File

@ -26,7 +26,6 @@ import com.yubico.authenticator.*
import com.yubico.authenticator.device.Capabilities
import com.yubico.authenticator.device.DeviceListener
import com.yubico.authenticator.device.DeviceManager
import com.yubico.authenticator.device.Info
import com.yubico.authenticator.device.UnknownDevice
import com.yubico.authenticator.oath.data.Code
import com.yubico.authenticator.oath.data.CodeType
@ -43,13 +42,11 @@ import com.yubico.authenticator.oath.keystore.ClearingMemProvider
import com.yubico.authenticator.oath.keystore.KeyProvider
import com.yubico.authenticator.oath.keystore.KeyStoreProvider
import com.yubico.authenticator.oath.keystore.SharedPrefProvider
import com.yubico.authenticator.yubikit.getDeviceInfo
import com.yubico.authenticator.yubikit.withConnection
import com.yubico.yubikit.android.transport.nfc.NfcYubiKeyDevice
import com.yubico.yubikit.android.transport.usb.UsbYubiKeyDevice
import com.yubico.yubikit.core.Transport
import com.yubico.yubikit.core.YubiKeyDevice
import com.yubico.yubikit.core.application.ApplicationNotAvailableException
import com.yubico.yubikit.core.smartcard.ApduException
import com.yubico.yubikit.core.smartcard.AppId
import com.yubico.yubikit.core.smartcard.SW
@ -57,7 +54,6 @@ import com.yubico.yubikit.core.smartcard.SmartCardConnection
import com.yubico.yubikit.core.smartcard.SmartCardProtocol
import com.yubico.yubikit.core.util.Result
import com.yubico.yubikit.oath.CredentialData
import com.yubico.yubikit.support.DeviceUtil
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.MethodChannel
import kotlinx.coroutines.*
@ -268,7 +264,7 @@ class OathManager(
try {
SmartCardProtocol(connection).select(AppId.OTP)
} catch (e: Exception) {
logger.error("Failed to recognize this OATH device.")
logger.error("Failed to recognize this OATH device.", e)
// we know this is NFC device and it supports OATH
val oathCapabilities = Capabilities(nfc = 0x20)
deviceManager.setDeviceInfo(

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yubico.
* Copyright (C) 2023-2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,10 +25,8 @@ typealias YubiKitCode = com.yubico.yubikit.oath.Code
data class Code(
val value: String? = null,
@SerialName("valid_from")
@Suppress("unused")
val validFrom: Long,
@SerialName("valid_to")
@Suppress("unused")
val validTo: Long
) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Yubico.
* Copyright (C) 2022,2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,7 +16,6 @@
package com.yubico.authenticator.oath.keystore
import android.security.keystore.KeyProperties
import com.yubico.yubikit.oath.AccessKey
import java.util.*
import javax.crypto.Mac

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yubico.
* Copyright (C) 2023-2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@
package com.yubico.authenticator.device
import com.yubico.authenticator.jsonSerializer
import com.yubico.yubikit.management.DeviceConfig
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonNull
import kotlinx.serialization.json.JsonObject

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Yubico.
* Copyright (C) 2022-2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -42,7 +42,7 @@ class SkyHelperTest {
fun `supports three specific UsbPids`() {
val skyHelper = SkyHelper(CompatUtil(33))
for (pid in UsbPid.values()) {
for (pid in UsbPid.entries) {
val ykDevice = getUsbYubiKeyDeviceMock().also {
`when`(it.pid).thenReturn(pid)
}

View File

@ -11,7 +11,7 @@ allprojects {
yubiKitVersion = "2.6.0"
junitVersion = "4.13.2"
mockitoVersion = "5.11.0"
mockitoVersion = "5.12.0"
}
}

View File

@ -2,14 +2,14 @@ group 'com.yubico.authenticator.flutter_plugins.qrscanner_zxing'
version '1.0'
buildscript {
ext.kotlin_version = '1.9.23'
ext.kotlin_version = '2.0.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.android.tools.build:gradle:8.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@ -50,7 +50,7 @@ android {
}
dependencies {
def camerax_version = "1.3.3"
def camerax_version = "1.3.4"
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
implementation "androidx.camera:camera-view:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"

View File

@ -1,6 +1,6 @@
#Mon Oct 16 08:48:17 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Yubico.
* Copyright (C) 2022,2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -42,7 +42,7 @@ class PermissionsResultRegistrar {
requestCode,
permissions,
grantResults
) ?: false
) == true
}
}

View File

@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.9.10'
ext.kotlin_version = '2.0.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.2'
classpath 'com.android.tools.build:gradle:8.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip

View File

@ -1,6 +1,6 @@
#Mon Aug 15 14:34:17 CEST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -26,9 +26,9 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.3.2" apply false
id "org.jetbrains.kotlin.android" version "1.9.23" apply false
id "org.jetbrains.kotlin.plugin.serialization" version "1.9.23" apply false
id "com.android.application" version "8.5.0" apply false
id "org.jetbrains.kotlin.android" version "2.0.0" apply false
id "org.jetbrains.kotlin.plugin.serialization" version "2.0.0" apply false
id "com.google.android.gms.oss-licenses-plugin" version "0.10.6" apply false
}