project: Move to ESM Modules

This commit is contained in:
Rajeh Taher
2025-07-17 13:54:17 +03:00
parent 19124426b2
commit 787aed88b8
69 changed files with 5143 additions and 4757 deletions
+9 -8
View File
@@ -1,10 +1,11 @@
import { Boom } from '@hapi/boom'
import { proto } from '../../WAProto'
import { NOISE_MODE, WA_CERT_DETAILS } from '../Defaults'
import { KeyPair } from '../Types'
import { BinaryNode, decodeBinaryNode } from '../WABinary'
import type { KeyPair } from '../Types'
import type { BinaryNode } from '../WABinary'
import { decodeBinaryNode } from '../WABinary'
import { aesDecryptGCM, aesEncryptGCM, Curve, hkdf, sha256 } from './crypto'
import { ILogger } from './logger'
import type { ILogger } from './logger'
const generateIV = (counter: number) => {
const iv = new ArrayBuffer(12)
@@ -64,17 +65,17 @@ export const makeNoiseHandler = ({
const mixIntoKey = async (data: Uint8Array) => {
const [write, read] = await localHKDF(data)
salt = write
encKey = read
decKey = read
salt = write!
encKey = read!
decKey = read!
readCounter = 0
writeCounter = 0
}
const finishInit = async () => {
const [write, read] = await localHKDF(new Uint8Array(0))
encKey = write
decKey = read
encKey = write!
decKey = read!
hash = Buffer.from([])
readCounter = 0
writeCounter = 0