@maxim_mazurok/gapi.client.verifiedaccess-v1 0.0.20220519

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,175 @@
1
+ /* Type definitions for non-npm package Chrome Verified Access API v1 0.0 */
2
+ // Project: https://developers.google.com/chrome/verified-access
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://verifiedaccess.googleapis.com/$discovery/rest?version=v1
13
+ // Revision: 20220519
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load Chrome Verified Access API v1 */
19
+ function load(urlOrObject: "https://verifiedaccess.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "verifiedaccess", version: "v1"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "verifiedaccess", version: "v1", callback: () => any): void;
24
+
25
+ namespace verifiedaccess {
26
+ interface Challenge {
27
+ /** Challenge generated with the old signing key (this will only be present during key rotation) */
28
+ alternativeChallenge?: SignedData;
29
+ /** Generated challenge */
30
+ challenge?: SignedData;
31
+ }
32
+ // tslint:disable-next-line:no-empty-interface
33
+ interface Empty {
34
+ }
35
+ interface SignedData {
36
+ /** The data to be signed. */
37
+ data?: string;
38
+ /** The signature of the data field. */
39
+ signature?: string;
40
+ }
41
+ interface VerifyChallengeResponseRequest {
42
+ /** The generated response to the challenge */
43
+ challengeResponse?: SignedData;
44
+ /**
45
+ * Service can optionally provide identity information about the device or user associated with the key. For an EMK, this value is the enrolled domain. For an EUK, this value is the
46
+ * user's email address. If present, this value will be checked against contents of the response, and verification will fail if there is no match.
47
+ */
48
+ expectedIdentity?: string;
49
+ }
50
+ interface VerifyChallengeResponseResult {
51
+ /** Device enrollment id is returned in this field (for the machine response only). */
52
+ deviceEnrollmentId?: string;
53
+ /** Device permanent id is returned in this field (for the machine response only). */
54
+ devicePermanentId?: string;
55
+ /**
56
+ * Certificate Signing Request (in the SPKAC format, base64 encoded) is returned in this field. This field will be set only if device has included CSR in its challenge response. (the
57
+ * option to include CSR is now available for both user and machine responses)
58
+ */
59
+ signedPublicKeyAndChallenge?: string;
60
+ /**
61
+ * For EMCert check, device permanent id is returned here. For EUCert check, signed_public_key_and_challenge [base64 encoded] is returned if present, otherwise empty string is
62
+ * returned. This field is deprecated, please use device_permanent_id or signed_public_key_and_challenge fields.
63
+ */
64
+ verificationOutput?: string;
65
+ }
66
+ interface ChallengeResource {
67
+ /** CreateChallenge API */
68
+ create(request: {
69
+ /** V1 error format. */
70
+ "$.xgafv"?: string;
71
+ /** OAuth access token. */
72
+ access_token?: string;
73
+ /** Data format for response. */
74
+ alt?: string;
75
+ /** JSONP */
76
+ callback?: string;
77
+ /** Selector specifying which fields to include in a partial response. */
78
+ fields?: string;
79
+ /** 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. */
80
+ key?: string;
81
+ /** OAuth 2.0 token for the current user. */
82
+ oauth_token?: string;
83
+ /** Returns response with indentations and line breaks. */
84
+ prettyPrint?: boolean;
85
+ /** 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. */
86
+ quotaUser?: string;
87
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
88
+ upload_protocol?: string;
89
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
90
+ uploadType?: string;
91
+ /** Request body */
92
+ resource: Empty;
93
+ }): Request<Challenge>;
94
+ create(request: {
95
+ /** V1 error format. */
96
+ "$.xgafv"?: string;
97
+ /** OAuth access token. */
98
+ access_token?: string;
99
+ /** Data format for response. */
100
+ alt?: string;
101
+ /** JSONP */
102
+ callback?: string;
103
+ /** Selector specifying which fields to include in a partial response. */
104
+ fields?: string;
105
+ /** 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. */
106
+ key?: string;
107
+ /** OAuth 2.0 token for the current user. */
108
+ oauth_token?: string;
109
+ /** Returns response with indentations and line breaks. */
110
+ prettyPrint?: boolean;
111
+ /** 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. */
112
+ quotaUser?: string;
113
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
114
+ upload_protocol?: string;
115
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
116
+ uploadType?: string;
117
+ },
118
+ body: Empty): Request<Challenge>;
119
+ /** VerifyChallengeResponse API */
120
+ verify(request: {
121
+ /** V1 error format. */
122
+ "$.xgafv"?: string;
123
+ /** OAuth access token. */
124
+ access_token?: string;
125
+ /** Data format for response. */
126
+ alt?: string;
127
+ /** JSONP */
128
+ callback?: string;
129
+ /** Selector specifying which fields to include in a partial response. */
130
+ fields?: string;
131
+ /** 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. */
132
+ key?: string;
133
+ /** OAuth 2.0 token for the current user. */
134
+ oauth_token?: string;
135
+ /** Returns response with indentations and line breaks. */
136
+ prettyPrint?: boolean;
137
+ /** 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. */
138
+ quotaUser?: string;
139
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
140
+ upload_protocol?: string;
141
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
142
+ uploadType?: string;
143
+ /** Request body */
144
+ resource: VerifyChallengeResponseRequest;
145
+ }): Request<VerifyChallengeResponseResult>;
146
+ verify(request: {
147
+ /** V1 error format. */
148
+ "$.xgafv"?: string;
149
+ /** OAuth access token. */
150
+ access_token?: string;
151
+ /** Data format for response. */
152
+ alt?: string;
153
+ /** JSONP */
154
+ callback?: string;
155
+ /** Selector specifying which fields to include in a partial response. */
156
+ fields?: string;
157
+ /** 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. */
158
+ key?: string;
159
+ /** OAuth 2.0 token for the current user. */
160
+ oauth_token?: string;
161
+ /** Returns response with indentations and line breaks. */
162
+ prettyPrint?: boolean;
163
+ /** 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. */
164
+ quotaUser?: string;
165
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
166
+ upload_protocol?: string;
167
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
168
+ uploadType?: string;
169
+ },
170
+ body: VerifyChallengeResponseRequest): Request<VerifyChallengeResponseResult>;
171
+ }
172
+
173
+ const challenge: ChallengeResource;
174
+ }
175
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.verifiedaccess-v1",
3
+ "version": "0.0.20220519",
4
+ "description": "TypeScript typings for Chrome Verified Access 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,78 @@
1
+ # TypeScript typings for Chrome Verified Access API v1
2
+
3
+ API for Verified Access chrome extension to provide credential verification for chrome devices connecting to an enterprise network
4
+ For detailed description please check [documentation](https://developers.google.com/chrome/verified-access).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Chrome Verified Access API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.verifiedaccess-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://verifiedaccess.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.verifiedaccess
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('verifiedaccess', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.verifiedaccess
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
+ // Verify your enterprise credentials
49
+ 'https://www.googleapis.com/auth/verifiedaccess',
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 Chrome Verified Access API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+
69
+ /*
70
+ CreateChallenge API
71
+ */
72
+ await gapi.client.verifiedaccess.challenge.create({ });
73
+
74
+ /*
75
+ VerifyChallengeResponse API
76
+ */
77
+ await gapi.client.verifiedaccess.challenge.verify({ });
78
+ ```
package/tests.ts ADDED
@@ -0,0 +1,46 @@
1
+ /* This is stub file for gapi.client.verifiedaccess-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: 20220519
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://verifiedaccess.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.verifiedaccess */
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
+ /** Verify your enterprise credentials */
19
+ 'https://www.googleapis.com/auth/verifiedaccess',
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
+ /** CreateChallenge API */
33
+ await gapi.client.verifiedaccess.challenge.create({
34
+ }, {
35
+ });
36
+ /** VerifyChallengeResponse API */
37
+ await gapi.client.verifiedaccess.challenge.verify({
38
+ }, {
39
+ challengeResponse: {
40
+ data: "Test string",
41
+ signature: "Test string",
42
+ },
43
+ expectedIdentity: "Test string",
44
+ });
45
+ }
46
+ });
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
+ }