From 521aed8cd73413d2f24984c365d3e24f2a71a9f6 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Fri, 5 Apr 2024 10:59:07 +0200 Subject: [PATCH 1/3] Expose remainingDiscoverableCredentials --- .../com/yubico/authenticator/fido/data/Session.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/fido/data/Session.kt b/android/app/src/main/kotlin/com/yubico/authenticator/fido/data/Session.kt index a0a07d40..3cf75159 100644 --- a/android/app/src/main/kotlin/com/yubico/authenticator/fido/data/Session.kt +++ b/android/app/src/main/kotlin/com/yubico/authenticator/fido/data/Session.kt @@ -53,13 +53,16 @@ data class SessionInfo( @SerialName("min_pin_length") val minPinLength: Int, @SerialName("force_pin_change") - val forcePinChange: Boolean + val forcePinChange: Boolean, + @SerialName("remaining_disc_creds") + val remainingDiscoverableCredentials: Int? ) { constructor(infoData: InfoData) : this( Options(infoData), infoData.aaguid, infoData.minPinLength, - infoData.forcePinChange + infoData.forcePinChange, + infoData.remainingDiscoverableCredentials ) override fun equals(other: Any?): Boolean { @@ -71,7 +74,10 @@ data class SessionInfo( if (options != other.options) return false if (!aaguid.contentEquals(other.aaguid)) return false if (minPinLength != other.minPinLength) return false - return forcePinChange == other.forcePinChange + if (forcePinChange != other.forcePinChange) return false + if (remainingDiscoverableCredentials != other.remainingDiscoverableCredentials) return false + + return true } override fun hashCode(): Int { @@ -79,6 +85,7 @@ data class SessionInfo( result = 31 * result + aaguid.contentHashCode() result = 31 * result + minPinLength result = 31 * result + forcePinChange.hashCode() + result = 31 * result + (remainingDiscoverableCredentials ?: 0) return result } From 29a1bcf91c92620bb4ae6a70dd86245b92cd7065 Mon Sep 17 00:00:00 2001 From: Elias Bonnici Date: Fri, 5 Apr 2024 15:13:13 +0200 Subject: [PATCH 2/3] Ensure initial currentSection is `Section.Home` for Android This ensures that the Home `NavigationItem` is not disabled. --- lib/android/init.dart | 8 ++------ lib/android/state.dart | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/android/init.dart b/lib/android/init.dart index 0d9731d6..d0715b03 100644 --- a/lib/android/init.dart +++ b/lib/android/init.dart @@ -93,12 +93,8 @@ Future initialize() async { ]), // this specifies the priority of sections to show when // the connected YubiKey does not support current section - androidSectionPriority.overrideWithValue([ - Section.accounts, - Section.fingerprints, - Section.passkeys, - Section.home - ]), + androidSectionPriority.overrideWithValue( + [Section.accounts, Section.fingerprints, Section.passkeys]), supportedThemesProvider.overrideWith( (ref) => ref.watch(androidSupportedThemesProvider), ), diff --git a/lib/android/state.dart b/lib/android/state.dart index 9b5fa39e..34437cb9 100644 --- a/lib/android/state.dart +++ b/lib/android/state.dart @@ -121,7 +121,7 @@ class AndroidCurrentSectionNotifier extends CurrentSectionNotifier { AndroidCurrentSectionNotifier( this._supportedSectionsByPriority, this._appContextHandler, - ) : super(Section.accounts); + ) : super(Section.home); @override void setCurrentSection(Section section) { From b1322102db118c6ec43d249e42ba992d66878c68 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Fri, 5 Apr 2024 15:48:04 +0200 Subject: [PATCH 3/3] make displayName nullable --- .../main/kotlin/com/yubico/authenticator/fido/FidoManager.kt | 2 +- .../kotlin/com/yubico/authenticator/fido/data/FidoCredential.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/fido/FidoManager.kt b/android/app/src/main/kotlin/com/yubico/authenticator/fido/FidoManager.kt index d617c13d..839dae01 100644 --- a/android/app/src/main/kotlin/com/yubico/authenticator/fido/FidoManager.kt +++ b/android/app/src/main/kotlin/com/yubico/authenticator/fido/FidoManager.kt @@ -434,7 +434,7 @@ class FidoManager( (credentialData.user["id"] as ByteArray).asString(), credentialData.user["name"] as String, publicKeyCredentialDescriptor = credentialData.credentialId, - displayName = credentialData.user["displayName"] as String, + displayName = credentialData.user["displayName"] as String?, ) } }.reduceOrNull { credentials, credentialList -> diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/fido/data/FidoCredential.kt b/android/app/src/main/kotlin/com/yubico/authenticator/fido/data/FidoCredential.kt index cdf2abbd..18a201ef 100644 --- a/android/app/src/main/kotlin/com/yubico/authenticator/fido/data/FidoCredential.kt +++ b/android/app/src/main/kotlin/com/yubico/authenticator/fido/data/FidoCredential.kt @@ -31,7 +31,7 @@ data class FidoCredential( @SerialName("user_name") val userName: String, @SerialName("display_name") - val displayName: String, + val displayName: String?, @Transient val publicKeyCredentialDescriptor: Map = emptyMap() )