Skip to content

Commit e6d753a

Browse files
committed
Merge branch 'jens/configuration-fixes'
2 parents d859d5a + 62afd8a commit e6d753a

File tree

11 files changed

+177
-39
lines changed

11 files changed

+177
-39
lines changed

Authenticator.xcodeproj/project.pbxproj

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
B4C93E8929B89DE300C2A8B8 /* DetachedMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4C93E8829B89DE300C2A8B8 /* DetachedMenu.swift */; };
118118
B4C93E9329C1B2BC00C2A8B8 /* AboutWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4C93E9229C1B2BC00C2A8B8 /* AboutWrapper.swift */; };
119119
B4C93E9529C1B90900C2A8B8 /* AddAccountWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4C93E9429C1B90900C2A8B8 /* AddAccountWrapper.swift */; };
120+
B4D71E812CE4E6E6004D4C29 /* YubiKit in Frameworks */ = {isa = PBXBuildFile; productRef = B4D71E802CE4E6E6004D4C29 /* YubiKit */; };
120121
B4DB228A299BC373003110ED /* OATHSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4DB2289299BC373003110ED /* OATHSession.swift */; };
121122
B4FE90D02A42028400B59170 /* VersionHistoryWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4FE90CF2A42028400B59170 /* VersionHistoryWrapper.swift */; };
122123
B4FE90D22A4431AB00B59170 /* NotificationsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4FE90D12A4431AB00B59170 /* NotificationsViewModel.swift */; };
@@ -299,6 +300,7 @@
299300
buildActionMask = 2147483647;
300301
files = (
301302
B44E5E842C74C8CC007ABB79 /* YubiKit in Frameworks */,
303+
B4D71E812CE4E6E6004D4C29 /* YubiKit in Frameworks */,
302304
B42A39332B2A03D20039DB26 /* YubiKit in Frameworks */,
303305
B9F0FF11F842A39183974083 /* (null) in Frameworks */,
304306
51AFD4DA271D4278008F2630 /* QuartzCore.framework in Frameworks */,
@@ -633,6 +635,7 @@
633635
packageProductDependencies = (
634636
B42A39322B2A03D20039DB26 /* YubiKit */,
635637
B44E5E832C74C8CC007ABB79 /* YubiKit */,
638+
B4D71E802CE4E6E6004D4C29 /* YubiKit */,
636639
);
637640
productName = Authenticator;
638641
productReference = 818866B322DFD729006BC0A8 /* Authenticator.app */;
@@ -695,7 +698,7 @@
695698
);
696699
mainGroup = 818866AA22DFD729006BC0A8;
697700
packageReferences = (
698-
B44E5E822C74C8CC007ABB79 /* XCLocalSwiftPackageReference "../yubikit-ios" */,
701+
B4D71E7F2CE4E6E6004D4C29 /* XCRemoteSwiftPackageReference "yubikit-ios" */,
699702
);
700703
productRefGroup = 818866B422DFD729006BC0A8 /* Products */;
701704
projectDirPath = "";
@@ -932,7 +935,7 @@
932935
buildSettings = {
933936
CODE_SIGN_ENTITLEMENTS = TokenExtension/TokenExtension.entitlements;
934937
CODE_SIGN_STYLE = Automatic;
935-
CURRENT_PROJECT_VERSION = 143;
938+
CURRENT_PROJECT_VERSION = 163;
936939
DEVELOPMENT_TEAM = LQA3CS5MM7;
937940
INFOPLIST_FILE = TokenExtension/Info.plist;
938941
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
@@ -956,7 +959,7 @@
956959
buildSettings = {
957960
CODE_SIGN_ENTITLEMENTS = TokenExtension/TokenExtension.entitlements;
958961
CODE_SIGN_STYLE = Automatic;
959-
CURRENT_PROJECT_VERSION = 143;
962+
CURRENT_PROJECT_VERSION = 163;
960963
DEVELOPMENT_TEAM = LQA3CS5MM7;
961964
INFOPLIST_FILE = TokenExtension/Info.plist;
962965
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
@@ -1106,7 +1109,7 @@
11061109
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
11071110
CODE_SIGN_ENTITLEMENTS = Authenticator/Authenticator.entitlements;
11081111
CODE_SIGN_STYLE = Automatic;
1109-
CURRENT_PROJECT_VERSION = 143;
1112+
CURRENT_PROJECT_VERSION = 163;
11101113
DEVELOPMENT_TEAM = LQA3CS5MM7;
11111114
HEADER_SEARCH_PATHS = "../Submodules/YubiKit/**";
11121115
INFOPLIST_FILE = Authenticator/Info.plist;
@@ -1136,7 +1139,7 @@
11361139
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
11371140
CODE_SIGN_ENTITLEMENTS = Authenticator/Authenticator.entitlements;
11381141
CODE_SIGN_STYLE = Automatic;
1139-
CURRENT_PROJECT_VERSION = 143;
1142+
CURRENT_PROJECT_VERSION = 163;
11401143
DEVELOPMENT_TEAM = LQA3CS5MM7;
11411144
HEADER_SEARCH_PATHS = "../Submodules/YubiKit/**";
11421145
INFOPLIST_FILE = Authenticator/Info.plist;
@@ -1244,12 +1247,16 @@
12441247
};
12451248
/* End XCConfigurationList section */
12461249

1247-
/* Begin XCLocalSwiftPackageReference section */
1248-
B44E5E822C74C8CC007ABB79 /* XCLocalSwiftPackageReference "../yubikit-ios" */ = {
1249-
isa = XCLocalSwiftPackageReference;
1250-
relativePath = "../yubikit-ios";
1250+
/* Begin XCRemoteSwiftPackageReference section */
1251+
B4D71E7F2CE4E6E6004D4C29 /* XCRemoteSwiftPackageReference "yubikit-ios" */ = {
1252+
isa = XCRemoteSwiftPackageReference;
1253+
repositoryURL = "https://github.com/Yubico/yubikit-ios";
1254+
requirement = {
1255+
branch = main;
1256+
kind = branch;
1257+
};
12511258
};
1252-
/* End XCLocalSwiftPackageReference section */
1259+
/* End XCRemoteSwiftPackageReference section */
12531260

12541261
/* Begin XCSwiftPackageProductDependency section */
12551262
B42A39322B2A03D20039DB26 /* YubiKit */ = {
@@ -1260,6 +1267,11 @@
12601267
isa = XCSwiftPackageProductDependency;
12611268
productName = YubiKit;
12621269
};
1270+
B4D71E802CE4E6E6004D4C29 /* YubiKit */ = {
1271+
isa = XCSwiftPackageProductDependency;
1272+
package = B4D71E7F2CE4E6E6004D4C29 /* XCRemoteSwiftPackageReference "yubikit-ios" */;
1273+
productName = YubiKit;
1274+
};
12631275
/* End XCSwiftPackageProductDependency section */
12641276
};
12651277
rootObject = 818866AB22DFD729006BC0A8 /* Project object */;

Authenticator/Localizable.xcstrings

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@
552552
}
553553
},
554554
"Confirm OATH reset" : {
555+
"extractionState" : "stale",
555556
"localizations" : {
556557
"fr" : {
557558
"stringUnit" : {
@@ -1048,6 +1049,7 @@
10481049
}
10491050
},
10501051
"FIDO factory reset" : {
1052+
"extractionState" : "stale",
10511053
"localizations" : {
10521054
"fr" : {
10531055
"stringUnit" : {
@@ -1113,6 +1115,7 @@
11131115
}
11141116
},
11151117
"FIDO PIN protection" : {
1118+
"extractionState" : "stale",
11161119
"localizations" : {
11171120
"fr" : {
11181121
"stringUnit" : {
@@ -1129,6 +1132,7 @@
11291132
}
11301133
},
11311134
"FIDO reset" : {
1135+
"extractionState" : "stale",
11321136
"localizations" : {
11331137
"fr" : {
11341138
"stringUnit" : {
@@ -1178,6 +1182,7 @@
11781182
}
11791183
},
11801184
"For additional security and to prevent unauthorized access the FIDO application can be protected by a PIN." : {
1185+
"extractionState" : "stale",
11811186
"localizations" : {
11821187
"fr" : {
11831188
"stringUnit" : {
@@ -1194,6 +1199,7 @@
11941199
}
11951200
},
11961201
"For additional security and to prevent unauthorized access the YubiKey can be password protected." : {
1202+
"extractionState" : "stale",
11971203
"localizations" : {
11981204
"fr" : {
11991205
"stringUnit" : {
@@ -1708,7 +1714,24 @@
17081714
}
17091715
}
17101716
},
1717+
"OATH password" : {
1718+
"localizations" : {
1719+
"fr" : {
1720+
"stringUnit" : {
1721+
"state" : "translated",
1722+
"value" : "Mots de passe OATH"
1723+
}
1724+
},
1725+
"ja" : {
1726+
"stringUnit" : {
1727+
"state" : "translated",
1728+
"value" : "OATHパスワード"
1729+
}
1730+
}
1731+
}
1732+
},
17111733
"OATH password protection" : {
1734+
"extractionState" : "stale",
17121735
"localizations" : {
17131736
"fr" : {
17141737
"stringUnit" : {
@@ -2453,6 +2476,22 @@
24532476
}
24542477
}
24552478
},
2479+
"Reset FIDO" : {
2480+
"localizations" : {
2481+
"fr" : {
2482+
"stringUnit" : {
2483+
"state" : "translated",
2484+
"value" : "Réinitialiser FIDO"
2485+
}
2486+
},
2487+
"ja" : {
2488+
"stringUnit" : {
2489+
"state" : "translated",
2490+
"value" : "FIDOのリセット"
2491+
}
2492+
}
2493+
}
2494+
},
24562495
"Reset FIDO application" : {
24572496
"comment" : "FIDO reset NFC confirmation message",
24582497
"localizations" : {
@@ -2587,6 +2626,7 @@
25872626
}
25882627
},
25892628
"Saved passwords has been cleared" : {
2629+
"extractionState" : "stale",
25902630
"localizations" : {
25912631
"fr" : {
25922632
"stringUnit" : {
@@ -3121,6 +3161,22 @@
31213161
}
31223162
}
31233163
},
3164+
"This will irrevocably delete all OATH TOTP/HOTP accounts from your YubiKey." : {
3165+
"localizations" : {
3166+
"fr" : {
3167+
"stringUnit" : {
3168+
"state" : "translated",
3169+
"value" : "Cela supprimera définitivement tous les comptes OATH TOTP/HOTP de votre YubiKey."
3170+
}
3171+
},
3172+
"ja" : {
3173+
"stringUnit" : {
3174+
"state" : "translated",
3175+
"value" : "これにより、すべてのOATH TOTP/HOTPアカウントがYubiKeyから削除されます。削除は取り消すことができません。"
3176+
}
3177+
}
3178+
}
3179+
},
31243180
"This will irrevocably delete all U2F and FIDO2 accounts, including passkeys, from your YubiKey." : {
31253181
"localizations" : {
31263182
"fr" : {
@@ -3169,6 +3225,38 @@
31693225
}
31703226
}
31713227
},
3228+
"To prevent unauthorized access the FIDO application can be protected by a PIN." : {
3229+
"localizations" : {
3230+
"fr" : {
3231+
"stringUnit" : {
3232+
"state" : "translated",
3233+
"value" : "Pour éviter tout accès non autorisé, l'application FIDO peut être protégée par un code PIN."
3234+
}
3235+
},
3236+
"ja" : {
3237+
"stringUnit" : {
3238+
"state" : "translated",
3239+
"value" : "不正アクセスを防ぐため、FIDOアプリケーションはPINで保護することができる。"
3240+
}
3241+
}
3242+
}
3243+
},
3244+
"To prevent unauthorized access the OATH application can be protected by a password." : {
3245+
"localizations" : {
3246+
"fr" : {
3247+
"stringUnit" : {
3248+
"state" : "translated",
3249+
"value" : "Pour empêcher tout accès non autorisé, l'application OATH peut être protégée par un mot de passe."
3250+
}
3251+
},
3252+
"ja" : {
3253+
"stringUnit" : {
3254+
"state" : "translated",
3255+
"value" : "不正アクセスを防ぐため、OATHアプリケーションはパスワードで保護することができます。"
3256+
}
3257+
}
3258+
}
3259+
},
31723260
"To prevent unauthorized access this YubiKey is protected with a password." : {
31733261
"comment" : "OATH password entry enter password",
31743262
"localizations" : {
@@ -3604,6 +3692,7 @@
36043692
}
36053693
},
36063694
"YubiKey has been reset" : {
3695+
"extractionState" : "stale",
36073696
"localizations" : {
36083697
"fr" : {
36093698
"stringUnit" : {

Authenticator/Model/ConfigurationViewModel.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ class ConfigurationViewModel: ObservableObject {
2121

2222
let connection = Connection()
2323

24-
@Published var deviceInfo: YKFManagementDeviceInfo?
24+
@Published var deviceInfo: YKFManagementDeviceInfo? {
25+
didSet {
26+
resetDeviceInfoTask?.cancel()
27+
resetDeviceInfoTask = nil
28+
}
29+
}
30+
31+
var resetDeviceInfoTask: Task<Void, Error>?
2532

2633
init() {
2734
Logger.allocation.debug("ConfigurationViewModel: init")
@@ -52,7 +59,13 @@ class ConfigurationViewModel: ObservableObject {
5259
}
5360

5461
func start() {
55-
deviceInfo = nil
62+
resetDeviceInfoTask = Task.detached {
63+
try? await Task.sleep(for: .seconds(1))
64+
guard !Task.isCancelled else { return }
65+
Task.detached { @MainActor in
66+
self.deviceInfo = nil
67+
}
68+
}
5669
waitForConnection()
5770
}
5871

Authenticator/Model/Connection.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ class Connection: NSObject {
9494
smartCardConnection?.stop()
9595
accessoryConnection?.stop()
9696
nfcConnection?.stop()
97-
if YubiKitDeviceCapabilities.supportsMFIAccessoryKey {
98-
YubiKitManager.shared.startAccessoryConnection()
99-
}
100-
if YubiKitDeviceCapabilities.supportsSmartCardOverUSBC {
101-
YubiKitManager.shared.startSmartCardConnection()
97+
// stop() returns immediately but closing the connection will take a few cycles so we need to wait to make sure it's closed before restarting.
98+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
99+
if YubiKitDeviceCapabilities.supportsMFIAccessoryKey {
100+
YubiKitManager.shared.startAccessoryConnection()
101+
}
102+
if YubiKitDeviceCapabilities.supportsSmartCardOverUSBC {
103+
YubiKitManager.shared.startSmartCardConnection()
104+
}
102105
}
103106
}
104107

Authenticator/UI/YubiKeyConfiguration/ConfigurationView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@ struct ConfigurationView: View {
150150
Text("Manage PIN")
151151
}
152152
NavigationLink {
153-
FIDOResetView()
154-
.onDisappear {
153+
FIDOResetView {
154+
Task.detached { @MainActor in
155155
model.start()
156156
}
157+
}
157158
} label: {
158159
ListIconView(image: Image(systemName: "trash"), color: Color(.systemRed), padding: 5)
159160
Text("Reset FIDO application")

Authenticator/UI/YubiKeyConfiguration/FIDOPINView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ struct FIDOPINView: View {
2828

2929
var body: some View {
3030
SettingsView(image: Image(systemName: "lock.shield"), imageColor: Color(.systemPurple)) {
31-
Text("FIDO PIN protection").font(.title2).bold()
31+
Text("FIDO PIN").font(.title2).bold()
3232

33-
Text("For additional security and to prevent unauthorized access the FIDO application can be protected by a PIN.")
33+
Text("To prevent unauthorized access the FIDO application can be protected by a PIN.")
3434
.font(.subheadline)
3535
.multilineTextAlignment(.center)
3636

0 commit comments

Comments
 (0)