From 1e434a18e2274f0b8eac6be7d10d62ce1b82edd0 Mon Sep 17 00:00:00 2001 From: sidmohanty11 Date: Sat, 9 Jul 2022 17:50:48 +0530 Subject: [PATCH] using inbuilt crypto instead of js-sha256 --- lib/drivers/ddp.ts | 4 ++-- package.json | 1 - types/index.d.ts | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/drivers/ddp.ts b/lib/drivers/ddp.ts index 02703a0..0408957 100644 --- a/lib/drivers/ddp.ts +++ b/lib/drivers/ddp.ts @@ -38,7 +38,7 @@ import { } from '../../interfaces' import { hostToWS } from '../util' -import { sha256 } from 'js-sha256' +import crypto from 'crypto' const userDisconnectCloseCode = 4000; @@ -328,7 +328,7 @@ export class Socket extends EventEmitter { const params: ICredentialsPass = { user: { username: credentials.username }, password: { - digest: sha256(credentials.password), + digest: crypto.createHash('sha256').update(credentials.password).digest('hex'), algorithm: 'sha-256' } } diff --git a/package.json b/package.json index aba8006..4777726 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,6 @@ "webpack-cli": "^3.1.0" }, "dependencies": { - "js-sha256": "^0.9.0", "lru-cache": "^4.1.1", "mem": "^4.0.0", "tiny-events": "^1.0.1", diff --git a/types/index.d.ts b/types/index.d.ts index 8d75cc2..cc0fccc 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -3,9 +3,6 @@ declare module 'paho-mqtt' declare module 'paho-mqtt/src/paho-mqtt' declare module 'msgpack-lite' declare module 'mem' -declare module 'js-sha256' { - export function sha256( data:string) : string -} declare namespace NodeJS { interface Global {