Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f717e12
Extract GACAppCheckSettings from FIRAppCheckSettings (#11214)
andrewheard May 5, 2023
49e1725
Fork App Check dir for use outside of Firebase (#11247)
andrewheard May 9, 2023
f9d1794
Add AppCheck as a dependency of FirebaseAppCheck (#11257)
andrewheard May 9, 2023
0904e5e
[App Check] Rename FIR symbols in unit tests for generic SDK (#11267)
andrewheard May 10, 2023
e494411
Replace GACAppCheckLogger macros with NSLog wrappers (#11269)
andrewheard May 10, 2023
80f1c4d
Remove Firebase-specific implementation in GACAppCheckStorage (#11273)
andrewheard May 10, 2023
85c4a3d
Extract heartbeat logger from GACAppCheckAPIService (#11277)
andrewheard May 11, 2023
6d95814
[App Check] Expose `initWithApp:appCheckProvider:` (#11288)
andrewheard May 15, 2023
2cf85ca
Remove AppCheckProviderFactory from App Check Lite (#11290)
andrewheard May 15, 2023
de2e1b4
Extract Firebase-specific IDs from GACAppAttestAPIService (#11291)
andrewheard May 16, 2023
f46cf8e
Integrate FirebaseAppCheck changes into AppCheck (#11308)
andrewheard May 22, 2023
b729256
Remove Firebase IDs from GACAppAttestKeyIDStorage (#11309)
andrewheard May 22, 2023
6ce0a6c
Remove Firebase-specific implementation from GACAppCheckAPIService (#…
andrewheard May 24, 2023
ec95877
Extract Firebase symbols from GACAppAttestArtifactStorage (#11334)
andrewheard May 26, 2023
98254b0
Remove FIRApp dependencies from GACAppAttestProvider (#11340)
andrewheard May 26, 2023
aeb8e3f
[App Check] Remove Firebase specifics from Debug Provider (#11349)
andrewheard May 29, 2023
810caea
[App Check] Remove Firebase specifics from DeviceCheck Provider (#11352)
andrewheard May 30, 2023
ebfa41b
Add CI infrastructure for App Check (#11358)
andrewheard May 31, 2023
dde80cd
Remove Firebase specifics from `GACAppCheck` (#11368)
andrewheard May 31, 2023
fa377b0
[App Check] Rename symbols in GACAppCheckLogger (#11381)
andrewheard Jun 2, 2023
e6ebe87
Remove `AppCheckInterop` headers from the `AppCheck` SDK (#11404)
andrewheard Jun 6, 2023
d4abe44
Remove `GACAppCheckSettings` from FirebaseAppCheck (#11375)
andrewheard Jun 6, 2023
7565d0c
Replace `FIRAppCheckDebugProvider` with `GACAppCheckDebugProvider` sh…
andrewheard Jun 7, 2023
2e18f30
Replace `FIRAppAttestProvider` with `GACAppAttestProvider` shim (#11418)
andrewheard Jun 13, 2023
5de35f5
Replace `FIRDeviceCheckProvider` with `GACDeviceCheckProvider` shim (…
andrewheard Jun 15, 2023
f29bd3f
Move `GACAppCheckSettings` implementation back to `FIRAppCheckSetting…
andrewheard Jun 20, 2023
24446ae
[App Check] Remove non-interop API surface (#11512)
andrewheard Jul 6, 2023
482739e
[App Check] Replace token refresh `NSNotification`s with delegate (#1…
andrewheard Jul 11, 2023
20ce34b
[App Check] Copy SharedTestUtilities for Lite SDK (#11530)
andrewheard Jul 11, 2023
a35b0a4
[App Check] Depend on FirebaseCoreExtension via podspec (#11538)
andrewheard Jul 13, 2023
3f54723
[App Check] Support custom base URL (#11542)
andrewheard Jul 13, 2023
4ccfe4f
[App Check] Set `limited_use` request param for App Attest (#11544)
andrewheard Jul 13, 2023
611edba
[App Check] Add `limitedUse` parameter to `GACAppAttestProvider` (#11…
andrewheard Jul 13, 2023
a09b332
[App Check] Add log filtering based on log level (#11570)
andrewheard Jul 19, 2023
d186167
[App Check] Replace `gGACAppCheckLogLevel` with class property (#11572)
andrewheard Jul 20, 2023
40f00d3
Rename Swift symbols to AppCheckCore* (#11576)
andrewheard Jul 20, 2023
ed0e3fe
Cleanup some Firebase references in App Check Core (#11578)
andrewheard Jul 20, 2023
8185a36
Renamed `AppCheck` to `AppCheckCore` (#11581)
andrewheard Jul 21, 2023
0b257f8
Make `tokenDelegate` nullable in `GACAppCheck` (#11592)
andrewheard Jul 24, 2023
59b1a64
Implement `FIRAppCheckSettings` as subclass (#11597)
andrewheard Jul 24, 2023
fb660ae
Remove App Check Core Interop SDK (#11595)
andrewheard Jul 24, 2023
4defb65
[App Check] Rename `instanceName` and `storageID` to `serviceName` (#…
andrewheard Jul 25, 2023
e3f76d7
Depend on `AppCheckCore` staged in `SpecsDev` (#11641)
andrewheard Aug 2, 2023
2b2ee22
Add `baseURL:nil` in debug provider
andrewheard Sep 20, 2023
2169855
Remove `AppCheckCore` directory (#11834)
andrewheard Sep 20, 2023
84dbf97
Implement `FIRAppCheck` as a shim of `GACAppCheck` (#11721)
andrewheard Sep 22, 2023
6b1b752
Fix AppCheckCore import
andrewheard Oct 31, 2023
b481cb5
Replace `@import AppCheckCore` with `#import <...>`
andrewheard Oct 31, 2023
b2758ad
Fix AppCheckE2ETests
andrewheard Oct 31, 2023
a5318a1
Remove FirebaseAppCheckIntegration SPM testTarget
andrewheard Oct 31, 2023
8002773
Update AppCheckCore dependency to 10.18.0 (#12030)
andrewheard Nov 2, 2023
7ace85e
Convert errors from `GACAppCheckErrorDomain` to `FIRAppCheckErrorDoma…
andrewheard Nov 6, 2023
1f1ee2b
[Release] Require `GoogleUtilities/Logger` `7.12` in FirebaseCore (#1…
andrewheard Nov 7, 2023
3db9651
[Core] Add `FIRGetLoggerLevel` function (#12065)
andrewheard Nov 7, 2023
4ff62df
Set `GACAppCheckLogger.logLevel` in Firebase App Check (#12066)
andrewheard Nov 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Extract Firebase symbols from GACAppAttestArtifactStorage (#11334)
Removed the Firebase-specific references `appName` and `appID` from `GACAppAttestArtifactStorage`. They have been moved up one layer into `GACAppAttestProvider`.
  • Loading branch information
andrewheard committed Nov 1, 2023
commit ec95877252664bffc62706540208a8bb56afae9e
4 changes: 2 additions & 2 deletions AppCheck.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AppCheck'
s.version = '10.10.0'
s.version = '10.11.0'
s.summary = 'App Check SDK.'

s.description = <<-DESC
Expand Down Expand Up @@ -45,7 +45,7 @@ Pod::Spec.new do |s|
s.osx.weak_framework = 'DeviceCheck'
s.tvos.weak_framework = 'DeviceCheck'

s.dependency 'AppCheckInterop', '~> 10.10'
s.dependency 'AppCheckInterop', '~> 10.11'
s.dependency 'FirebaseCore', '~> 10.0'
s.dependency 'PromisesObjC', '~> 2.1'
s.dependency 'GoogleUtilities/Environment', '~> 7.8'
Expand Down
7 changes: 3 additions & 4 deletions AppCheck/Sources/AppAttestProvider/GACAppAttestProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,9 @@ - (nullable instancetype)initWithApp:(FIRApp *)app {
initWithAPIService:APIService
resourceName:[GACAppAttestProvider resourceNameFromApp:app]];

GACAppAttestArtifactStorage *artifactStorage =
[[GACAppAttestArtifactStorage alloc] initWithAppName:app.name
appID:app.options.googleAppID
accessGroup:app.options.appGroupID];
GACAppAttestArtifactStorage *artifactStorage = [[GACAppAttestArtifactStorage alloc]
initWithKeySuffix:[GACAppAttestProvider storageKeySuffixForApp:app]
accessGroup:app.options.appGroupID];

GACAppCheckBackoffWrapper *backoffWrapper = [[GACAppCheckBackoffWrapper alloc] init];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,20 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)init NS_UNAVAILABLE;

/// Default convenience initializer.
/// @param appName A Firebase App name (`FirebaseApp.name`). The app name will be used as a part of
/// the key to store the token for the storage instance.
/// @param appID A Firebase App identifier (`FirebaseOptions.googleAppID`). The app ID will be used
/// as a part of the key to store the token for the storage instance.
/// @param keySuffix A unique suffix that will be used as a part of the key to store the token for
/// the storage instance.
/// @param accessGroup The Keychain Access Group.
- (instancetype)initWithAppName:(NSString *)appName
appID:(NSString *)appID
accessGroup:(nullable NSString *)accessGroup;
- (instancetype)initWithKeySuffix:(NSString *)keySuffix
accessGroup:(nullable NSString *)accessGroup;

/// Designated initializer.
/// @param appName A Firebase App name (`FirebaseApp.name`). The app name will be used as a part of
/// the key to store the token for the storage instance.
/// @param appID A Firebase App identifier (`FirebaseOptions.googleAppID`). The app ID will be used
/// as a part of the key to store the token for the storage instance.
/// @param keySuffix A unique suffix that will be used as a part of the key to store the token for
/// the storage instance.
/// @param keychainStorage An instance of `GULKeychainStorage` used as an underlying secure storage.
/// @param accessGroup The Keychain Access Group.
- (instancetype)initWithAppName:(NSString *)appName
appID:(NSString *)appID
keychainStorage:(GULKeychainStorage *)keychainStorage
accessGroup:(nullable NSString *)accessGroup NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithKeySuffix:(NSString *)keySuffix
keychainStorage:(GULKeychainStorage *)keychainStorage
accessGroup:(nullable NSString *)accessGroup NS_DESIGNATED_INITIALIZER;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,31 @@

@interface GACAppAttestArtifactStorage ()

@property(nonatomic, readonly) NSString *appName;
@property(nonatomic, readonly) NSString *appID;
@property(nonatomic, readonly) NSString *keySuffix;
@property(nonatomic, readonly) GULKeychainStorage *keychainStorage;
@property(nonatomic, readonly, nullable) NSString *accessGroup;

@end

@implementation GACAppAttestArtifactStorage

- (instancetype)initWithAppName:(NSString *)appName
appID:(NSString *)appID
keychainStorage:(GULKeychainStorage *)keychainStorage
accessGroup:(nullable NSString *)accessGroup {
- (instancetype)initWithKeySuffix:(NSString *)keySuffix
keychainStorage:(GULKeychainStorage *)keychainStorage
accessGroup:(nullable NSString *)accessGroup {
self = [super init];
if (self) {
_appName = [appName copy];
_appID = [appID copy];
_keySuffix = [keySuffix copy];
_keychainStorage = keychainStorage;
_accessGroup = [accessGroup copy];
}
return self;
}

- (instancetype)initWithAppName:(NSString *)appName
appID:(NSString *)appID
accessGroup:(nullable NSString *)accessGroup {
- (instancetype)initWithKeySuffix:(NSString *)keySuffix
accessGroup:(nullable NSString *)accessGroup {
GULKeychainStorage *keychainStorage =
[[GULKeychainStorage alloc] initWithService:kKeychainService];
return [self initWithAppName:appName
appID:appID
keychainStorage:keychainStorage
accessGroup:accessGroup];
return [self initWithKeySuffix:keySuffix keychainStorage:keychainStorage accessGroup:accessGroup];
}

- (FBLPromise<NSData *> *)getArtifactForKey:(NSString *)keyID {
Expand Down Expand Up @@ -116,8 +109,7 @@ - (instancetype)initWithAppName:(NSString *)appName
}

- (NSString *)artifactKey {
return
[NSString stringWithFormat:@"app_check_app_attest_artifact.%@.%@", self.appName, self.appID];
return [NSString stringWithFormat:@"app_check_app_attest_artifact.%@", self.keySuffix];
}

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@
#import "AppCheck/Sources/AppAttestProvider/Storage/GACAppAttestArtifactStorage.h"
#import "AppCheck/Sources/Core/Errors/GACAppCheckErrorUtil.h"

static NSString *const kAppName = @"GACAppAttestArtifactStorageTests";
static NSString *const kAppID = @"1:100000000000:ios:aaaaaaaaaaaaaaaaaaaaaaaa";

@interface GACAppAttestArtifactStorageTests : XCTestCase

@property(nonatomic) NSString *appName;
@property(nonatomic) NSString *appID;
@property(nonatomic) NSString *keySuffix;
@property(nonatomic) GACAppAttestArtifactStorage *storage;

@end
Expand All @@ -49,12 +51,11 @@ @implementation GACAppAttestArtifactStorageTests
- (void)setUp {
[super setUp];

self.appName = @"GACAppAttestArtifactStorageTests";
self.appID = @"1:100000000000:ios:aaaaaaaaaaaaaaaaaaaaaaaa";
self.keySuffix = [GACAppAttestArtifactStorageTests artifactKeySuffixForAppName:kAppName
appID:kAppID];

self.storage = [[GACAppAttestArtifactStorage alloc] initWithAppName:self.appName
appID:self.appID
accessGroup:nil];
self.storage = [[GACAppAttestArtifactStorage alloc] initWithKeySuffix:self.keySuffix
accessGroup:nil];
}

- (void)tearDown {
Expand Down Expand Up @@ -87,15 +88,15 @@ - (void)testRemoveArtifact {

- (void)testSetAndGetPerApp {
// Assert storages for apps with the same name can independently set/get artifact.
[self assertIndependentSetGetForStoragesWithAppName1:self.appName
appID1:@"app_id"
appName2:self.appName
[self assertIndependentSetGetForStoragesWithAppName1:kAppName
appID1:@"app_id_1"
appName2:kAppName
appID2:@"app_id_2"];
// Assert storages for apps with the same app ID can independently set/get artifact.
[self assertIndependentSetGetForStoragesWithAppName1:@"app_1"
appID1:self.appID
appID1:kAppID
appName2:@"app_2"
appID2:self.appID];
appID2:kAppID];
// Assert storages for apps with different info can independently set/get artifact.
[self assertIndependentSetGetForStoragesWithAppName1:@"app_1"
appID1:@"app_id_1"
Expand Down Expand Up @@ -134,10 +135,9 @@ - (void)testGetArtifact_KeychainError {
// 1. Set up storage mock.
id mockKeychainStorage = OCMClassMock([GULKeychainStorage class]);
GACAppAttestArtifactStorage *artifactStorage =
[[GACAppAttestArtifactStorage alloc] initWithAppName:self.appName
appID:self.appID
keychainStorage:mockKeychainStorage
accessGroup:nil];
[[GACAppAttestArtifactStorage alloc] initWithKeySuffix:self.keySuffix
keychainStorage:mockKeychainStorage
accessGroup:nil];

// 2. Create and expect keychain error.
NSError *gulsKeychainError = [NSError errorWithDomain:@"com.guls.keychain" code:-1 userInfo:nil];
Expand All @@ -161,10 +161,9 @@ - (void)testSetArtifact_KeychainError {
// 1. Set up storage mock.
id mockKeychainStorage = OCMClassMock([GULKeychainStorage class]);
GACAppAttestArtifactStorage *artifactStorage =
[[GACAppAttestArtifactStorage alloc] initWithAppName:self.appName
appID:self.appID
keychainStorage:mockKeychainStorage
accessGroup:nil];
[[GACAppAttestArtifactStorage alloc] initWithKeySuffix:self.keySuffix
keychainStorage:mockKeychainStorage
accessGroup:nil];
// 2. Create and expect keychain error.
NSError *gulsKeychainError = [NSError errorWithDomain:@"com.guls.keychain" code:-1 userInfo:nil];
OCMExpect([mockKeychainStorage setObject:[OCMArg any]
Expand All @@ -188,10 +187,9 @@ - (void)testRemoveArtifact_KeychainError {
// 1. Set up storage mock.
id mockKeychainStorage = OCMClassMock([GULKeychainStorage class]);
GACAppAttestArtifactStorage *artifactStorage =
[[GACAppAttestArtifactStorage alloc] initWithAppName:self.appName
appID:self.appID
keychainStorage:mockKeychainStorage
accessGroup:nil];
[[GACAppAttestArtifactStorage alloc] initWithKeySuffix:self.keySuffix
keychainStorage:mockKeychainStorage
accessGroup:nil];

// 2. Create and expect keychain error.
NSError *gulsKeychainError = [NSError errorWithDomain:@"com.guls.keychain" code:-1 userInfo:nil];
Expand Down Expand Up @@ -242,12 +240,16 @@ - (void)assertIndependentSetGetForStoragesWithAppName1:(NSString *)appName1
appName2:(NSString *)appName2
appID2:(NSString *)appID2 {
NSString *keyID = [NSUUID UUID].UUIDString;
NSString *keySuffix1 = [GACAppAttestArtifactStorageTests artifactKeySuffixForAppName:appName1
appID:appID1];
NSString *keySuffix2 = [GACAppAttestArtifactStorageTests artifactKeySuffixForAppName:appName2
appID:appID2];

// Create two storages.
GACAppAttestArtifactStorage *storage1 =
[[GACAppAttestArtifactStorage alloc] initWithAppName:appName1 appID:appID1 accessGroup:nil];
[[GACAppAttestArtifactStorage alloc] initWithKeySuffix:keySuffix1 accessGroup:nil];
GACAppAttestArtifactStorage *storage2 =
[[GACAppAttestArtifactStorage alloc] initWithAppName:appName2 appID:appID2 accessGroup:nil];
[[GACAppAttestArtifactStorage alloc] initWithKeySuffix:keySuffix2 accessGroup:nil];
// 1. Independently set artifacts for the two storages.
NSData *artifact1 = [@"app_attest_artifact1" dataUsingEncoding:NSUTF8StringEncoding];
FBLPromise *setPromise1 = [storage1 setArtifact:artifact1 forKey:keyID];
Expand Down Expand Up @@ -281,6 +283,15 @@ - (void)assertIndependentSetGetForStoragesWithAppName1:(NSString *)appName1
XCTAssert(FBLWaitForPromisesWithTimeout(0.5));
}

// TODO(andrewheard): Remove from generic App Check SDK.
// FIREBASE_APP_CHECK_ONLY_BEGIN

+ (NSString *)artifactKeySuffixForAppName:(NSString *)appName appID:(NSString *)appID {
return [NSString stringWithFormat:@"%@.%@", appName, appID];
}

// FIREBASE_APP_CHECK_ONLY_END

@end

#endif // !TARGET_OS_MACCATALYST && !TARGET_OS_OSX
Expand Down
2 changes: 1 addition & 1 deletion AppCheckInterop.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AppCheckInterop'
s.version = '10.10.0'
s.version = '10.11.0'
s.summary = 'Interfaces that allow other SDKs to use AppCheck functionality.'

s.description = <<-DESC
Expand Down