feat: add retry capability to SignalKeyStore

This commit is contained in:
Adhiraj Singh
2022-05-22 20:52:21 +05:30
parent c5d488f1c6
commit a8e209705a
5 changed files with 42 additions and 16 deletions

View File

@@ -72,6 +72,11 @@ export type SignalKeyStoreWithTransaction = SignalKeyStore & {
prefetch<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Promise<void>
}
export type TransactionCapabilityOptions = {
maxCommitRetries: number
delayBetweenTriesMs: number
}
export type SignalAuthState = {
creds: SignalCreds
keys: SignalKeyStore

View File

@@ -12,7 +12,7 @@ export * from './Call'
import type NodeCache from 'node-cache'
import { proto } from '../../WAProto'
import { AuthenticationState } from './Auth'
import { AuthenticationState, TransactionCapabilityOptions } from './Auth'
import { CommonSocketConfig } from './Socket'
export type MessageRetryMap = { [msgId: string]: number }
@@ -20,6 +20,8 @@ export type MessageRetryMap = { [msgId: string]: number }
export type SocketConfig = CommonSocketConfig<AuthenticationState> & {
/** By default true, should history messages be downloaded and processed */
downloadHistory: boolean
/** transaction capability options for SignalKeyStore */
transactionOpts: TransactionCapabilityOptions
/** provide a cache to store a user's device list */
userDevicesCache?: NodeCache
/**