Changeset 285965 in webkit
- Timestamp:
- Nov 17, 2021, 4:10:02 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/Cocoa/_WKAuthenticatorResponse.h (modified) (1 diff)
-
UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r285959 r285965 1 2021-11-17 J Pascoe <j_pascoe@apple.com> 2 3 [WebAuthn] Add SPI for makeCredential / getAssertion using clientDataHash 4 https://bugs.webkit.org/show_bug.cgi?id=233216 5 <rdar://problem/85476386> 6 7 Reviewed by Brent Fulgham. 8 9 In order to avoid needing to make and coordinate changes to ASC to support new fields or changes 10 within ClientDataJSON and to maintain a single source of truth, calls to ASC from WebKit 11 will contain a precomputed ClientDataHash. This change creates new SPIs that will be called 12 from ASC using the ClientDataHash. 13 14 * UIProcess/API/Cocoa/_WKAuthenticatorResponse.h: 15 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: 16 (-[_WKWebAuthenticationPanel makeCredentialWithClientDataHash:options:completionHandler:]): 17 (-[_WKWebAuthenticationPanel getAssertionWithClientDataHash:options:completionHandler:]): 18 New functions to take in ClientDataHash instead of the data needed to construct it. 19 1 20 2021-11-17 Per Arne Vollan <pvollan@apple.com> 2 21 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAuthenticatorResponse.h
r279089 r285965 39 39 40 40 @property (nonatomic, readonly) _WKAuthenticatorAttachment attachment; 41 @property (n onatomic, readonly) NSData *clientDataJSON;41 @property (nullable, nonatomic, readonly) NSData *clientDataJSON; 42 42 @property (nonatomic, readonly) NSData *rawId; 43 43 @property (nullable, nonatomic, readonly, strong) _WKAuthenticationExtensionsClientOutputs *extensions; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm
r285763 r285965 581 581 } 582 582 583 - (void)makeCredentialWithClientDataHash:(NSData *)clientDataHash options:(_WKPublicKeyCredentialCreationOptions *)options completionHandler:(void (^)(_WKAuthenticatorAttestationResponse *, NSError *))handler 584 { 585 #if ENABLE(WEB_AUTHN) 586 auto callback = [handler = makeBlockPtr(handler)] (std::variant<Ref<WebCore::AuthenticatorResponse>, WebCore::ExceptionData>&& result) mutable { 587 WTF::switchOn(result, [&](const Ref<WebCore::AuthenticatorResponse>& response) { 588 handler(wkAuthenticatorAttestationResponse(response->data(), nullptr, response->attachment()).get(), nil); 589 }, [&](const WebCore::ExceptionData& exception) { 590 handler(nil, [NSError errorWithDomain:WKErrorDomain code:exception.code userInfo:@{ NSLocalizedDescriptionKey: exception.message }]); 591 }); 592 }; 593 _panel->handleRequest({ vectorFromNSData(clientDataHash), [_WKWebAuthenticationPanel convertToCoreCreationOptionsWithOptions:options], nullptr, WebKit::WebAuthenticationPanelResult::Unavailable, nullptr, std::nullopt, { }, true, String(), nullptr }, WTFMove(callback)); 594 #endif 595 } 596 583 597 + (WebCore::PublicKeyCredentialRequestOptions)convertToCoreRequestOptionsWithOptions:(_WKPublicKeyCredentialRequestOptions *)options 584 598 { … … 631 645 } 632 646 647 - (void)getAssertionWithClientDataHash:(NSData *)clientDataHash options:(_WKPublicKeyCredentialRequestOptions *)options completionHandler:(void (^)(_WKAuthenticatorAssertionResponse *, NSError *))handler 648 { 649 #if ENABLE(WEB_AUTHN) 650 auto callback = [handler = makeBlockPtr(handler)] (std::variant<Ref<WebCore::AuthenticatorResponse>, WebCore::ExceptionData>&& result) mutable { 651 WTF::switchOn(result, [&](const Ref<WebCore::AuthenticatorResponse>& response) { 652 handler(wkAuthenticatorAssertionResponse(response->data(), nullptr, response->attachment()).get(), nil); 653 }, [&](const WebCore::ExceptionData& exception) { 654 handler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:nil]); 655 }); 656 }; 657 _panel->handleRequest({ vectorFromNSData(clientDataHash), [_WKWebAuthenticationPanel convertToCoreRequestOptionsWithOptions:options], nullptr, WebKit::WebAuthenticationPanelResult::Unavailable, nullptr, std::nullopt, { }, true, String(), nullptr }, WTFMove(callback)); 658 #endif 659 } 660 633 661 + (BOOL)isUserVerifyingPlatformAuthenticatorAvailable 634 662 {
Note:
See TracChangeset
for help on using the changeset viewer.