@maxim_mazurok/gapi.client.playintegrity-v1 0.0.20220808

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/index.d.ts ADDED
@@ -0,0 +1,140 @@
1
+ /* Type definitions for non-npm package Google Play Integrity API v1 0.0 */
2
+ // Project: https://developer.android.com/google/play/integrity
3
+ // Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
4
+ // Nick Amoscato <https://github.com/namoscato>
5
+ // Declan Vong <https://github.com/declanvong>
6
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
+ // TypeScript Version: 2.8
8
+
9
+ // IMPORTANT
10
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
11
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
12
+ // Generated from: https://playintegrity.googleapis.com/$discovery/rest?version=v1
13
+ // Revision: 20220808
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load Google Play Integrity API v1 */
19
+ function load(urlOrObject: "https://playintegrity.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "playintegrity", version: "v1"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "playintegrity", version: "v1", callback: () => any): void;
24
+
25
+ namespace playintegrity {
26
+ interface AccountDetails {
27
+ /** Required. Details about the licensing status of the user for the app in the scope. */
28
+ appLicensingVerdict?: string;
29
+ }
30
+ interface AppIntegrity {
31
+ /** Required. Details about the app recognition verdict */
32
+ appRecognitionVerdict?: string;
33
+ /** Hex fingerprint of the application signing certificate. e.g. “ABCE1F....” Set iff app_recognition_verdict != UNEVALUATED. */
34
+ certificateSha256Digest?: string[];
35
+ /** Package name of the application under attestation. Set iff app_recognition_verdict != UNEVALUATED. */
36
+ packageName?: string;
37
+ /** Version code of the application. Set iff app_recognition_verdict != UNEVALUATED. */
38
+ versionCode?: string;
39
+ }
40
+ interface DecodeIntegrityTokenRequest {
41
+ /** Encoded integrity token. */
42
+ integrityToken?: string;
43
+ }
44
+ interface DecodeIntegrityTokenResponse {
45
+ /** Plain token payload generated from the decoded integrity token. */
46
+ tokenPayloadExternal?: TokenPayloadExternal;
47
+ }
48
+ interface DeviceIntegrity {
49
+ /** Details about the integrity of the device the app is running on */
50
+ deviceRecognitionVerdict?: string[];
51
+ }
52
+ interface RequestDetails {
53
+ /** Required. Nonce that was provided in the request (which is base64 web-safe no-wrap). */
54
+ nonce?: string;
55
+ /**
56
+ * Required. Application package name this attestation was requested for. Note: This field makes no guarantees or promises on the caller integrity. For details on application
57
+ * integrity, check application_integrity.
58
+ */
59
+ requestPackageName?: string;
60
+ /** Required. Timestamp, in milliseconds, of the integrity application request. */
61
+ timestampMillis?: string;
62
+ }
63
+ interface TestingDetails {
64
+ /** Required. Indicates that the information contained in this payload is a testing response that is statically overridden for a tester. */
65
+ isTestingResponse?: boolean;
66
+ }
67
+ interface TokenPayloadExternal {
68
+ /** Required. Details about the Play Store account. */
69
+ accountDetails?: AccountDetails;
70
+ /** Required. Details about the application integrity. */
71
+ appIntegrity?: AppIntegrity;
72
+ /** Required. Details about the device integrity. */
73
+ deviceIntegrity?: DeviceIntegrity;
74
+ /** Required. Details about the integrity request. */
75
+ requestDetails?: RequestDetails;
76
+ /** Indicates that this payload is generated for testing purposes and contains any additional data that is linked with testing status. */
77
+ testingDetails?: TestingDetails;
78
+ }
79
+ interface V1Resource {
80
+ /** Decodes the integrity token and returns the token payload. */
81
+ decodeIntegrityToken(request: {
82
+ /** V1 error format. */
83
+ "$.xgafv"?: string;
84
+ /** OAuth access token. */
85
+ access_token?: string;
86
+ /** Data format for response. */
87
+ alt?: string;
88
+ /** JSONP */
89
+ callback?: string;
90
+ /** Selector specifying which fields to include in a partial response. */
91
+ fields?: string;
92
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
93
+ key?: string;
94
+ /** OAuth 2.0 token for the current user. */
95
+ oauth_token?: string;
96
+ /** Package name of the app the attached integrity token belongs to. */
97
+ packageName: string;
98
+ /** Returns response with indentations and line breaks. */
99
+ prettyPrint?: boolean;
100
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
101
+ quotaUser?: string;
102
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
103
+ upload_protocol?: string;
104
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
105
+ uploadType?: string;
106
+ /** Request body */
107
+ resource: DecodeIntegrityTokenRequest;
108
+ }): Request<DecodeIntegrityTokenResponse>;
109
+ decodeIntegrityToken(request: {
110
+ /** V1 error format. */
111
+ "$.xgafv"?: string;
112
+ /** OAuth access token. */
113
+ access_token?: string;
114
+ /** Data format for response. */
115
+ alt?: string;
116
+ /** JSONP */
117
+ callback?: string;
118
+ /** Selector specifying which fields to include in a partial response. */
119
+ fields?: string;
120
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
121
+ key?: string;
122
+ /** OAuth 2.0 token for the current user. */
123
+ oauth_token?: string;
124
+ /** Package name of the app the attached integrity token belongs to. */
125
+ packageName: string;
126
+ /** Returns response with indentations and line breaks. */
127
+ prettyPrint?: boolean;
128
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
129
+ quotaUser?: string;
130
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
131
+ upload_protocol?: string;
132
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
133
+ uploadType?: string;
134
+ },
135
+ body: DecodeIntegrityTokenRequest): Request<DecodeIntegrityTokenResponse>;
136
+ }
137
+
138
+ const v1: V1Resource;
139
+ }
140
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.playintegrity-v1",
3
+ "version": "0.0.20220808",
4
+ "description": "TypeScript typings for Google Play Integrity 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,73 @@
1
+ # TypeScript typings for Google Play Integrity API v1
2
+
3
+ Play Integrity
4
+ For detailed description please check [documentation](https://developer.android.com/google/play/integrity).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Google Play Integrity API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.playintegrity-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://playintegrity.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.playintegrity
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('playintegrity', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.playintegrity
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
+ // Private Service: https://www.googleapis.com/auth/playintegrity
49
+ 'https://www.googleapis.com/auth/playintegrity',
50
+ ],
51
+ immediate = true;
52
+ // ...
53
+
54
+ gapi.auth.authorize(
55
+ { client_id: client_id, scope: scope, immediate: immediate },
56
+ authResult => {
57
+ if (authResult && !authResult.error) {
58
+ /* handle successful authorization */
59
+ } else {
60
+ /* handle authorization error */
61
+ }
62
+ });
63
+ ```
64
+
65
+ After that you can use Google Play Integrity API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+
69
+ /*
70
+ Decodes the integrity token and returns the token payload.
71
+ */
72
+ await gapi.client.playintegrity.decodeIntegrityToken({ packageName: "packageName", });
73
+ ```
package/tests.ts ADDED
@@ -0,0 +1,39 @@
1
+ /* This is stub file for gapi.client.playintegrity-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: 20220808
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://playintegrity.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.playintegrity */
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
+ /** Private Service: https://www.googleapis.com/auth/playintegrity */
19
+ 'https://www.googleapis.com/auth/playintegrity',
20
+ ];
21
+ const immediate = false;
22
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
23
+ if (authResult && !authResult.error) {
24
+ /** handle successful authorization */
25
+ run();
26
+ } else {
27
+ /** handle authorization error */
28
+ }
29
+ });
30
+
31
+ async function run() {
32
+ /** Decodes the integrity token and returns the token payload. */
33
+ await gapi.client.playintegrity.v1.decodeIntegrityToken({
34
+ packageName: "Test string",
35
+ }, {
36
+ integrityToken: "Test string",
37
+ });
38
+ }
39
+ });
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
+ }