Merge pull request #292 from SimplyDanny/make-simulator-untouched-by-tests

Do not influence the Simulator by tests
This commit is contained in:
Yishi Lin 2019-07-21 13:39:53 +08:00 committed by GitHub
commit 032e442d78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 139 additions and 62 deletions

View file

@ -42,7 +42,6 @@
30697C5321F63E0B0064FCAC /* PasscodeExtensionDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5121F63E0B0064FCAC /* PasscodeExtensionDisplay.swift */; }; 30697C5321F63E0B0064FCAC /* PasscodeExtensionDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5121F63E0B0064FCAC /* PasscodeExtensionDisplay.swift */; };
30697C5421F63E0B0064FCAC /* CredentialProviderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5221F63E0B0064FCAC /* CredentialProviderViewController.swift */; }; 30697C5421F63E0B0064FCAC /* CredentialProviderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5221F63E0B0064FCAC /* CredentialProviderViewController.swift */; };
30697C5F21F674800064FCAC /* String+UtilitiesTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5E21F674800064FCAC /* String+UtilitiesTest.swift */; }; 30697C5F21F674800064FCAC /* String+UtilitiesTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5E21F674800064FCAC /* String+UtilitiesTest.swift */; };
307BF39921BC2298003A082D /* TestBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 307BF39821BC2297003A082D /* TestBase.swift */; };
308C273A2279F9CB0016D0E2 /* SearchBarScope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302202EE222F14E400555236 /* SearchBarScope.swift */; }; 308C273A2279F9CB0016D0E2 /* SearchBarScope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302202EE222F14E400555236 /* SearchBarScope.swift */; };
30A1D29C21AF451E00E2D1F7 /* PasswordGeneratorFlavourTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A1D29B21AF451E00E2D1F7 /* PasswordGeneratorFlavourTest.swift */; }; 30A1D29C21AF451E00E2D1F7 /* PasswordGeneratorFlavourTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A1D29B21AF451E00E2D1F7 /* PasswordGeneratorFlavourTest.swift */; };
30A1D2A221B2BC6F00E2D1F7 /* TokenBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A1D2A121B2BC6F00E2D1F7 /* TokenBuilder.swift */; }; 30A1D2A221B2BC6F00E2D1F7 /* TokenBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A1D2A121B2BC6F00E2D1F7 /* TokenBuilder.swift */; };
@ -51,6 +50,10 @@
30A1D2AA21B32A0100E2D1F7 /* OtpTypeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A1D2A921B32A0100E2D1F7 /* OtpTypeTest.swift */; }; 30A1D2AA21B32A0100E2D1F7 /* OtpTypeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A1D2A921B32A0100E2D1F7 /* OtpTypeTest.swift */; };
30A1D2AC21B32C2A00E2D1F7 /* TokenBuilderTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A1D2AB21B32C2A00E2D1F7 /* TokenBuilderTest.swift */; }; 30A1D2AC21B32C2A00E2D1F7 /* TokenBuilderTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A1D2AB21B32C2A00E2D1F7 /* TokenBuilderTest.swift */; };
30B04860209A5141001013CA /* PasswordTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30B0485F209A5141001013CA /* PasswordTest.swift */; }; 30B04860209A5141001013CA /* PasswordTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30B0485F209A5141001013CA /* PasswordTest.swift */; };
30BAC8C622E3BAAF00438475 /* TestBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30BAC8C422E3BAAF00438475 /* TestBase.swift */; };
30BAC8C722E3BAAF00438475 /* TestPGPKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30BAC8C522E3BAAF00438475 /* TestPGPKeys.swift */; };
30BAC8CB22E3BB6C00438475 /* DictBasedKeychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30BAC8CA22E3BB6C00438475 /* DictBasedKeychain.swift */; };
30BAC8CD22E3BB9700438475 /* KeyStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30BAC8CC22E3BB9700438475 /* KeyStore.swift */; };
30BF5EC821EA8FB5000E4154 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30BF5ECA21EA8FB5000E4154 /* Localizable.strings */; }; 30BF5EC821EA8FB5000E4154 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30BF5ECA21EA8FB5000E4154 /* Localizable.strings */; };
30BF5ED721ED2434000E4154 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 30BF5ED521ED2434000E4154 /* Localizable.stringsdict */; }; 30BF5ED721ED2434000E4154 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 30BF5ED521ED2434000E4154 /* Localizable.stringsdict */; };
30C25DBD21F3599E00BB27BB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30C25DBF21F3599E00BB27BB /* InfoPlist.strings */; }; 30C25DBD21F3599E00BB27BB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30C25DBF21F3599E00BB27BB /* InfoPlist.strings */; };
@ -99,7 +102,6 @@
A2A7813F1E97DBD9001311F5 /* QRScannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2A7813E1E97DBD9001311F5 /* QRScannerController.swift */; }; A2A7813F1E97DBD9001311F5 /* QRScannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2A7813E1E97DBD9001311F5 /* QRScannerController.swift */; };
A2AA934422DE30DD00D79A00 /* PGPAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AA934322DE30DD00D79A00 /* PGPAgent.swift */; }; A2AA934422DE30DD00D79A00 /* PGPAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AA934322DE30DD00D79A00 /* PGPAgent.swift */; };
A2AA934622DE3A8000D79A00 /* PGPAgentTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AA934522DE3A8000D79A00 /* PGPAgentTest.swift */; }; A2AA934622DE3A8000D79A00 /* PGPAgentTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AA934522DE3A8000D79A00 /* PGPAgentTest.swift */; };
A2AA934822DE3F0200D79A00 /* TestPGPKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AA934722DE3F0200D79A00 /* TestPGPKeys.swift */; };
DC037CA61E4B883900609409 /* OpenSourceComponentsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CA51E4B883900609409 /* OpenSourceComponentsTableViewController.swift */; }; DC037CA61E4B883900609409 /* OpenSourceComponentsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CA51E4B883900609409 /* OpenSourceComponentsTableViewController.swift */; };
DC037CA81E4B898100609409 /* BasicStaticTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CA71E4B898100609409 /* BasicStaticTableViewController.swift */; }; DC037CA81E4B898100609409 /* BasicStaticTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CA71E4B898100609409 /* BasicStaticTableViewController.swift */; };
DC037CAA1E4B8EAE00609409 /* SpecialThanksTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CA91E4B8EAE00609409 /* SpecialThanksTableViewController.swift */; }; DC037CAA1E4B8EAE00609409 /* SpecialThanksTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CA91E4B8EAE00609409 /* SpecialThanksTableViewController.swift */; };
@ -252,7 +254,6 @@
30697C5121F63E0B0064FCAC /* PasscodeExtensionDisplay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeExtensionDisplay.swift; sourceTree = "<group>"; }; 30697C5121F63E0B0064FCAC /* PasscodeExtensionDisplay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeExtensionDisplay.swift; sourceTree = "<group>"; };
30697C5221F63E0B0064FCAC /* CredentialProviderViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CredentialProviderViewController.swift; sourceTree = "<group>"; }; 30697C5221F63E0B0064FCAC /* CredentialProviderViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CredentialProviderViewController.swift; sourceTree = "<group>"; };
30697C5E21F674800064FCAC /* String+UtilitiesTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+UtilitiesTest.swift"; sourceTree = "<group>"; }; 30697C5E21F674800064FCAC /* String+UtilitiesTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+UtilitiesTest.swift"; sourceTree = "<group>"; };
307BF39821BC2297003A082D /* TestBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestBase.swift; sourceTree = "<group>"; };
30A1D29B21AF451E00E2D1F7 /* PasswordGeneratorFlavourTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordGeneratorFlavourTest.swift; sourceTree = "<group>"; }; 30A1D29B21AF451E00E2D1F7 /* PasswordGeneratorFlavourTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordGeneratorFlavourTest.swift; sourceTree = "<group>"; };
30A1D2A121B2BC6F00E2D1F7 /* TokenBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenBuilder.swift; sourceTree = "<group>"; }; 30A1D2A121B2BC6F00E2D1F7 /* TokenBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenBuilder.swift; sourceTree = "<group>"; };
30A1D2A521B2D46100E2D1F7 /* OtpType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OtpType.swift; sourceTree = "<group>"; }; 30A1D2A521B2D46100E2D1F7 /* OtpType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OtpType.swift; sourceTree = "<group>"; };
@ -260,6 +261,10 @@
30A1D2A921B32A0100E2D1F7 /* OtpTypeTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OtpTypeTest.swift; sourceTree = "<group>"; }; 30A1D2A921B32A0100E2D1F7 /* OtpTypeTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OtpTypeTest.swift; sourceTree = "<group>"; };
30A1D2AB21B32C2A00E2D1F7 /* TokenBuilderTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenBuilderTest.swift; sourceTree = "<group>"; }; 30A1D2AB21B32C2A00E2D1F7 /* TokenBuilderTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenBuilderTest.swift; sourceTree = "<group>"; };
30B0485F209A5141001013CA /* PasswordTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordTest.swift; sourceTree = "<group>"; }; 30B0485F209A5141001013CA /* PasswordTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordTest.swift; sourceTree = "<group>"; };
30BAC8C422E3BAAF00438475 /* TestBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestBase.swift; sourceTree = "<group>"; };
30BAC8C522E3BAAF00438475 /* TestPGPKeys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestPGPKeys.swift; sourceTree = "<group>"; };
30BAC8CA22E3BB6C00438475 /* DictBasedKeychain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DictBasedKeychain.swift; sourceTree = "<group>"; };
30BAC8CC22E3BB9700438475 /* KeyStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyStore.swift; sourceTree = "<group>"; };
30BF5EC921EA8FB5000E4154 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; }; 30BF5EC921EA8FB5000E4154 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
30BF5ED621ED2434000E4154 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; }; 30BF5ED621ED2434000E4154 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
30C25DA921F34D2800BB27BB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = "<group>"; }; 30C25DA921F34D2800BB27BB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = "<group>"; };
@ -303,7 +308,6 @@
A2A7813E1E97DBD9001311F5 /* QRScannerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QRScannerController.swift; sourceTree = "<group>"; }; A2A7813E1E97DBD9001311F5 /* QRScannerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QRScannerController.swift; sourceTree = "<group>"; };
A2AA934322DE30DD00D79A00 /* PGPAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PGPAgent.swift; sourceTree = "<group>"; }; A2AA934322DE30DD00D79A00 /* PGPAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PGPAgent.swift; sourceTree = "<group>"; };
A2AA934522DE3A8000D79A00 /* PGPAgentTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PGPAgentTest.swift; sourceTree = "<group>"; }; A2AA934522DE3A8000D79A00 /* PGPAgentTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PGPAgentTest.swift; sourceTree = "<group>"; };
A2AA934722DE3F0200D79A00 /* TestPGPKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestPGPKeys.swift; sourceTree = "<group>"; };
A2BC54C71EEE5669001FAFBD /* Objective-CBridgingHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Objective-CBridgingHeader.h"; sourceTree = "<group>"; }; A2BC54C71EEE5669001FAFBD /* Objective-CBridgingHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Objective-CBridgingHeader.h"; sourceTree = "<group>"; };
DC037CA51E4B883900609409 /* OpenSourceComponentsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenSourceComponentsTableViewController.swift; sourceTree = "<group>"; }; DC037CA51E4B883900609409 /* OpenSourceComponentsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenSourceComponentsTableViewController.swift; sourceTree = "<group>"; };
DC037CA71E4B898100609409 /* BasicStaticTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicStaticTableViewController.swift; sourceTree = "<group>"; }; DC037CA71E4B898100609409 /* BasicStaticTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicStaticTableViewController.swift; sourceTree = "<group>"; };
@ -467,6 +471,16 @@
path = Extensions; path = Extensions;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
30BAC8C322E3BA4300438475 /* Testbase */ = {
isa = PBXGroup;
children = (
30BAC8CA22E3BB6C00438475 /* DictBasedKeychain.swift */,
30BAC8C422E3BAAF00438475 /* TestBase.swift */,
30BAC8C522E3BAAF00438475 /* TestPGPKeys.swift */,
);
path = Testbase;
sourceTree = "<group>";
};
30C015A3214ECF2B005BB6DF /* Parser */ = { 30C015A3214ECF2B005BB6DF /* Parser */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -566,14 +580,13 @@
A26075861EEC6F34005DB03E /* passKitTests */ = { A26075861EEC6F34005DB03E /* passKitTests */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
30BAC8C322E3BA4300438475 /* Testbase */,
30697C5521F63F870064FCAC /* Extensions */, 30697C5521F63F870064FCAC /* Extensions */,
301F6464216164670071A4CE /* Helpers */, 301F6464216164670071A4CE /* Helpers */,
30C015A7214ED378005BB6DF /* Models */, 30C015A7214ED378005BB6DF /* Models */,
30C015A6214ED32A005BB6DF /* Parser */, 30C015A6214ED32A005BB6DF /* Parser */,
A26075871EEC6F34005DB03E /* passKitTests.swift */, A26075871EEC6F34005DB03E /* passKitTests.swift */,
307BF39821BC2297003A082D /* TestBase.swift */,
A26075891EEC6F34005DB03E /* Info.plist */, A26075891EEC6F34005DB03E /* Info.plist */,
A2AA934722DE3F0200D79A00 /* TestPGPKeys.swift */,
); );
path = passKitTests; path = passKitTests;
sourceTree = "<group>"; sourceTree = "<group>";
@ -624,6 +637,7 @@
30697C2521F63C590064FCAC /* FileManagerExtension.swift */, 30697C2521F63C590064FCAC /* FileManagerExtension.swift */,
30697C2421F63C590064FCAC /* Globals.swift */, 30697C2421F63C590064FCAC /* Globals.swift */,
3032327322C7F710009EBD9C /* KeyFileManager.swift */, 3032327322C7F710009EBD9C /* KeyFileManager.swift */,
30BAC8CC22E3BB9700438475 /* KeyStore.swift */,
30697C2321F63C580064FCAC /* NotificationNames.swift */, 30697C2321F63C580064FCAC /* NotificationNames.swift */,
30697C2621F63C590064FCAC /* PasswordGeneratorFlavour.swift */, 30697C2621F63C590064FCAC /* PasswordGeneratorFlavour.swift */,
302202EE222F14E400555236 /* SearchBarScope.swift */, 302202EE222F14E400555236 /* SearchBarScope.swift */,
@ -1275,6 +1289,7 @@
30697C2E21F63C5A0064FCAC /* Utils.swift in Sources */, 30697C2E21F63C5A0064FCAC /* Utils.swift in Sources */,
30697C4521F63CAB0064FCAC /* Password.swift in Sources */, 30697C4521F63CAB0064FCAC /* Password.swift in Sources */,
30697C4421F63CAB0064FCAC /* PasswordEntity.swift in Sources */, 30697C4421F63CAB0064FCAC /* PasswordEntity.swift in Sources */,
30BAC8CD22E3BB9700438475 /* KeyStore.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -1284,13 +1299,14 @@
files = ( files = (
30A1D2AC21B32C2A00E2D1F7 /* TokenBuilderTest.swift in Sources */, 30A1D2AC21B32C2A00E2D1F7 /* TokenBuilderTest.swift in Sources */,
301F646D216166AA0071A4CE /* AdditionFieldTest.swift in Sources */, 301F646D216166AA0071A4CE /* AdditionFieldTest.swift in Sources */,
30BAC8CB22E3BB6C00438475 /* DictBasedKeychain.swift in Sources */,
30FD2F78214D9E0E005E0A92 /* ParserTest.swift in Sources */, 30FD2F78214D9E0E005E0A92 /* ParserTest.swift in Sources */,
A2AA934622DE3A8000D79A00 /* PGPAgentTest.swift in Sources */, A2AA934622DE3A8000D79A00 /* PGPAgentTest.swift in Sources */,
30BAC8C622E3BAAF00438475 /* TestBase.swift in Sources */,
30B04860209A5141001013CA /* PasswordTest.swift in Sources */, 30B04860209A5141001013CA /* PasswordTest.swift in Sources */,
307BF39921BC2298003A082D /* TestBase.swift in Sources */,
30697C5F21F674800064FCAC /* String+UtilitiesTest.swift in Sources */, 30697C5F21F674800064FCAC /* String+UtilitiesTest.swift in Sources */,
3032328A22C9FBA2009EBD9C /* KeyFileManagerTest.swift in Sources */, 3032328A22C9FBA2009EBD9C /* KeyFileManagerTest.swift in Sources */,
A2AA934822DE3F0200D79A00 /* TestPGPKeys.swift in Sources */, 30BAC8C722E3BAAF00438475 /* TestPGPKeys.swift in Sources */,
30A1D2AA21B32A0100E2D1F7 /* OtpTypeTest.swift in Sources */, 30A1D2AA21B32A0100E2D1F7 /* OtpTypeTest.swift in Sources */,
301F6468216165290071A4CE /* ConstantsTest.swift in Sources */, 301F6468216165290071A4CE /* ConstantsTest.swift in Sources */,
30A1D29C21AF451E00E2D1F7 /* PasswordGeneratorFlavourTest.swift in Sources */, 30A1D29C21AF451E00E2D1F7 /* PasswordGeneratorFlavourTest.swift in Sources */,

View file

@ -43,7 +43,7 @@ class GitServerSettingTableViewController: UITableViewController {
super.viewWillAppear(animated) super.viewWillAppear(animated)
// Grey out ssh option if ssh_key is not present // Grey out ssh option if ssh_key is not present
if let sshLabel = sshLabel { if let sshLabel = sshLabel {
sshLabel.isEnabled = AppKeychain.contains(key: SshKey.PRIVATE.getKeychainKey()) sshLabel.isEnabled = AppKeychain.shared.contains(key: SshKey.PRIVATE.getKeychainKey())
} }
} }
override func viewDidLoad() { override func viewDidLoad() {
@ -86,7 +86,7 @@ class GitServerSettingTableViewController: UITableViewController {
SVProgressHUD.setDefaultStyle(.light) SVProgressHUD.setDefaultStyle(.light)
SVProgressHUD.show(withStatus: "PrepareRepository".localize()) SVProgressHUD.show(withStatus: "PrepareRepository".localize())
var gitCredential: GitCredential var gitCredential: GitCredential
let privateKey: String? = AppKeychain.get(for: SshKey.PRIVATE.getKeychainKey()) let privateKey: String? = AppKeychain.shared.get(for: SshKey.PRIVATE.getKeychainKey())
if auth == "Password" || privateKey == nil { if auth == "Password" || privateKey == nil {
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: username)) gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: username))
} else { } else {
@ -160,7 +160,7 @@ class GitServerSettingTableViewController: UITableViewController {
authenticationMethod = "Password" authenticationMethod = "Password"
} else if cell == authSSHKeyCell { } else if cell == authSSHKeyCell {
if !AppKeychain.contains(key: SshKey.PRIVATE.getKeychainKey()) { if !AppKeychain.shared.contains(key: SshKey.PRIVATE.getKeychainKey()) {
Utils.alert(title: "CannotSelectSshKey".localize(), message: "PleaseSetupSshKeyFirst.".localize(), controller: self, completion: nil) Utils.alert(title: "CannotSelectSshKey".localize(), message: "PleaseSetupSshKeyFirst.".localize(), controller: self, completion: nil)
authenticationMethod = "Password" authenticationMethod = "Password"
} else { } else {

View file

@ -139,7 +139,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
SVProgressHUD.setDefaultStyle(.light) SVProgressHUD.setDefaultStyle(.light)
SVProgressHUD.show(withStatus: "SyncingPasswordStore".localize()) SVProgressHUD.show(withStatus: "SyncingPasswordStore".localize())
var gitCredential: GitCredential var gitCredential: GitCredential
let privateKey: String? = AppKeychain.get(for: SshKey.PRIVATE.getKeychainKey()) let privateKey: String? = AppKeychain.shared.get(for: SshKey.PRIVATE.getKeychainKey())
if SharedDefaults[.gitAuthenticationMethod] == "Password" || privateKey == nil { if SharedDefaults[.gitAuthenticationMethod] == "Password" || privateKey == nil {
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: SharedDefaults[.gitUsername]!)) gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: SharedDefaults[.gitUsername]!))
} else { } else {

View file

@ -8,37 +8,39 @@
import KeychainAccess import KeychainAccess
public class AppKeychain { public class AppKeychain: KeyStore {
private static let keychain = Keychain(service: Globals.bundleIdentifier, accessGroup: Globals.groupIdentifier) public static let shared = AppKeychain()
private let keychain = Keychain(service: Globals.bundleIdentifier, accessGroup: Globals.groupIdentifier)
.accessibility(.whenUnlockedThisDeviceOnly) .accessibility(.whenUnlockedThisDeviceOnly)
.synchronizable(false) .synchronizable(false)
public static func add(data: Data?, for key: String) { public func add(data: Data?, for key: String) {
keychain[data: key] = data keychain[data: key] = data
} }
public static func add(string: String?, for key: String) { public func add(string: String?, for key: String) {
keychain[key] = string keychain[key] = string
} }
public static func contains(key: String) -> Bool { public func contains(key: String) -> Bool {
return (try? keychain.contains(key)) ?? false return (try? keychain.contains(key)) ?? false
} }
public static func get(for key: String) -> Data? { public func get(for key: String) -> Data? {
return try? keychain.getData(key) return try? keychain.getData(key)
} }
public static func get(for key: String) -> String? { public func get(for key: String) -> String? {
return try? keychain.getString(key) return try? keychain.getString(key)
} }
public static func removeContent(for key: String) { public func removeContent(for key: String) {
try? keychain.remove(key) try? keychain.remove(key)
} }
public static func removeAllContent() { public func removeAllContent() {
try? keychain.removeAll() try? keychain.removeAll()
} }
} }

View file

@ -15,19 +15,17 @@ public class KeyFileManager {
private let keyType: CryptographicKey private let keyType: CryptographicKey
private let keyPath: String private let keyPath: String
private let keyHandler: KeyHandler
private convenience init(keyType: CryptographicKey) { private convenience init(keyType: CryptographicKey) {
self.init(keyType: keyType, keyPath: keyType.getFileSharingPath()) self.init(keyType: keyType, keyPath: keyType.getFileSharingPath())
} }
public init(keyType: CryptographicKey, keyPath: String, keyHandler: @escaping KeyHandler = AppKeychain.add) { public init(keyType: CryptographicKey, keyPath: String) {
self.keyType = keyType self.keyType = keyType
self.keyPath = keyPath self.keyPath = keyPath
self.keyHandler = keyHandler
} }
public func importKeyAndDeleteFile() throws { public func importKeyAndDeleteFile(keyHandler: KeyHandler = AppKeychain.shared.add) throws {
guard let keyFileContent = FileManager.default.contents(atPath: keyPath) else { guard let keyFileContent = FileManager.default.contents(atPath: keyPath) else {
throw AppError.ReadingFile(URL(fileURLWithPath: keyPath).lastPathComponent) throw AppError.ReadingFile(URL(fileURLWithPath: keyPath).lastPathComponent)
} }

View file

@ -0,0 +1,19 @@
//
// KeyStore.swift
// passKit
//
// Created by Danny Moesch on 20.07.19.
// Copyright © 2019 Bob Sun. All rights reserved.
//
import Foundation
public protocol KeyStore {
func add(data: Data?, for key: String)
func add(string: String?, for key: String)
func contains(key: String) -> Bool
func get(for key: String) -> Data?
func get(for key: String) -> String?
func removeContent(for key: String)
func removeAllContent()
}

View file

@ -13,14 +13,20 @@ import Gopenpgpwrapper
public class PGPAgent { public class PGPAgent {
private let keyStore: KeyStore
public init(keyStore: KeyStore = AppKeychain.shared) {
self.keyStore = keyStore
}
public var pgpKeyID: String? public var pgpKeyID: String?
// PGP passphrase // PGP passphrase
public var passphrase: String? { public var passphrase: String? {
set { set {
AppKeychain.add(string: newValue, for: "pgpKeyPassphrase") keyStore.add(string: newValue, for: "pgpKeyPassphrase")
} }
get { get {
return AppKeychain.get(for: "pgpKeyPassphrase") return keyStore.get(for: "pgpKeyPassphrase")
} }
} }
@ -68,12 +74,12 @@ public class PGPAgent {
} }
// Read the key data from keychain. // Read the key data from keychain.
guard let pgpKeyData: Data = AppKeychain.get(for: keyType.getKeychainKey()) else { guard let pgpKeyData: Data = keyStore.get(for: keyType.getKeychainKey()) else {
throw AppError.KeyImport throw AppError.KeyImport
} }
// Remove the key data from keychain temporary, in case the following step crashes repeatedly. // Remove the key data from keychain temporary, in case the following step crashes repeatedly.
AppKeychain.removeContent(for: keyType.getKeychainKey()) keyStore.removeContent(for: keyType.getKeychainKey())
// Try GopenpgpwrapperReadKey first. // Try GopenpgpwrapperReadKey first.
if let key = GopenpgpwrapperReadKey(pgpKeyData) { if let key = GopenpgpwrapperReadKey(pgpKeyData) {
@ -83,7 +89,7 @@ public class PGPAgent {
case .PRIVATE: case .PRIVATE:
self.privateKey = key self.privateKey = key
} }
AppKeychain.add(data: pgpKeyData, for: keyType.getKeychainKey()) keyStore.add(data: pgpKeyData, for: keyType.getKeychainKey())
return return
} }
@ -98,7 +104,7 @@ public class PGPAgent {
case .PRIVATE: case .PRIVATE:
self.privateKeyV2 = key self.privateKeyV2 = key
} }
AppKeychain.add(data: pgpKeyData, for: keyType.getKeychainKey()) keyStore.add(data: pgpKeyData, for: keyType.getKeychainKey())
return return
} }
@ -107,19 +113,19 @@ public class PGPAgent {
public func initPGPKey(from url: URL, keyType: PgpKey) throws { public func initPGPKey(from url: URL, keyType: PgpKey) throws {
let pgpKeyData = try Data(contentsOf: url) let pgpKeyData = try Data(contentsOf: url)
AppKeychain.add(data: pgpKeyData, for: keyType.getKeychainKey()) keyStore.add(data: pgpKeyData, for: keyType.getKeychainKey())
try initPGPKey(keyType) try initPGPKey(keyType)
} }
public func initPGPKey(with armorKey: String, keyType: PgpKey) throws { public func initPGPKey(with armorKey: String, keyType: PgpKey) throws {
let pgpKeyData = armorKey.data(using: .ascii)! let pgpKeyData = armorKey.data(using: .ascii)!
AppKeychain.add(data: pgpKeyData, for: keyType.getKeychainKey()) keyStore.add(data: pgpKeyData, for: keyType.getKeychainKey())
try initPGPKey(keyType) try initPGPKey(keyType)
} }
public func initPGPKeyFromFileSharing() throws { public func initPGPKeyFromFileSharing() throws {
try KeyFileManager.PublicPgp.importKeyAndDeleteFile() try KeyFileManager.PublicPgp.importKeyAndDeleteFile(keyHandler: keyStore.add)
try KeyFileManager.PrivatePgp.importKeyAndDeleteFile() try KeyFileManager.PrivatePgp.importKeyAndDeleteFile(keyHandler: keyStore.add)
try initPGPKeys() try initPGPKeys()
} }
@ -167,8 +173,8 @@ public class PGPAgent {
} }
public func removePGPKeys() { public func removePGPKeys() {
AppKeychain.removeContent(for: PgpKey.PUBLIC.getKeychainKey()) keyStore.removeContent(for: PgpKey.PUBLIC.getKeychainKey())
AppKeychain.removeContent(for: PgpKey.PRIVATE.getKeychainKey()) keyStore.removeContent(for: PgpKey.PRIVATE.getKeychainKey())
passphrase = nil passphrase = nil
publicKey = nil publicKey = nil
privateKey = nil privateKey = nil

View file

@ -12,7 +12,7 @@ public class PasscodeLock {
private static let identifier = Globals.bundleIdentifier + "passcode" private static let identifier = Globals.bundleIdentifier + "passcode"
/// Cached passcode to avoid frequent access to Keychain /// Cached passcode to avoid frequent access to Keychain
private var passcode: String? = AppKeychain.get(for: PasscodeLock.identifier) private var passcode: String? = AppKeychain.shared.get(for: PasscodeLock.identifier)
/// Constructor used to migrate passcode from SharedDefaults to Keychain /// Constructor used to migrate passcode from SharedDefaults to Keychain
private init() { private init() {
@ -27,7 +27,7 @@ public class PasscodeLock {
} }
public func save(passcode: String) { public func save(passcode: String) {
AppKeychain.add(string: passcode, for: PasscodeLock.identifier) AppKeychain.shared.add(string: passcode, for: PasscodeLock.identifier)
self.passcode = passcode self.passcode = passcode
} }
@ -36,7 +36,7 @@ public class PasscodeLock {
} }
public func delete() { public func delete() {
AppKeychain.removeContent(for: PasscodeLock.identifier) AppKeychain.shared.removeContent(for: PasscodeLock.identifier)
passcode = nil passcode = nil
} }
} }

View file

@ -39,19 +39,19 @@ public class PasswordStore {
public var gitPassword: String? { public var gitPassword: String? {
set { set {
AppKeychain.add(string: newValue, for: "gitPassword") AppKeychain.shared.add(string: newValue, for: "gitPassword")
} }
get { get {
return AppKeychain.get(for: "gitPassword") return AppKeychain.shared.get(for: "gitPassword")
} }
} }
public var gitSSHPrivateKeyPassphrase: String? { public var gitSSHPrivateKeyPassphrase: String? {
set { set {
AppKeychain.add(string: newValue, for: "gitSSHPrivateKeyPassphrase") AppKeychain.shared.add(string: newValue, for: "gitSSHPrivateKeyPassphrase")
} }
get { get {
return AppKeychain.get(for: "gitSSHPrivateKeyPassphrase") return AppKeychain.shared.get(for: "gitSSHPrivateKeyPassphrase")
} }
} }
@ -128,7 +128,7 @@ public class PasswordStore {
} }
public func initGitSSHKey(with armorKey: String) throws { public func initGitSSHKey(with armorKey: String) throws {
AppKeychain.add(string: armorKey, for: SshKey.PRIVATE.getKeychainKey()) AppKeychain.shared.add(string: armorKey, for: SshKey.PRIVATE.getKeychainKey())
} }
public func repositoryExisted() -> Bool { public func repositoryExisted() -> Bool {
@ -640,7 +640,7 @@ public class PasswordStore {
self.pgpAgent.removePGPKeys() self.pgpAgent.removePGPKeys()
AppKeychain.removeAllContent() AppKeychain.shared.removeAllContent()
deleteCoreData(entityName: "PasswordEntity") deleteCoreData(entityName: "PasswordEntity")
@ -720,7 +720,7 @@ public class PasswordStore {
Defaults.remove(.gitSSHKeySource) Defaults.remove(.gitSSHKeySource)
Defaults.remove(.gitSSHPrivateKeyArmor) Defaults.remove(.gitSSHPrivateKeyArmor)
Defaults.remove(.gitSSHPrivateKeyURL) Defaults.remove(.gitSSHPrivateKeyURL)
AppKeychain.removeContent(for: SshKey.PRIVATE.getKeychainKey()) AppKeychain.shared.removeContent(for: SshKey.PRIVATE.getKeychainKey())
gitSSHPrivateKeyPassphrase = nil gitSSHPrivateKeyPassphrase = nil
} }

View file

@ -12,7 +12,7 @@ import XCTest
class KeyFileManagerTest: XCTestCase { class KeyFileManagerTest: XCTestCase {
private static let filePath = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("test.txt").path private static let filePath = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("test.txt").path
private static let keyFileManager = KeyFileManager(keyType: PgpKey.PUBLIC, keyPath: filePath) { _, _ in } private static let keyFileManager = KeyFileManager(keyType: PgpKey.PUBLIC, keyPath: filePath)
override func tearDown() { override func tearDown() {
try? FileManager.default.removeItem(atPath: KeyFileManagerTest.filePath) try? FileManager.default.removeItem(atPath: KeyFileManagerTest.filePath)
@ -22,17 +22,17 @@ class KeyFileManagerTest: XCTestCase {
func testImportKeyAndDeleteFile() throws { func testImportKeyAndDeleteFile() throws {
let fileContent = "content".data(using: .ascii) let fileContent = "content".data(using: .ascii)
var storage: [String: Data] = [:] var storage: [String: Data] = [:]
let keyFileManager = KeyFileManager(keyType: PgpKey.PRIVATE, keyPath: KeyFileManagerTest.filePath) { storage[$1] = $0 } let keyFileManager = KeyFileManager(keyType: PgpKey.PRIVATE, keyPath: KeyFileManagerTest.filePath)
FileManager.default.createFile(atPath: KeyFileManagerTest.filePath, contents: fileContent, attributes: nil) FileManager.default.createFile(atPath: KeyFileManagerTest.filePath, contents: fileContent, attributes: nil)
try keyFileManager.importKeyAndDeleteFile() try keyFileManager.importKeyAndDeleteFile { storage[$1] = $0 }
XCTAssertFalse(FileManager.default.fileExists(atPath: KeyFileManagerTest.filePath)) XCTAssertFalse(FileManager.default.fileExists(atPath: KeyFileManagerTest.filePath))
XCTAssertTrue(storage[PgpKey.PRIVATE.getKeychainKey()] == fileContent) XCTAssertTrue(storage[PgpKey.PRIVATE.getKeychainKey()] == fileContent)
} }
func testErrorReadingFile() throws { func testErrorReadingFile() throws {
XCTAssertThrowsError(try KeyFileManagerTest.keyFileManager.importKeyAndDeleteFile()) { XCTAssertThrowsError(try KeyFileManagerTest.keyFileManager.importKeyAndDeleteFile { _, _ in }) {
XCTAssertEqual($0 as! AppError, AppError.ReadingFile("test.txt")) XCTAssertEqual($0 as! AppError, AppError.ReadingFile("test.txt"))
} }
} }

View file

@ -12,13 +12,7 @@ import XCTest
class PGPAgentTest: XCTestCase { class PGPAgentTest: XCTestCase {
override func setUp() { private let keychain = DictBasedKeychain()
PGPAgent().removePGPKeys()
}
override func tearDown() {
PGPAgent().removePGPKeys()
}
func basicEncryptDecrypt(pgpAgent: PGPAgent) -> Bool { func basicEncryptDecrypt(pgpAgent: PGPAgent) -> Bool {
// Encrypt and decrypt. // Encrypt and decrypt.
@ -33,7 +27,7 @@ class PGPAgentTest: XCTestCase {
} }
func testInitPGPKey() { func testInitPGPKey() {
let pgpAgent = PGPAgent() let pgpAgent = PGPAgent(keyStore: keychain)
// [RSA2048] Setup keys. // [RSA2048] Setup keys.
try? pgpAgent.initPGPKey(with: PGP_RSA2048_PUBLIC_KEY, keyType: .PUBLIC) try? pgpAgent.initPGPKey(with: PGP_RSA2048_PUBLIC_KEY, keyType: .PUBLIC)
@ -41,7 +35,7 @@ class PGPAgentTest: XCTestCase {
XCTAssertTrue(pgpAgent.isImported) XCTAssertTrue(pgpAgent.isImported)
XCTAssertEqual(pgpAgent.pgpKeyID, "A1024DAE") XCTAssertEqual(pgpAgent.pgpKeyID, "A1024DAE")
XCTAssertTrue(self.basicEncryptDecrypt(pgpAgent: pgpAgent)) XCTAssertTrue(self.basicEncryptDecrypt(pgpAgent: pgpAgent))
let pgpAgent2 = PGPAgent() let pgpAgent2 = PGPAgent(keyStore: keychain)
try? pgpAgent2.initPGPKeys() // load from the keychain try? pgpAgent2.initPGPKeys() // load from the keychain
XCTAssertTrue(self.basicEncryptDecrypt(pgpAgent: pgpAgent2)) XCTAssertTrue(self.basicEncryptDecrypt(pgpAgent: pgpAgent2))
pgpAgent.removePGPKeys() pgpAgent.removePGPKeys()
@ -88,7 +82,7 @@ class PGPAgentTest: XCTestCase {
} }
func testInitPGPKeyBadPrivateKeys() { func testInitPGPKeyBadPrivateKeys() {
let pgpAgent = PGPAgent() let pgpAgent = PGPAgent(keyStore: keychain)
let plainData = "Hello World!".data(using: .utf8)! let plainData = "Hello World!".data(using: .utf8)!
// [RSA2048] Setup the public key. // [RSA2048] Setup the public key.

View file

@ -0,0 +1,42 @@
//
// DictBasedKeychain.swift
// passKitTests
//
// Created by Danny Moesch on 20.07.19.
// Copyright © 2019 Bob Sun. All rights reserved.
//
import Foundation
import passKit
class DictBasedKeychain: KeyStore {
private var store: [String: Any] = [:]
public func add(data: Data?, for key: String) {
store[key] = data
}
public func add(string: String?, for key: String) {
store[key] = string
}
public func contains(key: String) -> Bool {
return store[key] != nil
}
public func get(for key: String) -> Data? {
return store[key] as? Data
}
public func get(for key: String) -> String? {
return store[key] as? String
}
public func removeContent(for key: String) {
store.removeValue(forKey: key)
}
public func removeAllContent() {
store.removeAll()
}
}