mobile: deprecation.

This commit is contained in:
Rajeh Taher
2024-10-14 03:39:46 +03:00
parent 647f8d767f
commit 61a0ff3178
18 changed files with 47 additions and 533 deletions

View File

@@ -16,13 +16,11 @@ const generateIV = (counter: number) => {
export const makeNoiseHandler = ({
keyPair: { private: privateKey, public: publicKey },
NOISE_HEADER,
mobile,
logger,
routingInfo
}: {
keyPair: KeyPair
NOISE_HEADER: Uint8Array
mobile: boolean
logger: Logger
routingInfo?: Buffer | undefined
}) => {
@@ -113,16 +111,12 @@ export const makeNoiseHandler = ({
const certDecoded = decrypt(serverHello!.payload!)
if(mobile) {
proto.CertChain.NoiseCertificate.decode(certDecoded)
} else {
const { intermediate: certIntermediate } = proto.CertChain.decode(certDecoded)
const { intermediate: certIntermediate } = proto.CertChain.decode(certDecoded)
const { issuerSerial } = proto.CertChain.NoiseCertificate.Details.decode(certIntermediate!.details!)
const { issuerSerial } = proto.CertChain.NoiseCertificate.Details.decode(certIntermediate!.details!)
if(issuerSerial !== WA_CERT_DETAILS.SERIAL) {
throw new Boom('certification match failed', { statusCode: 400 })
}
if(issuerSerial !== WA_CERT_DETAILS.SERIAL) {
throw new Boom('certification match failed', { statusCode: 400 })
}
const keyEnc = encrypt(noiseKey.public)
@@ -183,11 +177,11 @@ export const makeNoiseHandler = ({
inBytes = inBytes.slice(size + 3)
if(isFinished) {
const result = decrypt(frame as Uint8Array)
const result = decrypt(frame)
frame = await decodeBinaryNode(result)
}
logger.trace({ msg: (frame as any)?.attrs?.id }, 'recv frame')
logger.trace({ msg: (frame as BinaryNode)?.attrs?.id }, 'recv frame')
onFrame(frame)
size = getBytesSize()