1+ /* eslint-disable class-methods-use-this */
12// Copyright (c) Microsoft Corporation. All rights reserved.
23// Licensed under the MIT License.
34
@@ -7,6 +8,7 @@ import { inject, injectable } from 'inversify';
78import * as path from 'path' ;
89import { clearTimeout , setTimeout } from 'timers' ;
910import { TextDocument } from 'vscode' ;
11+ import { createHash } from 'crypto' ;
1012import { sendTelemetryEvent } from '.' ;
1113import { IExtensionSingleActivationService } from '../activation/types' ;
1214import { IDocumentManager } from '../common/application/types' ;
@@ -53,9 +55,6 @@ export class ImportTracker implements IExtensionSingleActivationService {
5355
5456 private static sentMatches : Set < string > = new Set < string > ( ) ;
5557
56- // eslint-disable-next-line global-require
57- private hashFn = require ( 'hash.js' ) . sha256 ;
58-
5958 constructor (
6059 @inject ( IDocumentManager ) private documentManager : IDocumentManager ,
6160 @inject ( IDisposableRegistry ) private disposables : IDisposableRegistry ,
@@ -120,7 +119,7 @@ export class ImportTracker implements IExtensionSingleActivationService {
120119 ImportTracker . sentMatches . add ( packageName ) ;
121120 // Hash the package name so that we will never accidentally see a
122121 // user's private package name.
123- const hash = this . hashFn ( ) . update ( packageName ) . digest ( 'hex' ) ;
122+ const hash = createHash ( 'sha256' ) . update ( packageName ) . digest ( 'hex' ) ;
124123 sendTelemetryEvent ( EventName . HASHED_PACKAGE_NAME , undefined , { hashedName : hash } ) ;
125124 }
126125
0 commit comments