mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 00:12:09 +03:00
android updates
This commit is contained in:
parent
ba85a257d4
commit
cf6a57be2e
@ -27,7 +27,7 @@ enum class FidoActionDescription(private val value: Int) {
|
||||
RenameFingerprint(5),
|
||||
RegisterFingerprint(6),
|
||||
EnableEnterpriseAttestation(7),
|
||||
ActionFailure(7);
|
||||
ActionFailure(8);
|
||||
|
||||
val id: Int
|
||||
get() = value + dialogDescriptionFidoIndex
|
||||
|
@ -252,11 +252,6 @@ class FidoManager(
|
||||
ClientPin.PIN_PERMISSION_BE else 0
|
||||
}
|
||||
|
||||
private fun getPinPermissionsACFG(fidoSession: YubiKitFidoSession): Int {
|
||||
return if(Config.isSupported(fidoSession.cachedInfo))
|
||||
ClientPin.PIN_PERMISSION_ACFG else 0
|
||||
}
|
||||
|
||||
private fun unlockSession(
|
||||
fidoSession: YubiKitFidoSession,
|
||||
clientPin: ClientPin,
|
||||
@ -613,41 +608,44 @@ class FidoManager(
|
||||
|
||||
private suspend fun enableEnterpriseAttestation(): String =
|
||||
connectionHelper.useSession(FidoActionDescription.EnableEnterpriseAttestation) { fidoSession ->
|
||||
|
||||
val uvAuthProtocol = getPreferredPinUvAuthProtocol(fidoSession.cachedInfo)
|
||||
val clientPin = ClientPin(fidoSession, uvAuthProtocol)
|
||||
val token = if (pinStore.hasPin()) {
|
||||
clientPin.getPinToken(
|
||||
pinStore.getPin(),
|
||||
getPinPermissionsACFG(fidoSession),
|
||||
null
|
||||
)
|
||||
} else null
|
||||
val config = Config(fidoSession, uvAuthProtocol, token)
|
||||
|
||||
try {
|
||||
config.enableEnterpriseAttestation()
|
||||
fidoViewModel.setSessionState(
|
||||
Session(
|
||||
fidoSession.info,
|
||||
pinStore.hasPin(),
|
||||
pinRetries
|
||||
if (Config.isSupported(fidoSession.cachedInfo)) {
|
||||
val uvAuthProtocol = getPreferredPinUvAuthProtocol(fidoSession.cachedInfo)
|
||||
val clientPin = ClientPin(fidoSession, uvAuthProtocol)
|
||||
val token = if (pinStore.hasPin()) {
|
||||
clientPin.getPinToken(
|
||||
pinStore.getPin(),
|
||||
ClientPin.PIN_PERMISSION_ACFG,
|
||||
null
|
||||
)
|
||||
)
|
||||
return@useSession JSONObject(
|
||||
mapOf(
|
||||
"success" to true,
|
||||
)
|
||||
).toString()
|
||||
} else null
|
||||
val config = Config(fidoSession, uvAuthProtocol, token)
|
||||
|
||||
} catch (e: Exception) {
|
||||
logger.error("Failed to enable enterprise attestation. ", e)
|
||||
return@useSession JSONObject(
|
||||
mapOf(
|
||||
"success" to false,
|
||||
try {
|
||||
config.enableEnterpriseAttestation()
|
||||
fidoViewModel.setSessionState(
|
||||
Session(
|
||||
fidoSession.info,
|
||||
pinStore.hasPin(),
|
||||
pinRetries
|
||||
)
|
||||
)
|
||||
).toString()
|
||||
} catch (e: Exception) {
|
||||
logger.error("Failed to enable enterprise attestation. ", e)
|
||||
return@useSession JSONObject(
|
||||
mapOf(
|
||||
"success" to false,
|
||||
)
|
||||
).toString()
|
||||
}
|
||||
} else {
|
||||
logger.debug("authenticatorConfig not supported, ignoring call to enableEnterpriseAttestation")
|
||||
}
|
||||
|
||||
return@useSession JSONObject(
|
||||
mapOf(
|
||||
"success" to true,
|
||||
)
|
||||
).toString()
|
||||
}
|
||||
|
||||
override fun onDisconnected() {
|
||||
|
@ -80,6 +80,8 @@ enum _DDesc {
|
||||
fidoDeleteCredential,
|
||||
fidoDeleteFingerprint,
|
||||
fidoRenameFingerprint,
|
||||
fidoRegisterFingerprint,
|
||||
fidoEnableEnterpriseAttestation,
|
||||
fidoActionFailure,
|
||||
// Others
|
||||
invalid;
|
||||
@ -105,7 +107,9 @@ enum _DDesc {
|
||||
dialogDescriptionFidoIndex + 3: fidoDeleteCredential,
|
||||
dialogDescriptionFidoIndex + 4: fidoDeleteFingerprint,
|
||||
dialogDescriptionFidoIndex + 5: fidoRenameFingerprint,
|
||||
dialogDescriptionFidoIndex + 6: fidoActionFailure,
|
||||
dialogDescriptionFidoIndex + 6: fidoRegisterFingerprint,
|
||||
dialogDescriptionFidoIndex + 7: fidoEnableEnterpriseAttestation,
|
||||
dialogDescriptionFidoIndex + 8: fidoActionFailure,
|
||||
}[id] ??
|
||||
_DDesc.invalid;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user