Skip to content

Commit 7acf27a

Browse files
committed
feat: Add abuse reduction support (#1264)
- Add abuse reduction support APIs
1 parent 17157bc commit 7acf27a

33 files changed

+3128
-415
lines changed

.github/scripts/run_integration_tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ gpg --quiet --batch --yes --decrypt --passphrase="${FIREBASE_SERVICE_ACCT_KEY}"
2222

2323
echo "${FIREBASE_API_KEY}" > test/resources/apikey.txt
2424

25+
echo "${FIREBASE_APP_ID}" > test/resources/appid.txt
26+
2527
npm run test:integration -- --updateRules --testMultiTenancy

.github/workflows/nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
env:
5656
FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
5757
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
58+
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
5859

5960
- name: Package release artifacts
6061
run: |

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
env:
6767
FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
6868
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
69+
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
6970

7071
- name: Package release artifacts
7172
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ node_modules/
1414
# Real key file should not be checked in
1515
test/resources/key.json
1616
test/resources/apikey.txt
17+
test/resources/appid.txt
1718

1819
# Release tarballs should not be checked in
1920
firebase-admin-*.tgz

etc/firebase-admin.api.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export function app(name?: string): app.App;
1717
export namespace app {
1818
// Warning: (ae-forgotten-export) The symbol "App" needs to be exported by the entry point default-namespace.d.ts
1919
export interface App extends App {
20+
// (undocumented)
21+
appCheck(): appCheck.AppCheck;
2022
// (undocumented)
2123
auth(): auth.Auth;
2224
// (undocumented)
@@ -41,6 +43,37 @@ export namespace app {
4143
}
4244
}
4345

46+
// @public
47+
export function appCheck(app?: app.App): appCheck.AppCheck;
48+
49+
// @public (undocumented)
50+
export namespace appCheck {
51+
export interface AppCheck {
52+
// (undocumented)
53+
app: app.App;
54+
createToken(appId: string): Promise<AppCheckToken>;
55+
verifyToken(appCheckToken: string): Promise<VerifyAppCheckTokenResponse>;
56+
}
57+
export interface AppCheckToken {
58+
token: string;
59+
ttlMillis: number;
60+
}
61+
export interface DecodedAppCheckToken {
62+
// (undocumented)
63+
[key: string]: any;
64+
app_id: string;
65+
aud: string[];
66+
exp: number;
67+
iat: number;
68+
iss: string;
69+
sub: string;
70+
}
71+
export interface VerifyAppCheckTokenResponse {
72+
appId: string;
73+
token: appCheck.DecodedAppCheckToken;
74+
}
75+
}
76+
4477
// @public
4578
export interface AppOptions {
4679
// Warning: (ae-forgotten-export) The symbol "Credential" needs to be exported by the entry point default-namespace.d.ts

0 commit comments

Comments
 (0)