'How to show certificate selection popup to the user in WKWebview embedded browser in mac

I'm trying to add support for client certificate based authentication (cba) in an embedded browser of my app in Mac. Here is the code I have.

- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler 
{
NSString *lAuthenticationMethod = [[challenge protectionSpace] authenticationMethod];
.....
else if ([lAuthenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
    lCredential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
    [[challenge sender] useCredential:lCredential forAuthenticationChallenge:challenge];
    completionHandler(NSURLSessionAuthChallengeUseCredential, lCredential);
}
else if ([lAuthenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate]) {
// **Q1. How to let the user manually select the Identity from the keychain using a popup?**(like in below screenshot)
}
.....
// Code to retrieve certificate from Identity, then get credential and pass it to CompletionHandler goes here
}

Certificate selection popup screenshot - similar to Safari

Q1. How to let the user manually select the Identity from the keychain using a popup?(like in above screenshot)

Also if someone can point me to an example code of manual certificate selection popup in MacOS in Objective C for client certificate based authentication in WKWebkit, it would be helpful!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source