diff --git a/.gitmodules b/.gitmodules index 73294397c..cfb2e966b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "Frameworks/UICKeyChainStore"] path = Frameworks/UICKeyChainStore url = https://github.com/kishikawakatsumi/UICKeyChainStore.git -[submodule "Frameworks/PasscodeLock"] - path = Frameworks/PasscodeLock - url = https://github.com/blinksh/SwiftPasscodeLock.git [submodule "Frameworks/ios_system"] path = Frameworks/ios_system url = https://github.com/holzschu/ios_system.git diff --git a/Blink.xcodeproj/project.pbxproj b/Blink.xcodeproj/project.pbxproj index c77903845..53a825df8 100644 --- a/Blink.xcodeproj/project.pbxproj +++ b/Blink.xcodeproj/project.pbxproj @@ -21,24 +21,6 @@ 076FBD501DB6BD9400F6D997 /* libmoshios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 076FBD4F1DB6BD9400F6D997 /* libmoshios.framework */; }; 076FBD521DB6BE1D00F6D997 /* libprotobuf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 076FBD511DB6BE1D00F6D997 /* libprotobuf.a */; }; 079635871D0E6602000473B1 /* TermView.m in Sources */ = {isa = PBXBuildFile; fileRef = 079635841D0E6602000473B1 /* TermView.m */; }; - 07AA06491E08B12E008310B7 /* PasscodeLock.strings in Resources */ = {isa = PBXBuildFile; fileRef = 07AA06331E08B12E008310B7 /* PasscodeLock.strings */; }; - 07AA064A1E08B12E008310B7 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06351E08B12E008310B7 /* Functions.swift */; }; - 07AA064C1E08B12E008310B7 /* ChangePasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06381E08B12E008310B7 /* ChangePasscodeState.swift */; }; - 07AA064D1E08B12E008310B7 /* ConfirmPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06391E08B12E008310B7 /* ConfirmPasscodeState.swift */; }; - 07AA064E1E08B12E008310B7 /* EnterPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA063A1E08B12E008310B7 /* EnterPasscodeState.swift */; }; - 07AA064F1E08B12E008310B7 /* PasscodeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA063B1E08B12E008310B7 /* PasscodeLock.swift */; }; - 07AA06501E08B12E008310B7 /* SetPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA063C1E08B12E008310B7 /* SetPasscodeState.swift */; }; - 07AA06511E08B12E008310B7 /* PasscodeLockPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA063E1E08B12E008310B7 /* PasscodeLockPresenter.swift */; }; - 07AA06521E08B12E008310B7 /* PasscodeLockViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA063F1E08B12E008310B7 /* PasscodeLockViewController.swift */; }; - 07AA06531E08B12E008310B7 /* PasscodeLockConfigurationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06411E08B12E008310B7 /* PasscodeLockConfigurationType.swift */; }; - 07AA06541E08B12E008310B7 /* PasscodeLockStateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06421E08B12E008310B7 /* PasscodeLockStateType.swift */; }; - 07AA06551E08B12E008310B7 /* PasscodeLockType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06431E08B12E008310B7 /* PasscodeLockType.swift */; }; - 07AA06561E08B12E008310B7 /* PasscodeRepositoryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06441E08B12E008310B7 /* PasscodeRepositoryType.swift */; }; - 07AA06571E08B12E008310B7 /* PasscodeLockView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 07AA06461E08B12E008310B7 /* PasscodeLockView.xib */; }; - 07AA06581E08B12E008310B7 /* PasscodeSignButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06471E08B12E008310B7 /* PasscodeSignButton.swift */; }; - 07AA06591E08B12E008310B7 /* PasscodeSignPlaceholderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA06481E08B12E008310B7 /* PasscodeSignPlaceholderView.swift */; }; - 07AA065B1E08B61F008310B7 /* PasscodeLockConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA065A1E08B61F008310B7 /* PasscodeLockConfiguration.swift */; }; - 07AA065D1E08B6EB008310B7 /* UserDefaultsPasscodeRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07AA065C1E08B6EB008310B7 /* UserDefaultsPasscodeRepository.swift */; }; 07E3AEB01D8F6758007BC086 /* BKFeedbackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 07E3AEAF1D8F6758007BC086 /* BKFeedbackViewController.m */; }; 07E3AEB31D8F6775007BC086 /* BKSupportViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 07E3AEB21D8F6775007BC086 /* BKSupportViewController.m */; }; 07E3AEB61D8F6E2E007BC086 /* BKLinkActions.m in Sources */ = {isa = PBXBuildFile; fileRef = 07E3AEB51D8F6E2E007BC086 /* BKLinkActions.m */; }; @@ -65,7 +47,6 @@ B7A487651DC7BD65007BA809 /* BKDefaultUserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B7A487641DC7BD65007BA809 /* BKDefaultUserViewController.m */; }; B7A487691DC7C48D007BA809 /* UIDevice+DeviceName.m in Sources */ = {isa = PBXBuildFile; fileRef = B7A487681DC7C48D007BA809 /* UIDevice+DeviceName.m */; }; B7A4876D1DC7C709007BA809 /* BKSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B7A4876C1DC7C709007BA809 /* BKSettingsViewController.m */; }; - B7B3FC401DF5E99200B3D37C /* BKTouchIDAuthManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B7B3FC3F1DF5E99200B3D37C /* BKTouchIDAuthManager.m */; }; B7D450361DD3A87200CE0DBE /* BKiCloudSyncHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = B7D450351DD3A87200CE0DBE /* BKiCloudSyncHandler.m */; }; B7D4503C1DD4706000CE0DBE /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = B7D4503B1DD4706000CE0DBE /* Reachability.m */; }; B7D6A6291E2D43A800EDF7B0 /* BKSmartKeysConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B7D6A6281E2D43A800EDF7B0 /* BKSmartKeysConfigViewController.m */; }; @@ -256,6 +237,7 @@ D2CB353B23339D5C00088765 /* UIView+Touches.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2CB353A23339D5C00088765 /* UIView+Touches.swift */; }; D2D6D78620527651003CBEC4 /* TermDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = D2D6D78520527651003CBEC4 /* TermDevice.m */; }; D2D75EE021AFDA10007336B6 /* LayoutManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2D75EDF21AFDA10007336B6 /* LayoutManager.m */; }; + D2D8DD8523C71CC500BFF223 /* LocalAuth.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2D8DD8423C71CC500BFF223 /* LocalAuth.swift */; }; D2ED4A6F239BB12E000DC67F /* KeyCaptureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2ED4A6E239BB12E000DC67F /* KeyCaptureView.swift */; }; D2EFE1F520B7FAFC0087888B /* link_files.m in Sources */ = {isa = PBXBuildFile; fileRef = D2EFE1EE20B7FAFC0087888B /* link_files.m */; }; D2F30EAD205009CD008C5F35 /* base64js.min.js in Resources */ = {isa = PBXBuildFile; fileRef = D2F30EAC205009CD008C5F35 /* base64js.min.js */; }; @@ -393,26 +375,6 @@ 0795F29B1DC11C6B00CC8B83 /* Blink.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Blink.entitlements; sourceTree = ""; }; 079635831D0E6602000473B1 /* TermView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TermView.h; sourceTree = ""; }; 079635841D0E6602000473B1 /* TermView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TermView.m; sourceTree = ""; }; - 07AA06341E08B12E008310B7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/PasscodeLock.strings; sourceTree = ""; }; - 07AA06351E08B12E008310B7 /* Functions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functions.swift; sourceTree = ""; }; - 07AA06361E08B12E008310B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 07AA06381E08B12E008310B7 /* ChangePasscodeState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangePasscodeState.swift; sourceTree = ""; }; - 07AA06391E08B12E008310B7 /* ConfirmPasscodeState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfirmPasscodeState.swift; sourceTree = ""; }; - 07AA063A1E08B12E008310B7 /* EnterPasscodeState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterPasscodeState.swift; sourceTree = ""; }; - 07AA063B1E08B12E008310B7 /* PasscodeLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeLock.swift; sourceTree = ""; }; - 07AA063C1E08B12E008310B7 /* SetPasscodeState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetPasscodeState.swift; sourceTree = ""; }; - 07AA063D1E08B12E008310B7 /* PasscodeLock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasscodeLock.h; sourceTree = ""; }; - 07AA063E1E08B12E008310B7 /* PasscodeLockPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeLockPresenter.swift; sourceTree = ""; }; - 07AA063F1E08B12E008310B7 /* PasscodeLockViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeLockViewController.swift; sourceTree = ""; }; - 07AA06411E08B12E008310B7 /* PasscodeLockConfigurationType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeLockConfigurationType.swift; sourceTree = ""; }; - 07AA06421E08B12E008310B7 /* PasscodeLockStateType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeLockStateType.swift; sourceTree = ""; }; - 07AA06431E08B12E008310B7 /* PasscodeLockType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeLockType.swift; sourceTree = ""; }; - 07AA06441E08B12E008310B7 /* PasscodeRepositoryType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeRepositoryType.swift; sourceTree = ""; }; - 07AA06461E08B12E008310B7 /* PasscodeLockView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasscodeLockView.xib; sourceTree = ""; }; - 07AA06471E08B12E008310B7 /* PasscodeSignButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeSignButton.swift; sourceTree = ""; }; - 07AA06481E08B12E008310B7 /* PasscodeSignPlaceholderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeSignPlaceholderView.swift; sourceTree = ""; }; - 07AA065A1E08B61F008310B7 /* PasscodeLockConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeLockConfiguration.swift; sourceTree = ""; }; - 07AA065C1E08B6EB008310B7 /* UserDefaultsPasscodeRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserDefaultsPasscodeRepository.swift; sourceTree = ""; }; 07E3AEAE1D8F6758007BC086 /* BKFeedbackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKFeedbackViewController.h; sourceTree = ""; }; 07E3AEAF1D8F6758007BC086 /* BKFeedbackViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKFeedbackViewController.m; sourceTree = ""; }; 07E3AEB11D8F6775007BC086 /* BKSupportViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKSupportViewController.h; sourceTree = ""; }; @@ -454,8 +416,6 @@ B7A487681DC7C48D007BA809 /* UIDevice+DeviceName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+DeviceName.m"; sourceTree = ""; }; B7A4876B1DC7C709007BA809 /* BKSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKSettingsViewController.h; sourceTree = ""; }; B7A4876C1DC7C709007BA809 /* BKSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKSettingsViewController.m; sourceTree = ""; }; - B7B3FC3E1DF5E99200B3D37C /* BKTouchIDAuthManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKTouchIDAuthManager.h; sourceTree = ""; }; - B7B3FC3F1DF5E99200B3D37C /* BKTouchIDAuthManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKTouchIDAuthManager.m; sourceTree = ""; }; B7D450341DD3A87200CE0DBE /* BKiCloudSyncHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKiCloudSyncHandler.h; sourceTree = ""; }; B7D450351DD3A87200CE0DBE /* BKiCloudSyncHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKiCloudSyncHandler.m; sourceTree = ""; }; B7D4503A1DD4706000CE0DBE /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; @@ -705,6 +665,7 @@ D2D6D78520527651003CBEC4 /* TermDevice.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TermDevice.m; sourceTree = ""; }; D2D75EDE21AFDA10007336B6 /* LayoutManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutManager.h; sourceTree = ""; }; D2D75EDF21AFDA10007336B6 /* LayoutManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LayoutManager.m; sourceTree = ""; }; + D2D8DD8423C71CC500BFF223 /* LocalAuth.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalAuth.swift; sourceTree = ""; }; D2E4F92920B2BB4500B30F7B /* curl_ios_static.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = curl_ios_static.xcodeproj; path = ios_system/curl_ios_static.xcodeproj; sourceTree = ""; }; D2ED4A6E239BB12E000DC67F /* KeyCaptureView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyCaptureView.swift; sourceTree = ""; }; D2EFE1EE20B7FAFC0087888B /* link_files.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = link_files.m; sourceTree = ""; }; @@ -852,7 +813,6 @@ D2A3F4E120690B70006BB305 /* text.framework */, 22E1F3342036EE86001FCC5C /* libssh2.framework */, 22E1F3332036EE86001FCC5C /* openssl.framework */, - 07AA06321E08B12E008310B7 /* PasscodeLock */, B700AED71DD0F2C200100EBF /* CloudKit.framework */, 076FBD4F1DB6BD9400F6D997 /* libmoshios.framework */, 0732F1281D06324200AB5438 /* libcurses.tbd */, @@ -905,58 +865,6 @@ name = Products; sourceTree = ""; }; - 07AA06321E08B12E008310B7 /* PasscodeLock */ = { - isa = PBXGroup; - children = ( - 07AA065C1E08B6EB008310B7 /* UserDefaultsPasscodeRepository.swift */, - 07AA065A1E08B61F008310B7 /* PasscodeLockConfiguration.swift */, - 07AA06331E08B12E008310B7 /* PasscodeLock.strings */, - 07AA06351E08B12E008310B7 /* Functions.swift */, - 07AA06361E08B12E008310B7 /* Info.plist */, - 07AA06371E08B12E008310B7 /* PasscodeLock */, - 07AA063D1E08B12E008310B7 /* PasscodeLock.h */, - 07AA063E1E08B12E008310B7 /* PasscodeLockPresenter.swift */, - 07AA063F1E08B12E008310B7 /* PasscodeLockViewController.swift */, - 07AA06401E08B12E008310B7 /* Protocols */, - 07AA06451E08B12E008310B7 /* Views */, - ); - name = PasscodeLock; - path = PasscodeLock/PasscodeLock; - sourceTree = ""; - }; - 07AA06371E08B12E008310B7 /* PasscodeLock */ = { - isa = PBXGroup; - children = ( - 07AA06381E08B12E008310B7 /* ChangePasscodeState.swift */, - 07AA06391E08B12E008310B7 /* ConfirmPasscodeState.swift */, - 07AA063A1E08B12E008310B7 /* EnterPasscodeState.swift */, - 07AA063B1E08B12E008310B7 /* PasscodeLock.swift */, - 07AA063C1E08B12E008310B7 /* SetPasscodeState.swift */, - ); - path = PasscodeLock; - sourceTree = ""; - }; - 07AA06401E08B12E008310B7 /* Protocols */ = { - isa = PBXGroup; - children = ( - 07AA06411E08B12E008310B7 /* PasscodeLockConfigurationType.swift */, - 07AA06421E08B12E008310B7 /* PasscodeLockStateType.swift */, - 07AA06431E08B12E008310B7 /* PasscodeLockType.swift */, - 07AA06441E08B12E008310B7 /* PasscodeRepositoryType.swift */, - ); - path = Protocols; - sourceTree = ""; - }; - 07AA06451E08B12E008310B7 /* Views */ = { - isa = PBXGroup; - children = ( - 07AA06461E08B12E008310B7 /* PasscodeLockView.xib */, - 07AA06471E08B12E008310B7 /* PasscodeSignButton.swift */, - 07AA06481E08B12E008310B7 /* PasscodeSignPlaceholderView.swift */, - ); - path = Views; - sourceTree = ""; - }; 07E3AEAA1D8F64C6007BC086 /* GetInTouch */ = { isa = PBXGroup; children = ( @@ -1040,8 +948,7 @@ B7B3FC3A1DF5E96900B3D37C /* Security */ = { isa = PBXGroup; children = ( - B7B3FC3E1DF5E99200B3D37C /* BKTouchIDAuthManager.h */, - B7B3FC3F1DF5E99200B3D37C /* BKTouchIDAuthManager.m */, + D2D8DD8423C71CC500BFF223 /* LocalAuth.swift */, ); path = Security; sourceTree = ""; @@ -1684,7 +1591,6 @@ D2C24428238E44CD0082C69C /* kb.js in Resources */, C94437601D831CD30096F84E /* Themes in Resources */, D296199B214F995D0070935A /* ge25519_base.data in Resources */, - 07AA06571E08B12E008310B7 /* PasscodeLockView.xib in Resources */, D29FE54B208DC860004679D0 /* extraCommandsDictionary.plist in Resources */, D21A3FD921943BE200269705 /* dark-settings-iphone-29pt@3x.png in Resources */, D21A3FE021943BE200269705 /* dark-notification-iphone-20pt@3x.png in Resources */, @@ -1699,7 +1605,6 @@ D21A3FE121943BE200269705 /* dark-notification-iphone-20pt@2x.png in Resources */, D2C21F3920FCD7B800F125E0 /* blinkCommandsDictionary.plist in Resources */, D2496F412003941B00E75FE9 /* term.js in Resources */, - 07AA06491E08B12E008310B7 /* PasscodeLock.strings in Resources */, D21A3FE621943BE200269705 /* dark-spotlight-iphone-40pt@3x.png in Resources */, D21A3FDA21943BE200269705 /* dark-app-iphone-60pt@2x.png in Resources */, D21A3FDC21943BE200269705 /* dark-app-iphone-60pt@3x.png in Resources */, @@ -1740,7 +1645,6 @@ D296197F214F91550070935A /* sshkey.c in Sources */, D2961989214F96A10070935A /* chacha.c in Sources */, D241CBDF23040734003D64A5 /* KBKeyAccessibilityElement.swift in Sources */, - 07AA064F1E08B12E008310B7 /* PasscodeLock.swift in Sources */, D2D75EE021AFDA10007336B6 /* LayoutManager.m in Sources */, B7A4876D1DC7C709007BA809 /* BKSettingsViewController.m in Sources */, D241CBD923040734003D64A5 /* KBKeyView.swift in Sources */, @@ -1760,20 +1664,16 @@ D241CBDE23040734003D64A5 /* KBKeyValue.swift in Sources */, D2179F2D2136A5DC00B0850A /* GeoManager.m in Sources */, D2C2441E238E44AB0082C69C /* Checkmark.swift in Sources */, - 07AA06531E08B12E008310B7 /* PasscodeLockConfigurationType.swift in Sources */, D296199E214F995D0070935A /* sc25519.c in Sources */, D2961970214F89360070935A /* ssh-agent.m in Sources */, D2B1F8DD23265A0600634D67 /* CommandsHUDView.swift in Sources */, D2903F3C239BBF5D005F991B /* KeyShortcut.swift in Sources */, - 07AA06541E08B12E008310B7 /* PasscodeLockStateType.swift in Sources */, - 07AA064E1E08B12E008310B7 /* EnterPasscodeState.swift in Sources */, C9B2E0301D6B612400B89F69 /* BKPubKey.m in Sources */, D27BBA1C20529FFF00AEA303 /* TermStream.m in Sources */, D2036B6323967F2F0013D2A3 /* BindingConfigView.swift in Sources */, D296198D214F96D50070935A /* digest-openssl.c in Sources */, D25D58102358897B00D1BCAE /* Complete.swift in Sources */, B7D4503C1DD4706000CE0DBE /* Reachability.m in Sources */, - 07AA065D1E08B6EB008310B7 /* UserDefaultsPasscodeRepository.swift in Sources */, B752EE2E1DFEF45300E305C8 /* BKSecurityConfigurationViewController.m in Sources */, D2F330D420A6F1DF0074ADD7 /* clear.m in Sources */, C94437571D8311960096F84E /* BKResource.m in Sources */, @@ -1781,7 +1681,6 @@ D241CBD323040734003D64A5 /* KBSound.swift in Sources */, D29619AF214FB5EA0070935A /* ssh-ecdsa.c in Sources */, 07F670761D05EEE200C0A53C /* SSHCopyIDSession.m in Sources */, - 07AA06551E08B12E008310B7 /* PasscodeLockType.swift in Sources */, D2C244352390FEEF0082C69C /* KeyBindingAction.swift in Sources */, D241CBDA23040734003D64A5 /* KBTraits.swift in Sources */, B752EE2B1DFEF19D00E305C8 /* BKUserConfigurationManager.m in Sources */, @@ -1806,7 +1705,6 @@ D241CBDC23040734003D64A5 /* KBKeyViewVertical2.swift in Sources */, D2C24422238E44AB0082C69C /* KeyActionPicker.swift in Sources */, D2C24423238E44AB0082C69C /* KBWebView.swift in Sources */, - 07AA06501E08B12E008310B7 /* SetPasscodeState.swift in Sources */, D2C24417238E44AB0082C69C /* KeyConfig.swift in Sources */, D28F301A21AD8A6B00E5259F /* DeviceInfo.m in Sources */, D29619AE214FB5EA0070935A /* ssh-rsa.c in Sources */, @@ -1819,7 +1717,6 @@ D2C24412238E44AB0082C69C /* KeyModifier.swift in Sources */, D29619A0214F995D0070935A /* fe25519.c in Sources */, 074F30791D062A2800A73445 /* main.m in Sources */, - 07AA06511E08B12E008310B7 /* PasscodeLockPresenter.swift in Sources */, D2A5221E230D279B0010AC04 /* SmarterTermInput.swift in Sources */, D23D258823438B15002850CA /* UIColor.swift in Sources */, D2C24419238E44AB0082C69C /* KeyConfigPairView.swift in Sources */, @@ -1829,16 +1726,13 @@ D215AC30233521B600E164C3 /* WKWebView.swift in Sources */, D2A86D6920EB86F2000DF1DA /* SSHClientOptions.m in Sources */, D27AD9BC222FDD3D00379872 /* xcall.m in Sources */, - 07AA065B1E08B61F008310B7 /* PasscodeLockConfiguration.swift in Sources */, D29568B921BE629100480A83 /* bk_getopts.c in Sources */, 07E3AEC61D9190CF007BC086 /* BKAboutViewController.m in Sources */, D2F330D620A6F4F50074ADD7 /* history.m in Sources */, D2EFE1F520B7FAFC0087888B /* link_files.m in Sources */, D2C24418238E44AB0082C69C /* KBConfigView.swift in Sources */, D2F330CA20A6CB840074ADD7 /* help.m in Sources */, - 07AA064C1E08B12E008310B7 /* ChangePasscodeState.swift in Sources */, D2A90AE220D277E00073BF3D /* ssh.m in Sources */, - 07AA06561E08B12E008310B7 /* PasscodeRepositoryType.swift in Sources */, D241CBD223040734003D64A5 /* KBDevice.swift in Sources */, D2334D1C21495DAE00D26AC3 /* udptunnel.m in Sources */, C9B2E0311D6B612400B89F69 /* BKDefaults.m in Sources */, @@ -1851,10 +1745,10 @@ D29D6C3122DB9CA700A84173 /* TermController.swift in Sources */, D23E142B20A970C3000FCF5C /* BlinkPaths.m in Sources */, D2D6D78620527651003CBEC4 /* TermDevice.m in Sources */, + D2D8DD8523C71CC500BFF223 /* LocalAuth.swift in Sources */, D296199C214F995D0070935A /* ed25519.c in Sources */, D2C24424238E44AB0082C69C /* KBWebViewBase.m in Sources */, C9B2E0331D6B612400B89F69 /* BKHosts.m in Sources */, - 07AA064A1E08B12E008310B7 /* Functions.swift in Sources */, D2F330D220A6EF030074ADD7 /* showkey.m in Sources */, D2BC514D2355C3AE0034FDD4 /* History.swift in Sources */, D2C24437239104250082C69C /* ShortcutsConfigView.swift in Sources */, @@ -1864,12 +1758,10 @@ 07E3AEB01D8F6758007BC086 /* BKFeedbackViewController.m in Sources */, B7D450361DD3A87200CE0DBE /* BKiCloudSyncHandler.m in Sources */, C989E54C1D6CC488003E0079 /* BKPredictionViewController.m in Sources */, - 07AA06521E08B12E008310B7 /* PasscodeLockViewController.swift in Sources */, D248E67622DDDF130057FE67 /* UIStateRestorable.swift in Sources */, C9B2E0341D6B612400B89F69 /* BKTheme.m in Sources */, D29619A7214FA7D40070935A /* bcrypt-pbkdf.c in Sources */, D241CBD123040734003D64A5 /* KBKeyViewArrows.swift in Sources */, - 07AA06581E08B12E008310B7 /* PasscodeSignButton.swift in Sources */, C989E5671D6CC95A003E0079 /* BKPubKeyViewController.m in Sources */, D2334D1D21495DAE00D26AC3 /* host2ip.c in Sources */, D2C24415238E44AB0082C69C /* KeyCode.swift in Sources */, @@ -1880,7 +1772,6 @@ D241CBE123040734003D64A5 /* KBKeyViewTriangle.swift in Sources */, D241CBDD23040734003D64A5 /* KBProxy.swift in Sources */, B75112CD1DE4A7B10040C693 /* BKiCloudConfigurationViewController.m in Sources */, - 07AA064D1E08B12E008310B7 /* ConfirmPasscodeState.swift in Sources */, D2C24413238E44AB0082C69C /* KeyConfigPair.swift in Sources */, D2FCB4DD2339F9DB00A88108 /* UIScrollView+Paging.swift in Sources */, C989E5571D6CC4A1003E0079 /* BKFontCreateViewController.m in Sources */, @@ -1907,14 +1798,12 @@ D2060A5420E2644400CF5122 /* SSHClient.m in Sources */, D2C244332390FB830082C69C /* KeyBinding.swift in Sources */, D2C8D30A21B544B100AC39C3 /* say.m in Sources */, - B7B3FC401DF5E99200B3D37C /* BKTouchIDAuthManager.m in Sources */, D29619A4214F99A30070935A /* rsa.c in Sources */, D2C2441A238E44AB0082C69C /* KeySection.swift in Sources */, 079635871D0E6602000473B1 /* TermView.m in Sources */, D241CBE6230562E9003D64A5 /* KBSizes.swift in Sources */, D241CBD023040734003D64A5 /* KBKeyViewFlexible.swift in Sources */, D2C2442F238E62A70082C69C /* KBSettingsViewController.swift in Sources */, - 07AA06591E08B12E008310B7 /* PasscodeSignPlaceholderView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1947,14 +1836,6 @@ name = LaunchScreen.storyboard; sourceTree = ""; }; - 07AA06331E08B12E008310B7 /* PasscodeLock.strings */ = { - isa = PBXVariantGroup; - children = ( - 07AA06341E08B12E008310B7 /* en */, - ); - name = PasscodeLock.strings; - sourceTree = ""; - }; C9B2E0041D6B612300B89F69 /* Settings.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/Blink/AppDelegate.m b/Blink/AppDelegate.m index 30b8833bf..e79bc0924 100644 --- a/Blink/AppDelegate.m +++ b/Blink/AppDelegate.m @@ -31,7 +31,6 @@ #import "AppDelegate.h" #import "BKiCloudSyncHandler.h" -#import "BKTouchIDAuthManager.h" #import "BlinkPaths.h" #import "BKDefaults.h" #import "BKPubKey.h" @@ -77,8 +76,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( dispatch_async(bgQueue, ^{ [BlinkPaths linkICloudDriveIfNeeded]; }); - - [[BKTouchIDAuthManager sharedManager] registerforDeviceLockNotif]; sideLoading = false; // Turn off extra commands from iOS system initializeEnvironment(); // initialize environment variables for iOS system diff --git a/Blink/Blink-bridge.h b/Blink/Blink-bridge.h index 26a852811..e4dd29c4b 100644 --- a/Blink/Blink-bridge.h +++ b/Blink/Blink-bridge.h @@ -38,7 +38,6 @@ #import "BlinkPaths.h" #import "DeviceInfo.h" #import "LayoutManager.h" -#import "BKTouchIDAuthManager.h" #import "BKUserConfigurationManager.h" #import "Session.h" #import "MCPSession.h" diff --git a/Blink/SceneDelegate.swift b/Blink/SceneDelegate.swift index c687cd2a0..e9afbbb75 100644 --- a/Blink/SceneDelegate.swift +++ b/Blink/SceneDelegate.swift @@ -71,9 +71,31 @@ struct StuckView: View { } } +struct LockView: View { + var scene: UIScene + + var body: some View { + VStack { + Image(systemName: "lock.shield.fill") + .font(.system(size: 70)) + .accentColor(Color(UIColor.blinkTint)) + .padding() + Text("Autolocked") + .font(.headline) + .padding() + + if scene.session.role == .windowApplication { + Button(action: { LocalAuth.shared.unlock(scene: self.scene) }, label: { Text("Unlock") }) + .padding() + } + } + } +} + class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? = nil var _ctrl = DummyVC() + var _lockCtrl: UIViewController? = nil var _spCtrl = SpaceController() func scene( @@ -94,29 +116,50 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } func sceneDidBecomeActive(_ scene: UIScene) { + + if LocalAuth.shared.lockRequired { + if let lockCtrl = _lockCtrl { + if window?.rootViewController != lockCtrl { + window?.rootViewController = lockCtrl + } + } else { + let ctrl = UIHostingController(rootView: LockView(scene: scene)) + window?.rootViewController = ctrl + _lockCtrl = ctrl + LocalAuth.shared.unlock(scene: scene) + } + return + } else { + _lockCtrl = nil + } + if window?.rootViewController != _spCtrl { window?.rootViewController = _spCtrl } + guard let term = _spCtrl.currentTerm() else { return } + + term.resumeIfNeeded() term.view?.setNeedsLayout() + let spCtrl = _spCtrl let input = SmarterTermInput.shared if let key = input.stuckKey() { debugPrint("BK:", "stuck!!!") input.setTrackingModifierFlags([]) let ctrl = UIHostingController(rootView: StuckView(keyCode: key, dismissAction: { - self._spCtrl.onStuckOpCommand() + spCtrl.onStuckOpCommand() })) ctrl.modalPresentationStyle = .formSheet - _spCtrl.stuckKeyCode = key - _spCtrl.present(ctrl, animated: false) + spCtrl.stuckKeyCode = key + spCtrl.present(ctrl, animated: false) return; } else { - _spCtrl.stuckKeyCode = nil + spCtrl.stuckKeyCode = nil } if term.termDevice.view?.isFocused() == false, @@ -125,14 +168,14 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) { if !SmarterTermInput.shared.isRealFirstResponder, scene.activationState == .foregroundActive { - self._spCtrl.focusOnShellAction() + spCtrl.focusOnShellAction() } } } else if input.window == self.window { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) { if term.termDevice.view?.isFocused() == false, scene.activationState == .foregroundActive { - self._spCtrl.focusOnShellAction() + spCtrl.focusOnShellAction() } } } else { @@ -140,20 +183,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } } - func sceneWillResignActive(_ scene: UIScene) { -// debugPrint("BK:", "sceneWillResignActive") - } - - func sceneWillEnterForeground(_ scene: UIScene) { -// debugPrint("BK:", "sceneWillEnterForeground") - } - - func sceneDidEnterBackground(_ scene: UIScene) { -// debugPrint("BK:", "sceneDidEnterBackground") - } - func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? { -// debugPrint("BK:", "stateRestorationActivity") _setDummyVC() return _spCtrl.stateRestorationActivity() } diff --git a/Blink/SpaceController.swift b/Blink/SpaceController.swift index db69d95d2..10bdab67c 100644 --- a/Blink/SpaceController.swift +++ b/Blink/SpaceController.swift @@ -157,11 +157,6 @@ public class SpaceController: UIViewController { func _registerForNotifications() { let nc = NotificationCenter.default - nc.addObserver(self, - selector: #selector(_focusOnShell), - name: NSNotification.Name.BKUserAuthenticated, - object: nil) - nc.addObserver(self, selector: #selector(_didBecomeKeyWindow), name: UIWindow.didBecomeKeyNotification, diff --git a/Frameworks/PasscodeLock b/Frameworks/PasscodeLock deleted file mode 160000 index 52201ba2d..000000000 --- a/Frameworks/PasscodeLock +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 52201ba2d7873e3b2473149fa8933ccb61c66dba diff --git a/Settings/Security/BKTouchIDAuthManager.h b/Settings/Security/BKTouchIDAuthManager.h deleted file mode 100644 index d1b5e5ed1..000000000 --- a/Settings/Security/BKTouchIDAuthManager.h +++ /dev/null @@ -1,46 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// B L I N K -// -// Copyright (C) 2016-2018 Blink Mobile Shell Project -// -// This file is part of Blink. -// -// Blink is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Blink is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Blink. If not, see . -// -// In addition, Blink is also subject to certain additional terms under -// GNU GPL version 3 section 7. -// -// You should have received a copy of these additional terms immediately -// following the terms and conditions of the GNU General Public License -// which accompanied the Blink Source Code. If not, see -// . -// -//////////////////////////////////////////////////////////////////////////////// - -#import -#import - -extern const NSNotificationName BKUserAuthenticated; - -@interface BKTouchIDAuthManager : NSObject - -@property (nonatomic, strong) UIViewController *rootViewController; -@property (nonatomic, strong) UIViewController *lockViewController; - -+ (instancetype)sharedManager; -+ (BOOL)requiresTouchAuth; -- (void)registerforDeviceLockNotif; - -@end diff --git a/Settings/Security/BKTouchIDAuthManager.m b/Settings/Security/BKTouchIDAuthManager.m deleted file mode 100644 index 0e8f5343a..000000000 --- a/Settings/Security/BKTouchIDAuthManager.m +++ /dev/null @@ -1,150 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// B L I N K -// -// Copyright (C) 2016-2018 Blink Mobile Shell Project -// -// This file is part of Blink. -// -// Blink is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Blink is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Blink. If not, see . -// -// In addition, Blink is also subject to certain additional terms under -// GNU GPL version 3 section 7. -// -// You should have received a copy of these additional terms immediately -// following the terms and conditions of the GNU General Public License -// which accompanied the Blink Source Code. If not, see -// . -// -//////////////////////////////////////////////////////////////////////////////// - -#import "BKTouchIDAuthManager.h" -#import "BKUserConfigurationManager.h" -#import "Blink-Swift.h" - -const NSNotificationName BKUserAuthenticated = @"BKUserAuthenticated"; - -@import LocalAuthentication; - -#define MAX_INTERVAL_INACTIVE 10 * 60 - -static BKTouchIDAuthManager *sharedManager = nil; -static BOOL authRequired = NO; - -@implementation BKTouchIDAuthManager { - NSTimeInterval inactiveTimeStamp; -} - -+ (instancetype)sharedManager -{ - if ([BKUserConfigurationManager userSettingsValueForKey:BKUserConfigAutoLock]) { - if (sharedManager == nil) { - sharedManager = [[self alloc] init]; - } - return sharedManager; - } else { - //If user settings is turned off, return nil, so that all messages are ignored - [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; - return nil; - } -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - authRequired = YES; - } - return self; -} -- (void)registerforDeviceLockNotif -{ - //Screen lock notifications - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(displayStatusChanged:) name:UIApplicationDidEnterBackgroundNotification object:nil]; -// CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center -// NULL, // observer -// displayStatusChanged, // callback -// CFSTR("com.apple.springboard.lockcomplete"), // event name -// NULL, // object -// CFNotificationSuspensionBehaviorDeliverImmediately); -// -// CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center -// NULL, // observer -// displayStatusChanged, // callback -// CFSTR("com.apple.springboard.lockstate"), // event name -// NULL, // object -// CFNotificationSuspensionBehaviorDeliverImmediately); - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; -} - - -- (void)didBecomeActive:(NSNotification *)notification -{ - if (authRequired == NO && inactiveTimeStamp != 0) { - authRequired = ([[NSDate date] timeIntervalSince1970] - inactiveTimeStamp) > MAX_INTERVAL_INACTIVE; - } - inactiveTimeStamp = 0; - if ([BKTouchIDAuthManager requiresTouchAuth]) { - [self authenticateUser]; - } -} - -//call back -//static void displayStatusChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) -- (void) displayStatusChanged:(NSNotification *)notification -{ - // the "com.apple.springboard.lockcomplete" notification will always come after the "com.apple.springboard.lockstate" notification - inactiveTimeStamp = [[NSDate date] timeIntervalSince1970]; - //authRequired = YES; -} - -+ (BOOL)requiresTouchAuth -{ - return authRequired && [BKUserConfigurationManager userSettingsValueForKey:BKUserConfigAutoLock]; -} - -- (void)authenticateUser -{ - - if (_lockViewController != nil) { - return; - } - -// [[ScreenController shared] switchToTouchScreen]; - UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; - - PasscodeLockViewController *ctrl = [[PasscodeLockViewController alloc] initWithStateString:@"EnterPassCode"]; - - __weak BKTouchIDAuthManager *weakSelf = self; - - ctrl.dismissCompletionCallback = ^{ - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ - authRequired = NO; - [keyWindow setRootViewController:weakSelf.rootViewController]; - - weakSelf.lockViewController = nil; - weakSelf.rootViewController = nil; - - [[NSNotificationCenter defaultCenter] postNotificationName:BKUserAuthenticated object:nil]; - }]; - }; - - _lockViewController = ctrl; - _rootViewController = [keyWindow rootViewController]; - [keyWindow setRootViewController:_lockViewController]; -} - - -@end diff --git a/Settings/Security/LocalAuth.swift b/Settings/Security/LocalAuth.swift new file mode 100644 index 000000000..d8382cf9a --- /dev/null +++ b/Settings/Security/LocalAuth.swift @@ -0,0 +1,119 @@ +////////////////////////////////////////////////////////////////////////////////// +// +// B L I N K +// +// Copyright (C) 2016-2019 Blink Mobile Shell Project +// +// This file is part of Blink. +// +// Blink is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Blink is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Blink. If not, see . +// +// In addition, Blink is also subject to certain additional terms under +// GNU GPL version 3 section 7. +// +// You should have received a copy of these additional terms immediately +// following the terms and conditions of the GNU General Public License +// which accompanied the Blink Source Code. If not, see +// . +// +//////////////////////////////////////////////////////////////////////////////// + + +import Foundation +import UIKit +import LocalAuthentication + +@objc class LocalAuth: NSObject { + + static var unlockNotification = Notification.Name("blink.localauth.unlock") + + @objc static let shared = LocalAuth() + + static var _maxInactiveInterval = TimeInterval(10 * 60) + private var _didEnterBackgroundAt: Date? = nil + private var _inProgress = false + + override init() { + super.init() + + // worm up LAContext + LAContext().canEvaluatePolicy(.deviceOwnerAuthentication, error: nil) + + if BKUserConfigurationManager.userSettingsValue(forKey: BKUserConfigAutoLock) { + _didEnterBackgroundAt = Date.distantPast + } + + NotificationCenter.default.addObserver( + forName: UIApplication.didEnterBackgroundNotification, + object: nil, + queue: OperationQueue.main + ) { _ in + self._didEnterBackgroundAt = Date() + } + } + + var lockRequired: Bool { + guard + let didEnterBackgroundAt = _didEnterBackgroundAt, + BKUserConfigurationManager.userSettingsValue(forKey: BKUserConfigAutoLock), + Date().timeIntervalSince(didEnterBackgroundAt) > LocalAuth._maxInactiveInterval + else { + return false + } + + return true + } + + func unlock(scene: UIScene) { + guard + scene.session.role == .windowApplication, + _inProgress == false + else { + return + } + + autheticate(callback: { [weak self] (success) in + if success { + self?._didEnterBackgroundAt = nil + NotificationCenter.default.post(name: LocalAuth.unlockNotification, object: nil) + } + }, reason: "to unlock blink.") + } + + @objc func autheticate(callback: @escaping (_ success: Bool) -> Void, reason: String = "to access sensitive data.") { + if _inProgress { + callback(false) + } + _inProgress = true + + let context = LAContext() + var error: NSError? + guard + context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) + else { + debugPrint(error?.localizedDescription ?? "Can't evaluate policy") + _inProgress = false + callback(false) + return + } + + context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason ) { success, error in + DispatchQueue.main.async { + self._inProgress = false + callback(success) + } + } + } + +} diff --git a/Settings/ViewControllers/BKPubKey/BKPubKeyDetailsViewController.m b/Settings/ViewControllers/BKPubKey/BKPubKeyDetailsViewController.m index d9d7a9973..91eaec83e 100644 --- a/Settings/ViewControllers/BKPubKey/BKPubKeyDetailsViewController.m +++ b/Settings/ViewControllers/BKPubKey/BKPubKeyDetailsViewController.m @@ -32,6 +32,7 @@ #import "BKPubKeyDetailsViewController.h" #import "UIDevice+DeviceName.h" #import "BKDefaults.h" +#import "Blink-Swift.h" @interface BKPubKeyDetailsViewController () @@ -49,12 +50,6 @@ - (void)viewDidLoad _comments.text = [NSString stringWithFormat:@"%@@%@", [BKDefaults defaultUserName] , [UIDevice getInfoTypeFromDeviceName:BKDeviceInfoTypeDeviceName]]; } -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - - (void)viewWillDisappear:(BOOL)animated { if ([self.navigationController.viewControllers indexOfObject:self] == NSNotFound) { @@ -74,15 +69,6 @@ - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRang return YES; } -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} -*/ - (IBAction)copyPublicKey:(id)sender { UIPasteboard *pb = [UIPasteboard generalPasteboard]; @@ -91,8 +77,12 @@ - (IBAction)copyPublicKey:(id)sender - (IBAction)copyPrivateKey:(id)sender { - UIPasteboard *pb = [UIPasteboard generalPasteboard]; - [pb setString:_pubkey.privateKey]; + [[LocalAuth shared] autheticateWithCallback:^(BOOL success) { + if (success) { + UIPasteboard *pb = [UIPasteboard generalPasteboard]; + [pb setString:_pubkey.privateKey]; + } + } reason:@"to copy private key to clipboard."]; } - (IBAction)sharePublicKey:(id)sender diff --git a/Settings/ViewControllers/BKPubKey/BKPubKeyViewController.m b/Settings/ViewControllers/BKPubKey/BKPubKeyViewController.m index c6d470c72..87da3f732 100644 --- a/Settings/ViewControllers/BKPubKey/BKPubKeyViewController.m +++ b/Settings/ViewControllers/BKPubKey/BKPubKeyViewController.m @@ -35,6 +35,7 @@ #import "BKPubKeyCreateViewController.h" #import "BKPubKeyDetailsViewController.h" #import "BKPubKeyViewController.h" +#import "Blink-Swift.h" @interface BKPubKeyViewController () @@ -123,11 +124,15 @@ - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleFo - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { - // Remove BKPubKey - [BKPubKey.all removeObjectAtIndex:indexPath.row]; - [self.tableView deleteRowsAtIndexPaths:@[ indexPath ] withRowAnimation:true]; - [BKPubKey saveIDS]; - [self.tableView reloadData]; + [[LocalAuth shared] autheticateWithCallback:^(BOOL success) { + if (success) { + // Remove BKPubKey + [BKPubKey.all removeObjectAtIndex:indexPath.row]; + [self.tableView deleteRowsAtIndexPaths:@[ indexPath ] withRowAnimation:true]; + [BKPubKey saveIDS]; + [self.tableView reloadData]; + } + } reason:@"to delete key."]; } } diff --git a/Settings/ViewControllers/Settings/BKSettingsViewController.m b/Settings/ViewControllers/Settings/BKSettingsViewController.m index 37c54f13a..ed1cffe30 100644 --- a/Settings/ViewControllers/Settings/BKSettingsViewController.m +++ b/Settings/ViewControllers/Settings/BKSettingsViewController.m @@ -32,7 +32,6 @@ #import "UIApplication+Version.h" #import "BKSettingsViewController.h" #import "BKDefaults.h" -#import "BKTouchIDAuthManager.h" #import "BKUserConfigurationManager.h" #import "BKiCloudConfigurationViewController.h" #import "BKiCloudSyncHandler.h" diff --git a/Settings/ViewControllers/UserConfiguration/BKSecurityConfigurationViewController.m b/Settings/ViewControllers/UserConfiguration/BKSecurityConfigurationViewController.m index 42e0e5129..bf7d82e47 100644 --- a/Settings/ViewControllers/UserConfiguration/BKSecurityConfigurationViewController.m +++ b/Settings/ViewControllers/UserConfiguration/BKSecurityConfigurationViewController.m @@ -30,11 +30,10 @@ //////////////////////////////////////////////////////////////////////////////// #import "BKSecurityConfigurationViewController.h" -#import "BKTouchIDAuthManager.h" #import "BKUserConfigurationManager.h" #import "Blink-Swift.h" -@interface BKSecurityConfigurationViewController () +@interface BKSecurityConfigurationViewController () @property (nonatomic, weak) IBOutlet UISwitch *toggleAppLock; @@ -42,47 +41,20 @@ @interface BKSecurityConfigurationViewController ()