Skip to content

Commit a511e56

Browse files
renovate-botd-goog
andauthored
chore(deps): update dependency gts to v6 (#1886)
* chore(deps): update dependency gts to v6 * style: lint fix * chore: update config * chore: lint * chore: clean-up * style: lint * chore: clean-up internal --------- Co-authored-by: Daniel Bankhead <[email protected]>
1 parent f23e807 commit a511e56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+970
-1017
lines changed

Diff for: browser-test/test.crypto.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import * as base64js from 'base64-js';
16-
import {assert} from 'chai';
16+
import {strict as assert} from 'assert';
1717
import {createCrypto, fromArrayBufferToHex} from '../src/crypto/crypto';
1818
import {BrowserCrypto} from '../src/crypto/browser/crypto';
1919
import {privateKey, publicKey} from './fixtures/keys';
@@ -112,8 +112,8 @@ describe('Browser crypto tests', () => {
112112
'f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8';
113113
const expectedHash = new Uint8Array(
114114
(expectedHexHash.match(/.{1,2}/g) as string[]).map(byte =>
115-
parseInt(byte, 16)
116-
)
115+
parseInt(byte, 16),
116+
),
117117
);
118118

119119
const calculatedHash = await crypto.signWithHmacSha256(key, message);
@@ -129,8 +129,8 @@ describe('Browser crypto tests', () => {
129129
'f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8';
130130
const expectedHash = new Uint8Array(
131131
(expectedHexHash.match(/.{1,2}/g) as string[]).map(byte =>
132-
parseInt(byte, 16)
133-
)
132+
parseInt(byte, 16),
133+
),
134134
);
135135

136136
const calculatedHash = await crypto.signWithHmacSha256(key, message);

Diff for: browser-test/test.oauth2.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import * as base64js from 'base64-js';
16-
import {assert} from 'chai';
16+
import {strict as assert} from 'assert';
1717
import * as sinon from 'sinon';
1818
import {privateKey, publicKey} from './fixtures/keys';
1919
import {it, describe, beforeEach} from 'mocha';
@@ -89,8 +89,8 @@ describe('Browser OAuth2 tests', () => {
8989
client.transporter.request = stub;
9090
const response = await client.getToken('code here');
9191
const tokens = response.tokens;
92-
assert.isAbove(tokens!.expiry_date!, now + 10 * 1000);
93-
assert.isBelow(tokens!.expiry_date!, now + 15 * 1000);
92+
assert(tokens!.expiry_date! > now + 10 * 1000);
93+
assert(tokens!.expiry_date! < now + 15 * 1000);
9494
});
9595

9696
it('getFederatedSignonCerts talks to correct endpoint', async () => {
@@ -135,7 +135,7 @@ describe('Browser OAuth2 tests', () => {
135135
assert.strictEqual(params.get('code_challenge'), codes.codeChallenge);
136136
assert.strictEqual(
137137
params.get('code_challenge_method'),
138-
CodeChallengeMethod.S256
138+
CodeChallengeMethod.S256,
139139
);
140140
});
141141

@@ -167,25 +167,23 @@ describe('Browser OAuth2 tests', () => {
167167
name: 'RSASSA-PKCS1-v1_5',
168168
hash: {name: 'SHA-256'},
169169
};
170-
// eslint-disable-next-line no-undef
171170
const cryptoKey = await window.crypto.subtle.importKey(
172171
'jwk',
173172
privateKey,
174173
algo,
175174
true,
176-
['sign']
175+
['sign'],
177176
);
178-
// eslint-disable-next-line no-undef
179177
const signature = await window.crypto.subtle.sign(
180178
algo,
181179
cryptoKey,
182-
new TextEncoder().encode(data)
180+
new TextEncoder().encode(data),
183181
);
184182
data += '.' + base64js.fromByteArray(new Uint8Array(signature));
185183
const login = await client.verifySignedJwtWithCertsAsync(
186184
data,
187185
{keyid: publicKey},
188-
'testaudience'
186+
'testaudience',
189187
);
190188
assert.strictEqual(login.getUserId(), '123456789');
191189
});

Diff for: package.json

+6-8
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,17 @@
2626
},
2727
"devDependencies": {
2828
"@types/base64-js": "^1.2.5",
29-
"@types/chai": "^4.1.7",
3029
"@types/jws": "^3.1.0",
31-
"@types/mocha": "^9.0.0",
30+
"@types/mocha": "^10.0.10",
3231
"@types/mv": "^2.1.0",
3332
"@types/ncp": "^2.0.1",
3433
"@types/node": "^22.0.0",
3534
"@types/sinon": "^17.0.0",
3635
"assert-rejects": "^1.0.0",
3736
"c8": "^10.0.0",
38-
"chai": "^4.2.0",
3937
"codecov": "^3.0.2",
40-
"gts": "^5.0.0",
41-
"is-docker": "^2.0.0",
38+
"gts": "^6.0.0",
39+
"is-docker": "^3.0.0",
4240
"jsdoc": "^4.0.0",
4341
"jsdoc-fresh": "^3.0.0",
4442
"jsdoc-region-tag": "^3.0.0",
@@ -48,16 +46,16 @@
4846
"karma-firefox-launcher": "^2.0.0",
4947
"karma-mocha": "^2.0.0",
5048
"karma-sourcemap-loader": "^0.4.0",
51-
"karma-webpack": "5.0.0",
49+
"karma-webpack": "^5.0.1",
5250
"keypair": "^1.0.4",
5351
"linkinator": "^6.1.2",
54-
"mocha": "^9.2.2",
52+
"mocha": "^11.1.0",
5553
"mv": "^2.1.1",
5654
"ncp": "^2.0.0",
5755
"nock": "^14.0.1",
5856
"null-loader": "^4.0.0",
5957
"puppeteer": "^24.0.0",
60-
"sinon": "^18.0.0",
58+
"sinon": "^18.0.1",
6159
"ts-loader": "^8.0.0",
6260
"typescript": "^5.1.6",
6361
"webpack": "^5.21.2",

Diff for: samples/authenticateAPIKey.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function main() {
4343

4444
console.log(`Text: ${text}`);
4545
console.log(
46-
`Sentiment: ${response.documentSentiment.score}, ${response.documentSentiment.magnitude}`
46+
`Sentiment: ${response.documentSentiment.score}, ${response.documentSentiment.magnitude}`,
4747
);
4848
console.log('Successfully authenticated using the API key');
4949
}

Diff for: samples/idtokens-iap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
function main(
2222
url = 'https://some.iap.url',
23-
targetAudience = 'IAP_CLIENT_ID.apps.googleusercontent.com'
23+
targetAudience = 'IAP_CLIENT_ID.apps.googleusercontent.com',
2424
) {
2525
// [START iap_make_request]
2626
/**

Diff for: samples/idtokens-serverless.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
function main(
2222
url = 'https://service-1234-uc.a.run.app',
23-
targetAudience = null
23+
targetAudience = null,
2424
) {
2525
if (!targetAudience) {
2626
// Use the target service's hostname as the target audience for requests.

Diff for: samples/jwt.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const fs = require('fs');
2929

3030
async function main(
3131
// Full path to the service account credential
32-
keyFile = process.env.GOOGLE_APPLICATION_CREDENTIALS
32+
keyFile = process.env.GOOGLE_APPLICATION_CREDENTIALS,
3333
) {
3434
const keys = JSON.parse(fs.readFileSync(keyFile, 'utf8'));
3535
const client = new JWT({

Diff for: samples/keyfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const {GoogleAuth} = require('google-auth-library');
2424
*/
2525
async function main(
2626
// Full path to the service account credential
27-
keyFile = process.env.GOOGLE_APPLICATION_CREDENTIALS
27+
keyFile = process.env.GOOGLE_APPLICATION_CREDENTIALS,
2828
) {
2929
const auth = new GoogleAuth({
3030
keyFile: keyFile,

Diff for: samples/oauth2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function main() {
4040
// After acquiring an access_token, you may want to check on the audience, expiration,
4141
// or original scopes requested. You can do that with the `getTokenInfo` method.
4242
const tokenInfo = await oAuth2Client.getTokenInfo(
43-
oAuth2Client.credentials.access_token
43+
oAuth2Client.credentials.access_token,
4444
);
4545
console.log(tokenInfo);
4646
}

Diff for: samples/scripts/downscoping-with-cab-setup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function generateRandomString(length) {
5757
const allowedChars = 'abcdefghijklmnopqrstuvwxyz0123456789';
5858
for (let i = 0; i < length; i++) {
5959
chars.push(
60-
allowedChars.charAt(Math.floor(Math.random() * allowedChars.length))
60+
allowedChars.charAt(Math.floor(Math.random() * allowedChars.length)),
6161
);
6262
}
6363
return chars.join('');

Diff for: samples/scripts/externalclient-setup.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function generateRandomString(length) {
101101
const allowedChars = 'abcdefghijklmnopqrstuvwxyz0123456789';
102102
for (let i = 0; i < length; i++) {
103103
chars.push(
104-
allowedChars.charAt(Math.floor(Math.random() * allowedChars.length))
104+
allowedChars.charAt(Math.floor(Math.random() * allowedChars.length)),
105105
);
106106
}
107107
return chars.join('');
@@ -276,12 +276,12 @@ const config = {
276276
main(config)
277277
.then(audiences => {
278278
console.log(
279-
'The following constants need to be set in test/externalclient.test.js'
279+
'The following constants need to be set in test/externalclient.test.js',
280280
);
281281
console.log(`AUDIENCE_OIDC='${audiences.oidcAudience}'`);
282282
console.log(`AUDIENCE_AWS='${audiences.awsAudience}'`);
283283
console.log(
284-
`AWS_ROLE_ARN='arn:aws:iam::${config.awsAccountId}:role/${config.awsRoleName}'`
284+
`AWS_ROLE_ARN='arn:aws:iam::${config.awsAccountId}:role/${config.awsRoleName}'`,
285285
);
286286
})
287287
.catch(console.error);

Diff for: samples/test/auth.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ describe('auth samples', () => {
4040
const projectId = await auth.getProjectId();
4141

4242
const output = execSync(
43-
`node authenticateImplicitWithAdc ${projectId} ${ZONE}`
43+
`node authenticateImplicitWithAdc ${projectId} ${ZONE}`,
4444
);
4545

4646
assert.match(output, /Listed all storage buckets./);
4747
});
4848

4949
it('should get id token from metadata server', async () => {
5050
const output = execSync(
51-
'node idTokenFromMetadataServer https://www.google.com'
51+
'node idTokenFromMetadataServer https://www.google.com',
5252
);
5353

5454
assert.match(output, /Generated ID token./);
5555
});
5656

5757
it('should get id token from service account', async () => {
5858
const output = execSync(
59-
`node idTokenFromServiceAccount ${TARGET_AUDIENCE} ${keyFile}`
59+
`node idTokenFromServiceAccount ${TARGET_AUDIENCE} ${keyFile}`,
6060
);
6161

6262
assert.match(output, /Generated ID token./);
@@ -69,7 +69,7 @@ describe('auth samples', () => {
6969
const idToken = await client.fetchIdToken(TARGET_AUDIENCE);
7070

7171
const output = execSync(
72-
`node verifyGoogleIdToken ${idToken} ${TARGET_AUDIENCE} https://www.googleapis.com/oauth2/v3/certs`
72+
`node verifyGoogleIdToken ${idToken} ${TARGET_AUDIENCE} https://www.googleapis.com/oauth2/v3/certs`,
7373
);
7474

7575
assert.match(output, /ID token verified./);

Diff for: samples/test/externalclient.test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const assumeRoleWithWebIdentity = async (
146146
auth,
147147
aud,
148148
clientEmail,
149-
awsRoleArn
149+
awsRoleArn,
150150
) => {
151151
// API documented at:
152152
// https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html
@@ -186,7 +186,7 @@ const generateRandomString = length => {
186186
const allowedChars = 'abcdefghijklmnopqrstuvwxyz0123456789';
187187
while (length > 0) {
188188
chars.push(
189-
allowedChars.charAt(Math.floor(Math.random() * allowedChars.length))
189+
allowedChars.charAt(Math.floor(Math.random() * allowedChars.length)),
190190
);
191191
length--;
192192
}
@@ -242,7 +242,7 @@ describe('samples for external-account', () => {
242242
auth,
243243
clientId,
244244
clientEmail,
245-
AWS_ROLE_ARN
245+
AWS_ROLE_ARN,
246246
);
247247
});
248248

@@ -361,15 +361,15 @@ describe('samples for external-account', () => {
361361
res.end(
362362
JSON.stringify({
363363
access_token: oidcToken,
364-
})
364+
}),
365365
);
366366
} else {
367367
res.setHeader('content-type', 'application/json');
368368
res.writeHead(400);
369369
res.end(
370370
JSON.stringify({
371371
error: 'missing-header',
372-
})
372+
}),
373373
);
374374
}
375375
} else {
@@ -506,7 +506,7 @@ describe('samples for external-account', () => {
506506
const actualExpireTime = new Date(token.res.data.expireTime).getTime();
507507

508508
assert.isTrue(
509-
minExpireTime <= actualExpireTime && actualExpireTime <= maxExpireTime
509+
minExpireTime <= actualExpireTime && actualExpireTime <= maxExpireTime,
510510
);
511511
});
512512
});

Diff for: samples/verifyIdToken-iap.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function main(
2828
iapJwt,
2929
projectNumber = '',
3030
projectId = '',
31-
backendServiceId = ''
31+
backendServiceId = '',
3232
) {
3333
// [START iap_validate_jwt]
3434
/**
@@ -54,7 +54,7 @@ function main(
5454
iapJwt,
5555
response.pubkeys,
5656
expectedAudience,
57-
['https://cloud.google.com/iap']
57+
['https://cloud.google.com/iap'],
5858
);
5959
// Print out the info contained in the IAP ID token
6060
console.log(ticket);
@@ -65,7 +65,7 @@ function main(
6565
// [END iap_validate_jwt]
6666
if (!expectedAudience) {
6767
console.log(
68-
'Audience not verified! Supply a projectNumber and projectID to verify'
68+
'Audience not verified! Supply a projectNumber and projectID to verify',
6969
);
7070
}
7171
}

Diff for: src/auth/authclient.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export abstract class AuthClient
227227

228228
if (options.get('useAuthRequestParameters') !== false) {
229229
this.transporter.interceptors.request.add(
230-
AuthClient.DEFAULT_REQUEST_INTERCEPTOR
230+
AuthClient.DEFAULT_REQUEST_INTERCEPTOR,
231231
);
232232
}
233233

@@ -306,7 +306,7 @@ export abstract class AuthClient
306306
*/
307307
protected addUserProjectAndAuthHeaders<T extends Headers>(
308308
target: T,
309-
source: Headers
309+
source: Headers,
310310
): T {
311311
const xGoogUserProject = source.get('x-goog-user-project');
312312
const authorizationHeader = source.get('authorization');

0 commit comments

Comments
 (0)