@@ -114,15 +114,22 @@ extension WebAuthnKey: Signer {
114
114
self . log? . message ( " WebAuthn Controller called to perform request. " , . debug)
115
115
return self . signaturePub!
116
116
}
117
+ . handleEvents ( receiveCancel: {
118
+ self . log? . message ( " WebAuthn signature publisher cancelled " , . debug)
119
+ } )
117
120
. sink ( receiveCompletion: { completion in
121
+ self . log? . message ( " WebAuthn received signature publisher completed with \( completion) " , . debug)
118
122
switch completion {
119
123
case . failure( let err) :
120
124
error = err
121
125
case . finished:
122
126
break
123
127
}
124
128
semaphore. signal ( )
125
- } , receiveValue: { signature = $0 } )
129
+ } , receiveValue: { sig in
130
+ self . log? . message ( " WebAuthn signature received. " , . debug)
131
+ signature = sig
132
+ } )
126
133
127
134
self . log? . message ( " WebAuthn Controller awaiting response. " , . debug)
128
135
semaphore. wait ( )
@@ -151,7 +158,9 @@ extension WebAuthnKey: ASAuthorizationControllerDelegate, ASAuthorizationControl
151
158
let credentialAssertion = authorization. credential as? ASAuthorizationPublicKeyCredentialAssertion ,
152
159
let rawSignature = credentialAssertion. signature
153
160
else {
154
- return signaturePub. send ( completion: . failure( WebAuthnError . signatureError ( " Unexpected operation " ) ) )
161
+ self . log? . message ( " WebAuthn Controller unexpected operation received. " , . warn)
162
+ signaturePub. send ( completion: . failure( WebAuthnError . signatureError ( " Unexpected operation " ) ) )
163
+ return
155
164
}
156
165
157
166
let rawClientData = credentialAssertion. rawClientDataJSON
@@ -164,6 +173,7 @@ extension WebAuthnKey: ASAuthorizationControllerDelegate, ASAuthorizationControl
164
173
165
174
// TODO We should validate the CredentialID, to be sure we signed with the proper key,
166
175
// before we fail or ask the user to retry.
176
+ self . log? . message ( " WebAuthn Controller sending signature " , . debug)
167
177
signaturePub. send ( webAuthnSig)
168
178
signaturePub. send ( completion: . finished)
169
179
}
0 commit comments