2.0.x fixes

This commit is contained in:
2025-02-13 11:55:03 -06:00
parent f0a6db2266
commit a4c7e699e1
12 changed files with 108 additions and 334 deletions

View File

@@ -1,6 +1,6 @@
import { randomBytes } from 'crypto';
import { Int64BE, Uint64BE } from 'int64-buffer';
import crypto from 'crypto';
import blake2 from 'blake2';
import { TextEncoder } from 'text-encoding';
import { getCustomEncryption } from '../utils/constants';
import {
@@ -156,7 +156,7 @@ export default class packet {
decrypt = async () => {
try {
let hash = crypto.createHash('sha256');
let hash = blake2.createHash('blake2b', { digestLength: 32 });
hash = hash.update(new TextEncoder().encode(this.token));
const key = Uint8Array.from(hash.digest());
@@ -282,7 +282,7 @@ export default class packet {
encrypt = async (nonce) => {
try {
let hash = crypto.createHash('sha256');
let hash = blake2.createHash('blake2b', { digestLength: 32 });
hash = hash.update(new TextEncoder().encode(this.token));
const key = Uint8Array.from(hash.digest());