The autofill extension currently calls the success callback even if a passcode/FaceID is not successfully verified. In the case that the PGP key passphrase is stored, this results in password decryption without further user interaction. The fix is to only decrypt passwords upon successful passcode / FaceID verification.
30 lines
1,014 B
Swift
30 lines
1,014 B
Swift
//
|
|
// PasscodeExtensionDisplay.swift
|
|
// passAutoFillExtension
|
|
//
|
|
// Created by Yishi Lin on 14/6/17.
|
|
// Copyright © 2017 Bob Sun. All rights reserved.
|
|
//
|
|
|
|
import passKit
|
|
|
|
class PasscodeExtensionDisplay {
|
|
private let passcodeLockVC: PasscodeLockViewControllerForExtension
|
|
|
|
init(extensionContext: NSExtensionContext) {
|
|
self.passcodeLockVC = PasscodeLockViewControllerForExtension(extensionContext: extensionContext)
|
|
passcodeLockVC.setCancellable(true)
|
|
}
|
|
|
|
// present the passcode lock view if passcode is set and the view controller is not presented
|
|
func presentPasscodeLockIfNeeded(_ sender: UIViewController, before: (() -> Void)? = nil, after: (() -> Void)? = nil) {
|
|
if PasscodeLock.shared.hasPasscode {
|
|
before?()
|
|
passcodeLockVC.successCallback = after
|
|
passcodeLockVC.modalPresentationStyle = .fullScreen
|
|
sender.parent?.present(passcodeLockVC, animated: false)
|
|
} else {
|
|
after?()
|
|
}
|
|
}
|
|
}
|