File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import SwiftUI
99import LibFido2Swift
1010
1111struct ContentView : View {
12+ let fido2 = FIDO2 ( )
1213 @AppStorage ( " challengeUrl " ) var challengeUrl = " "
1314 @AppStorage ( " rpId " ) var rpId = " "
1415 @AppStorage ( " validCreds " ) var validCreds = " "
@@ -23,13 +24,18 @@ struct ContentView: View {
2324 TextField ( " Valid Credentials (comma separated) " , text: $validCreds)
2425 TextField ( " Origin " , text: $origin)
2526 TextField ( " Device Pin " , text: $devicePin)
26- Button ( " FIDO " ) {
27- do {
28- try fido ( )
29- } catch {
30- print ( error)
27+ Button ( " Get Assertion " ) {
28+ DispatchQueue . global ( ) . async {
29+ do {
30+ try fido ( )
31+ } catch {
32+ print ( error)
33+ }
3134 }
3235 }
36+ Button ( " Cancel " ) {
37+ fido2. cancel ( )
38+ }
3339 }
3440 VStack {
3541 Text ( " Response: " )
@@ -44,7 +50,6 @@ struct ContentView: View {
4450 }
4551
4652 func fido( ) throws {
47- let fido2 = FIDO2 ( )
4853 let validCredsArray = validCreds. split ( separator: " , " ) . map { String ( $0) }
4954 let response = try fido2. respondToChallenge ( args: ChallengeArgs ( rpId: rpId,
5055 validCredentials: validCredsArray,
You can’t perform that action at this time.
0 commit comments