package appstate
import "github.com/insomnius/whatsmeow/appstate"
Package appstate implements encoding and decoding WhatsApp's app state patches.
Index ¶
- Variables
- type DownloadExternalFunc
- type ExpandedAppStateKeys
- type HashState
- type Mutation
- type PatchList
- type Processor
- func NewProcessor(store *store.Device, log waLog.Logger) *Processor
- func (proc *Processor) DecodePatches(list *PatchList, initialState HashState, validateMACs bool) (newMutations []Mutation, currentState HashState, err error)
- func (proc *Processor) GetMissingKeyIDs(pl *PatchList) [][]byte
- type WAPatchName
Variables ¶
var ( ErrMissingPreviousSetValueOperation = errors.New("missing value MAC of previous SET operation") ErrMismatchingLTHash = errors.New("mismatching LTHash") ErrMismatchingPatchMAC = errors.New("mismatching patch MAC") ErrMismatchingContentMAC = errors.New("mismatching content MAC") ErrMismatchingIndexMAC = errors.New("mismatching index MAC") ErrKeyNotFound = errors.New("didn't find app state key") )
Errors that this package can return.
var AllPatchNames = [...]WAPatchName{WAPatchCriticalBlock, WAPatchCriticalUnblockLow, WAPatchRegularHigh, WAPatchRegular, WAPatchRegularLow}
AllPatchNames contains all currently known patch state names.
Types ¶
type DownloadExternalFunc ¶
type DownloadExternalFunc func(*waProto.ExternalBlobReference) ([]byte, error)
DownloadExternalFunc is a function that can download a blob of external app state patches.
type ExpandedAppStateKeys ¶
type ExpandedAppStateKeys struct { Index []byte ValueEncryption []byte ValueMAC []byte SnapshotMAC []byte PatchMAC []byte }
type HashState ¶
type Mutation ¶
type Mutation struct { Operation waProto.SyncdMutation_SyncdOperation Action *waProto.SyncActionValue Index []string IndexMAC []byte ValueMAC []byte }
type PatchList ¶
type PatchList struct { Name WAPatchName HasMorePatches bool Patches []*waProto.SyncdPatch Snapshot *waProto.SyncdSnapshot }
PatchList represents a decoded response to getting app state patches from the WhatsApp servers.
func ParsePatchList ¶
func ParsePatchList(node *waBinary.Node, downloadExternal DownloadExternalFunc) (*PatchList, error)
ParsePatchList will decode an XML node containing app state patches, including downloading any external blobs.
type Processor ¶
type Processor struct { Store *store.Device Log waLog.Logger // contains filtered or unexported fields }
func NewProcessor ¶
func (*Processor) DecodePatches ¶
func (proc *Processor) DecodePatches(list *PatchList, initialState HashState, validateMACs bool) (newMutations []Mutation, currentState HashState, err error)
DecodePatches will decode all the patches in a PatchList into a list of app state mutations.
func (*Processor) GetMissingKeyIDs ¶
type WAPatchName ¶
type WAPatchName string
WAPatchName represents a type of app state patch.
const ( // WAPatchCriticalBlock contains the user's settings like push name and locale. WAPatchCriticalBlock WAPatchName = "critical_block" // WAPatchCriticalUnblockLow contains the user's contact list. WAPatchCriticalUnblockLow WAPatchName = "critical_unblock_low" // WAPatchRegularLow contains some local chat settings like pin, archive status, and the setting of whether to unarchive chats when messages come in. WAPatchRegularLow WAPatchName = "regular_low" // WAPatchRegularHigh contains more local chat settings like mute status and starred messages. WAPatchRegularHigh WAPatchName = "regular_high" // WAPatchRegular contains protocol info about app state patches like key expiration. WAPatchRegular WAPatchName = "regular" )
Source Files ¶
decode.go errors.go hash.go keys.go
Directories ¶
Path | Synopsis |
---|---|
appstate/lthash | Package lthash implements a summation based hash algorithm that maintains the integrity of a piece of data over a series of mutations. |
- Version
- v0.0.0-20221222071518-e03eb42e21a9 (latest)
- Published
- Dec 22, 2022
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 1 month ago –
Tools for package owners.