Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Using inbuilt crypto instead of js-sha256 #155

Open
wants to merge 1 commit into
base: mobile
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions lib/drivers/ddp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
} from '../../interfaces'

import { hostToWS } from '../util'
import { sha256 } from 'js-sha256'
import crypto from 'crypto'

const userDisconnectCloseCode = 4000;

Expand Down Expand Up @@ -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'
}
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down