diff --git a/AppCheckCore/Sources/AppAttestProvider/GACAppAttestProvider.m b/AppCheckCore/Sources/AppAttestProvider/GACAppAttestProvider.m index 8af7e8d..3368917 100644 --- a/AppCheckCore/Sources/AppAttestProvider/GACAppAttestProvider.m +++ b/AppCheckCore/Sources/AppAttestProvider/GACAppAttestProvider.m @@ -134,36 +134,36 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (nullable instancetype)initWithStorageID:(NSString *)storageID - resourceName:(NSString *)resourceName - baseURL:(nullable NSString *)baseURL - APIKey:(nullable NSString *)APIKey - keychainAccessGroup:(nullable NSString *)accessGroup - requestHooks: - (nullable NSArray *)requestHooks { - return [self initWithStorageID:storageID - resourceName:resourceName - baseURL:baseURL - APIKey:APIKey - keychainAccessGroup:accessGroup - limitedUse:NO - requestHooks:requestHooks]; +- (nullable instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + baseURL:(nullable NSString *)baseURL + APIKey:(nullable NSString *)APIKey + keychainAccessGroup:(nullable NSString *)accessGroup + requestHooks: + (nullable NSArray *)requestHooks { + return [self initWithServiceName:serviceName + resourceName:resourceName + baseURL:baseURL + APIKey:APIKey + keychainAccessGroup:accessGroup + limitedUse:NO + requestHooks:requestHooks]; } -- (nullable instancetype)initWithStorageID:(NSString *)storageID - resourceName:(NSString *)resourceName - baseURL:(nullable NSString *)baseURL - APIKey:(nullable NSString *)APIKey - keychainAccessGroup:(nullable NSString *)accessGroup - limitedUse:(BOOL)limitedUse - requestHooks: - (nullable NSArray *)requestHooks { +- (nullable instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + baseURL:(nullable NSString *)baseURL + APIKey:(nullable NSString *)APIKey + keychainAccessGroup:(nullable NSString *)accessGroup + limitedUse:(BOOL)limitedUse + requestHooks: + (nullable NSArray *)requestHooks { #if GAC_APP_ATTEST_SUPPORTED_TARGETS NSURLSession *URLSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]]; - NSString *storageKeySuffix = [GACAppAttestProvider storageKeySuffixWithID:storageID - resourceName:resourceName]; + NSString *storageKeySuffix = [GACAppAttestProvider storageKeySuffixWithServiceName:serviceName + resourceName:resourceName]; GACAppAttestKeyIDStorage *keyIDStorage = [[GACAppAttestKeyIDStorage alloc] initWithKeySuffix:storageKeySuffix]; @@ -512,8 +512,9 @@ NS_ASSUME_NONNULL_BEGIN }); } -+ (NSString *)storageKeySuffixWithID:(NSString *)storageID resourceName:(NSString *)resourceName { - return [NSString stringWithFormat:@"%@.%@", storageID, resourceName]; ++ (NSString *)storageKeySuffixWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName { + return [NSString stringWithFormat:@"%@.%@", serviceName, resourceName]; } @end diff --git a/AppCheckCore/Sources/Core/GACAppCheck.m b/AppCheckCore/Sources/Core/GACAppCheck.m index 6e75a5d..903ce6d 100644 --- a/AppCheckCore/Sources/Core/GACAppCheck.m +++ b/AppCheckCore/Sources/Core/GACAppCheck.m @@ -45,7 +45,7 @@ typedef void (^GACAppCheckTokenHandler)(id _Nullable t @interface GACAppCheck () -@property(nonatomic, readonly) NSString *instanceName; +@property(nonatomic, readonly) NSString *serviceName; @property(nonatomic, readonly) id appCheckProvider; @property(nonatomic, readonly) id storage; @property(nonatomic, readonly) id settings; @@ -61,15 +61,15 @@ typedef void (^GACAppCheckTokenHandler)(id _Nullable t #pragma mark - Internal -- (instancetype)initWithInstanceName:(NSString *)instanceName - appCheckProvider:(id)appCheckProvider - storage:(id)storage - tokenRefresher:(id)tokenRefresher - settings:(id)settings - tokenDelegate:(nullable id)tokenDelegate { +- (instancetype)initWithServiceName:(NSString *)serviceName + appCheckProvider:(id)appCheckProvider + storage:(id)storage + tokenRefresher:(id)tokenRefresher + settings:(id)settings + tokenDelegate:(nullable id)tokenDelegate { self = [super init]; if (self) { - _instanceName = instanceName; + _serviceName = serviceName; _appCheckProvider = appCheckProvider; _storage = storage; _tokenRefresher = tokenRefresher; @@ -87,28 +87,28 @@ typedef void (^GACAppCheckTokenHandler)(id _Nullable t #pragma mark - Public -- (instancetype)initWithInstanceName:(NSString *)instanceName - appCheckProvider:(id)appCheckProvider - settings:(id)settings - resourceName:(NSString *)resourceName - tokenDelegate:(nullable id)tokenDelegate - keychainAccessGroup:(nullable NSString *)accessGroup { +- (instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + appCheckProvider:(id)appCheckProvider + settings:(id)settings + tokenDelegate:(nullable id)tokenDelegate + keychainAccessGroup:(nullable NSString *)accessGroup { GACAppCheckTokenRefreshResult *refreshResult = [[GACAppCheckTokenRefreshResult alloc] initWithStatusNever]; GACAppCheckTokenRefresher *tokenRefresher = [[GACAppCheckTokenRefresher alloc] initWithRefreshResult:refreshResult settings:settings]; NSString *tokenKey = - [NSString stringWithFormat:@"app_check_token.%@.%@", instanceName, resourceName]; + [NSString stringWithFormat:@"app_check_token.%@.%@", serviceName, resourceName]; GACAppCheckStorage *storage = [[GACAppCheckStorage alloc] initWithTokenKey:tokenKey accessGroup:accessGroup]; - return [self initWithInstanceName:instanceName - appCheckProvider:appCheckProvider - storage:storage - tokenRefresher:tokenRefresher - settings:settings - tokenDelegate:tokenDelegate]; + return [self initWithServiceName:serviceName + appCheckProvider:appCheckProvider + storage:storage + tokenRefresher:tokenRefresher + settings:settings + tokenDelegate:tokenDelegate]; } #pragma mark - GACAppCheckInterop @@ -205,7 +205,7 @@ typedef void (^GACAppCheckTokenHandler)(id _Nullable t receivedAtDate:token.receivedAtDate]; [self.tokenRefresher updateWithRefreshResult:refreshResult]; if (self.tokenDelegate) { - [self.tokenDelegate tokenDidUpdate:token instanceName:self.instanceName]; + [self.tokenDelegate tokenDidUpdate:token serviceName:self.serviceName]; } return token; }); diff --git a/AppCheckCore/Sources/DebugProvider/GACAppCheckDebugProvider.m b/AppCheckCore/Sources/DebugProvider/GACAppCheckDebugProvider.m index 3ef4093..24ae7f5 100644 --- a/AppCheckCore/Sources/DebugProvider/GACAppCheckDebugProvider.m +++ b/AppCheckCore/Sources/DebugProvider/GACAppCheckDebugProvider.m @@ -50,10 +50,10 @@ static NSString *const kDebugTokenUserDefaultsKey = @"FIRAAppCheckDebugToken"; return self; } -- (instancetype)initWithStorageID:(NSString *)storageID - resourceName:(NSString *)resourceName - APIKey:(nullable NSString *)APIKey - requestHooks:(nullable NSArray *)requestHooks { +- (instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + APIKey:(nullable NSString *)APIKey + requestHooks:(nullable NSArray *)requestHooks { NSURLSession *URLSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]]; diff --git a/AppCheckCore/Sources/DeviceCheckProvider/GACDeviceCheckProvider.m b/AppCheckCore/Sources/DeviceCheckProvider/GACDeviceCheckProvider.m index b1d16f8..bbbb5c9 100644 --- a/AppCheckCore/Sources/DeviceCheckProvider/GACDeviceCheckProvider.m +++ b/AppCheckCore/Sources/DeviceCheckProvider/GACDeviceCheckProvider.m @@ -70,10 +70,10 @@ NS_ASSUME_NONNULL_BEGIN backoffWrapper:backoffWrapper]; } -- (instancetype)initWithStorageID:(NSString *)storageID - resourceName:(NSString *)resourceName - APIKey:(nullable NSString *)APIKey - requestHooks:(nullable NSArray *)requestHooks { +- (instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + APIKey:(nullable NSString *)APIKey + requestHooks:(nullable NSArray *)requestHooks { NSURLSession *URLSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]]; diff --git a/AppCheckCore/Sources/Public/AppCheckCore/GACAppAttestProvider.h b/AppCheckCore/Sources/Public/AppCheckCore/GACAppAttestProvider.h index 5eeb03f..3ba8837 100644 --- a/AppCheckCore/Sources/Public/AppCheckCore/GACAppAttestProvider.h +++ b/AppCheckCore/Sources/Public/AppCheckCore/GACAppAttestProvider.h @@ -33,7 +33,7 @@ NS_SWIFT_NAME(AppCheckCoreAppAttestProvider) - (instancetype)init NS_UNAVAILABLE; /// The default initializer. -/// @param storageID A unique identifier to differentiate storage keys corresponding to the same +/// @param serviceName A unique identifier to differentiate storage keys corresponding to the same /// `resourceName`; may be a Firebase App Name or an SDK name. /// @param resourceName The name of the resource protected by App Check; for a Firebase App this is /// "projects/{project_id}/apps/{app_id}". @@ -43,20 +43,20 @@ NS_SWIFT_NAME(AppCheckCoreAppAttestProvider) /// @param accessGroup The Keychain Access Group. /// @param requestHooks Hooks that will be invoked on requests through this service. /// @return An instance of `AppAttestProvider` if App Attest is supported or `nil`. -- (nullable instancetype)initWithStorageID:(NSString *)storageID - resourceName:(NSString *)resourceName - baseURL:(nullable NSString *)baseURL - APIKey:(nullable NSString *)APIKey - keychainAccessGroup:(nullable NSString *)accessGroup - requestHooks: - (nullable NSArray *)requestHooks; +- (nullable instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + baseURL:(nullable NSString *)baseURL + APIKey:(nullable NSString *)APIKey + keychainAccessGroup:(nullable NSString *)accessGroup + requestHooks: + (nullable NSArray *)requestHooks; /// Initializer with support for short-lived tokens. /// /// TODO(andrewheard): Remove or refactor this constructor when the short-lived (limited-use) token /// feature is fully implemented. /// -/// @param storageID A unique identifier to differentiate storage keys corresponding to the same +/// @param serviceName A unique identifier to differentiate storage keys corresponding to the same /// `resourceName`; may be a Firebase App Name or an SDK name. /// @param resourceName The name of the resource protected by App Check; for a Firebase App this is /// "projects/{project_id}/apps/{app_id}". @@ -67,14 +67,14 @@ NS_SWIFT_NAME(AppCheckCoreAppAttestProvider) /// @param limitedUse If YES, forces a short-lived token with a 5 minute TTL. /// @param requestHooks Hooks that will be invoked on requests through this service. /// @return An instance of `AppAttestProvider` if App Attest is supported or `nil`. -- (nullable instancetype)initWithStorageID:(NSString *)storageID - resourceName:(NSString *)resourceName - baseURL:(nullable NSString *)baseURL - APIKey:(nullable NSString *)APIKey - keychainAccessGroup:(nullable NSString *)accessGroup - limitedUse:(BOOL)limitedUse - requestHooks: - (nullable NSArray *)requestHooks; +- (nullable instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + baseURL:(nullable NSString *)baseURL + APIKey:(nullable NSString *)APIKey + keychainAccessGroup:(nullable NSString *)accessGroup + limitedUse:(BOOL)limitedUse + requestHooks: + (nullable NSArray *)requestHooks; @end diff --git a/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheck.h b/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheck.h index b2ac158..a3f68c2 100644 --- a/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheck.h +++ b/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheck.h @@ -55,20 +55,22 @@ NS_SWIFT_NAME(AppCheckCore) - (instancetype)init NS_UNAVAILABLE; /// Returns an instance of `AppCheck` for an application. -/// @param appCheckProvider An object that provides App Check tokens. -/// @param settings An object that provides App Check settings. +/// @param serviceName A unique identifier for the App Check instance, may be a Firebase App Name +/// or an SDK name. /// @param resourceName The name of the resource protected by App Check; for a Firebase App this is /// "projects/{project_id}/apps/{app_id}". +/// @param appCheckProvider An object that provides App Check tokens. +/// @param settings An object that provides App Check settings. /// @param tokenDelegate A delegate that receives token update notifications. /// @param accessGroup The identifier for a keychain group that the app shares items with; if /// provided, requires the Keychain Access Groups Entitlement. /// @return An instance of `AppCheckCore` with the specified token provider. -- (instancetype)initWithInstanceName:(NSString *)instanceName - appCheckProvider:(id)appCheckProvider - settings:(id)settings - resourceName:(NSString *)resourceName - tokenDelegate:(nullable id)tokenDelegate - keychainAccessGroup:(nullable NSString *)accessGroup; +- (instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + appCheckProvider:(id)appCheckProvider + settings:(id)settings + tokenDelegate:(nullable id)tokenDelegate + keychainAccessGroup:(nullable NSString *)accessGroup; @end diff --git a/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheckDebugProvider.h b/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheckDebugProvider.h index 8bfcd3d..4377346 100644 --- a/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheckDebugProvider.h +++ b/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheckDebugProvider.h @@ -64,17 +64,17 @@ NS_SWIFT_NAME(AppCheckCoreDebugProvider) - (instancetype)init NS_UNAVAILABLE; /// The default initializer. -/// @param storageID A unique identifier to differentiate storage keys corresponding to the same +/// @param serviceName A unique identifier to differentiate storage keys corresponding to the same /// `resourceName`; may be a Firebase App Name or an SDK name. /// @param resourceName The name of the resource protected by App Check; for a Firebase App this is /// "projects/{project_id}/apps/{app_id}". /// @param APIKey The Google Cloud Platform API key, if needed, or nil. /// @param requestHooks Hooks that will be invoked on requests through this service. /// @return An instance of `AppCheckDebugProvider` . -- (instancetype)initWithStorageID:(NSString *)storageID - resourceName:(NSString *)resourceName - APIKey:(nullable NSString *)APIKey - requestHooks:(nullable NSArray *)requestHooks; +- (instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + APIKey:(nullable NSString *)APIKey + requestHooks:(nullable NSArray *)requestHooks; /** Return the locally generated token. */ - (NSString *)localDebugToken; diff --git a/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheckTokenDelegate.h b/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheckTokenDelegate.h index 195946e..be5d9b1 100644 --- a/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheckTokenDelegate.h +++ b/AppCheckCore/Sources/Public/AppCheckCore/GACAppCheckTokenDelegate.h @@ -24,9 +24,9 @@ NS_SWIFT_NAME(AppCheckCoreTokenDelegate) /// Called each time an App Check token is refreshed. /// /// @param token The updated App Check token. -/// @param instanceName A unique identifier for the App Check instance, may be a Firebase App Name +/// @param serviceName A unique identifier for the App Check instance, may be a Firebase App Name /// or an SDK name. -- (void)tokenDidUpdate:(GACAppCheckToken *)token instanceName:(NSString *)instanceName; +- (void)tokenDidUpdate:(GACAppCheckToken *)token serviceName:(NSString *)serviceName; @end diff --git a/AppCheckCore/Sources/Public/AppCheckCore/GACDeviceCheckProvider.h b/AppCheckCore/Sources/Public/AppCheckCore/GACDeviceCheckProvider.h index 6a45da6..da6f1d1 100644 --- a/AppCheckCore/Sources/Public/AppCheckCore/GACDeviceCheckProvider.h +++ b/AppCheckCore/Sources/Public/AppCheckCore/GACDeviceCheckProvider.h @@ -37,17 +37,17 @@ NS_SWIFT_NAME(AppCheckCoreDeviceCheckProvider) - (instancetype)init NS_UNAVAILABLE; /// The default initializer. -/// @param storageID A unique identifier to differentiate storage keys corresponding to the same +/// @param serviceName A unique identifier to differentiate storage keys corresponding to the same /// `resourceName`; may be a Firebase App Name or an SDK name. /// @param resourceName The name of the resource protected by App Check; for a Firebase App this is /// "projects/{project_id}/apps/{app_id}". /// @param APIKey The Google Cloud Platform API key, if needed, or nil. /// @param requestHooks Hooks that will be invoked on requests through this service. /// @return An instance of `DeviceCheckProvider` . -- (instancetype)initWithStorageID:(NSString *)storageID - resourceName:(NSString *)resourceName - APIKey:(nullable NSString *)APIKey - requestHooks:(nullable NSArray *)requestHooks; +- (instancetype)initWithServiceName:(NSString *)serviceName + resourceName:(NSString *)resourceName + APIKey:(nullable NSString *)APIKey + requestHooks:(nullable NSArray *)requestHooks; @end diff --git a/AppCheckCore/Tests/Unit/AppAttestProvider/GACAppAttestProviderTests.m b/AppCheckCore/Tests/Unit/AppAttestProvider/GACAppAttestProviderTests.m index ccfd557..db46ee3 100644 --- a/AppCheckCore/Tests/Unit/AppAttestProvider/GACAppAttestProviderTests.m +++ b/AppCheckCore/Tests/Unit/AppAttestProvider/GACAppAttestProviderTests.m @@ -112,13 +112,13 @@ GAC_APP_ATTEST_PROVIDER_AVAILABILITY FIRApp *app = [[FIRApp alloc] initInstanceWithName:@"testInitWithValidApp" options:options]; NSString *resourceName = [GACAppAttestProviderTests resourceNameFromApp:app]; - XCTAssertNotNil([[GACAppAttestProvider alloc] initWithStorageID:app.name - resourceName:resourceName - baseURL:nil - APIKey:app.options.APIKey - keychainAccessGroup:nil - limitedUse:NO - requestHooks:nil]); + XCTAssertNotNil([[GACAppAttestProvider alloc] initWithServiceName:app.name + resourceName:resourceName + baseURL:nil + APIKey:app.options.APIKey + keychainAccessGroup:nil + limitedUse:NO + requestHooks:nil]); } #endif // !TARGET_OS_MACCATALYST diff --git a/AppCheckCore/Tests/Unit/Core/GACAppCheckTests.m b/AppCheckCore/Tests/Unit/Core/GACAppCheckTests.m index 0cc14cf..ece1c89 100644 --- a/AppCheckCore/Tests/Unit/Core/GACAppCheckTests.m +++ b/AppCheckCore/Tests/Unit/Core/GACAppCheckTests.m @@ -43,12 +43,12 @@ static NSString *const kAppGroupID = @"app_group_id"; @interface GACAppCheck (Tests) -- (instancetype)initWithInstanceName:(NSString *)instanceName - appCheckProvider:(id)appCheckProvider - storage:(id)storage - tokenRefresher:(id)tokenRefresher - settings:(id)settings - tokenDelegate:(nullable id)tokenDelegate; +- (instancetype)initWithServiceName:(NSString *)instanceName + appCheckProvider:(id)appCheckProvider + storage:(id)storage + tokenRefresher:(id)tokenRefresher + settings:(id)settings + tokenDelegate:(nullable id)tokenDelegate; @end @@ -78,12 +78,12 @@ static NSString *const kAppGroupID = @"app_group_id"; [self stubSetTokenRefreshHandler]; - self.appCheck = [[GACAppCheck alloc] initWithInstanceName:kAppName - appCheckProvider:self.mockAppCheckProvider - storage:self.mockStorage - tokenRefresher:self.mockTokenRefresher - settings:self.mockSettings - tokenDelegate:self.mockTokenDelegate]; + self.appCheck = [[GACAppCheck alloc] initWithServiceName:kAppName + appCheckProvider:self.mockAppCheckProvider + storage:self.mockStorage + tokenRefresher:self.mockTokenRefresher + settings:self.mockSettings + tokenDelegate:self.mockTokenDelegate]; } - (void)tearDown { @@ -144,12 +144,12 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMStrictProtocolMock(@protocol(GACAppCheckTokenDelegate)); // 6. Call init. - GACAppCheck *appCheck = [[GACAppCheck alloc] initWithInstanceName:kAppName - appCheckProvider:mockProvider - settings:mockSettings - resourceName:kResourceName - tokenDelegate:mockTokenDelegate - keychainAccessGroup:kAppGroupID]; + GACAppCheck *appCheck = [[GACAppCheck alloc] initWithServiceName:kAppName + resourceName:kResourceName + appCheckProvider:mockProvider + settings:mockSettings + tokenDelegate:mockTokenDelegate + keychainAccessGroup:kAppGroupID]; XCTAssert([appCheck isKindOfClass:[GACAppCheck class]]); // 7. Verify mocks. @@ -287,7 +287,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMExpect([self.mockTokenRefresher updateWithRefreshResult:[OCMArg any]]); // 4. Expect token update notification to be sent. - OCMExpect([self.mockTokenDelegate tokenDidUpdate:tokenToReturn instanceName:kAppName]); + OCMExpect([self.mockTokenDelegate tokenDidUpdate:tokenToReturn serviceName:kAppName]); // 5. Trigger refresh and expect the result. if (self.tokenRefreshHandler == nil) { @@ -319,7 +319,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMReject([self.mockAppCheckProvider getTokenWithCompletion:[OCMArg any]]); // 4. Don't expect token update notification to be sent. - OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY instanceName:OCMOCK_ANY]); + OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY serviceName:OCMOCK_ANY]); // 5. Trigger refresh and expect the result. if (self.tokenRefreshHandler == nil) { @@ -352,7 +352,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMReject([self.mockStorage setToken:expectedToken]); // 4. Don't expect token update notification to be sent. - OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY instanceName:OCMOCK_ANY]); + OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY serviceName:OCMOCK_ANY]); // 5. Expect token request to be completed. XCTestExpectation *getTokenExpectation = [self expectationWithDescription:@"getToken"]; @@ -381,7 +381,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMReject([self.mockAppCheckProvider getTokenWithCompletion:[OCMArg any]]); // 4. Don't expect token update notification to be sent. - OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY instanceName:OCMOCK_ANY]); + OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY serviceName:OCMOCK_ANY]); // 5. Expect token request to be completed. XCTestExpectation *getTokenExpectation = [self expectationWithDescription:@"getToken"]; @@ -410,7 +410,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMExpect([self.mockTokenRefresher updateWithRefreshResult:[OCMArg any]]); // 2. Expect token update notification to be sent. - OCMExpect([self.mockTokenDelegate tokenDidUpdate:expectedToken instanceName:kAppName]); + OCMExpect([self.mockTokenDelegate tokenDidUpdate:expectedToken serviceName:kAppName]); // 3. Request token several times. NSInteger getTokenCallsCount = 10; @@ -455,7 +455,7 @@ static NSString *const kAppGroupID = @"app_group_id"; NSError *storageError = [NSError errorWithDomain:self.name code:0 userInfo:nil]; // 2. Don't expect token update notification to be sent. - OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY instanceName:OCMOCK_ANY]); + OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY serviceName:OCMOCK_ANY]); // 3. Request token several times. NSInteger getTokenCallsCount = 10; @@ -572,7 +572,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMExpect([self.mockTokenRefresher updateWithRefreshResult:[OCMArg any]]); // 4. Expect token update notification to be sent. - OCMExpect([self.mockTokenDelegate tokenDidUpdate:expectedToken instanceName:kAppName]); + OCMExpect([self.mockTokenDelegate tokenDidUpdate:expectedToken serviceName:kAppName]); // 5. Expect token request to be completed. XCTestExpectation *getTokenExpectation = [self expectationWithDescription:@"getToken"]; @@ -589,7 +589,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMReject([self.mockAppCheckProvider getTokenWithCompletion:[OCMArg any]]); // 3. Don't expect token update notification to be sent. - OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY instanceName:OCMOCK_ANY]); + OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY serviceName:OCMOCK_ANY]); // 4. Expect token request to be completed. return [self expectationWithDescription:@"getToken"]; @@ -611,7 +611,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMExpect([self.mockTokenRefresher updateWithRefreshResult:[OCMArg any]]); // 4. Expect token update notification to be sent. - OCMExpect([self.mockTokenDelegate tokenDidUpdate:expectedToken instanceName:kAppName]); + OCMExpect([self.mockTokenDelegate tokenDidUpdate:expectedToken serviceName:kAppName]); // 5. Expect token request to be completed. XCTestExpectation *getTokenExpectation = [self expectationWithDescription:@"getToken"]; @@ -636,7 +636,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMExpect([self.mockTokenRefresher updateWithRefreshResult:[OCMArg any]]); // 4. Expect token update notification to be sent. - OCMExpect([self.mockTokenDelegate tokenDidUpdate:expectedToken instanceName:kAppName]); + OCMExpect([self.mockTokenDelegate tokenDidUpdate:expectedToken serviceName:kAppName]); // 5. Expect token request to be completed. XCTestExpectation *getTokenExpectation = [self expectationWithDescription:@"getToken"]; @@ -658,7 +658,7 @@ static NSString *const kAppGroupID = @"app_group_id"; OCMReject([self.mockAppCheckProvider getTokenWithCompletion:[OCMArg any]]); // 4. Expect token update notification to be sent. - OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY instanceName:OCMOCK_ANY]); + OCMReject([self.mockTokenDelegate tokenDidUpdate:OCMOCK_ANY serviceName:OCMOCK_ANY]); // 5. Expect token request to be completed. XCTestExpectation *getTokenExpectation = [self expectationWithDescription:@"getToken"]; diff --git a/AppCheckCore/Tests/Unit/DebugProvider/GACAppCheckDebugProviderTests.m b/AppCheckCore/Tests/Unit/DebugProvider/GACAppCheckDebugProviderTests.m index 557730a..99503da 100644 --- a/AppCheckCore/Tests/Unit/DebugProvider/GACAppCheckDebugProviderTests.m +++ b/AppCheckCore/Tests/Unit/DebugProvider/GACAppCheckDebugProviderTests.m @@ -70,10 +70,10 @@ typedef void (^GACAppCheckTokenValidationBlock)(GACAppCheckToken *_Nullable toke FIRApp *app = [[FIRApp alloc] initInstanceWithName:@"testInitWithValidApp" options:options]; XCTAssertNotNil([[GACAppCheckDebugProvider alloc] - initWithStorageID:options.googleAppID - resourceName:[GACAppCheckDebugProviderTests resourceNameFromApp:app] - APIKey:app.options.APIKey - requestHooks:nil]); + initWithServiceName:options.googleAppID + resourceName:[GACAppCheckDebugProviderTests resourceNameFromApp:app] + APIKey:app.options.APIKey + requestHooks:nil]); } #pragma mark - Debug token generating/storing diff --git a/AppCheckCore/Tests/Unit/DeviceCheckProvider/GACDeviceCheckProviderTests.m b/AppCheckCore/Tests/Unit/DeviceCheckProvider/GACDeviceCheckProviderTests.m index 04629e9..dcea1c1 100644 --- a/AppCheckCore/Tests/Unit/DeviceCheckProvider/GACDeviceCheckProviderTests.m +++ b/AppCheckCore/Tests/Unit/DeviceCheckProvider/GACDeviceCheckProviderTests.m @@ -80,10 +80,10 @@ GAC_DEVICE_CHECK_PROVIDER_AVAILABILITY FIRApp *app = [[FIRApp alloc] initInstanceWithName:@"testInitWithValidApp" options:options]; XCTAssertNotNil([[GACDeviceCheckProvider alloc] - initWithStorageID:app.name - resourceName:[GACDeviceCheckProviderTests resourceNameFromApp:app] - APIKey:app.options.APIKey - requestHooks:nil]); + initWithServiceName:app.name + resourceName:[GACDeviceCheckProviderTests resourceNameFromApp:app] + APIKey:app.options.APIKey + requestHooks:nil]); } - (void)testGetTokenSuccess { diff --git a/AppCheckCore/Tests/Unit/Swift/AppCheckAPITests.swift b/AppCheckCore/Tests/Unit/Swift/AppCheckAPITests.swift index 0a421fc..92ac64c 100644 --- a/AppCheckCore/Tests/Unit/Swift/AppCheckAPITests.swift +++ b/AppCheckCore/Tests/Unit/Swift/AppCheckAPITests.swift @@ -52,10 +52,10 @@ final class AppCheckAPITests { // Retrieving an AppCheck instance let appCheck = AppCheckCore( - instanceName: app.name, + serviceName: app.name, + resourceName: resourceName, appCheckProvider: DummyAppCheckProvider(), settings: DummyAppCheckSettings(), - resourceName: resourceName, tokenDelegate: DummyAppCheckTokenDelegate(), keychainAccessGroup: app.options.appGroupID ) @@ -86,7 +86,7 @@ final class AppCheckAPITests { // `AppCheckDebugProvider` initializer // TODO(andrewheard): Add `requestHooks` in API tests. let debugProvider = AppCheckCoreDebugProvider( - storageID: app.name, + serviceName: app.name, resourceName: resourceName, apiKey: app.options.apiKey, requestHooks: nil @@ -157,7 +157,7 @@ final class AppCheckAPITests { if #available(iOS 11.0, macOS 10.15, macCatalyst 13.0, tvOS 11.0, *) { // TODO(andrewheard): Add `requestHooks` in API tests. let deviceCheckProvider = AppCheckCoreDeviceCheckProvider( - storageID: app.name, + serviceName: app.name, resourceName: resourceName, apiKey: app.options.apiKey, requestHooks: nil @@ -204,5 +204,5 @@ class DummyAppCheckSettings: NSObject, AppCheckCoreSettingsProtocol { } class DummyAppCheckTokenDelegate: NSObject, AppCheckCoreTokenDelegate { - func tokenDidUpdate(_ token: AppCheckCoreToken, instanceName: String) {} + func tokenDidUpdate(_ token: AppCheckCoreToken, serviceName: String) {} }