Versions in this module Expand all Collapse all v0 v0.0.1 Mar 11, 2026 Changes in this version + const FrameLengthSize + const FrameMaxSize + const NoiseStartPattern + const Origin + const URL + const WAMagicValue + var ErrDialFailed = errors.New("failed to dial whatsapp web websocket") + var ErrFrameTooLarge = errors.New("frame too large") + var ErrSocketAlreadyOpen = errors.New("frame socket is already open") + var ErrSocketClosed = errors.New("frame socket is closed") + var WAConnHeader = []byte + type DisconnectHandler func(ctx context.Context, socket *NoiseSocket, remote bool) + type ErrWithStatusCode struct + StatusCode int + type FrameHandler func(context.Context, []byte) + type FrameSocket struct + Frames chan []byte + HTTPClient *http.Client + HTTPHeaders http.Header + Header []byte + OnDisconnect func(ctx context.Context, remote bool) + URL string + func NewFrameSocket(log waLog.Logger, client *http.Client) *FrameSocket + func (fs *FrameSocket) Close(code websocket.StatusCode) + func (fs *FrameSocket) Connect(ctx context.Context) error + func (fs *FrameSocket) Context() context.Context + func (fs *FrameSocket) IsConnected() bool + func (fs *FrameSocket) SendFrame(data []byte) error + type NoiseHandshake struct + func NewNoiseHandshake() *NoiseHandshake + func (nh *NoiseHandshake) Authenticate(data []byte) + func (nh *NoiseHandshake) Decrypt(ciphertext []byte) (plaintext []byte, err error) + func (nh *NoiseHandshake) Encrypt(plaintext []byte) []byte + func (nh *NoiseHandshake) Finish(ctx context.Context, fs *FrameSocket, frameHandler FrameHandler, ...) (*NoiseSocket, error) + func (nh *NoiseHandshake) MixIntoKey(data []byte) error + func (nh *NoiseHandshake) MixSharedSecretIntoKey(priv, pub [32]byte) error + func (nh *NoiseHandshake) Start(pattern string, header []byte) + type NoiseSocket struct + func (ns *NoiseSocket) IsConnected() bool + func (ns *NoiseSocket) SendFrame(ctx context.Context, plaintext []byte) error + func (ns *NoiseSocket) Stop(disconnect, allowOnDisconnect bool)