mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
WASecretBundle patch
This commit is contained in:
@@ -103,12 +103,13 @@ export default class WAConnectionBase {
|
|||||||
const file = fs.readFileSync(authInfo, { encoding: 'utf-8' }) // load a closed session back if it exists
|
const file = fs.readFileSync(authInfo, { encoding: 'utf-8' }) // load a closed session back if it exists
|
||||||
authInfo = JSON.parse(file) as AuthenticationCredentialsBrowser
|
authInfo = JSON.parse(file) as AuthenticationCredentialsBrowser
|
||||||
}
|
}
|
||||||
|
const secretBundle: {encKey: string, macKey: string} = typeof authInfo === 'string' ? JSON.parse (authInfo): authInfo
|
||||||
this.authInfo = {
|
this.authInfo = {
|
||||||
clientID: authInfo.WABrowserId.replace(/\"/g, ''),
|
clientID: authInfo.WABrowserId.replace(/\"/g, ''),
|
||||||
serverToken: authInfo.WAToken2.replace(/\"/g, ''),
|
serverToken: authInfo.WAToken2.replace(/\"/g, ''),
|
||||||
clientToken: authInfo.WAToken1.replace(/\"/g, ''),
|
clientToken: authInfo.WAToken1.replace(/\"/g, ''),
|
||||||
encKey: Buffer.from(authInfo.WASecretBundle.encKey, 'base64'), // decode from base64
|
encKey: Buffer.from(secretBundle.encKey, 'base64'), // decode from base64
|
||||||
macKey: Buffer.from(authInfo.WASecretBundle.macKey, 'base64'), // decode from base64
|
macKey: Buffer.from(secretBundle.macKey, 'base64'), // decode from base64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export interface AuthenticationCredentialsBase64 {
|
|||||||
}
|
}
|
||||||
export interface AuthenticationCredentialsBrowser {
|
export interface AuthenticationCredentialsBrowser {
|
||||||
WABrowserId: string
|
WABrowserId: string
|
||||||
WASecretBundle: {encKey: string, macKey: string}
|
WASecretBundle: {encKey: string, macKey: string} | string
|
||||||
WAToken1: string
|
WAToken1: string
|
||||||
WAToken2: string
|
WAToken2: string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user