From 0650c10c736a6b386700b29c7ab664b4203cd3d4 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Sun, 12 Dec 2021 11:18:04 +0530 Subject: [PATCH] fix: decode app state key correctly --- src/Utils/auth-utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Utils/auth-utils.ts b/src/Utils/auth-utils.ts index 39ea354..3ad7e1a 100644 --- a/src/Utils/auth-utils.ts +++ b/src/Utils/auth-utils.ts @@ -1,6 +1,7 @@ import { Boom } from '@hapi/boom' import { randomBytes } from 'crypto' import type { Logger } from 'pino' +import { proto } from '../../WAProto' import type { AuthenticationCreds, AuthenticationState, SignalDataTypeMap, SignalDataSet, SignalKeyStore, SignalKeyStoreWithTransaction } from "../Types" import { Curve, signedKeyPair } from './crypto' import { generateRegistrationId, BufferJSON } from './generics' @@ -144,8 +145,11 @@ export const useSingleFileAuthState = (filename: string): { state: Authenticatio const key = KEY_MAP[type] return ids.reduce( (dict, id) => { - const value = keys[key]?.[id] + let value = keys[key]?.[id] if(value) { + if(type === 'app-state-sync-key') { + value = proto.AppStateSyncKeyData.fromObject(value) + } dict[id] = value } return dict