Versions in this module Expand all Collapse all v0 v0.8.0 Jul 27, 2023 Changes in this version + const BusinessMessageLinkDirectPrefix + const BusinessMessageLinkPrefix + const CheckUpdateURL + const ContactQRLinkDirectPrefix + const ContactQRLinkPrefix + const DisappearingTimer24Hours + const DisappearingTimer7Days + const DisappearingTimer90Days + const DisappearingTimerOff + const EditAttributeAdminRevoke + const EditAttributeEmpty + const EditAttributeMessageEdit + const EditAttributeSenderRevoke + const EditWindow + const InviteLinkPrefix + const MinPreKeyCount + const NoiseHandshakeResponseTimeout + const QRChannelEventCode + const QRChannelEventError + const RemoveReactionText + const WantedPreKeyCount + var DefaultStatusPrivacy = []types.StatusPrivacy + var ErrAlreadyConnected = errors.New("websocket is already connected") + var ErrAppStateUpdate = errors.New("server returned error updating app state") + var ErrBroadcastListUnsupported = errors.New("sending to non-status broadcast lists is not yet supported") + var ErrBusinessMessageLinkNotFound = errors.New("that business message link does not exist or has been revoked") + var ErrContactQRLinkNotFound = errors.New("that contact QR link does not exist or has been revoked") + var ErrFileLengthMismatch = errors.New("file length does not match") + var ErrGroupInviteLinkUnauthorized = errors.New("you don't have the permission to get the group's invite link") + var ErrGroupNotFound = errors.New("that group does not exist") + var ErrIQBadRequest error = &IQError + var ErrIQDisconnected = &DisconnectedError + var ErrIQForbidden error = &IQError + var ErrIQGone error = &IQError + var ErrIQInternalServerError error = &IQError + var ErrIQLocked error = &IQError + var ErrIQNotAcceptable error = &IQError + var ErrIQNotAllowed error = &IQError + var ErrIQNotAuthorized error = &IQError + var ErrIQNotFound error = &IQError + var ErrIQPartialServerError error = &IQError + var ErrIQResourceLimit error = &IQError + var ErrIQServiceUnavailable error = &IQError + var ErrIQTimedOut = errors.New("info query timed out") + var ErrInvalidDisappearingTimer = errors.New("invalid disappearing timer provided") + var ErrInvalidImageFormat = errors.New("the given data is not a valid image") + var ErrInvalidMediaEncSHA256 = errors.New("hash of media ciphertext doesn't match") + var ErrInvalidMediaHMAC = errors.New("invalid media hmac") + var ErrInvalidMediaSHA256 = errors.New("hash of media plaintext doesn't match") + var ErrInviteLinkInvalid = errors.New("that group invite link is not valid") + var ErrInviteLinkRevoked = errors.New("that group invite link has been revoked") + var ErrMediaDownloadFailedWith403 = errors.New("download failed with status code 403") + var ErrMediaDownloadFailedWith404 = errors.New("download failed with status code 404") + var ErrMediaDownloadFailedWith410 = errors.New("download failed with status code 410") + var ErrMediaNotAvailableOnPhone = errors.New("media no longer available on phone") + var ErrMessageTimedOut = errors.New("timed out waiting for message send response") + var ErrNoPrivacyToken = errors.New("no privacy token stored") + var ErrNoPushName = errors.New("can't send presence without PushName set") + var ErrNoSession = errors.New("can't encrypt message for device: no signal session established") + var ErrNoURLPresent = errors.New("no url present") + var ErrNotConnected = errors.New("websocket not connected") + var ErrNotEncryptedReactionMessage = errors.New("given message isn't an encrypted reaction message") + var ErrNotInGroup = errors.New("you're not participating in that group") + var ErrNotLoggedIn = errors.New("the store doesn't contain a device JID") + var ErrNotPollUpdateMessage = errors.New("given message isn't a poll update message") + var ErrNothingDownloadableFound = errors.New("didn't find any attachments in message") + var ErrOriginalMessageSecretNotFound = errors.New("original message secret key not found") + var ErrPairInvalidDeviceIdentityHMAC = errors.New("invalid device identity HMAC in pair success message") + var ErrPairInvalidDeviceSignature = errors.New("invalid device signature in pair success message") + var ErrPairRejectedLocally = errors.New("local PrePairCallback rejected pairing") + var ErrProfilePictureNotSet = errors.New("that user or group does not have a profile picture") + var ErrProfilePictureUnauthorized = errors.New("the user has hidden their profile picture from you") + var ErrQRAlreadyConnected = errors.New("GetQRChannel must be called before connecting") + var ErrQRStoreContainsID = errors.New(...) + var ErrRecipientADJID = errors.New("message recipient must be normal (non-AD) JID") + var ErrServerReturnedError = errors.New("server returned error") + var ErrTooShortFile = errors.New("file too short") + var ErrUnknownMediaRetryError = errors.New("unknown media retry error") + var ErrUnknownMediaType = errors.New("unknown media type") + var ErrUnknownServer = errors.New("can't send message to unknown server") + var KeepAliveIntervalMax = 30 * time.Second + var KeepAliveIntervalMin = 20 * time.Second + var KeepAliveMaxFailTime = 3 * time.Minute + var KeepAliveResponseDeadline = 10 * time.Second + var QRChannelClientOutdated = QRChannelItem + var QRChannelErrUnexpectedEvent = QRChannelItem + var QRChannelScannedWithoutMultidevice = QRChannelItem + var QRChannelSuccess = QRChannelItem + var QRChannelTimeout = QRChannelItem + func DecryptMediaRetryNotification(evt *events.MediaRetry, mediaKey []byte) (*waProto.MediaRetryNotification, error) + func GenerateMessageID() types.MessageID + func HashPollOptions(optionNames []string) [][]byte + func ParseDisappearingTimerString(val string) (time.Duration, bool) + type CheckUpdateResponse struct + CurrentVersion string + IsBelowHard bool + IsBelowSoft bool + IsBroken bool + ParsedVersion store.WAVersionContainer + func CheckUpdate(httpClient *http.Client) (respData CheckUpdateResponse, err error) + type Client struct + AutoReconnectErrors int + AutoTrustIdentity bool + DontSendSelfBroadcast bool + EmitAppStateEventsOnFullSync bool + EnableAutoReconnect bool + ErrorOnSubscribePresenceWithoutToken bool + GetMessageForRetry func(requester, to types.JID, id types.MessageID) *waProto.Message + LastSuccessfulConnect time.Time + Log waLog.Logger + PrePairCallback func(jid types.JID, platform, businessName string) bool + PreRetryCallback func(receipt *events.Receipt, id types.MessageID, retryCount int, ...) bool + Store *store.Device + func NewClient(deviceStore *store.Device, log waLog.Logger) *Client + func (cli *Client) AddEventHandler(handler EventHandler) uint32 + func (cli *Client) BuildEdit(chat types.JID, id types.MessageID, newContent *waProto.Message) *waProto.Message + func (cli *Client) BuildPollCreation(name string, optionNames []string, selectableOptionCount int) *waProto.Message + func (cli *Client) BuildPollVote(pollInfo *types.MessageInfo, optionNames []string) (*waProto.Message, error) + func (cli *Client) BuildRevoke(chat, sender types.JID, id types.MessageID) *waProto.Message + func (cli *Client) CheckUpdate() (respData CheckUpdateResponse, err error) + func (cli *Client) Connect() error + func (cli *Client) CreateGroup(req ReqCreateGroup) (*types.GroupInfo, error) + func (cli *Client) DangerousInternals() *DangerousInternalClient + func (cli *Client) DecryptPollVote(vote *events.Message) (*waProto.PollVoteMessage, error) + func (cli *Client) DecryptReaction(reaction *events.Message) (*waProto.ReactionMessage, error) + func (cli *Client) Disconnect() + func (cli *Client) Download(msg DownloadableMessage) ([]byte, error) + func (cli *Client) DownloadAny(msg *waProto.Message) (data []byte, err error) + func (cli *Client) DownloadMediaWithPath(directPath string, encFileHash, fileHash, mediaKey []byte, fileLength int, ...) (data []byte, err error) + func (cli *Client) DownloadThumbnail(msg DownloadableThumbnail) ([]byte, error) + func (cli *Client) EncryptPollVote(pollInfo *types.MessageInfo, vote *waProto.PollVoteMessage) (*waProto.PollUpdateMessage, error) + func (cli *Client) FetchAppState(name appstate.WAPatchName, fullSync, onlyIfNotSynced bool) error + func (cli *Client) GetContactQRLink(revoke bool) (string, error) + func (cli *Client) GetGroupInfo(jid types.JID) (*types.GroupInfo, error) + func (cli *Client) GetGroupInfoFromInvite(jid, inviter types.JID, code string, expiration int64) (*types.GroupInfo, error) + func (cli *Client) GetGroupInfoFromLink(code string) (*types.GroupInfo, error) + func (cli *Client) GetGroupInviteLink(jid types.JID, reset bool) (string, error) + func (cli *Client) GetJoinedGroups() ([]*types.GroupInfo, error) + func (cli *Client) GetLinkedGroupsParticipants(community types.JID) ([]types.JID, error) + func (cli *Client) GetPrivacySettings() (settings types.PrivacySettings) + func (cli *Client) GetProfilePictureInfo(jid types.JID, params *GetProfilePictureParams) (*types.ProfilePictureInfo, error) + func (cli *Client) GetQRChannel(ctx context.Context) (<-chan QRChannelItem, error) + func (cli *Client) GetStatusPrivacy() ([]types.StatusPrivacy, error) + func (cli *Client) GetSubGroups(community types.JID) ([]*types.GroupLinkTarget, error) + func (cli *Client) GetUserDevices(jids []types.JID) ([]types.JID, error) + func (cli *Client) GetUserDevicesContext(ctx context.Context, jids []types.JID) ([]types.JID, error) + func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo, error) + func (cli *Client) IsConnected() bool + func (cli *Client) IsLoggedIn() bool + func (cli *Client) IsOnWhatsApp(phones []string) ([]types.IsOnWhatsAppResponse, error) + func (cli *Client) JoinGroupWithInvite(jid, inviter types.JID, code string, expiration int64) error + func (cli *Client) JoinGroupWithLink(code string) (types.JID, error) + func (cli *Client) LeaveGroup(jid types.JID) error + func (cli *Client) LinkGroup(parent, child types.JID) error + func (cli *Client) Logout() error + func (cli *Client) MarkRead(ids []types.MessageID, timestamp time.Time, chat, sender types.JID) error + func (cli *Client) PairPhone(phone string, showPushNotification bool) (string, error) + func (cli *Client) ParseWebMessage(chatJID types.JID, webMsg *waProto.WebMessageInfo) (*events.Message, error) + func (cli *Client) RemoveEventHandler(id uint32) bool + func (cli *Client) RemoveEventHandlers() + func (cli *Client) ResolveBusinessMessageLink(code string) (*types.BusinessMessageLinkTarget, error) + func (cli *Client) ResolveContactQRLink(code string) (*types.ContactQRLinkTarget, error) + func (cli *Client) RevokeMessage(chat types.JID, id types.MessageID) (SendResponse, error) + func (cli *Client) SendAppState(patch appstate.PatchInfo) error + func (cli *Client) SendChatPresence(jid types.JID, state types.ChatPresence, media types.ChatPresenceMedia) error + func (cli *Client) SendMediaRetryReceipt(message *types.MessageInfo, mediaKey []byte) error + func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waProto.Message, ...) (resp SendResponse, err error) + func (cli *Client) SendPresence(state types.Presence) error + func (cli *Client) SetDisappearingTimer(chat types.JID, timer time.Duration) (err error) + func (cli *Client) SetForceActiveDeliveryReceipts(active bool) + func (cli *Client) SetGroupAnnounce(jid types.JID, announce bool) error + func (cli *Client) SetGroupLocked(jid types.JID, locked bool) error + func (cli *Client) SetGroupName(jid types.JID, name string) error + func (cli *Client) SetGroupPhoto(jid types.JID, avatar []byte) (string, error) + func (cli *Client) SetGroupTopic(jid types.JID, previousID, newID, topic string) error + func (cli *Client) SetPassive(passive bool) error + func (cli *Client) SetProxy(proxy socket.Proxy) + func (cli *Client) SetProxyAddress(addr string) error + func (cli *Client) SetStatusMessage(msg string) error + func (cli *Client) SubscribePresence(jid types.JID) error + func (cli *Client) TryFetchPrivacySettings(ignoreCache bool) (*types.PrivacySettings, error) + func (cli *Client) UnlinkGroup(parent, child types.JID) error + func (cli *Client) UpdateGroupParticipants(jid types.JID, participantChanges map[types.JID]ParticipantChange) (*waBinary.Node, error) + func (cli *Client) Upload(ctx context.Context, plaintext []byte, appInfo MediaType) (resp UploadResponse, err error) + func (cli *Client) WaitForConnection(timeout time.Duration) bool + type DangerousInfoQuery = infoQuery + type DangerousInfoQueryType = infoQueryType + type DangerousInternalClient struct + func (int *DangerousInternalClient) CancelResponse(reqID string, ch chan *waBinary.Node) + func (int *DangerousInternalClient) GetServerPreKeyCount() (int, error) + func (int *DangerousInternalClient) QueryMediaConn() (*MediaConn, error) + func (int *DangerousInternalClient) RefreshMediaConn(force bool) (*MediaConn, error) + func (int *DangerousInternalClient) RequestAppStateKeys(ctx context.Context, keyIDs [][]byte) + func (int *DangerousInternalClient) SendIQ(query DangerousInfoQuery) (*waBinary.Node, error) + func (int *DangerousInternalClient) SendIQAsync(query DangerousInfoQuery) (<-chan *waBinary.Node, error) + func (int *DangerousInternalClient) SendNode(node waBinary.Node) error + func (int *DangerousInternalClient) SendRetryReceipt(node *waBinary.Node, forceIncludeIdentity bool) + func (int *DangerousInternalClient) WaitResponse(reqID string) chan *waBinary.Node + type DisconnectedError struct + Action string + Node *waBinary.Node + func (err *DisconnectedError) Error() string + func (err *DisconnectedError) Is(other error) bool + type DownloadableMessage interface + GetDirectPath func() string + GetFileEncSha256 func() []byte + GetFileSha256 func() []byte + GetMediaKey func() []byte + type DownloadableThumbnail interface + GetMediaKey func() []byte + GetThumbnailDirectPath func() string + GetThumbnailEncSha256 func() []byte + GetThumbnailSha256 func() []byte + type ElementMissingError struct + In string + Tag string + func (eme *ElementMissingError) Error() string + type EventHandler func(evt interface{}) + type GetProfilePictureParams struct + ExistingID string + IsCommunity bool + Preview bool + type IQError struct + Code int + ErrorNode *waBinary.Node + RawNode *waBinary.Node + Text string + func (iqe *IQError) Error() string + func (iqe *IQError) Is(other error) bool + type MediaConn struct + Auth string + AuthTTL int + FetchedAt time.Time + Hosts []MediaConnHost + MaxBuckets int + TTL int + func (mc *MediaConn) Expiry() time.Time + type MediaConnHost struct + Hostname string + type MediaType string + const MediaAppState + const MediaAudio + const MediaDocument + const MediaHistory + const MediaImage + const MediaLinkThumbnail + const MediaVideo + func GetMediaType(msg DownloadableMessage) MediaType + type MessageDebugTimings struct + GetDevices time.Duration + GetParticipants time.Duration + GroupEncrypt time.Duration + Marshal time.Duration + PeerEncrypt time.Duration + Queue time.Duration + Resp time.Duration + Retry time.Duration + Send time.Duration + type MsgSecretType string + const EncSecretPollVote + const EncSecretReaction + type PairClientType int + const PairClientChrome + const PairClientEdge + const PairClientElectron + const PairClientFirefox + const PairClientIE + const PairClientOpera + const PairClientOtherWebClient + const PairClientSafari + const PairClientUWP + const PairClientUnknown + type PairDatabaseError struct + DBErr error + Message string + func (err *PairDatabaseError) Error() string + func (err *PairDatabaseError) Unwrap() error + type PairProtoError struct + Message string + ProtoErr error + func (err *PairProtoError) Error() string + func (err *PairProtoError) Unwrap() error + type ParticipantChange string + const ParticipantChangeAdd + const ParticipantChangeDemote + const ParticipantChangePromote + const ParticipantChangeRemove + type QRChannelItem struct + Code string + Error error + Event string + Timeout time.Duration + type RecentMessage struct + Proto *waProto.Message + Timestamp time.Time + type ReqCreateGroup struct + CreateKey types.MessageID + Name string + Participants []types.JID + type SendRequestExtra struct + ID types.MessageID + Peer bool + type SendResponse struct + DebugTimings MessageDebugTimings + ID types.MessageID + Timestamp time.Time + type UploadResponse struct + DirectPath string + FileEncSHA256 []byte + FileLength uint64 + FileSHA256 []byte + MediaKey []byte + URL string