Bug 234112

Summary: [WebAuthn] Provide SPI to export/import local credentials
Product: WebKit Reporter: pascoe <pascoe>
Component: WebKit Misc.Assignee: pascoe <pascoe>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, darin, ews-watchlist, jiewen_tan, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch for landing none

Description pascoe@apple.com 2021-12-09 17:01:16 PST
Provide SPI to export/import local credentials.
Comment 1 pascoe@apple.com 2021-12-09 17:01:32 PST
rdar://84822000
Comment 2 pascoe@apple.com 2021-12-10 07:10:28 PST
Created attachment 446722 [details]
Patch
Comment 3 pascoe@apple.com 2022-01-21 12:00:20 PST
Reminder to make these SPIs synchronous.
Comment 4 pascoe@apple.com 2022-01-25 16:20:13 PST
Created attachment 449981 [details]
Patch
Comment 5 Darin Adler 2022-01-25 17:05:36 PST
Comment on attachment 449981 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=449981&action=review

> Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h:80
>  const char LocalAuthenticatiorAccessGroup[] = "com.apple.webkit.webauthn";

Misspelled word "authenticator" here.

> Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h:87
> +const char privateKeyKey[] = "priv";
> +const char keyTypeKey[] = "key_type";
> +const char keySizeKey[] = "key_size";
> +const char relyingPartyKey[] = "rp";
> +const char applicationTagKey[] = "tag";

constexpr?
Comment 6 pascoe@apple.com 2022-01-25 17:41:11 PST
Created attachment 449987 [details]
Patch
Comment 7 Brent Fulgham 2022-01-26 15:45:08 PST
Comment on attachment 449987 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=449987&action=review

r=me

> Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h:80
> +constexpr const char LocalAuthenticatorAccessGroup[] = "com.apple.webkit.webauthn";

Thank you for fixing that typo!

> Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:397
> +            *error = [NSError errorWithDomain:WKErrorDomain code:WKErrorMalformedCredential userInfo:nil];

This little check and assignment is repeated so many times it might be nice as a static function:

static void createMalformedCredentialErrorIfNecessary(NSError **error)

> Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:488
> +            *error = [NSError errorWithDomain:WKErrorDomain code:WKErrorDuplicateCredential userInfo:nil];

... or, perhaps a helper that takes the WKError type:

static void createNSErrorFromWKErrorIfNecessary(NSError **error, WKErrorCode errorCode)
{
    if (error)
         *error = [NSError errorWithDomain:WKErrorDomain code: errorCode userInfo:nil];
}
Comment 8 pascoe@apple.com 2022-01-26 17:26:32 PST
Created attachment 450088 [details]
Patch
Comment 9 pascoe@apple.com 2022-01-26 17:32:33 PST
Created attachment 450089 [details]
Patch for landing
Comment 10 EWS 2022-01-31 08:56:58 PST
Committed r288816 (246592@main): <https://commits.webkit.org/246592@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450089 [details].