From 07ed368c2463c5955351c3a25044ed8c3e9af990 Mon Sep 17 00:00:00 2001 From: Jacob Fink Date: Mon, 26 Jun 2023 15:47:43 -0400 Subject: [PATCH] add secondary fallback name for bio key for safari --- .../src/safari/safari/SafariWebExtensionHandler.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/browser/src/safari/safari/SafariWebExtensionHandler.swift b/apps/browser/src/safari/safari/SafariWebExtensionHandler.swift index b0688e3beb..9ca04ea3ef 100644 --- a/apps/browser/src/safari/safari/SafariWebExtensionHandler.swift +++ b/apps/browser/src/safari/safari/SafariWebExtensionHandler.swift @@ -133,6 +133,11 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling { status = SecKeychainFindGenericPassword(nil, UInt32(ServiceNameBiometric.utf8.count), ServiceNameBiometric, UInt32(fallbackName.utf8.count), fallbackName, &passwordLength, &passwordPtr, nil) } + if status != errSecSuccess { + let secondaryFallbackName = "_masterkey_biometric" + status = SecKeychainFindGenericPassword(nil, UInt32(ServiceNameBiometric.utf8.count), ServiceNameBiometric, UInt32(secondaryFallbackName.utf8.count), secondaryFallbackName, &passwordLength, &passwordPtr, nil) + } + if status == errSecSuccess { let result = NSString(bytes: passwordPtr!, length: Int(passwordLength), encoding: String.Encoding.utf8.rawValue) as String? SecKeychainItemFreeContent(nil, passwordPtr)