Skip to content

Commit a410c94

Browse files
authored
Refactor YubiKey decryptor (#663)
- Add YKFSmartCardInterface extension to simplify smart card related calls - Use async/await to rewrite callback closures - Update YubiKeyConnection - Better error handling
1 parent fc35805 commit a410c94

File tree

9 files changed

+343
-319
lines changed

9 files changed

+343
-319
lines changed

pass.xcodeproj/project.pbxproj

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@
117117
9A1D1CE526E5D1CE0052028E /* OneTimePassword in Frameworks */ = {isa = PBXBuildFile; productRef = 9A1D1CE426E5D1CE0052028E /* OneTimePassword */; };
118118
9A1D1CE726E5D2230052028E /* OneTimePassword in Frameworks */ = {isa = PBXBuildFile; productRef = 9A1D1CE626E5D2230052028E /* OneTimePassword */; };
119119
9A1F47FA26E5CF4B000C0E01 /* OneTimePassword in Frameworks */ = {isa = PBXBuildFile; productRef = 9A1F47F926E5CF4B000C0E01 /* OneTimePassword */; };
120-
9A2C7D822782CB2F00BD9AF3 /* YubiKit in Frameworks */ = {isa = PBXBuildFile; productRef = 9A2C7D812782CB2F00BD9AF3 /* YubiKit */; };
121120
9A2C7D842783FF5200BD9AF3 /* YubiKeyConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2C7D832783FF5200BD9AF3 /* YubiKeyConnection.swift */; };
122-
9A2C7D862783FF9600BD9AF3 /* YubiKit in Frameworks */ = {isa = PBXBuildFile; productRef = 9A2C7D852783FF9600BD9AF3 /* YubiKit */; };
123121
9A2C7D8B2784139200BD9AF3 /* YubiKeyAPDU.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2C7D8A2784139200BD9AF3 /* YubiKeyAPDU.swift */; };
124122
9A55C158259E785600FA8FD9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDD1E2E8231000FDF54 /* Assets.xcassets */; };
125123
9A55C15F259E785700FA8FD9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDD1E2E8231000FDF54 /* Assets.xcassets */; };
@@ -132,8 +130,6 @@
132130
9A58664825AAAB7E006719C2 /* SearchPassword.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A5865EF25AA944B006719C2 /* SearchPassword.storyboard */; };
133131
9A58665125AADB76006719C2 /* CredentialProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A58665025AADB76006719C2 /* CredentialProvider.swift */; };
134132
9A5C6EF42786CA5F0003F340 /* AlertPresenting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5C6EEF2786C8710003F340 /* AlertPresenting.swift */; };
135-
9A5C6EF92786CE170003F340 /* YubiKit in Frameworks */ = {isa = PBXBuildFile; productRef = 9A5C6EF82786CE170003F340 /* YubiKit */; };
136-
9A5C6EFB2786CE5E0003F340 /* YubiKit in Frameworks */ = {isa = PBXBuildFile; productRef = 9A5C6EFA2786CE5E0003F340 /* YubiKit */; };
137133
9A5C6EFF2787F0980003F340 /* Gopenpgp.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9ADAB21C26DDA52400900F10 /* Gopenpgp.xcframework */; };
138134
9A5C6F022787F09A0003F340 /* passKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A26075781EEC6F34005DB03E /* passKit.framework */; };
139135
9A5C6F042787F09D0003F340 /* Gopenpgp.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9ADAB21C26DDA52400900F10 /* Gopenpgp.xcframework */; };
@@ -199,6 +195,8 @@
199195
DC4914961E434301007FF592 /* LabelTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4914941E434301007FF592 /* LabelTableViewCell.swift */; };
200196
DC4914991E434600007FF592 /* PasswordDetailTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4914981E434600007FF592 /* PasswordDetailTableViewController.swift */; };
201197
DC5F385B1E56AADB00C69ACA /* PGPKeyArmorImportTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5F385A1E56AADB00C69ACA /* PGPKeyArmorImportTableViewController.swift */; };
198+
DC7CBBBD2D0FA3F2003BB4D2 /* YubiKit in Frameworks */ = {isa = PBXBuildFile; productRef = DC7CBBBC2D0FA3F2003BB4D2 /* YubiKit */; };
199+
DC7CBBBF2D0FAC92003BB4D2 /* YKFSmartCardInterfaceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC7CBBBE2D0FAC8E003BB4D2 /* YKFSmartCardInterfaceExtension.swift */; };
202200
DC8963C01E38EEB900828B09 /* SSHKeyURLImportTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC8963BF1E38EEB900828B09 /* SSHKeyURLImportTableViewController.swift */; };
203201
DC917BD71E2E8231000FDF54 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC917BD61E2E8231000FDF54 /* AppDelegate.swift */; };
204202
DC917BDC1E2E8231000FDF54 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDA1E2E8231000FDF54 /* Main.storyboard */; };
@@ -495,6 +493,7 @@
495493
DC4914941E434301007FF592 /* LabelTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LabelTableViewCell.swift; sourceTree = "<group>"; };
496494
DC4914981E434600007FF592 /* PasswordDetailTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordDetailTableViewController.swift; sourceTree = "<group>"; };
497495
DC5F385A1E56AADB00C69ACA /* PGPKeyArmorImportTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PGPKeyArmorImportTableViewController.swift; sourceTree = "<group>"; };
496+
DC7CBBBE2D0FAC8E003BB4D2 /* YKFSmartCardInterfaceExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YKFSmartCardInterfaceExtension.swift; sourceTree = "<group>"; };
498497
DC8963BF1E38EEB900828B09 /* SSHKeyURLImportTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SSHKeyURLImportTableViewController.swift; sourceTree = "<group>"; };
499498
DC917BD31E2E8231000FDF54 /* Pass.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Pass.app; sourceTree = BUILT_PRODUCTS_DIR; };
500499
DC917BD61E2E8231000FDF54 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -533,7 +532,6 @@
533532
buildActionMask = 2147483647;
534533
files = (
535534
5F9D7B0E27AF6FCA00A8AB22 /* CryptoTokenKit.framework in Frameworks */,
536-
9A5C6EF92786CE170003F340 /* YubiKit in Frameworks */,
537535
9A996C6E26DEB99200A4485D /* passKit.framework in Frameworks */,
538536
30A3001A26DA697C002A734E /* SwiftyUserDefaults in Frameworks */,
539537
9A5C6F042787F09D0003F340 /* Gopenpgp.xcframework in Frameworks */,
@@ -544,14 +542,14 @@
544542
isa = PBXFrameworksBuildPhase;
545543
buildActionMask = 2147483647;
546544
files = (
545+
DC7CBBBD2D0FA3F2003BB4D2 /* YubiKit in Frameworks */,
547546
9ADAB21D26DDA52400900F10 /* Gopenpgp.xcframework in Frameworks */,
548547
30A3001426DA6692002A734E /* KeychainAccess in Frameworks */,
549548
9A996C5726DDF65900A4485D /* Base32 in Frameworks */,
550549
9A1D1CE526E5D1CE0052028E /* OneTimePassword in Frameworks */,
551550
30333B2D2CF9252E008A2EA2 /* SVProgressHUD in Frameworks */,
552551
30A3001626DA6697002A734E /* SwiftyUserDefaults in Frameworks */,
553552
3032DA5626DAF4E500A7728C /* ObjectivePGP in Frameworks */,
554-
9A2C7D862783FF9600BD9AF3 /* YubiKit in Frameworks */,
555553
);
556554
runOnlyForDeploymentPostprocessing = 0;
557555
};
@@ -572,7 +570,6 @@
572570
files = (
573571
5F9D7B0F27AF6FD200A8AB22 /* CryptoTokenKit.framework in Frameworks */,
574572
9A5C6F022787F09A0003F340 /* passKit.framework in Frameworks */,
575-
9A5C6EFB2786CE5E0003F340 /* YubiKit in Frameworks */,
576573
9A5C6EFF2787F0980003F340 /* Gopenpgp.xcframework in Frameworks */,
577574
9A5C6F082787F0C20003F340 /* SwiftyUserDefaults in Frameworks */,
578575
);
@@ -596,7 +593,6 @@
596593
9A1F47FA26E5CF4B000C0E01 /* OneTimePassword in Frameworks */,
597594
9A996C5326DDF61F00A4485D /* Base32 in Frameworks */,
598595
3032DA5426DAF4C200A7728C /* ObjectivePGP in Frameworks */,
599-
9A2C7D822782CB2F00BD9AF3 /* YubiKit in Frameworks */,
600596
3010CB6626DA500F008964D2 /* KeychainAccess in Frameworks */,
601597
9A996C5826DEB0D100A4485D /* passKit.framework in Frameworks */,
602598
30ED1777276F8842009BA876 /* ObjectiveGit in Frameworks */,
@@ -683,6 +679,7 @@
683679
30B6AABA21F49095006B352D /* Extensions */ = {
684680
isa = PBXGroup;
685681
children = (
682+
DC7CBBBE2D0FAC8E003BB4D2 /* YKFSmartCardInterfaceExtension.swift */,
686683
30DAFD49240985A7002456E7 /* Array+Slices.swift */,
687684
30CCA90A2325119C0048CA51 /* Data+Mutable.swift */,
688685
30697C3621F63C990064FCAC /* String+Localization.swift */,
@@ -1127,7 +1124,6 @@
11271124
name = passAutoFillExtension;
11281125
packageProductDependencies = (
11291126
30A3001926DA697C002A734E /* SwiftyUserDefaults */,
1130-
9A5C6EF82786CE170003F340 /* YubiKit */,
11311127
);
11321128
productName = passAutoFillExtension;
11331129
productReference = A239F5952158C08B00576CBF /* passAutoFillExtension.appex */;
@@ -1153,8 +1149,8 @@
11531149
3032DA5526DAF4E500A7728C /* ObjectivePGP */,
11541150
9A996C5626DDF65900A4485D /* Base32 */,
11551151
9A1D1CE426E5D1CE0052028E /* OneTimePassword */,
1156-
9A2C7D852783FF9600BD9AF3 /* YubiKit */,
11571152
30333B2C2CF9252E008A2EA2 /* SVProgressHUD */,
1153+
DC7CBBBC2D0FA3F2003BB4D2 /* YubiKit */,
11581154
);
11591155
productName = passKit;
11601156
productReference = A26075781EEC6F34005DB03E /* passKit.framework */;
@@ -1198,7 +1194,6 @@
11981194
);
11991195
name = passExtension;
12001196
packageProductDependencies = (
1201-
9A5C6EFA2786CE5E0003F340 /* YubiKit */,
12021197
9A5C6F072787F0C20003F340 /* SwiftyUserDefaults */,
12031198
);
12041199
productName = passExtension;
@@ -1256,7 +1251,6 @@
12561251
9A996C5226DDF61F00A4485D /* Base32 */,
12571252
9A1F47F926E5CF4B000C0E01 /* OneTimePassword */,
12581253
30ED1776276F8842009BA876 /* ObjectiveGit */,
1259-
9A2C7D812782CB2F00BD9AF3 /* YubiKit */,
12601254
30333B2A2CF924DC008A2EA2 /* SVProgressHUD */,
12611255
);
12621256
productName = pass;
@@ -1362,10 +1356,10 @@
13621356
3032DA5226DAF4C200A7728C /* XCRemoteSwiftPackageReference "ObjectivePGP" */,
13631357
9A1F47F826E5CF4B000C0E01 /* XCRemoteSwiftPackageReference "OneTimePassword" */,
13641358
30ED1775276F8842009BA876 /* XCRemoteSwiftPackageReference "objective-git-swift-package" */,
1365-
9A2C7D802782CB2F00BD9AF3 /* XCRemoteSwiftPackageReference "yubikit-ios" */,
13661359
307CA2322CF348260099F6DE /* XCRemoteSwiftPackageReference "SwiftFormat" */,
13671360
307CB7522CF9219100D0931F /* XCRemoteSwiftPackageReference "SVProgressHUD" */,
13681361
30333B292CF922D9008A2EA2 /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */,
1362+
DC7CBBBB2D0FA3F2003BB4D2 /* XCRemoteSwiftPackageReference "yubikit-ios" */,
13691363
);
13701364
productRefGroup = DC917BD41E2E8231000FDF54 /* Products */;
13711365
projectDirPath = "";
@@ -1568,6 +1562,7 @@
15681562
A26075AD1EEC7125005DB03E /* pass.xcdatamodeld in Sources */,
15691563
30697C2D21F63C5A0064FCAC /* PasswordGeneratorFlavor.swift in Sources */,
15701564
308C273A2279F9CB0016D0E2 /* SearchBarScope.swift in Sources */,
1565+
DC7CBBBF2D0FAC92003BB4D2 /* YKFSmartCardInterfaceExtension.swift in Sources */,
15711566
30697C2F21F63C5A0064FCAC /* DefaultsKeys.swift in Sources */,
15721567
30A1D2A821B2D53200E2D1F7 /* PasswordChange.swift in Sources */,
15731568
30697C3E21F63C990064FCAC /* String+Utilities.swift in Sources */,
@@ -2932,12 +2927,12 @@
29322927
revision = 8d59e4abba762d0f1e9aed161081f7b3fe21daa0;
29332928
};
29342929
};
2935-
9A2C7D802782CB2F00BD9AF3 /* XCRemoteSwiftPackageReference "yubikit-ios" */ = {
2930+
DC7CBBBB2D0FA3F2003BB4D2 /* XCRemoteSwiftPackageReference "yubikit-ios" */ = {
29362931
isa = XCRemoteSwiftPackageReference;
2937-
repositoryURL = "https://github.com/Yubico/yubikit-ios";
2932+
repositoryURL = "https://github.com/Yubico/yubikit-ios.git";
29382933
requirement = {
29392934
kind = upToNextMajorVersion;
2940-
minimumVersion = 4.0.0;
2935+
minimumVersion = 4.6.0;
29412936
};
29422937
};
29432938
/* End XCRemoteSwiftPackageReference section */
@@ -3028,26 +3023,6 @@
30283023
package = 9A1F47F826E5CF4B000C0E01 /* XCRemoteSwiftPackageReference "OneTimePassword" */;
30293024
productName = OneTimePassword;
30303025
};
3031-
9A2C7D812782CB2F00BD9AF3 /* YubiKit */ = {
3032-
isa = XCSwiftPackageProductDependency;
3033-
package = 9A2C7D802782CB2F00BD9AF3 /* XCRemoteSwiftPackageReference "yubikit-ios" */;
3034-
productName = YubiKit;
3035-
};
3036-
9A2C7D852783FF9600BD9AF3 /* YubiKit */ = {
3037-
isa = XCSwiftPackageProductDependency;
3038-
package = 9A2C7D802782CB2F00BD9AF3 /* XCRemoteSwiftPackageReference "yubikit-ios" */;
3039-
productName = YubiKit;
3040-
};
3041-
9A5C6EF82786CE170003F340 /* YubiKit */ = {
3042-
isa = XCSwiftPackageProductDependency;
3043-
package = 9A2C7D802782CB2F00BD9AF3 /* XCRemoteSwiftPackageReference "yubikit-ios" */;
3044-
productName = YubiKit;
3045-
};
3046-
9A5C6EFA2786CE5E0003F340 /* YubiKit */ = {
3047-
isa = XCSwiftPackageProductDependency;
3048-
package = 9A2C7D802782CB2F00BD9AF3 /* XCRemoteSwiftPackageReference "yubikit-ios" */;
3049-
productName = YubiKit;
3050-
};
30513026
9A5C6F072787F0C20003F340 /* SwiftyUserDefaults */ = {
30523027
isa = XCSwiftPackageProductDependency;
30533028
package = 3010CB5E26DA4F87008964D2 /* XCRemoteSwiftPackageReference "SwiftyUserDefaults" */;
@@ -3063,6 +3038,11 @@
30633038
package = 30A3000C26DA62F4002A734E /* XCRemoteSwiftPackageReference "Base32" */;
30643039
productName = Base32;
30653040
};
3041+
DC7CBBBC2D0FA3F2003BB4D2 /* YubiKit */ = {
3042+
isa = XCSwiftPackageProductDependency;
3043+
package = DC7CBBBB2D0FA3F2003BB4D2 /* XCRemoteSwiftPackageReference "yubikit-ios" */;
3044+
productName = YubiKit;
3045+
};
30663046
/* End XCSwiftPackageProductDependency section */
30673047

30683048
/* Begin XCVersionGroup section */

pass.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)