@maxim_mazurok/gapi.client.firebaseappcheck-v1 0.0.20220806

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.firebaseappcheck-v1",
3
+ "version": "0.0.20220806",
4
+ "description": "TypeScript typings for Firebase App Check API v1",
5
+ "license": "MIT",
6
+ "author": {
7
+ "email": "maxim@mazurok.com",
8
+ "name": "Maxim Mazurok",
9
+ "url": "https://maxim.mazurok.com"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,76 @@
1
+ # TypeScript typings for Firebase App Check API v1
2
+
3
+ Firebase App Check works alongside other Firebase services to help protect your backend resources from abuse, such as billing fraud or phishing.
4
+ For detailed description please check [documentation](https://firebase.google.com/docs/app-check).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Firebase App Check API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.firebaseappcheck-v1 --save-dev
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You need to initialize Google API client in your code:
17
+
18
+ ```typescript
19
+ gapi.load('client', () => {
20
+ // now we can use gapi.client
21
+ // ...
22
+ });
23
+ ```
24
+
25
+ Then load api client wrapper:
26
+
27
+ ```typescript
28
+ gapi.client.load('https://firebaseappcheck.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.firebaseappcheck
31
+ });
32
+ ```
33
+
34
+ ```typescript
35
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
36
+ gapi.client.load('firebaseappcheck', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.firebaseappcheck
39
+ });
40
+ ```
41
+
42
+ Don't forget to authenticate your client before sending any request to resources:
43
+
44
+ ```typescript
45
+ // declare client_id registered in Google Developers Console
46
+ var client_id = '',
47
+ scope = [
48
+ // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
49
+ 'https://www.googleapis.com/auth/cloud-platform',
50
+
51
+ // View and administer all your Firebase data and settings
52
+ 'https://www.googleapis.com/auth/firebase',
53
+ ],
54
+ immediate = true;
55
+ // ...
56
+
57
+ gapi.auth.authorize(
58
+ { client_id: client_id, scope: scope, immediate: immediate },
59
+ authResult => {
60
+ if (authResult && !authResult.error) {
61
+ /* handle successful authorization */
62
+ } else {
63
+ /* handle authorization error */
64
+ }
65
+ });
66
+ ```
67
+
68
+ After that you can use Firebase App Check API resources: <!-- TODO: make this work for multiple namespaces -->
69
+
70
+ ```typescript
71
+
72
+ /*
73
+ Returns a public JWK set as specified by [RFC 7517](https://tools.ietf.org/html/rfc7517) that can be used to verify App Check tokens. Exactly one of the public keys in the returned set will successfully validate any App Check token that is currently valid.
74
+ */
75
+ await gapi.client.firebaseappcheck.jwks.get({ name: "name", });
76
+ ```
package/tests.ts ADDED
@@ -0,0 +1,315 @@
1
+ /* This is stub file for gapi.client.firebaseappcheck-v1 definition tests */
2
+ // IMPORTANT
3
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
+
6
+ // Revision: 20220806
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://firebaseappcheck.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.firebaseappcheck */
13
+
14
+ /** don't forget to authenticate your client before sending any request to resources: */
15
+ /** declare client_id registered in Google Developers Console */
16
+ const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
+ const scope = [
18
+ /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
19
+ 'https://www.googleapis.com/auth/cloud-platform',
20
+ /** View and administer all your Firebase data and settings */
21
+ 'https://www.googleapis.com/auth/firebase',
22
+ ];
23
+ const immediate = false;
24
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
25
+ if (authResult && !authResult.error) {
26
+ /** handle successful authorization */
27
+ run();
28
+ } else {
29
+ /** handle authorization error */
30
+ }
31
+ });
32
+
33
+ async function run() {
34
+ /**
35
+ * Returns a public JWK set as specified by [RFC 7517](https://tools.ietf.org/html/rfc7517) that can be used to verify App Check tokens. Exactly one of the public keys in the returned set
36
+ * will successfully validate any App Check token that is currently valid.
37
+ */
38
+ await gapi.client.firebaseappcheck.jwks.get({
39
+ name: "Test string",
40
+ });
41
+ /** Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken. */
42
+ await gapi.client.firebaseappcheck.projects.apps.exchangeAppAttestAssertion({
43
+ app: "Test string",
44
+ }, {
45
+ artifact: "Test string",
46
+ assertion: "Test string",
47
+ challenge: "Test string",
48
+ });
49
+ /**
50
+ * Accepts an App Attest CBOR attestation and verifies it with Apple using your preconfigured team and bundle IDs. If valid, returns an attestation artifact that can later be exchanged for
51
+ * an AppCheckToken using ExchangeAppAttestAssertion. For convenience and performance, this method's response object will also contain an AppCheckToken (if the verification is successful).
52
+ */
53
+ await gapi.client.firebaseappcheck.projects.apps.exchangeAppAttestAttestation({
54
+ app: "Test string",
55
+ }, {
56
+ attestationStatement: "Test string",
57
+ challenge: "Test string",
58
+ keyId: "Test string",
59
+ });
60
+ /** Validates a custom token signed using your project's Admin SDK service account credentials. If valid, returns an AppCheckToken. */
61
+ await gapi.client.firebaseappcheck.projects.apps.exchangeCustomToken({
62
+ app: "Test string",
63
+ }, {
64
+ customToken: "Test string",
65
+ });
66
+ /**
67
+ * Validates a debug token secret that you have previously created using CreateDebugToken. If valid, returns an AppCheckToken. Note that a restrictive quota is enforced on this method to
68
+ * prevent accidental exposure of the app to abuse.
69
+ */
70
+ await gapi.client.firebaseappcheck.projects.apps.exchangeDebugToken({
71
+ app: "Test string",
72
+ }, {
73
+ debugToken: "Test string",
74
+ });
75
+ /**
76
+ * Accepts a [`device_token`](https://developer.apple.com/documentation/devicecheck/dcdevice) issued by DeviceCheck, and attempts to validate it with Apple. If valid, returns an
77
+ * AppCheckToken.
78
+ */
79
+ await gapi.client.firebaseappcheck.projects.apps.exchangeDeviceCheckToken({
80
+ app: "Test string",
81
+ }, {
82
+ deviceToken: "Test string",
83
+ });
84
+ /** Validates an [integrity verdict response token from Play Integrity](https://developer.android.com/google/play/integrity/verdict#decrypt-verify). If valid, returns an AppCheckToken. */
85
+ await gapi.client.firebaseappcheck.projects.apps.exchangePlayIntegrityToken({
86
+ app: "Test string",
87
+ }, {
88
+ playIntegrityToken: "Test string",
89
+ });
90
+ /** Validates a [reCAPTCHA Enterprise response token](https://cloud.google.com/recaptcha-enterprise/docs/create-assessment#retrieve_token). If valid, returns an AppCheckToken. */
91
+ await gapi.client.firebaseappcheck.projects.apps.exchangeRecaptchaEnterpriseToken({
92
+ app: "Test string",
93
+ }, {
94
+ recaptchaEnterpriseToken: "Test string",
95
+ });
96
+ /** Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken. */
97
+ await gapi.client.firebaseappcheck.projects.apps.exchangeRecaptchaV3Token({
98
+ app: "Test string",
99
+ }, {
100
+ recaptchaV3Token: "Test string",
101
+ });
102
+ /** Validates a [SafetyNet token](https://developer.android.com/training/safetynet/attestation#request-attestation-step). If valid, returns an AppCheckToken. */
103
+ await gapi.client.firebaseappcheck.projects.apps.exchangeSafetyNetToken({
104
+ app: "Test string",
105
+ }, {
106
+ safetyNetToken: "Test string",
107
+ });
108
+ /**
109
+ * Generates a challenge that protects the integrity of an immediately following call to ExchangeAppAttestAttestation or ExchangeAppAttestAssertion. A challenge should not be reused for
110
+ * multiple calls.
111
+ */
112
+ await gapi.client.firebaseappcheck.projects.apps.generateAppAttestChallenge({
113
+ app: "Test string",
114
+ }, {
115
+ });
116
+ /**
117
+ * Generates a challenge that protects the integrity of an immediately following integrity verdict request to the Play Integrity API. The next call to ExchangePlayIntegrityToken using the
118
+ * resulting integrity token will verify the presence and validity of the challenge. A challenge should not be reused for multiple calls.
119
+ */
120
+ await gapi.client.firebaseappcheck.projects.apps.generatePlayIntegrityChallenge({
121
+ app: "Test string",
122
+ }, {
123
+ });
124
+ /** Atomically gets the AppAttestConfigs for the specified list of apps. */
125
+ await gapi.client.firebaseappcheck.projects.apps.appAttestConfig.batchGet({
126
+ names: "Test string",
127
+ parent: "Test string",
128
+ });
129
+ /** Gets the AppAttestConfig for the specified app. */
130
+ await gapi.client.firebaseappcheck.projects.apps.appAttestConfig.get({
131
+ name: "Test string",
132
+ });
133
+ /** Updates the AppAttestConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange AppAttest tokens for App Check tokens. */
134
+ await gapi.client.firebaseappcheck.projects.apps.appAttestConfig.patch({
135
+ name: "Test string",
136
+ updateMask: "Test string",
137
+ }, {
138
+ name: "Test string",
139
+ tokenTtl: "Test string",
140
+ });
141
+ /**
142
+ * Creates a new DebugToken for the specified app. For security reasons, after the creation operation completes, the `token` field cannot be updated or retrieved, but you can revoke the
143
+ * debug token using DeleteDebugToken. Each app can have a maximum of 20 debug tokens.
144
+ */
145
+ await gapi.client.firebaseappcheck.projects.apps.debugTokens.create({
146
+ parent: "Test string",
147
+ }, {
148
+ displayName: "Test string",
149
+ name: "Test string",
150
+ token: "Test string",
151
+ });
152
+ /**
153
+ * Deletes the specified DebugToken. A deleted debug token cannot be used to exchange for an App Check token. Use this method when you suspect the secret `token` has been compromised or
154
+ * when you no longer need the debug token.
155
+ */
156
+ await gapi.client.firebaseappcheck.projects.apps.debugTokens.delete({
157
+ name: "Test string",
158
+ });
159
+ /** Gets the specified DebugToken. For security reasons, the `token` field is never populated in the response. */
160
+ await gapi.client.firebaseappcheck.projects.apps.debugTokens.get({
161
+ name: "Test string",
162
+ });
163
+ /** Lists all DebugTokens for the specified app. For security reasons, the `token` field is never populated in the response. */
164
+ await gapi.client.firebaseappcheck.projects.apps.debugTokens.list({
165
+ pageSize: 42,
166
+ pageToken: "Test string",
167
+ parent: "Test string",
168
+ });
169
+ /**
170
+ * Updates the specified DebugToken. For security reasons, the `token` field cannot be updated, nor will it be populated in the response, but you can revoke the debug token using
171
+ * DeleteDebugToken.
172
+ */
173
+ await gapi.client.firebaseappcheck.projects.apps.debugTokens.patch({
174
+ name: "Test string",
175
+ updateMask: "Test string",
176
+ }, {
177
+ displayName: "Test string",
178
+ name: "Test string",
179
+ token: "Test string",
180
+ });
181
+ /** Atomically gets the DeviceCheckConfigs for the specified list of apps. For security reasons, the `private_key` field is never populated in the response. */
182
+ await gapi.client.firebaseappcheck.projects.apps.deviceCheckConfig.batchGet({
183
+ names: "Test string",
184
+ parent: "Test string",
185
+ });
186
+ /** Gets the DeviceCheckConfig for the specified app. For security reasons, the `private_key` field is never populated in the response. */
187
+ await gapi.client.firebaseappcheck.projects.apps.deviceCheckConfig.get({
188
+ name: "Test string",
189
+ });
190
+ /**
191
+ * Updates the DeviceCheckConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange DeviceCheck tokens for App Check tokens. For
192
+ * security reasons, the `private_key` field is never populated in the response.
193
+ */
194
+ await gapi.client.firebaseappcheck.projects.apps.deviceCheckConfig.patch({
195
+ name: "Test string",
196
+ updateMask: "Test string",
197
+ }, {
198
+ keyId: "Test string",
199
+ name: "Test string",
200
+ privateKey: "Test string",
201
+ privateKeySet: true,
202
+ tokenTtl: "Test string",
203
+ });
204
+ /** Atomically gets the PlayIntegrityConfigs for the specified list of apps. */
205
+ await gapi.client.firebaseappcheck.projects.apps.playIntegrityConfig.batchGet({
206
+ names: "Test string",
207
+ parent: "Test string",
208
+ });
209
+ /** Gets the PlayIntegrityConfig for the specified app. */
210
+ await gapi.client.firebaseappcheck.projects.apps.playIntegrityConfig.get({
211
+ name: "Test string",
212
+ });
213
+ /** Updates the PlayIntegrityConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange Play Integrity tokens for App Check tokens. */
214
+ await gapi.client.firebaseappcheck.projects.apps.playIntegrityConfig.patch({
215
+ name: "Test string",
216
+ updateMask: "Test string",
217
+ }, {
218
+ name: "Test string",
219
+ tokenTtl: "Test string",
220
+ });
221
+ /** Atomically gets the RecaptchaEnterpriseConfigs for the specified list of apps. */
222
+ await gapi.client.firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.batchGet({
223
+ names: "Test string",
224
+ parent: "Test string",
225
+ });
226
+ /** Gets the RecaptchaEnterpriseConfig for the specified app. */
227
+ await gapi.client.firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.get({
228
+ name: "Test string",
229
+ });
230
+ /**
231
+ * Updates the RecaptchaEnterpriseConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange reCAPTCHA Enterprise tokens for App
232
+ * Check tokens.
233
+ */
234
+ await gapi.client.firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.patch({
235
+ name: "Test string",
236
+ updateMask: "Test string",
237
+ }, {
238
+ name: "Test string",
239
+ siteKey: "Test string",
240
+ tokenTtl: "Test string",
241
+ });
242
+ /** Atomically gets the RecaptchaV3Configs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response. */
243
+ await gapi.client.firebaseappcheck.projects.apps.recaptchaV3Config.batchGet({
244
+ names: "Test string",
245
+ parent: "Test string",
246
+ });
247
+ /** Gets the RecaptchaV3Config for the specified app. For security reasons, the `site_secret` field is never populated in the response. */
248
+ await gapi.client.firebaseappcheck.projects.apps.recaptchaV3Config.get({
249
+ name: "Test string",
250
+ });
251
+ /**
252
+ * Updates the RecaptchaV3Config for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange reCAPTCHA tokens for App Check tokens. For
253
+ * security reasons, the `site_secret` field is never populated in the response.
254
+ */
255
+ await gapi.client.firebaseappcheck.projects.apps.recaptchaV3Config.patch({
256
+ name: "Test string",
257
+ updateMask: "Test string",
258
+ }, {
259
+ name: "Test string",
260
+ siteSecret: "Test string",
261
+ siteSecretSet: true,
262
+ tokenTtl: "Test string",
263
+ });
264
+ /** Atomically gets the SafetyNetConfigs for the specified list of apps. */
265
+ await gapi.client.firebaseappcheck.projects.apps.safetyNetConfig.batchGet({
266
+ names: "Test string",
267
+ parent: "Test string",
268
+ });
269
+ /** Gets the SafetyNetConfig for the specified app. */
270
+ await gapi.client.firebaseappcheck.projects.apps.safetyNetConfig.get({
271
+ name: "Test string",
272
+ });
273
+ /** Updates the SafetyNetConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange SafetyNet tokens for App Check tokens. */
274
+ await gapi.client.firebaseappcheck.projects.apps.safetyNetConfig.patch({
275
+ name: "Test string",
276
+ updateMask: "Test string",
277
+ }, {
278
+ name: "Test string",
279
+ tokenTtl: "Test string",
280
+ });
281
+ /** Atomically updates the specified Service configurations. */
282
+ await gapi.client.firebaseappcheck.projects.services.batchUpdate({
283
+ parent: "Test string",
284
+ }, {
285
+ requests: [
286
+ {
287
+ service: {
288
+ enforcementMode: "Test string",
289
+ name: "Test string",
290
+ },
291
+ updateMask: "Test string",
292
+ }
293
+ ],
294
+ updateMask: "Test string",
295
+ });
296
+ /** Gets the Service configuration for the specified service name. */
297
+ await gapi.client.firebaseappcheck.projects.services.get({
298
+ name: "Test string",
299
+ });
300
+ /** Lists all Service configurations for the specified project. Only Services which were explicitly configured using UpdateService or BatchUpdateServices will be returned. */
301
+ await gapi.client.firebaseappcheck.projects.services.list({
302
+ pageSize: 42,
303
+ pageToken: "Test string",
304
+ parent: "Test string",
305
+ });
306
+ /** Updates the specified Service configuration. */
307
+ await gapi.client.firebaseappcheck.projects.services.patch({
308
+ name: "Test string",
309
+ updateMask: "Test string",
310
+ }, {
311
+ enforcementMode: "Test string",
312
+ name: "Test string",
313
+ });
314
+ }
315
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "lib": ["es6", "dom"],
5
+ "noImplicitAny": true,
6
+ "noImplicitThis": true,
7
+ "strictNullChecks": true,
8
+ "baseUrl": "../",
9
+ "typeRoots": [
10
+ "../"
11
+ ],
12
+ "types": [],
13
+ "noEmit": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strictFunctionTypes": true
16
+ },
17
+ "files": ["index.d.ts", "tests.ts"]
18
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }