whatsmeowgo.mau.fi/whatsmeow/binary/token Index | Files

package token

import "go.mau.fi/whatsmeow/binary/token"

Package token contains maps of predefined tokens that WhatsApp's binary XML encoding uses to save bytes when sending commonly used strings.

Index

Constants

const (
	ListEmpty   = 0
	Dictionary0 = 236
	Dictionary1 = 237
	Dictionary2 = 238
	Dictionary3 = 239
	InteropJID  = 245
	FBJID       = 246
	ADJID       = 247
	List8       = 248
	List16      = 249
	JIDPair     = 250
	Hex8        = 251
	Binary8     = 252
	Binary20    = 253
	Binary32    = 254
	Nibble8     = 255
)

Type tokens used in the binary XML representation.

const (
	PackedMax     = 127
	SingleByteMax = 256
)

Other constants

const DictVersion = 3

DictVersion is the version number of the token lists above. It's sent when connecting to the websocket so the server knows which tokens are supported.

Variables

var (
	SingleByteTokens = [...]string{ /* 236 elements not displayed */ }
	DoubleByteTokens = [...][]string{
		{ /* 256 elements not displayed */ },
		{ /* 256 elements not displayed */ },
		{ /* 256 elements not displayed */ },
		{ /* 256 elements not displayed */ },
	}
)

All the currently known string tokens.

Functions

func GetDoubleToken

func GetDoubleToken(index1, index2 int) (string, error)

GetDoubleToken gets the string value of the double-byte token at the given index.

func IndexOfDoubleByteToken

func IndexOfDoubleByteToken(token string) (byte, byte, bool)

IndexOfDoubleByteToken gets the index of the double-byte token with the given string value. If there's no token with the given value, the third return value will be false.

func IndexOfSingleToken

func IndexOfSingleToken(token string) (val byte, ok bool)

IndexOfSingleToken gets the index of the single-byte token with the given string value. If there's no token with the given value, the second return value will be false.

Source Files

token.go

Version
v0.0.0-20250326122532-6680c9a6e9a7 (latest)
Published
Mar 26, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
7 hours ago

Tools for package owners.