Przeglądaj źródła

[v11] Fix GetRecaptchaConfigResponse key (#13151)

Paul Beusterien 1 rok temu
rodzic
commit
1dd83a3f2a

+ 2 - 2
.github/workflows/auth.yml

@@ -61,7 +61,7 @@ jobs:
     env:
       plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
       FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
-    runs-on: macos-13
+    runs-on: macos-14
     steps:
     - uses: actions/checkout@v4
     - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
@@ -84,7 +84,7 @@ jobs:
         scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/Credentials.swift.gpg \
           FirebaseAuth/Tests/SampleSwift/SwiftApiTests/Credentials.swift "$plist_secret"
     - name: Xcode
-      run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
+      run: sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer
     - uses: nick-fields/retry@v3
       with:
         timeout_minutes: 120

+ 2 - 0
.github/workflows/symbolcollision.yml

@@ -30,6 +30,8 @@ jobs:
     - uses: ruby/setup-ruby@v1
     - name: Setup Bundler
       run: scripts/setup_bundler.sh
+    - name: Xcode
+      run: sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer
     - name: Prereqs
       run: scripts/install_prereqs.sh SymbolCollision iOS
     - name: Build

+ 1 - 1
FirebaseAuth/Sources/Swift/Backend/RPC/GetRecaptchaConfigResponse.swift

@@ -22,6 +22,6 @@ class GetRecaptchaConfigResponse: AuthRPCResponse {
 
   func setFields(dictionary: [String: AnyHashable]) throws {
     recaptchaKey = dictionary["recaptchaKey"] as? String
-    enforcementState = dictionary["enforcementState"] as? [[String: String]]
+    enforcementState = dictionary["recaptchaEnforcementState"] as? [[String: String]]
   }
 }

+ 1 - 2
FirebaseAuth/Sources/Swift/Utilities/AuthRecaptchaVerifier.swift

@@ -96,8 +96,7 @@
       try await retrieveRecaptchaConfig(forceRefresh: forceRefresh)
       if recaptchaClient == nil {
         guard let siteKey = siteKey(),
-              let RecaptchaClass = NSClassFromString("Recaptcha"),
-              let recaptcha = RecaptchaClass as? any RCARecaptchaProtocol.Type else {
+              let recaptcha: AnyClass = NSClassFromString("Recaptcha") else {
           throw AuthErrorUtils.recaptchaSDKNotLinkedError()
         }
         recaptchaClient = try await recaptcha.getClient(withSiteKey: siteKey)

+ 19 - 0
FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj

@@ -33,6 +33,7 @@
 		DEC2E5DF2A9583CA0090260A /* AppManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC2E5DE2A9583CA0090260A /* AppManager.swift */; };
 		DEC2E5E42A966DE20090260A /* GoogleService-Info_multi.plist in Resources */ = {isa = PBXBuildFile; fileRef = DEC2E5E32A966DE20090260A /* GoogleService-Info_multi.plist */; };
 		DED37F632AB0C4F7003A67E4 /* SettingsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED37F622AB0C4F7003A67E4 /* SettingsUITests.swift */; };
+		DEE261C52C21E9F500EECAC5 /* RecaptchaEnterprise in Frameworks */ = {isa = PBXBuildFile; productRef = DEE261C42C21E9F500EECAC5 /* RecaptchaEnterprise */; };
 		EA02F68524A000E00079D000 /* UserActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA02F68424A000E00079D000 /* UserActions.swift */; };
 		EA02F68D24A063E90079D000 /* LoginDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA02F68C24A063E90079D000 /* LoginDelegate.swift */; };
 		EA062D5D24A0FEB6006714D3 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = EA062D5C24A0FEB6006714D3 /* README.md */; };
@@ -156,6 +157,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				DEE261C52C21E9F500EECAC5 /* RecaptchaEnterprise in Frameworks */,
 				DE8B63772BEC302200607B82 /* FacebookLogin in Frameworks */,
 				DE8B63742BEC2FB900607B82 /* GoogleSignInSwift in Frameworks */,
 				DE8B636F2BEC2DC300607B82 /* FirebaseAuth in Frameworks */,
@@ -388,6 +390,7 @@
 				DE8B63712BEC2FB900607B82 /* GoogleSignIn */,
 				DE8B63732BEC2FB900607B82 /* GoogleSignInSwift */,
 				DE8B63762BEC302200607B82 /* FacebookLogin */,
+				DEE261C42C21E9F500EECAC5 /* RecaptchaEnterprise */,
 			);
 			productName = "Swifty Auth";
 			productReference = EAE4CBC124855E3A00245E92 /* AuthenticationExample.app */;
@@ -475,6 +478,7 @@
 				DE8B63702BEC2FB900607B82 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */,
 				DE8B63752BEC302200607B82 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */,
 				DE8B63782BEC342000607B82 /* XCRemoteSwiftPackageReference "gtm-session-fetcher" */,
+				DEE261C32C21E9F500EECAC5 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */,
 			);
 			productRefGroup = EAE4CBC224855E3A00245E92 /* Products */;
 			projectDirPath = "";
@@ -714,6 +718,7 @@
 				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
 				MTL_FAST_MATH = YES;
 				ONLY_ACTIVE_ARCH = YES;
+				OTHER_LDFLAGS = "-ObjC";
 				SDKROOT = iphoneos;
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -767,6 +772,7 @@
 				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				MTL_FAST_MATH = YES;
+				OTHER_LDFLAGS = "-ObjC";
 				SDKROOT = iphoneos;
 				SWIFT_COMPILATION_MODE = wholemodule;
 				SWIFT_OPTIMIZATION_LEVEL = "-O";
@@ -993,6 +999,14 @@
 				minimumVersion = 3.4.1;
 			};
 		};
+		DEE261C32C21E9F500EECAC5 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */ = {
+			isa = XCRemoteSwiftPackageReference;
+			repositoryURL = "https://github.com/GoogleCloudPlatform/recaptcha-enterprise-mobile-sdk.git";
+			requirement = {
+				kind = upToNextMajorVersion;
+				minimumVersion = 18.5.1;
+			};
+		};
 /* End XCRemoteSwiftPackageReference section */
 
 /* Begin XCSwiftPackageProductDependency section */
@@ -1025,6 +1039,11 @@
 			package = DE8B63782BEC342000607B82 /* XCRemoteSwiftPackageReference "gtm-session-fetcher" */;
 			productName = GTMSessionFetcher;
 		};
+		DEE261C42C21E9F500EECAC5 /* RecaptchaEnterprise */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = DEE261C32C21E9F500EECAC5 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */;
+			productName = RecaptchaEnterprise;
+		};
 /* End XCSwiftPackageProductDependency section */
 	};
 	rootObject = EAE4CBB924855E3A00245E92 /* Project object */;