- FileBookmarkService: hold a security scope while creating the bookmark, fixing "file doesn't exist" on iCloud Drive-backed vaults (NSCocoaErrorDomain Code=4), which only surfaced on a real device since the Simulator strips entitlements needed to reproduce this. - Fix Keychain access group missing the Team ID prefix, which silently broke saving the master password so Face ID was never offered after backgrounding. - Add the autofill-credential-provider entitlement to the main app target (previously only on the extension) and declare ProvidesPasswords in the extension's Info.plist, so MyPass now registers as a selectable AutoFill Passwords provider. - CredentialMatcher: fall back to a scheme-prefixed re-parse when extracting a host, since KDBX entries commonly store bare domains (e.g. "allocine.fr") that URL(string:).host can't parse without an authority component. Fixes AutoFill suggestions being unranked/wrong for such entries.
51 lines
1.9 KiB
Swift
51 lines
1.9 KiB
Swift
//
|
|
// CredentialProviderViewController.swift
|
|
// AutoFill
|
|
//
|
|
// Created by Christophe Vila on 19/09/2026.
|
|
//
|
|
|
|
import AuthenticationServices
|
|
import SwiftUI
|
|
import MyPassCore
|
|
|
|
final class CredentialProviderViewController: ASCredentialProviderViewController {
|
|
|
|
private let session = VaultSession()
|
|
private let bookmarkService = FileBookmarkService()
|
|
private let keychainStore = KeychainStore(accessGroup: "F2KB6W8N4R.org.antiloop222.mypass")
|
|
private let biometricService = BiometricAuthService()
|
|
|
|
// Called when the user selects MyPass from the QuickType bar.
|
|
override func prepareCredentialList(for serviceIdentifiers: [ASCredentialServiceIdentifier]) {
|
|
let ids = serviceIdentifiers.map(\.identifier)
|
|
showUI(serviceIdentifiers: ids)
|
|
}
|
|
|
|
private func showUI(serviceIdentifiers: [String]) {
|
|
let rootView = ExtensionRootView(
|
|
session: session,
|
|
serviceIdentifiers: serviceIdentifiers,
|
|
bookmarkService: bookmarkService,
|
|
keychainStore: keychainStore,
|
|
biometricService: biometricService,
|
|
onSelect: { [weak self] (entry: Entry) in
|
|
let credential = ASPasswordCredential(
|
|
user: entry.username,
|
|
password: entry.password.reveal()
|
|
)
|
|
self?.extensionContext.completeRequest(withSelectedCredential: credential, completionHandler: nil)
|
|
},
|
|
onCancel: { [weak self] in
|
|
self?.extensionContext.cancelRequest(withError: ASExtensionError(.userCanceled))
|
|
}
|
|
)
|
|
let host = UIHostingController(rootView: rootView)
|
|
addChild(host)
|
|
view.addSubview(host.view)
|
|
host.view.frame = view.bounds
|
|
host.view.autoresizingMask = [UIView.AutoresizingMask.flexibleWidth, UIView.AutoresizingMask.flexibleHeight]
|
|
host.didMove(toParent: self)
|
|
}
|
|
}
|