1
0
Fork 0

various additions

refactor/models
Matthew 2020-05-17 06:48:08 -04:00
parent 02a9526752
commit 15ea1efe12
No known key found for this signature in database
GPG Key ID: D499B75C1390E321
1 changed files with 2 additions and 0 deletions

View File

@ -29,6 +29,7 @@ export default class CSCLI {
} }
public async handle(socket: net.Socket, data: Buffer) { public async handle(socket: net.Socket, data: Buffer) {
console.log(data.toString().trim());
const args = data.toString().trim().split('$'); const args = data.toString().trim().split('$');
const verification = this.verifyConnection(args[1], args[0]); const verification = this.verifyConnection(args[1], args[0]);
if (!verification) { if (!verification) {
@ -62,6 +63,7 @@ export default class CSCLI {
const hmac = crypto.createHmac('sha256', this.#hmac); const hmac = crypto.createHmac('sha256', this.#hmac);
hmac.update(data); hmac.update(data);
const computed = hmac.digest('hex'); const computed = hmac.digest('hex');
console.log(computed);
if (computed === key) return true; if (computed === key) return true;
return false; return false;
} }