40 lines
1.5 KiB
Swift
40 lines
1.5 KiB
Swift
//
|
|
// ActionRegisterFidoHandler.swift
|
|
// MobileFirstFramework
|
|
//
|
|
// Created by Scott Pfeil on 6/12/23.
|
|
// Copyright © 2023 Verizon Wireless. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import MVMCore
|
|
import LocalAuthentication
|
|
|
|
open class ActionRegisterFidoHandler: MVMCoreActionHandlerProtocol {
|
|
|
|
required public init() {}
|
|
|
|
public func execute(with model: MVMCore.ActionModelProtocol, delegateObject: MVMCore.DelegateObject?, additionalData: [AnyHashable : Any]?) async throws {
|
|
guard let model = model as? ActionRegisterFidoModel else { return }
|
|
do {
|
|
try await withCheckedThrowingContinuation({ continuation in
|
|
//MFFidoHelper.registerBiometric(model.fidoGuid, accessToken: model.accessToken, userIdentifier: model.userIdentifier) {
|
|
continuation.resume()
|
|
// } errorHandler: { error in
|
|
// continuation.resume(throwing: error)
|
|
// }
|
|
})
|
|
try await delegateObject?.actionDelegate?.action(with: model.onSuccess, additionalData: additionalData, delegateObject: delegateObject)
|
|
} catch {
|
|
let error = error as NSError
|
|
// guard error.code != FidoErrorCode.Canceled.rawValue,
|
|
// error.code != FidoErrorCode.SystemCanceled.rawValue,
|
|
// error.code != FidoErrorCode.UserNotResponsive.rawValue else {
|
|
// // Dont show error on this error codes
|
|
// return
|
|
// }
|
|
throw error
|
|
}
|
|
}
|
|
}
|