Skip to content

Commit 86d7095

Browse files
authored
Add stubs for the App Check providers (#1093)
* Add stubs for the App Check providers * Fix formatting * Rename the files based on platform * File formatting
1 parent e02c0f5 commit 86d7095

17 files changed

+449
-0
lines changed

app_check/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,39 @@ set(common_SRCS
3030
set(android_SRCS
3131
src/android/app_check_android.cc
3232
src/android/app_check_android.h
33+
# Supported providers
34+
src/android/debug_provider_android.cc
35+
src/android/play_integrity_provider_android.cc
36+
src/android/safety_net_provider_android.cc
37+
# Unsupported providers
38+
src/stub/app_attest_provider_stub.cc
39+
src/stub/device_check_provider_stub.cc
3340
)
3441

3542
# Source files used by the iOS implementation.
3643
set(ios_SRCS
3744
src/ios/app_check_ios.mm
3845
src/ios/app_check_ios.h
46+
# Supported providers
47+
src/ios/app_attest_provider_ios.mm
48+
src/ios/debug_provider_ios.mm
49+
src/ios/device_check_provider_ios.mm
50+
# Unsupported providers
51+
src/stub/play_integrity_provider_stub.cc
52+
src/stub/safety_net_provider_stub.cc
3953
)
4054

4155
# Source files used by the desktop implementation.
4256
set(desktop_SRCS
4357
src/desktop/app_check_desktop.cc
4458
src/desktop/app_check_desktop.h
59+
# Supported providers
60+
src/desktop/debug_provider_desktop.cc
61+
# Unsupported providers
62+
src/stub/app_attest_provider_stub.cc
63+
src/stub/device_check_provider_stub.cc
64+
src/stub/play_integrity_provider_stub.cc
65+
src/stub/safety_net_provider_stub.cc
4566
)
4667

4768
if(ANDROID)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "firebase/app_check/debug_provider.h"
16+
17+
namespace firebase {
18+
namespace app_check {
19+
20+
static DebugAppCheckProviderFactory* g_debug_app_check_provider_factory =
21+
nullptr;
22+
23+
DebugAppCheckProviderFactory* DebugAppCheckProviderFactory::GetInstance() {
24+
if (!g_debug_app_check_provider_factory) {
25+
g_debug_app_check_provider_factory = new DebugAppCheckProviderFactory();
26+
}
27+
return g_debug_app_check_provider_factory;
28+
}
29+
30+
DebugAppCheckProviderFactory::DebugAppCheckProviderFactory() {}
31+
32+
DebugAppCheckProviderFactory::~DebugAppCheckProviderFactory() {}
33+
34+
AppCheckProvider* DebugAppCheckProviderFactory::CreateProvider(App* app) {
35+
return nullptr;
36+
}
37+
38+
} // namespace app_check
39+
} // namespace firebase
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "firebase/app_check/play_integrity_provider.h"
16+
17+
namespace firebase {
18+
namespace app_check {
19+
20+
static PlayIntegrityProviderFactory* g_play_integrity_provider_factory =
21+
nullptr;
22+
23+
PlayIntegrityProviderFactory* PlayIntegrityProviderFactory::GetInstance() {
24+
if (!g_play_integrity_provider_factory) {
25+
g_play_integrity_provider_factory = new PlayIntegrityProviderFactory();
26+
}
27+
return g_play_integrity_provider_factory;
28+
}
29+
30+
PlayIntegrityProviderFactory::PlayIntegrityProviderFactory() {}
31+
32+
PlayIntegrityProviderFactory::~PlayIntegrityProviderFactory() {}
33+
34+
AppCheckProvider* PlayIntegrityProviderFactory::CreateProvider(App* app) {
35+
return nullptr;
36+
}
37+
38+
} // namespace app_check
39+
} // namespace firebase
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "firebase/app_check/safety_net_provider.h"
16+
17+
namespace firebase {
18+
namespace app_check {
19+
20+
static SafetyNetProviderFactory* g_safety_net_provider_factory = nullptr;
21+
22+
SafetyNetProviderFactory* SafetyNetProviderFactory::GetInstance() {
23+
if (!g_safety_net_provider_factory) {
24+
g_safety_net_provider_factory = new SafetyNetProviderFactory();
25+
}
26+
return g_safety_net_provider_factory;
27+
}
28+
29+
SafetyNetProviderFactory::SafetyNetProviderFactory() {}
30+
31+
SafetyNetProviderFactory::~SafetyNetProviderFactory() {}
32+
33+
AppCheckProvider* SafetyNetProviderFactory::CreateProvider(App* app) {
34+
return nullptr;
35+
}
36+
37+
} // namespace app_check
38+
} // namespace firebase
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "firebase/app_check/debug_provider.h"
16+
17+
namespace firebase {
18+
namespace app_check {
19+
20+
static DebugAppCheckProviderFactory* g_debug_app_check_provider_factory =
21+
nullptr;
22+
23+
DebugAppCheckProviderFactory* DebugAppCheckProviderFactory::GetInstance() {
24+
if (!g_debug_app_check_provider_factory) {
25+
g_debug_app_check_provider_factory = new DebugAppCheckProviderFactory();
26+
}
27+
return g_debug_app_check_provider_factory;
28+
}
29+
30+
DebugAppCheckProviderFactory::DebugAppCheckProviderFactory() {}
31+
32+
DebugAppCheckProviderFactory::~DebugAppCheckProviderFactory() {}
33+
34+
AppCheckProvider* DebugAppCheckProviderFactory::CreateProvider(App* app) {
35+
return nullptr;
36+
}
37+
38+
} // namespace app_check
39+
} // namespace firebase

app_check/src/include/firebase/app_check/app_attest_provider.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ class AppAttestProviderFactory : public AppCheckProviderFactory {
2828
/// firebase::app_check::AppCheck instance.
2929
static AppAttestProviderFactory* GetInstance();
3030

31+
virtual ~AppAttestProviderFactory();
32+
3133
/// Gets the AppCheckProvider associated with the given
3234
/// {@link App} instance, or creates one if none
3335
/// already exists.
3436
AppCheckProvider* CreateProvider(App* app) override;
37+
38+
private:
39+
AppAttestProviderFactory();
3540
};
3641

3742
} // namespace app_check

app_check/src/include/firebase/app_check/debug_provider.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ class DebugAppCheckProviderFactory : public AppCheckProviderFactory {
3434
/// firebase::app_check::AppCheck instance.
3535
static DebugAppCheckProviderFactory* GetInstance();
3636

37+
virtual ~DebugAppCheckProviderFactory();
38+
3739
/// Gets the AppCheckProvider associated with the given
3840
/// {@link App} instance, or creates one if none
3941
/// already exists.
4042
AppCheckProvider* CreateProvider(App* app) override;
43+
44+
private:
45+
DebugAppCheckProviderFactory();
4146
};
4247

4348
} // namespace app_check

app_check/src/include/firebase/app_check/device_check_provider.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ class DeviceCheckProviderFactory : public AppCheckProviderFactory {
2828
/// firebase::app_check::AppCheck instance.
2929
static DeviceCheckProviderFactory* GetInstance();
3030

31+
virtual ~DeviceCheckProviderFactory();
32+
3133
/// Gets the AppCheckProvider associated with the given
3234
/// {@link App} instance, or creates one if none
3335
/// already exists.
3436
AppCheckProvider* CreateProvider(App* app) override;
37+
38+
private:
39+
DeviceCheckProviderFactory();
3540
};
3641

3742
} // namespace app_check

app_check/src/include/firebase/app_check/play_integrity_provider.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ class PlayIntegrityProviderFactory : public AppCheckProviderFactory {
2828
/// firebase::app_check::AppCheck instance.
2929
static PlayIntegrityProviderFactory* GetInstance();
3030

31+
virtual ~PlayIntegrityProviderFactory();
32+
3133
/// Gets the AppCheckProvider associated with the given
3234
/// {@link App} instance, or creates one if none
3335
/// already exists.
3436
AppCheckProvider* CreateProvider(App* app) override;
37+
38+
private:
39+
PlayIntegrityProviderFactory();
3540
};
3641

3742
} // namespace app_check

app_check/src/include/firebase/app_check/safety_net_provider.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ class SafetyNetProviderFactory : public AppCheckProviderFactory {
2828
/// firebase::app_check::AppCheck instance.
2929
static SafetyNetProviderFactory* GetInstance();
3030

31+
virtual ~SafetyNetProviderFactory();
32+
3133
/// Gets the AppCheckProvider associated with the given
3234
/// {@link App} instance, or creates one if none
3335
/// already exists.
3436
AppCheckProvider* CreateProvider(App* app) override;
37+
38+
private:
39+
SafetyNetProviderFactory();
3540
};
3641

3742
} // namespace app_check

0 commit comments

Comments
 (0)