Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit af6b3e8

Browse files
authored
Merge pull request #788 from wordpress-mobile/ec/add-passkeys-support
Add Security Keys support
2 parents 3efca7d + 0015244 commit af6b3e8

File tree

26 files changed

+467
-60
lines changed

26 files changed

+467
-60
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ _None._
3030
3131
-->
3232

33+
## 7.2.0
34+
35+
### New Features
36+
37+
- Added security keys support as a two-factor authentication method.
38+
39+
### Internal Changes
40+
41+
- Bump WordPressKit dependency to `~> 8.7-beta`
42+
3343
## 7.0.0
3444

3545
### Breaking Changes

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def wordpress_authenticator_pods
2828
## These should match the version requirement from the podspec.
2929
pod 'Gridicons', '~> 1.0'
3030
pod 'WordPressUI', '~> 1.7-beta'
31-
pod 'WordPressKit', '~> 8.0-beta'
31+
pod 'WordPressKit', '~> 8.7-beta'
3232
pod 'WordPressShared', '~> 2.1-beta'
3333

3434
third_party_pods

Podfile.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ PODS:
88
- Specta (1.0.7)
99
- SVProgressHUD (2.2.5)
1010
- SwiftLint (0.49.1)
11-
- UIDeviceIdentifier (2.2.0)
12-
- WordPressAuthenticator (7.1.0):
11+
- UIDeviceIdentifier (2.3.0)
12+
- WordPressAuthenticator (7.2.0):
1313
- Gridicons (~> 1.0)
1414
- "NSURL+IDN (= 0.4)"
1515
- SVProgressHUD (~> 2.2.5)
16-
- WordPressKit (~> 8.0-beta)
16+
- WordPressKit (~> 8.7-beta)
1717
- WordPressShared (~> 2.1-beta)
1818
- WordPressUI (~> 1.7-beta)
19-
- WordPressKit (8.0.0):
19+
- WordPressKit (8.7.0):
2020
- Alamofire (~> 4.8.0)
2121
- NSObject-SafeExpectations (~> 0.0.4)
2222
- UIDeviceIdentifier (~> 2.0)
@@ -35,7 +35,7 @@ DEPENDENCIES:
3535
- SVProgressHUD (= 2.2.5)
3636
- SwiftLint (~> 0.49)
3737
- WordPressAuthenticator (from `.`)
38-
- WordPressKit (~> 8.0-beta)
38+
- WordPressKit (~> 8.7-beta)
3939
- WordPressShared (~> 2.1-beta)
4040
- WordPressUI (~> 1.7-beta)
4141

@@ -70,13 +70,13 @@ SPEC CHECKSUMS:
7070
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
7171
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
7272
SwiftLint: 32ee33ded0636d0905ef6911b2b67bbaeeedafa5
73-
UIDeviceIdentifier: f33af270ba9045ea18b31d9aab88e42a0082ea67
74-
WordPressAuthenticator: f73ba530531bb14eedd2f2b69c9b2d387004026c
75-
WordPressKit: 8e1c5a64645a59493a7316f38468ac036de9c79b
73+
UIDeviceIdentifier: 442b65b4ff1832d4ca9c2a157815cb29ad981b17
74+
WordPressAuthenticator: 1990484092eef67843515a5ed90f3e7db41caf35
75+
WordPressKit: a5432c2e3c2247c2b83b3ebf0acec75ae00782ef
7676
WordPressShared: 0aa459e5257a77184db87805a998f447443c9706
7777
WordPressUI: 1cf47a3b78154faf69caa18569ee7ece1e510fa0
7878
wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd
7979

80-
PODFILE CHECKSUM: 39d49f77667f2645b9a7575b7288487421a70c5d
80+
PODFILE CHECKSUM: 537f0cb26852aae6d94a89c678a95bc8bd640a01
8181

8282
COCOAPODS: 1.11.3

WordPressAuthenticator.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pod::Spec.new do |s|
44
s.name = 'WordPressAuthenticator'
5-
s.version = '7.1.0'
5+
s.version = '7.2.0'
66

77
s.summary = 'WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.'
88
s.description = <<-DESC
@@ -40,6 +40,6 @@ Pod::Spec.new do |s|
4040
# Use a loose restriction that allows both production and beta versions, up to the next major version.
4141
# If you want to update which of these is used, specify it in the host app.
4242
s.dependency 'WordPressUI', '~> 1.7-beta'
43-
s.dependency 'WordPressKit', '~> 8.0-beta'
43+
s.dependency 'WordPressKit', '~> 8.7-beta'
4444
s.dependency 'WordPressShared', '~> 2.1-beta'
4545
end

WordPressAuthenticator.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
02A526CF28A3A35D00FD1812 /* PasswordCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A526CE28A3A35D00FD1812 /* PasswordCoordinator.swift */; };
1717
1A21EE9822832BC300C940C6 /* WordPressComOAuthClientFacade+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A21EE9722832BC200C940C6 /* WordPressComOAuthClientFacade+Swift.swift */; };
1818
1A4095182271AEFC009AA86D /* WPAuthenticator-Swift.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4095152271AEFC009AA86D /* WPAuthenticator-Swift.h */; settings = {ATTRIBUTES = (Private, ); }; };
19+
264E09BF2AD39606004B5A5F /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 264E09BE2AD39606004B5A5F /* AuthenticationServices.framework */; };
1920
3108613125AFA4830022F75E /* PasteboardTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3108613025AFA4830022F75E /* PasteboardTests.swift */; };
2021
3F0B192C2A8DBE180012C731 /* LoginFieldsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F0B192B2A8DBE180012C731 /* LoginFieldsTests.swift */; };
2122
3F107B0529A87AF0009B3658 /* CodeVerifier+Fixture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F107B0429A87AF0009B3658 /* CodeVerifier+Fixture.swift */; };
@@ -272,6 +273,7 @@
272273
02A526CE28A3A35D00FD1812 /* PasswordCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordCoordinator.swift; sourceTree = "<group>"; };
273274
1A21EE9722832BC200C940C6 /* WordPressComOAuthClientFacade+Swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WordPressComOAuthClientFacade+Swift.swift"; sourceTree = "<group>"; };
274275
1A4095152271AEFC009AA86D /* WPAuthenticator-Swift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WPAuthenticator-Swift.h"; sourceTree = "<group>"; };
276+
264E09BE2AD39606004B5A5F /* AuthenticationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AuthenticationServices.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/iOSSupport/System/Library/Frameworks/AuthenticationServices.framework; sourceTree = DEVELOPER_DIR; };
275277
276354F054C34AD36CA32AB6 /* Pods-WordPressAuthenticator.release-alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.release-alpha.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.release-alpha.xcconfig"; sourceTree = "<group>"; };
276278
3108613025AFA4830022F75E /* PasteboardTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteboardTests.swift; sourceTree = "<group>"; };
277279
33FEF45B466FF8EAAE5F3923 /* Pods-WordPressAuthenticator.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.release.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.release.xcconfig"; sourceTree = "<group>"; };
@@ -510,6 +512,7 @@
510512
isa = PBXFrameworksBuildPhase;
511513
buildActionMask = 2147483647;
512514
files = (
515+
264E09BF2AD39606004B5A5F /* AuthenticationServices.framework in Frameworks */,
513516
7A7A9B9CD2D81959F9AB9AF6 /* Pods_WordPressAuthenticator.framework in Frameworks */,
514517
);
515518
runOnlyForDeploymentPostprocessing = 0;
@@ -969,6 +972,7 @@
969972
B5ED7910207E981400A8FD8C /* Frameworks */ = {
970973
isa = PBXGroup;
971974
children = (
975+
264E09BE2AD39606004B5A5F /* AuthenticationServices.framework */,
972976
B5ED7911207E981400A8FD8C /* WordPressKit.framework */,
973977
B5ED7913207E981400A8FD8C /* WordPressShared.framework */,
974978
B5ED7915207E981400A8FD8C /* WordPressUI.framework */,

WordPressAuthenticator.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WordPressAuthenticator/Analytics/AuthenticatorAnalyticsTracker.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ public class AuthenticatorAnalyticsTracker {
211211
///
212212
case sendCodeWithText = "send_code_with_text"
213213

214+
/// Used on the 2FA screen to use a security key instead of using the authenticator app
215+
///
216+
case enterSecurityKey = "enter_security_key"
217+
214218
/// Used on the 2FA screen to submit authentication code
215219
///
216220
case submitTwoFactorCode = "submit_2fa_code"

WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayStrings.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public struct WordPressAuthenticatorDisplayStrings {
1212
public let siteCredentialInstructions: String
1313
public let usernamePasswordInstructions: String
1414
public let twoFactorInstructions: String
15+
public let twoFactorOtherFormsInstructions: String
1516
public let magicLinkSignupInstructions: String
1617
public let openMailSignupInstructions: String
1718
public let openMailLoginInstructions: String
@@ -48,6 +49,7 @@ public struct WordPressAuthenticatorDisplayStrings {
4849
public let resetPasswordButtonTitle: String
4950
public let getLoginLinkButtonTitle: String
5051
public let textCodeButtonTitle: String
52+
public let securityKeyButtonTitle: String
5153
public let loginTermsOfService: String
5254
public let signupTermsOfService: String
5355
public let whatIsWPComLinkTitle: String
@@ -70,6 +72,7 @@ public struct WordPressAuthenticatorDisplayStrings {
7072
siteCredentialInstructions: String = defaultStrings.siteCredentialInstructions,
7173
usernamePasswordInstructions: String = defaultStrings.usernamePasswordInstructions,
7274
twoFactorInstructions: String = defaultStrings.twoFactorInstructions,
75+
twoFactorOtherFormsInstructions: String = defaultStrings.twoFactorOtherFormsInstructions,
7376
magicLinkSignupInstructions: String = defaultStrings.magicLinkSignupInstructions,
7477
openMailSignupInstructions: String = defaultStrings.openMailSignupInstructions,
7578
openMailLoginInstructions: String = defaultStrings.openMailLoginInstructions,
@@ -93,6 +96,7 @@ public struct WordPressAuthenticatorDisplayStrings {
9396
resetPasswordButtonTitle: String = defaultStrings.resetPasswordButtonTitle,
9497
getLoginLinkButtonTitle: String = defaultStrings.getLoginLinkButtonTitle,
9598
textCodeButtonTitle: String = defaultStrings.textCodeButtonTitle,
99+
securityKeyButtonTitle: String = defaultStrings.securityKeyButtonTitle,
96100
loginTermsOfService: String = defaultStrings.loginTermsOfService,
97101
signupTermsOfService: String = defaultStrings.signupTermsOfService,
98102
whatIsWPComLinkTitle: String = defaultStrings.whatIsWPComLinkTitle,
@@ -113,6 +117,7 @@ public struct WordPressAuthenticatorDisplayStrings {
113117
self.siteCredentialInstructions = siteCredentialInstructions
114118
self.usernamePasswordInstructions = usernamePasswordInstructions
115119
self.twoFactorInstructions = twoFactorInstructions
120+
self.twoFactorOtherFormsInstructions = twoFactorOtherFormsInstructions
116121
self.magicLinkSignupInstructions = magicLinkSignupInstructions
117122
self.openMailSignupInstructions = openMailSignupInstructions
118123
self.openMailLoginInstructions = openMailLoginInstructions
@@ -136,6 +141,7 @@ public struct WordPressAuthenticatorDisplayStrings {
136141
self.resetPasswordButtonTitle = resetPasswordButtonTitle
137142
self.getLoginLinkButtonTitle = getLoginLinkButtonTitle
138143
self.textCodeButtonTitle = textCodeButtonTitle
144+
self.securityKeyButtonTitle = securityKeyButtonTitle
139145
self.loginTermsOfService = loginTermsOfService
140146
self.signupTermsOfService = signupTermsOfService
141147
self.whatIsWPComLinkTitle = whatIsWPComLinkTitle
@@ -167,8 +173,10 @@ public extension WordPressAuthenticatorDisplayStrings {
167173
comment: "Enter your account information for {site url}. Asks the user to enter a username and password for their self-hosted site."),
168174
usernamePasswordInstructions: NSLocalizedString("Log in with your WordPress.com username and password.",
169175
comment: "Instructions on the WordPress.com username / password log in form."),
170-
twoFactorInstructions: NSLocalizedString("Please enter the verification code from your authenticator app, or tap the link below to receive a code via SMS.",
176+
twoFactorInstructions: NSLocalizedString("Please enter the verification code from your authenticator app.",
171177
comment: "Instruction text on the two-factor screen."),
178+
twoFactorOtherFormsInstructions: NSLocalizedString("Or choose another form of authentication.",
179+
comment: "Instruction text for other forms of two-factor auth methods."),
172180
magicLinkSignupInstructions: NSLocalizedString("We'll email you a signup link to create your new WordPress.com account.",
173181
comment: "Instruction text on the Sign Up screen."),
174182
openMailSignupInstructions: NSLocalizedString("We've emailed you a signup link to create your new WordPress.com account. Check your email on this device, and tap the link in the email you receive from WordPress.com.",
@@ -210,8 +218,10 @@ public extension WordPressAuthenticatorDisplayStrings {
210218
comment: "The button title for a secondary call-to-action button. When the user can't remember their password."),
211219
getLoginLinkButtonTitle: NSLocalizedString("Get a login link by email",
212220
comment: "The button title for a secondary call-to-action button. When the user wants to try sending a magic link instead of entering a password."),
213-
textCodeButtonTitle: NSLocalizedString("Text me a code instead",
221+
textCodeButtonTitle: NSLocalizedString("Text me a code via SMS",
214222
comment: "The button's title text to send a 2FA code via SMS text message."),
223+
securityKeyButtonTitle: NSLocalizedString("Use a security key",
224+
comment: "The button's title text to use a security key."),
215225
loginTermsOfService: NSLocalizedString("By continuing, you agree to our _Terms of Service_.", comment: "Legal disclaimer for logging in. The underscores _..._ denote underline."),
216226
signupTermsOfService: NSLocalizedString("If you continue with Apple or Google and don't already have a WordPress.com account, you are creating an account and you agree to our _Terms of Service_.", comment: "Legal disclaimer for signing up. The underscores _..._ denote underline."),
217227
whatIsWPComLinkTitle: NSLocalizedString("What is WordPress.com?",

WordPressAuthenticator/Authenticator/WordPressSupportSourceTag.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ extension WordPressSupportSourceTag {
3232
public static var login2FA: WordPressSupportSourceTag {
3333
return WordPressSupportSourceTag(name: "login2FA", origin: "origin:login-2fa")
3434
}
35+
public static var loginWebauthn: WordPressSupportSourceTag {
36+
return WordPressSupportSourceTag(name: "loginWebauthn", origin: "origin:login-webauthn")
37+
}
3538
public static var loginMagicLink: WordPressSupportSourceTag {
3639
return WordPressSupportSourceTag(name: "loginMagicLink", origin: "origin:login-magic-link")
3740
}

WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ extension FancyAlertViewController {
1313

1414
typealias ButtonConfig = FancyAlertViewController.Config.ButtonConfig
1515

16-
private static func defaultButton() -> ButtonConfig {
16+
private static func defaultButton(onTap: (() -> ())? = nil) -> ButtonConfig {
1717
return ButtonConfig(Strings.OK) { controller, _ in
18-
controller.dismiss(animated: true, completion: nil)
18+
controller.dismiss(animated: true, completion: {
19+
onTap?()
20+
})
1921
}
2022
}
2123

@@ -144,7 +146,7 @@ extension FancyAlertViewController {
144146
/// - Parameter message: The error message to show.
145147
/// - Parameter sourceTag: tag of the source of the error
146148
///
147-
static func alertForGenericErrorMessageWithHelpButton(_ message: String, loginFields: LoginFields, sourceTag: WordPressSupportSourceTag) -> FancyAlertViewController {
149+
static func alertForGenericErrorMessageWithHelpButton(_ message: String, loginFields: LoginFields, sourceTag: WordPressSupportSourceTag, onDismiss: (() -> ())? = nil) -> FancyAlertViewController {
148150

149151
// If support is not enabled, don't add a Help Button since it won't do anything.
150152
var moreHelpButton: ButtonConfig?
@@ -172,7 +174,7 @@ extension FancyAlertViewController {
172174
bodyText: message,
173175
headerImage: nil,
174176
dividerPosition: .top,
175-
defaultButton: defaultButton(),
177+
defaultButton: defaultButton(onTap: onDismiss),
176178
cancelButton: nil,
177179
moreInfoButton: moreHelpButton,
178180
titleAccessoryButton: nil,

0 commit comments

Comments
 (0)