Skip to content

Commit 6986cc7

Browse files
authored
Merge branch 'main' into yp-add-fid-arg
2 parents ec3fdc4 + 67d6d82 commit 6986cc7

8 files changed

Lines changed: 14 additions & 17 deletions

File tree

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@
221221
"fast-deep-equal": "^3.1.1",
222222
"google-auth-library": "^10.6.1",
223223
"jsonwebtoken": "^9.0.0",
224-
"jwks-rsa": "^3.1.0",
225-
"uuid": "^11.0.2"
224+
"jwks-rsa": "^3.1.0"
226225
},
227226
"optionalDependencies": {
228227
"@google-cloud/firestore": "^7.11.0",
@@ -248,7 +247,6 @@
248247
"@types/request-promise": "^4.1.41",
249248
"@types/sinon": "^17.0.2",
250249
"@types/sinon-chai": "^3.0.0",
251-
"@types/uuid": "^10.0.0",
252250
"@typescript-eslint/eslint-plugin": "^8.56.0",
253251
"@typescript-eslint/parser": "^8.56.0",
254252
"bcrypt": "^6.0.0",
@@ -281,4 +279,4 @@
281279
"typescript": "^5.7.3",
282280
"yargs": "^17.0.1"
283281
}
284-
}
282+
}

src/app/credential-internal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
import fs = require('fs');
19-
import { createPrivateKey } from 'crypto';
19+
import { createPrivateKey } from 'node:crypto';
2020

2121
import { Credentials as GoogleAuthCredentials, GoogleAuth, Compute, AnyAuthClient } from 'google-auth-library'
2222
import { Agent } from 'http';

src/eventarc/eventarc-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import { PrefixedFirebaseError } from '../utils/error';
1919
import { CloudEvent } from './cloudevent';
20-
import { v4 as uuid } from 'uuid';
2120
import * as validator from '../utils/validator';
21+
import { randomUUID } from 'node:crypto';
2222

2323
// List of CloudEvent properties that are handled "by hand" and should be skipped by
2424
// automatic attribute copy.
@@ -50,7 +50,7 @@ export function toCloudEventProtoFormat(ce: CloudEvent): any {
5050
}
5151
const out: Record<string, any> = {
5252
'@type': 'type.googleapis.com/io.cloudevents.v1.CloudEvent',
53-
'id': ce.id ?? uuid(),
53+
'id': ce.id ?? randomUUID(),
5454
'type': ce.type,
5555
'specVersion': ce.specversion ?? '1.0',
5656
'source': source

src/remote-config/condition-evaluator-internal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
CustomSignalCondition,
2828
CustomSignalOperator,
2929
} from './remote-config-api';
30-
import { createHash } from 'crypto';
30+
import { createHash } from 'node:crypto';
3131

3232

3333
/**

src/utils/crypto-signer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class ServiceAccountSigner implements CryptoSigner {
7979
* @inheritDoc
8080
*/
8181
public sign(buffer: Buffer): Promise<Buffer> {
82-
const crypto = require('crypto'); // eslint-disable-line @typescript-eslint/no-var-requires
82+
const crypto = require('node:crypto'); // eslint-disable-line @typescript-eslint/no-var-requires
8383
const sign = crypto.createSign('RSA-SHA256');
8484
sign.update(buffer);
8585
return Promise.resolve(sign.sign(this.credential.privateKey));

test/integration/auth.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import * as url from 'url';
18-
import * as crypto from 'crypto';
18+
import * as crypto from 'node:crypto';
1919
import * as bcrypt from 'bcrypt';
2020
import * as chai from 'chai';
2121
import * as chaiAsPromised from 'chai-as-promised';

test/unit/remote-config/condition-evaluator.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ import {
2626
NamedCondition,
2727
OneOfCondition,
2828
} from '../../../src/remote-config/remote-config-api';
29-
import { v4 as uuidv4 } from 'uuid';
3029
import { clone } from 'lodash';
31-
import * as crypto from 'crypto';
30+
import * as crypto from 'node:crypto';
3231

3332
const expect = chai.expect;
3433

@@ -907,7 +906,7 @@ describe('ConditionEvaluator', () => {
907906
...clone(condition),
908907
seed: 'seed'
909908
};
910-
const context = { randomizationId: uuidv4() }
909+
const context = { randomizationId: crypto.randomUUID() }
911910
if (conditionEvaluator.evaluateConditions([{
912911
name: 'is_enabled',
913912
condition: { percent: clonedCondition }

test/unit/utils/crypto-signer.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('CryptoSigner', () => {
5757
const cert = new ServiceAccountCredential(mocks.certificateObject);
5858

5959
// eslint-disable-next-line @typescript-eslint/no-var-requires
60-
const crypto = require('crypto');
60+
const crypto = require('node:crypto');
6161
const rsa = crypto.createSign('RSA-SHA256');
6262
rsa.update(payload);
6363
const result = rsa.sign(cert.privateKey, 'base64');
@@ -104,8 +104,8 @@ describe('CryptoSigner', () => {
104104
const signRequest = {
105105
method: 'POST',
106106
url: 'https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/foo@project_id.iam.gserviceaccount.com:signBlob',
107-
headers: {
108-
Authorization: `Bearer ${mockAccessToken}`,
107+
headers: {
108+
Authorization: `Bearer ${mockAccessToken}`,
109109
'X-Goog-Api-Client': getMetricsHeader()
110110
},
111111
data: { payload: input.toString('base64') },
@@ -162,7 +162,7 @@ describe('CryptoSigner', () => {
162162
const signRequest = {
163163
method: 'POST',
164164
url: 'https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/discovered-service-account:signBlob',
165-
headers: {
165+
headers: {
166166
Authorization: `Bearer ${mockAccessToken}`,
167167
'X-Goog-Api-Client': getMetricsHeader()
168168
},

0 commit comments

Comments
 (0)