mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
minor bug fix
This commit is contained in:
@@ -110,6 +110,11 @@ const makeAuthSocket = (config: SocketConfig) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateEncKeys = () => {
|
||||||
|
// update the keys so we can decrypt traffic
|
||||||
|
socket.updateKeys({ encKey: authInfo!.encKey, macKey: authInfo!.macKey })
|
||||||
|
}
|
||||||
|
|
||||||
const generateKeysForAuth = async(ref: string, ttl?: number) => {
|
const generateKeysForAuth = async(ref: string, ttl?: number) => {
|
||||||
curveKeys = Curve.generateKeyPair(randomBytes(32))
|
curveKeys = Curve.generateKeyPair(randomBytes(32))
|
||||||
const publicKey = Buffer.from(curveKeys.public).toString('base64')
|
const publicKey = Buffer.from(curveKeys.public).toString('base64')
|
||||||
@@ -168,6 +173,7 @@ const makeAuthSocket = (config: SocketConfig) => {
|
|||||||
})();
|
})();
|
||||||
let loginTag: string
|
let loginTag: string
|
||||||
if(canDoLogin) {
|
if(canDoLogin) {
|
||||||
|
updateEncKeys()
|
||||||
// if we have the info to restore a closed session
|
// if we have the info to restore a closed session
|
||||||
const json = [
|
const json = [
|
||||||
'admin',
|
'admin',
|
||||||
@@ -223,8 +229,7 @@ const makeAuthSocket = (config: SocketConfig) => {
|
|||||||
const isNewLogin = user.jid !== state.user?.jid
|
const isNewLogin = user.jid !== state.user?.jid
|
||||||
|
|
||||||
authInfo = auth
|
authInfo = auth
|
||||||
// update the keys so we can decrypt traffic
|
updateEncKeys()
|
||||||
socket.updateKeys({ encKey: auth.encKey, macKey: auth.macKey })
|
|
||||||
|
|
||||||
logger.info({ user }, 'logged in')
|
logger.info({ user }, 'logged in')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user