mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Make fido2 property a lazy var
- This object was being kept around after being created and as we need it in some other functions it made sense to make it lazy and keep it around that way. - Arguably the FIDO2 instance could be removed after each time it’s been used, but as the FIDO2 class doesn’t have any state stored in it, it seems benign keeping it about for now.
This commit is contained in:
parent
3d9cf73fc1
commit
36424a78e0
1 changed files with 3 additions and 5 deletions
|
|
@ -355,8 +355,8 @@ class AppState: ObservableObject {
|
|||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
var fido2: FIDO2?
|
||||
|
||||
private lazy var fido2 = FIDO2()
|
||||
|
||||
func createAndSubmitSecurityKeyAssertationWithPinCode(_ pinCode: String?, sessionData: AppleSessionData, authOptions: AuthOptionsResponse) {
|
||||
self.presentedSheet = .securityKeyTouchToConfirm
|
||||
|
||||
|
|
@ -379,8 +379,6 @@ class AppState: ObservableObject {
|
|||
|
||||
Task {
|
||||
do {
|
||||
let fido2 = FIDO2()
|
||||
self.fido2 = fido2
|
||||
let response = try fido2.respondToChallenge(args: ChallengeArgs(rpId: rpId, validCredentials: validCreds, devPin: pinCode, challenge: challenge, origin: origin))
|
||||
|
||||
Task { @MainActor in
|
||||
|
|
@ -413,7 +411,7 @@ class AppState: ObservableObject {
|
|||
}
|
||||
|
||||
func cancelSecurityKeyAssertationRequest() {
|
||||
self.fido2?.cancel()
|
||||
self.fido2.cancel()
|
||||
}
|
||||
|
||||
private func handleAuthenticationFlowCompletion(_ completion: Subscribers.Completion<Error>) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue