Set appropriate browsers

This commit is contained in:
Adhiraj
2020-07-13 14:14:45 +05:30
parent 51484df602
commit 3534bd856f
3 changed files with 15 additions and 8 deletions

View File

@@ -12,7 +12,6 @@ import {
WATag, WATag,
MessageLogLevel, MessageLogLevel,
AuthenticationCredentialsBrowser, AuthenticationCredentialsBrowser,
Browsers,
} from './Constants' } from './Constants'
/** Generate a QR code from the ref & the curve public key. This is scanned by the phone */ /** Generate a QR code from the ref & the curve public key. This is scanned by the phone */
@@ -25,7 +24,7 @@ export default class WAConnectionBase {
/** The version of WhatsApp Web we're telling the servers we are */ /** The version of WhatsApp Web we're telling the servers we are */
version: [number, number, number] = [2, 2027, 10] version: [number, number, number] = [2, 2027, 10]
/** The Browser we're telling the WhatsApp Web servers we are */ /** The Browser we're telling the WhatsApp Web servers we are */
browserDescription: [string, string, string] = Browsers.baileys ('Chrome') browserDescription: [string, string, string] = Utils.Browsers.baileys ('Chrome')
/** Metadata like WhatsApp id, name set on WhatsApp etc. */ /** Metadata like WhatsApp id, name set on WhatsApp etc. */
userMetaData: UserMetaData = { id: null, name: null, phone: null } userMetaData: UserMetaData = { id: null, name: null, phone: null }
/** Should reconnect automatically after an unexpected disconnect */ /** Should reconnect automatically after an unexpected disconnect */

View File

@@ -1,11 +1,6 @@
import { WA } from '../Binary/Constants' import { WA } from '../Binary/Constants'
import { proto } from '../../WAMessage/WAMessage' import { proto } from '../../WAMessage/WAMessage'
export const Browsers: Record<string, (string) => [string, string, string]> = {
ubuntu: browser => ['Ubuntu', browser, '18.04'],
macOS: browser => ['Mac OS', browser, '10.15.3'],
baileys: browser => ['Baileys', browser, '2.0']
}
export enum MessageLogLevel { export enum MessageLogLevel {
none=0, none=0,
unhandled=1, unhandled=1,

View File

@@ -1,8 +1,21 @@
import * as Crypto from 'crypto' import * as Crypto from 'crypto'
import HKDF from 'futoin-hkdf' import HKDF from 'futoin-hkdf'
import Decoder from '../Binary/Decoder' import Decoder from '../Binary/Decoder'
import { off } from 'process' import {platform, release} from 'os'
const platformMap = {
'aix': 'AIX',
'darwin': 'Mac OS',
'win32': 'Windows',
'android': 'Android'
}
export const Browsers = {
ubuntu: browser => ['Ubuntu', browser, '18.04'] as [string, string, string],
macOS: browser => ['Mac OS', browser, '10.15.3'] as [string, string, string],
baileys: browser => ['Baileys', browser, '2.0'] as [string, string, string],
/** The appropriate browser based on your OS & release */
appropriate: browser => [ platformMap [platform()] || 'Ubuntu', browser, release() ] as [string, string, string]
}
/** decrypt AES 256 CBC; where the IV is prefixed to the buffer */ /** decrypt AES 256 CBC; where the IV is prefixed to the buffer */
export function aesDecrypt(buffer: Buffer, key: Buffer) { export function aesDecrypt(buffer: Buffer, key: Buffer) {
return aesDecryptWithIV(buffer.slice(16, buffer.length), key, buffer.slice(0, 16)) return aesDecryptWithIV(buffer.slice(16, buffer.length), key, buffer.slice(0, 16))