Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 17d4489

Browse files
committed
Translate #7: authenticate WebAuthn
1 parent c323ce0 commit 17d4489

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

WordPressAuthenticator/Services/WordPressComOAuthClientFacade+Swift.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,30 @@ extension WordPressComOAuthClientFacade {
8787
self.client.requestWebauthnChallenge(userID: userID, twoStepNonce: twoStepNonce, success: success, failure: failure)
8888
}
8989

90+
func authenticateWebauthnSignature(
91+
userID: Int64,
92+
twoStepNonce: String,
93+
credentialID: Data,
94+
clientDataJson: Data,
95+
authenticatorData: Data,
96+
signature: Data,
97+
userHandle: Data,
98+
success: @escaping (_ authToken: String) -> Void,
99+
failure: @escaping (_ error: NSError) -> Void
100+
) {
101+
self.client.authenticateWebauthnSignature(
102+
userID: userID,
103+
twoStepNonce: twoStepNonce,
104+
credentialID: credentialID,
105+
clientDataJson: clientDataJson,
106+
authenticatorData: authenticatorData,
107+
signature: signature,
108+
userHandle: userHandle,
109+
success: success,
110+
failure: failure
111+
)
112+
}
113+
90114
}
91115

92116
// MARK: - This extension is needed because WordPressComOAuthClientFacade cannot access the WordPressAuthenticatorConfiguration struct.

WordPressAuthenticator/Services/WordPressComOAuthClientFacade.m

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,4 @@ - (instancetype)init {
2929
return nil;
3030
}
3131

32-
- (void) authenticateWebauthnSignatureWithUserID:(NSInteger)userID
33-
twoStepNonce:(NSString *)twoStepNonce
34-
credentialID:(NSData *)credentialID
35-
clientDataJson:(NSData *)clientDataJson
36-
authenticatorData:(NSData *)authenticatorData
37-
signature:(NSData *)signature
38-
userHandle:(NSData *)userHandle
39-
success:(void (^)(NSString *authToken))success
40-
failure:(void (^)(NSError *error))failure {
41-
[self.client authenticateWebauthnSignatureWithUserID:userID
42-
twoStepNonce:twoStepNonce
43-
credentialID:credentialID
44-
clientDataJson:clientDataJson
45-
authenticatorData:authenticatorData
46-
signature:signature
47-
userHandle:userHandle
48-
success:success
49-
failure:failure];
50-
}
51-
5232
@end

0 commit comments

Comments
 (0)