From a723b507411c06a6596f3153b6ba86f61c6e6d88 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Sat, 18 Dec 2021 19:54:08 +0530 Subject: [PATCH] chore: add type distinguisher for sockets --- src/LegacySocket/socket.ts | 1 + src/Socket/socket.ts | 1 + src/index.ts | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/LegacySocket/socket.ts b/src/LegacySocket/socket.ts index 2257c88..f16c2d8 100644 --- a/src/LegacySocket/socket.ts +++ b/src/LegacySocket/socket.ts @@ -363,6 +363,7 @@ export const makeSocket = ({ }) return { + type: 'legacy', ws, updateKeys: (info: { encKey: Buffer, macKey: Buffer }) => authInfo = info, waitForSocketOpen, diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts index 3aa0073..2007722 100644 --- a/src/Socket/socket.ts +++ b/src/Socket/socket.ts @@ -540,6 +540,7 @@ export const makeSocket = ({ ev.on('creds.update', update => Object.assign(creds, update)) return { + type: 'md', ws, ev, authState: { diff --git a/src/index.ts b/src/index.ts index d445a48..8139a9f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,4 +14,6 @@ export { makeWALegacySocket } export type WASocket = ReturnType +export type AnyWASocket = WASocket | WALegacySocket + export default makeWASocket \ No newline at end of file