1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00

Dynamically load MacOS passkey (#12897)

This commit is contained in:
Daniel García
2025-01-16 16:50:38 +01:00
committed by GitHub
parent 9a6f00ef11
commit 7c89c52098

View File

@@ -30,6 +30,7 @@ void runSync(void* context, NSDictionary *params) {
[mappedCredentials addObject:credential]; [mappedCredentials addObject:credential];
} }
if (@available(macos 14, *)) {
if ([type isEqualToString:@"fido2"]) { if ([type isEqualToString:@"fido2"]) {
NSString *cipherId = credential[@"cipherId"]; NSString *cipherId = credential[@"cipherId"];
NSString *rpId = credential[@"rpId"]; NSString *rpId = credential[@"rpId"];
@@ -37,7 +38,8 @@ void runSync(void* context, NSDictionary *params) {
NSData *credentialId = decodeBase64URL(credential[@"credentialId"]); NSData *credentialId = decodeBase64URL(credential[@"credentialId"]);
NSData *userHandle = decodeBase64URL(credential[@"userHandle"]); NSData *userHandle = decodeBase64URL(credential[@"userHandle"]);
ASPasskeyCredentialIdentity *credential = [[ASPasskeyCredentialIdentity alloc] Class passkeyCredentialIdentityClass = NSClassFromString(@"ASPasskeyCredentialIdentity");
id credential = [[passkeyCredentialIdentityClass alloc]
initWithRelyingPartyIdentifier:rpId initWithRelyingPartyIdentifier:rpId
userName:userName userName:userName
credentialID:credentialId credentialID:credentialId
@@ -47,6 +49,7 @@ void runSync(void* context, NSDictionary *params) {
[mappedCredentials addObject:credential]; [mappedCredentials addObject:credential];
} }
} }
}
[ASCredentialIdentityStore.sharedStore replaceCredentialIdentityEntries:mappedCredentials [ASCredentialIdentityStore.sharedStore replaceCredentialIdentityEntries:mappedCredentials
completion:^(__attribute__((unused)) BOOL success, NSError * _Nullable error) { completion:^(__attribute__((unused)) BOOL success, NSError * _Nullable error) {