mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: decode app state key correctly
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { Boom } from '@hapi/boom'
|
import { Boom } from '@hapi/boom'
|
||||||
import { randomBytes } from 'crypto'
|
import { randomBytes } from 'crypto'
|
||||||
import type { Logger } from 'pino'
|
import type { Logger } from 'pino'
|
||||||
|
import { proto } from '../../WAProto'
|
||||||
import type { AuthenticationCreds, AuthenticationState, SignalDataTypeMap, SignalDataSet, SignalKeyStore, SignalKeyStoreWithTransaction } from "../Types"
|
import type { AuthenticationCreds, AuthenticationState, SignalDataTypeMap, SignalDataSet, SignalKeyStore, SignalKeyStoreWithTransaction } from "../Types"
|
||||||
import { Curve, signedKeyPair } from './crypto'
|
import { Curve, signedKeyPair } from './crypto'
|
||||||
import { generateRegistrationId, BufferJSON } from './generics'
|
import { generateRegistrationId, BufferJSON } from './generics'
|
||||||
@@ -144,8 +145,11 @@ export const useSingleFileAuthState = (filename: string): { state: Authenticatio
|
|||||||
const key = KEY_MAP[type]
|
const key = KEY_MAP[type]
|
||||||
return ids.reduce(
|
return ids.reduce(
|
||||||
(dict, id) => {
|
(dict, id) => {
|
||||||
const value = keys[key]?.[id]
|
let value = keys[key]?.[id]
|
||||||
if(value) {
|
if(value) {
|
||||||
|
if(type === 'app-state-sync-key') {
|
||||||
|
value = proto.AppStateSyncKeyData.fromObject(value)
|
||||||
|
}
|
||||||
dict[id] = value
|
dict[id] = value
|
||||||
}
|
}
|
||||||
return dict
|
return dict
|
||||||
|
|||||||
Reference in New Issue
Block a user