mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: functional legacy socket
This commit is contained in:
@@ -3,6 +3,7 @@ import { jidDecode, jidEncode } from './jid-utils';
|
||||
import { Binary, numUtf8Bytes } from '../../WABinary/Binary';
|
||||
import { Boom } from '@hapi/boom';
|
||||
import { proto } from '../../WAProto';
|
||||
import { BinaryNode } from './types';
|
||||
|
||||
const LIST1 = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.', '<27>', '<27>', '<27>', '<27>'];
|
||||
const LIST2 = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];
|
||||
@@ -210,20 +211,6 @@ function bufferToUInt(e: Uint8Array | Buffer, t: number) {
|
||||
for (let i = 0; i < t; i++) a = 256 * a + e[i]
|
||||
return a
|
||||
}
|
||||
/**
|
||||
* the binary node WA uses internally for communication
|
||||
*
|
||||
* this is manipulated soley as an object and it does not have any functions.
|
||||
* This is done for easy serialization, to prevent running into issues with prototypes &
|
||||
* to maintain functional code structure
|
||||
* */
|
||||
export type BinaryNode = {
|
||||
tag: string
|
||||
attrs: { [key: string]: string }
|
||||
content?: BinaryNode[] | string | Uint8Array
|
||||
}
|
||||
export type BinaryNodeAttributes = BinaryNode['attrs']
|
||||
export type BinaryNodeData = BinaryNode['content']
|
||||
|
||||
export const decodeBinaryNode = (data: Binary): BinaryNode => {
|
||||
//U
|
||||
@@ -333,4 +320,6 @@ export const getBinaryNodeMessages = ({ content }: BinaryNode) => {
|
||||
}
|
||||
|
||||
export * from './jid-utils'
|
||||
export { Binary } from '../../WABinary/Binary'
|
||||
export { Binary } from '../../WABinary/Binary'
|
||||
export * from './types'
|
||||
export * from './Legacy'
|
||||
Reference in New Issue
Block a user