Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/credential-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import fs = require('fs');
import { createPrivateKey } from 'crypto';
import { createPrivateKey } from 'node:crypto';

import { Credentials as GoogleAuthCredentials, GoogleAuth, Compute, AnyAuthClient } from 'google-auth-library'
import { Agent } from 'http';
Expand Down
2 changes: 1 addition & 1 deletion src/remote-config/condition-evaluator-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
CustomSignalCondition,
CustomSignalOperator,
} from './remote-config-api';
import { createHash } from 'crypto';
import { createHash } from 'node:crypto';


/**
Expand Down
2 changes: 1 addition & 1 deletion src/utils/crypto-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class ServiceAccountSigner implements CryptoSigner {
* @inheritDoc
*/
public sign(buffer: Buffer): Promise<Buffer> {
const crypto = require('crypto'); // eslint-disable-line @typescript-eslint/no-var-requires
const crypto = require('node:crypto'); // eslint-disable-line @typescript-eslint/no-var-requires
const sign = crypto.createSign('RSA-SHA256');
sign.update(buffer);
return Promise.resolve(sign.sign(this.credential.privateKey));
Expand Down
2 changes: 1 addition & 1 deletion test/integration/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as url from 'url';
import * as crypto from 'crypto';
import * as crypto from 'node:crypto';
import * as bcrypt from 'bcrypt';
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/remote-config/condition-evaluator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from '../../../src/remote-config/remote-config-api';
import { v4 as uuidv4 } from 'uuid';
import { clone } from 'lodash';
import * as crypto from 'crypto';
import * as crypto from 'node:crypto';

const expect = chai.expect;

Expand Down
8 changes: 4 additions & 4 deletions test/unit/utils/crypto-signer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('CryptoSigner', () => {
const cert = new ServiceAccountCredential(mocks.certificateObject);

// eslint-disable-next-line @typescript-eslint/no-var-requires
const crypto = require('crypto');
const crypto = require('node:crypto');
const rsa = crypto.createSign('RSA-SHA256');
rsa.update(payload);
const result = rsa.sign(cert.privateKey, 'base64');
Expand Down Expand Up @@ -104,8 +104,8 @@ describe('CryptoSigner', () => {
const signRequest = {
method: 'POST',
url: 'https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/foo@project_id.iam.gserviceaccount.com:signBlob',
headers: {
Authorization: `Bearer ${mockAccessToken}`,
headers: {
Authorization: `Bearer ${mockAccessToken}`,
'X-Goog-Api-Client': getMetricsHeader()
},
data: { payload: input.toString('base64') },
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('CryptoSigner', () => {
const signRequest = {
method: 'POST',
url: 'https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/discovered-service-account:signBlob',
headers: {
headers: {
Authorization: `Bearer ${mockAccessToken}`,
'X-Goog-Api-Client': getMetricsHeader()
},
Expand Down
Loading