wxkey

package
v1.6.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package wxkey is wechat-cli's thin client for the standalone `wxkey` CLI. The CLI handles task_for_pid + memory scan + SQLCipher verification; this package finds the binary, invokes `wxkey setup`, and parses the JSON it prints to stdout. First-run human/agent setup should usually call `wxkey bootstrap` explicitly; wechat-cli keeps runtime startup on the narrower setup path so it does not silently re-sign or restart WeChat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindBinary

func FindBinary() (string, error)

FindBinary locates the wxkey CLI. Resolution order:

  1. $WX_KEY_BIN — explicit override
  2. next to the calling executable (the recommended distribution layout)
  3. PATH lookup

func SetupSupported

func SetupSupported() bool

func UnsupportedSetupMessage

func UnsupportedSetupMessage() string

Types

type ImageKeyCommandResult

type ImageKeyCommandResult struct {
	PID      int             `json:"pid"`
	Root     string          `json:"scan_root"`
	WxID     string          `json:"wxid"`
	ImageKey *ImageKeyResult `json:"image_key,omitempty"`
}

type ImageKeyResult

type ImageKeyResult struct {
	Key            string          `json:"key"`
	XORKey         *int            `json:"xor_key,omitempty"`
	TemplateFile   string          `json:"template_file,omitempty"`
	TemplateSource string          `json:"template_source,omitempty"`
	Regions        int             `json:"regions,omitempty"`
	BytesScanned   uint64          `json:"bytes_scanned,omitempty"`
	Candidates     int             `json:"candidates,omitempty"`
	Elapsed        json.RawMessage `json:"elapsed_ns,omitempty"`
}

func RunImageKey

func RunImageKey(root string) (*ImageKeyResult, string, error)

type ResultEntry

type ResultEntry struct {
	DBRel    string `json:"db_rel"`
	DBPath   string `json:"db_path"`
	SaltHex  string `json:"salt_hex"`
	KeyHex   string `json:"key_hex"`
	VerifyAs string `json:"verify_as"`
}

type SetupResult

type SetupResult struct {
	PID           int               `json:"pid"`
	Root          string            `json:"scan_root"`
	WxID          string            `json:"wxid"`
	ConfigPath    string            `json:"config_path"`
	Stats         json.RawMessage   `json:"stats"`
	Results       []ResultEntry     `json:"results"`
	ImageKey      *ImageKeyResult   `json:"image_key,omitempty"`
	ImageKeyError string            `json:"image_key_error,omitempty"`
	Keys          map[string]string `json:"-"` // populated from Results post-decode
}

SetupResult mirrors what `wxkey setup` writes to stdout. We only consume the bits wechat-cli needs.

func RunSetup

func RunSetup() (*SetupResult, string, error)

RunSetup refreshes schema-2 per-DB keys. On macOS/Linux builds this invokes the standalone `wxkey setup` helper and parses its JSON output. On Windows it uses the in-process adapter in setup_windows.go.

The macOS path intentionally does not run `wxkey bootstrap`, because bootstrap may quit, ad-hoc re-sign, and reopen WeChat. stderrText is also returned so wechat-cli can surface progress / errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL