Documentation
¶
Index ¶
- Constants
- func ComputeKeyFingerprint(key []byte) int64
- func DecryptFile(encryptedData []byte, key, iv []byte, originalSize int) ([]byte, error)
- func EncryptFile(data []byte, key, iv []byte) ([]byte, error)
- func GenerateRandomID() (int64, error)
- func IsSafePrime(p *big.Int, g int32) bool
- func IsValidGAOrGB(value, prime *big.Int) bool
- func PadKeyTo256(key []byte) []byte
- func SerializeDecryptedMessage(msg DecryptedMessage, layer int32, inSeqNo, outSeqNo int32) ([]byte, error)
- func SerializeDecryptedMessageService(msg *DecryptedMessageService, layer int32, inSeqNo, outSeqNo int32) ([]byte, error)
- func VerifyFileFingerprint(key, iv []byte, fingerprint int32) bool
- type DH
- type DecryptedMessage
- type DecryptedMessageAction
- type DecryptedMessageActionAbortKey
- type DecryptedMessageActionAcceptKey
- type DecryptedMessageActionCommitKey
- type DecryptedMessageActionDeleteMessages
- type DecryptedMessageActionFlushHistory
- type DecryptedMessageActionNoop
- type DecryptedMessageActionNotifyLayer
- type DecryptedMessageActionReadMessages
- type DecryptedMessageActionRequestKey
- type DecryptedMessageActionResend
- type DecryptedMessageActionScreenshotMessages
- type DecryptedMessageActionSetMessageTTL
- type DecryptedMessageActionTyping
- type DecryptedMessageLayer
- type DecryptedMessageMedia
- type DecryptedMessageMediaContact
- type DecryptedMessageMediaDocument
- type DecryptedMessageMediaEmpty
- type DecryptedMessageMediaExternalDocument
- type DecryptedMessageMediaGeoPoint
- type DecryptedMessageMediaPhoto
- type DecryptedMessageMediaVenue
- type DecryptedMessageMediaVideo
- type DecryptedMessageMediaWebPage
- type DecryptedMessageObj
- type DecryptedMessageService
- type DocumentAttribute
- type DocumentAttributeAnimated
- type DocumentAttributeAudio
- type DocumentAttributeFilename
- type DocumentAttributeImageSize
- type DocumentAttributeSticker
- type DocumentAttributeVideo
- type EncryptedFileKey
- type FileLocation
- type FileLocationObj
- type FileLocationUnavailable
- type InputStickerSet
- type InputStickerSetEmpty
- type InputStickerSetShortName
- type MessageEntity
- type MessageEntityBlockquote
- type MessageEntityBold
- type MessageEntityBotCommand
- type MessageEntityCode
- type MessageEntityEmail
- type MessageEntityHashtag
- type MessageEntityItalic
- type MessageEntityMention
- type MessageEntityPre
- type MessageEntityStrike
- type MessageEntityTextURL
- type MessageEntityURL
- type MessageEntityUnderline
- type MessageEntityUnknown
- type PhotoCachedSize
- type PhotoSize
- type PhotoSizeEmpty
- type PhotoSizeObj
- type SecretChat
- func (chat *SecretChat) DecryptMessage(msgKey []byte, encrypted []byte) (plaintext []byte, err error)
- func (chat *SecretChat) EncryptMessage(plaintext []byte) (msgKey []byte, encrypted []byte, err error)
- func (chat *SecretChat) GetNextSeqNo() int32
- func (chat *SecretChat) ShouldRekey() bool
- func (chat *SecretChat) UpdateLayer(layer int32)
- type SecretChatManager
- func (m *SecretChatManager) AcceptSecretChat(chatID int32, accessHash int64, userID int64, adminID int64, gA []byte, ...) (*SecretChat, []byte, int64, error)
- func (m *SecretChatManager) Close(chatID int32)
- func (m *SecretChatManager) CompleteKeyExchange(chatID int32, gB []byte, fingerprint int64) error
- func (m *SecretChatManager) CreateSecretChat(chatID int32, userID int64, prime []byte, g int32) (*SecretChat, []byte, error)
- func (m *SecretChatManager) GetAllChats() []*SecretChat
- func (m *SecretChatManager) GetSecretChat(chatID int32) (*SecretChat, error)
- func (m *SecretChatManager) RemoveSecretChat(chatID int32)
- func (m *SecretChatManager) UpdateChatID(oldID, newID int32)
- type SendMessageAction
- type SendMessageCancelAction
- type SendMessageChooseContactAction
- type SendMessageGeoLocationAction
- type SendMessageRecordAudioAction
- type SendMessageRecordRoundAction
- type SendMessageRecordVideoAction
- type SendMessageTypingAction
- type SendMessageUploadAudioAction
- type SendMessageUploadDocumentAction
- type SendMessageUploadPhotoAction
- type SendMessageUploadRoundAction
- type SendMessageUploadVideoAction
Constants ¶
const ( CurrentLayer = 73 // MTProto Secret Chat Layer 73 MinLayer = 46 // Minimum supported layer )
const (
KeySize = 256 // 256 bytes = 2048 bits
)
Variables ¶
This section is empty.
Functions ¶
func ComputeKeyFingerprint ¶
ComputeKeyFingerprint computes the 64-bit fingerprint of a shared key Used for sanity checking during key exchange
func DecryptFile ¶
DecryptFile decrypts file data using AES-256-IGE with the provided key and IV
func EncryptFile ¶
EncryptFile encrypts file data using AES-256-IGE with the provided key and IV
func GenerateRandomID ¶
GenerateRandomID generates a random message ID
func IsSafePrime ¶
IsSafePrime checks if p is a safe 2048-bit prime and g generates the correct subgroup A safe prime p satisfies: p and (p-1)/2 are both prime, and 2^2047 < p < 2^2048
func IsValidGAOrGB ¶
IsValidGAOrGB validates that g_a or g_b is in the valid range Must be: 1 < g_a < p-1 and 2^{2048-64} < g_a < p - 2^{2048-64}
func PadKeyTo256 ¶
PadKeyTo256 pads a key with leading zeros to ensure it's exactly 256 bytes
func SerializeDecryptedMessage ¶
func SerializeDecryptedMessage(msg DecryptedMessage, layer int32, inSeqNo, outSeqNo int32) ([]byte, error)
SerializeDecryptedMessage serializes a DecryptedMessage for encryption It wraps the message in a DecryptedMessageLayer with the specified layer version
func SerializeDecryptedMessageService ¶
func SerializeDecryptedMessageService(msg *DecryptedMessageService, layer int32, inSeqNo, outSeqNo int32) ([]byte, error)
SerializeDecryptedMessageService serializes a DecryptedMessageService
func VerifyFileFingerprint ¶
VerifyFileFingerprint verifies the fingerprint of a file encryption key
Types ¶
type DH ¶
type DH struct {
Prime *big.Int
G int32
GA *big.Int // g^a mod p
GB *big.Int // g^b mod p
A *big.Int // private key (our secret)
}
DH holds Diffie-Hellman parameters
func (*DH) ComputeSharedKey ¶
ComputeSharedKey computes the shared key using the other party's public key
func (*DH) GenerateKey ¶
GenerateKey generates a random 2048-bit private key 'a' and computes g^a mod p
type DecryptedMessage ¶
===== DecryptedMessage (Latest: Layer 73) =====
type DecryptedMessageAction ¶
type DecryptedMessageActionAbortKey ¶
type DecryptedMessageActionAbortKey struct {
ExchangeID int64 // exchange_id:long
}
decryptedMessageActionAbortKey#dd05ec6b exchange_id:long = DecryptedMessageAction;
func (*DecryptedMessageActionAbortKey) CRC ¶
func (*DecryptedMessageActionAbortKey) CRC() uint32
func (*DecryptedMessageActionAbortKey) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionAbortKey) ImplementsDecryptedMessageAction()
type DecryptedMessageActionAcceptKey ¶
type DecryptedMessageActionAcceptKey struct {
ExchangeID int64 // exchange_id:long
GB []byte // g_b:bytes
KeyFingerprint int64 // key_fingerprint:long
}
decryptedMessageActionAcceptKey#6fe1735b exchange_id:long g_b:bytes key_fingerprint:long = DecryptedMessageAction;
func (*DecryptedMessageActionAcceptKey) CRC ¶
func (*DecryptedMessageActionAcceptKey) CRC() uint32
func (*DecryptedMessageActionAcceptKey) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionAcceptKey) ImplementsDecryptedMessageAction()
type DecryptedMessageActionCommitKey ¶
type DecryptedMessageActionCommitKey struct {
ExchangeID int64 // exchange_id:long
KeyFingerprint int64 // key_fingerprint:long
}
decryptedMessageActionCommitKey#ec2e0b9b exchange_id:long key_fingerprint:long = DecryptedMessageAction;
func (*DecryptedMessageActionCommitKey) CRC ¶
func (*DecryptedMessageActionCommitKey) CRC() uint32
func (*DecryptedMessageActionCommitKey) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionCommitKey) ImplementsDecryptedMessageAction()
type DecryptedMessageActionDeleteMessages ¶
type DecryptedMessageActionDeleteMessages struct {
RandomIDs []int64 // random_ids:Vector<long>
}
decryptedMessageActionDeleteMessages#65614304 random_ids:Vector<long> = DecryptedMessageAction;
func (*DecryptedMessageActionDeleteMessages) CRC ¶
func (*DecryptedMessageActionDeleteMessages) CRC() uint32
func (*DecryptedMessageActionDeleteMessages) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionDeleteMessages) ImplementsDecryptedMessageAction()
type DecryptedMessageActionFlushHistory ¶
type DecryptedMessageActionFlushHistory struct{}
decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction;
func (*DecryptedMessageActionFlushHistory) CRC ¶
func (*DecryptedMessageActionFlushHistory) CRC() uint32
func (*DecryptedMessageActionFlushHistory) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionFlushHistory) ImplementsDecryptedMessageAction()
type DecryptedMessageActionNoop ¶
type DecryptedMessageActionNoop struct{}
decryptedMessageActionNoop#a82fdd63 = DecryptedMessageAction;
func (*DecryptedMessageActionNoop) CRC ¶
func (*DecryptedMessageActionNoop) CRC() uint32
func (*DecryptedMessageActionNoop) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionNoop) ImplementsDecryptedMessageAction()
type DecryptedMessageActionNotifyLayer ¶
type DecryptedMessageActionNotifyLayer struct {
Layer int32 // layer:int
}
decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction;
func (*DecryptedMessageActionNotifyLayer) CRC ¶
func (*DecryptedMessageActionNotifyLayer) CRC() uint32
func (*DecryptedMessageActionNotifyLayer) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionNotifyLayer) ImplementsDecryptedMessageAction()
type DecryptedMessageActionReadMessages ¶
type DecryptedMessageActionReadMessages struct {
RandomIDs []int64 // random_ids:Vector<long>
}
decryptedMessageActionReadMessages#c4f40be random_ids:Vector<long> = DecryptedMessageAction;
func (*DecryptedMessageActionReadMessages) CRC ¶
func (*DecryptedMessageActionReadMessages) CRC() uint32
func (*DecryptedMessageActionReadMessages) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionReadMessages) ImplementsDecryptedMessageAction()
type DecryptedMessageActionRequestKey ¶
type DecryptedMessageActionRequestKey struct {
ExchangeID int64 // exchange_id:long
GA []byte // g_a:bytes
}
decryptedMessageActionRequestKey#f3c9611b exchange_id:long g_a:bytes = DecryptedMessageAction;
func (*DecryptedMessageActionRequestKey) CRC ¶
func (*DecryptedMessageActionRequestKey) CRC() uint32
func (*DecryptedMessageActionRequestKey) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionRequestKey) ImplementsDecryptedMessageAction()
type DecryptedMessageActionResend ¶
type DecryptedMessageActionResend struct {
StartSeqNo int32 // start_seq_no:int
EndSeqNo int32 // end_seq_no:int
}
decryptedMessageActionResend#511110b0 start_seq_no:int end_seq_no:int = DecryptedMessageAction;
func (*DecryptedMessageActionResend) CRC ¶
func (*DecryptedMessageActionResend) CRC() uint32
func (*DecryptedMessageActionResend) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionResend) ImplementsDecryptedMessageAction()
type DecryptedMessageActionScreenshotMessages ¶
type DecryptedMessageActionScreenshotMessages struct {
RandomIDs []int64 // random_ids:Vector<long>
}
decryptedMessageActionScreenshotMessages#8ac1f475 random_ids:Vector<long> = DecryptedMessageAction;
func (*DecryptedMessageActionScreenshotMessages) CRC ¶
func (*DecryptedMessageActionScreenshotMessages) CRC() uint32
func (*DecryptedMessageActionScreenshotMessages) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionScreenshotMessages) ImplementsDecryptedMessageAction()
type DecryptedMessageActionSetMessageTTL ¶
type DecryptedMessageActionSetMessageTTL struct {
TTLSeconds int32 // ttl_seconds:int
}
decryptedMessageActionSetMessageTTL#a1733aec ttl_seconds:int = DecryptedMessageAction;
func (*DecryptedMessageActionSetMessageTTL) CRC ¶
func (*DecryptedMessageActionSetMessageTTL) CRC() uint32
func (*DecryptedMessageActionSetMessageTTL) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionSetMessageTTL) ImplementsDecryptedMessageAction()
type DecryptedMessageActionTyping ¶
type DecryptedMessageActionTyping struct {
Action SendMessageAction // action:SendMessageAction
}
decryptedMessageActionTyping#ccb27641 action:SendMessageAction = DecryptedMessageAction;
func (*DecryptedMessageActionTyping) CRC ¶
func (*DecryptedMessageActionTyping) CRC() uint32
func (*DecryptedMessageActionTyping) ImplementsDecryptedMessageAction ¶
func (*DecryptedMessageActionTyping) ImplementsDecryptedMessageAction()
type DecryptedMessageLayer ¶
type DecryptedMessageLayer struct {
RandomBytes []byte // random_bytes:bytes
Layer int32 // layer:int
InSeqNo int32 // in_seq_no:int
OutSeqNo int32 // out_seq_no:int
Message DecryptedMessage // message:DecryptedMessage
}
decryptedMessageLayer#1be31789 random_bytes:bytes layer:int in_seq_no:int out_seq_no:int message:DecryptedMessage = DecryptedMessageLayer;
func DeserializeDecryptedMessage ¶
func DeserializeDecryptedMessage(data []byte) (*DecryptedMessageLayer, error)
DeserializeDecryptedMessage deserializes a DecryptedMessage from decrypted data
func (*DecryptedMessageLayer) CRC ¶
func (*DecryptedMessageLayer) CRC() uint32
type DecryptedMessageMedia ¶
type DecryptedMessageMediaContact ¶
type DecryptedMessageMediaContact struct {
PhoneNumber string // phone_number:string
FirstName string // first_name:string
LastName string // last_name:string
UserID int32 // user_id:int
}
decryptedMessageMediaContact#588a0a97 phone_number:string first_name:string last_name:string user_id:int = DecryptedMessageMedia;
func (*DecryptedMessageMediaContact) CRC ¶
func (*DecryptedMessageMediaContact) CRC() uint32
func (*DecryptedMessageMediaContact) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaContact) ImplementsDecryptedMessageMedia()
type DecryptedMessageMediaDocument ¶
type DecryptedMessageMediaDocument struct {
Thumb []byte // thumb:bytes
ThumbW int32 // thumb_w:int
ThumbH int32 // thumb_h:int
MimeType string // mime_type:string
Size int64 // size:long
Key []byte // key:bytes
Iv []byte // iv:bytes
Attributes []DocumentAttribute // attributes:Vector<DocumentAttribute>
Caption string // caption:string
}
decryptedMessageMediaDocument#6abd9782 thumb:bytes thumb_w:int thumb_h:int mime_type:string size:long key:bytes iv:bytes attributes:Vector<DocumentAttribute> caption:string = DecryptedMessageMedia; (Layer 143)
func (*DecryptedMessageMediaDocument) CRC ¶
func (*DecryptedMessageMediaDocument) CRC() uint32
func (*DecryptedMessageMediaDocument) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaDocument) ImplementsDecryptedMessageMedia()
type DecryptedMessageMediaEmpty ¶
type DecryptedMessageMediaEmpty struct{}
decryptedMessageMediaEmpty#89f5c4a = DecryptedMessageMedia;
func (*DecryptedMessageMediaEmpty) CRC ¶
func (*DecryptedMessageMediaEmpty) CRC() uint32
func (*DecryptedMessageMediaEmpty) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaEmpty) ImplementsDecryptedMessageMedia()
type DecryptedMessageMediaExternalDocument ¶
type DecryptedMessageMediaExternalDocument struct {
ID int64 // id:long
AccessHash int64 // access_hash:long
Date int32 // date:int
MimeType string // mime_type:string
Size int32 // size:int
Thumb PhotoSize // thumb:PhotoSize
DcID int32 // dc_id:int
Attributes []DocumentAttribute // attributes:Vector<DocumentAttribute>
}
decryptedMessageMediaExternalDocument#fa95b0dd id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector<DocumentAttribute> = DecryptedMessageMedia;
func (*DecryptedMessageMediaExternalDocument) CRC ¶
func (*DecryptedMessageMediaExternalDocument) CRC() uint32
func (*DecryptedMessageMediaExternalDocument) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaExternalDocument) ImplementsDecryptedMessageMedia()
type DecryptedMessageMediaGeoPoint ¶
decryptedMessageMediaGeoPoint#35480a59 lat:double long:double = DecryptedMessageMedia;
func (*DecryptedMessageMediaGeoPoint) CRC ¶
func (*DecryptedMessageMediaGeoPoint) CRC() uint32
func (*DecryptedMessageMediaGeoPoint) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaGeoPoint) ImplementsDecryptedMessageMedia()
type DecryptedMessageMediaPhoto ¶
type DecryptedMessageMediaPhoto struct {
Thumb []byte // thumb:bytes
ThumbW int32 // thumb_w:int
ThumbH int32 // thumb_h:int
W int32 // w:int
H int32 // h:int
Size int32 // size:int
Key []byte // key:bytes
Iv []byte // iv:bytes
Caption string // caption:string
}
decryptedMessageMediaPhoto#f1fa8d78 thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia;
func (*DecryptedMessageMediaPhoto) CRC ¶
func (*DecryptedMessageMediaPhoto) CRC() uint32
func (*DecryptedMessageMediaPhoto) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaPhoto) ImplementsDecryptedMessageMedia()
type DecryptedMessageMediaVenue ¶
type DecryptedMessageMediaVenue struct {
Lat float64 // lat:double
Long float64 // long:double
Title string // title:string
Address string // address:string
Provider string // provider:string
VenueID string // venue_id:string
}
decryptedMessageMediaVenue#8a0df56f lat:double long:double title:string address:string provider:string venue_id:string = DecryptedMessageMedia;
func (*DecryptedMessageMediaVenue) CRC ¶
func (*DecryptedMessageMediaVenue) CRC() uint32
func (*DecryptedMessageMediaVenue) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaVenue) ImplementsDecryptedMessageMedia()
type DecryptedMessageMediaVideo ¶
type DecryptedMessageMediaVideo struct {
Thumb []byte // thumb:bytes
ThumbW int32 // thumb_w:int
ThumbH int32 // thumb_h:int
Duration int32 // duration:int
MimeType string // mime_type:string
W int32 // w:int
H int32 // h:int
Size int32 // size:int
Key []byte // key:bytes
Iv []byte // iv:bytes
Caption string // caption:string
}
decryptedMessageMediaVideo#970c8c0e thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia;
func (*DecryptedMessageMediaVideo) CRC ¶
func (*DecryptedMessageMediaVideo) CRC() uint32
func (*DecryptedMessageMediaVideo) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaVideo) ImplementsDecryptedMessageMedia()
type DecryptedMessageMediaWebPage ¶
type DecryptedMessageMediaWebPage struct {
URL string // url:string
}
decryptedMessageMediaWebPage#e50511d8 url:string = DecryptedMessageMedia;
func (*DecryptedMessageMediaWebPage) CRC ¶
func (*DecryptedMessageMediaWebPage) CRC() uint32
func (*DecryptedMessageMediaWebPage) ImplementsDecryptedMessageMedia ¶
func (*DecryptedMessageMediaWebPage) ImplementsDecryptedMessageMedia()
type DecryptedMessageObj ¶
type DecryptedMessageObj struct {
NoWebpage bool `tl:"flag:1,encoded_in_bitflags"`
Silent bool `tl:"flag:5,encoded_in_bitflags"`
RandomID int64 // random_id:long
TTL int32 // ttl:int
Message string // message:string
Media DecryptedMessageMedia `tl:"flag:9"` // media:flags.9?DecryptedMessageMedia
Entities []MessageEntity `tl:"flag:7"` // entities:flags.7?Vector<MessageEntity>
ViaBotName string `tl:"flag:11"` // via_bot_name:flags.11?string
ReplyToRandomID int64 `tl:"flag:3"` // reply_to_random_id:flags.3?long
GroupedID int64 `tl:"flag:17"` // grouped_id:flags.17?long
}
decryptedMessage#91cc4674 flags:# no_webpage:flags.1?true silent:flags.5?true random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector<MessageEntity> via_bot_name:flags.11?string reply_to_random_id:flags.3?long grouped_id:flags.17?long = DecryptedMessage;
func (*DecryptedMessageObj) CRC ¶
func (*DecryptedMessageObj) CRC() uint32
func (*DecryptedMessageObj) FlagIndex ¶
func (*DecryptedMessageObj) FlagIndex() int
func (*DecryptedMessageObj) ImplementsDecryptedMessage ¶
func (*DecryptedMessageObj) ImplementsDecryptedMessage()
type DecryptedMessageService ¶
type DecryptedMessageService struct {
RandomID int64 // random_id:long
Action DecryptedMessageAction // action:DecryptedMessageAction
}
decryptedMessageService#73164160 random_id:long action:DecryptedMessageAction = DecryptedMessage;
func (*DecryptedMessageService) CRC ¶
func (*DecryptedMessageService) CRC() uint32
func (*DecryptedMessageService) ImplementsDecryptedMessage ¶
func (*DecryptedMessageService) ImplementsDecryptedMessage()
type DocumentAttribute ¶
type DocumentAttributeAnimated ¶
type DocumentAttributeAnimated struct{}
documentAttributeAnimated#11b58939 = DocumentAttribute;
func (*DocumentAttributeAnimated) CRC ¶
func (*DocumentAttributeAnimated) CRC() uint32
func (*DocumentAttributeAnimated) ImplementsDocumentAttribute ¶
func (*DocumentAttributeAnimated) ImplementsDocumentAttribute()
type DocumentAttributeAudio ¶
type DocumentAttributeAudio struct {
Voice bool `tl:"flag:10,encoded_in_bitflags"` // voice:flags.10?true
Duration int32 // duration:int
Title string `tl:"flag:0"` // title:flags.0?string
Performer string `tl:"flag:1"` // performer:flags.1?string
Waveform []byte `tl:"flag:2"` // waveform:flags.2?bytes
}
documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; (Layer 46)
func (*DocumentAttributeAudio) CRC ¶
func (*DocumentAttributeAudio) CRC() uint32
func (*DocumentAttributeAudio) FlagIndex ¶
func (*DocumentAttributeAudio) FlagIndex() int
func (*DocumentAttributeAudio) ImplementsDocumentAttribute ¶
func (*DocumentAttributeAudio) ImplementsDocumentAttribute()
type DocumentAttributeFilename ¶
type DocumentAttributeFilename struct {
FileName string // file_name:string
}
documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
func (*DocumentAttributeFilename) CRC ¶
func (*DocumentAttributeFilename) CRC() uint32
func (*DocumentAttributeFilename) ImplementsDocumentAttribute ¶
func (*DocumentAttributeFilename) ImplementsDocumentAttribute()
type DocumentAttributeImageSize ¶
documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
func (*DocumentAttributeImageSize) CRC ¶
func (*DocumentAttributeImageSize) CRC() uint32
func (*DocumentAttributeImageSize) ImplementsDocumentAttribute ¶
func (*DocumentAttributeImageSize) ImplementsDocumentAttribute()
type DocumentAttributeSticker ¶
type DocumentAttributeSticker struct {
Alt string // alt:string
Stickerset InputStickerSet // stickerset:InputStickerSet
}
documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute;
func (*DocumentAttributeSticker) CRC ¶
func (*DocumentAttributeSticker) CRC() uint32
func (*DocumentAttributeSticker) ImplementsDocumentAttribute ¶
func (*DocumentAttributeSticker) ImplementsDocumentAttribute()
type DocumentAttributeVideo ¶
type DocumentAttributeVideo struct {
RoundMessage bool `tl:"flag:0,encoded_in_bitflags"` // round_message:flags.0?true
Duration int32 // duration:int
W int32 // w:int
H int32 // h:int
}
documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; (Layer 66)
func (*DocumentAttributeVideo) CRC ¶
func (*DocumentAttributeVideo) CRC() uint32
func (*DocumentAttributeVideo) FlagIndex ¶
func (*DocumentAttributeVideo) FlagIndex() int
func (*DocumentAttributeVideo) ImplementsDocumentAttribute ¶
func (*DocumentAttributeVideo) ImplementsDocumentAttribute()
type EncryptedFileKey ¶
type EncryptedFileKey struct {
Key []byte // 256-bit AES key
IV []byte // 256-bit initialization vector
Fingerprint int32 // 32-bit key fingerprint
}
EncryptedFileKey holds the encryption parameters for a file
func GenerateFileEncryptionKey ¶
func GenerateFileEncryptionKey() (*EncryptedFileKey, error)
GenerateFileEncryptionKey generates a random key and IV for file encryption Returns key, IV, and fingerprint
type FileLocation ¶
type FileLocationObj ¶
type FileLocationObj struct {
DcID int32 // dc_id:int
VolumeID int64 // volume_id:long
LocalID int32 // local_id:int
Secret int64 // secret:long
}
fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;
func (*FileLocationObj) CRC ¶
func (*FileLocationObj) CRC() uint32
func (*FileLocationObj) ImplementsFileLocation ¶
func (*FileLocationObj) ImplementsFileLocation()
type FileLocationUnavailable ¶
type FileLocationUnavailable struct {
}
fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation;
func (*FileLocationUnavailable) CRC ¶
func (*FileLocationUnavailable) CRC() uint32
func (*FileLocationUnavailable) ImplementsFileLocation ¶
func (*FileLocationUnavailable) ImplementsFileLocation()
type InputStickerSet ¶
type InputStickerSetEmpty ¶
type InputStickerSetEmpty struct{}
inputStickerSetEmpty#ffb62b95 = InputStickerSet;
func (*InputStickerSetEmpty) CRC ¶
func (*InputStickerSetEmpty) CRC() uint32
func (*InputStickerSetEmpty) ImplementsInputStickerSet ¶
func (*InputStickerSetEmpty) ImplementsInputStickerSet()
type InputStickerSetShortName ¶
type InputStickerSetShortName struct {
ShortName string // short_name:string
}
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
func (*InputStickerSetShortName) CRC ¶
func (*InputStickerSetShortName) CRC() uint32
func (*InputStickerSetShortName) ImplementsInputStickerSet ¶
func (*InputStickerSetShortName) ImplementsInputStickerSet()
type MessageEntity ¶
type MessageEntityBlockquote ¶
messageEntityBlockquote#20df5d0 offset:int length:int = MessageEntity;
func (*MessageEntityBlockquote) CRC ¶
func (*MessageEntityBlockquote) CRC() uint32
func (*MessageEntityBlockquote) ImplementsMessageEntity ¶
func (*MessageEntityBlockquote) ImplementsMessageEntity()
type MessageEntityBold ¶
messageEntityBold#bd610bc9 offset:int length:int = MessageEntity;
func (*MessageEntityBold) CRC ¶
func (*MessageEntityBold) CRC() uint32
func (*MessageEntityBold) ImplementsMessageEntity ¶
func (*MessageEntityBold) ImplementsMessageEntity()
type MessageEntityBotCommand ¶
messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity;
func (*MessageEntityBotCommand) CRC ¶
func (*MessageEntityBotCommand) CRC() uint32
func (*MessageEntityBotCommand) ImplementsMessageEntity ¶
func (*MessageEntityBotCommand) ImplementsMessageEntity()
type MessageEntityCode ¶
messageEntityCode#28a20571 offset:int length:int = MessageEntity;
func (*MessageEntityCode) CRC ¶
func (*MessageEntityCode) CRC() uint32
func (*MessageEntityCode) ImplementsMessageEntity ¶
func (*MessageEntityCode) ImplementsMessageEntity()
type MessageEntityEmail ¶
messageEntityEmail#64e475c2 offset:int length:int = MessageEntity;
func (*MessageEntityEmail) CRC ¶
func (*MessageEntityEmail) CRC() uint32
func (*MessageEntityEmail) ImplementsMessageEntity ¶
func (*MessageEntityEmail) ImplementsMessageEntity()
type MessageEntityHashtag ¶
messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity;
func (*MessageEntityHashtag) CRC ¶
func (*MessageEntityHashtag) CRC() uint32
func (*MessageEntityHashtag) ImplementsMessageEntity ¶
func (*MessageEntityHashtag) ImplementsMessageEntity()
type MessageEntityItalic ¶
messageEntityItalic#826f8b60 offset:int length:int = MessageEntity;
func (*MessageEntityItalic) CRC ¶
func (*MessageEntityItalic) CRC() uint32
func (*MessageEntityItalic) ImplementsMessageEntity ¶
func (*MessageEntityItalic) ImplementsMessageEntity()
type MessageEntityMention ¶
messageEntityMention#fa04579d offset:int length:int = MessageEntity;
func (*MessageEntityMention) CRC ¶
func (*MessageEntityMention) CRC() uint32
func (*MessageEntityMention) ImplementsMessageEntity ¶
func (*MessageEntityMention) ImplementsMessageEntity()
type MessageEntityPre ¶
type MessageEntityPre struct {
Offset int32 // offset:int
Length int32 // length:int
Language string // language:string
}
messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity;
func (*MessageEntityPre) CRC ¶
func (*MessageEntityPre) CRC() uint32
func (*MessageEntityPre) ImplementsMessageEntity ¶
func (*MessageEntityPre) ImplementsMessageEntity()
type MessageEntityStrike ¶
messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity;
func (*MessageEntityStrike) CRC ¶
func (*MessageEntityStrike) CRC() uint32
func (*MessageEntityStrike) ImplementsMessageEntity ¶
func (*MessageEntityStrike) ImplementsMessageEntity()
type MessageEntityTextURL ¶
type MessageEntityTextURL struct {
Offset int32 // offset:int
Length int32 // length:int
URL string // url:string
}
messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;
func (*MessageEntityTextURL) CRC ¶
func (*MessageEntityTextURL) CRC() uint32
func (*MessageEntityTextURL) ImplementsMessageEntity ¶
func (*MessageEntityTextURL) ImplementsMessageEntity()
type MessageEntityURL ¶
messageEntityUrl#6ed02538 offset:int length:int = MessageEntity;
func (*MessageEntityURL) CRC ¶
func (*MessageEntityURL) CRC() uint32
func (*MessageEntityURL) ImplementsMessageEntity ¶
func (*MessageEntityURL) ImplementsMessageEntity()
type MessageEntityUnderline ¶
messageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity;
func (*MessageEntityUnderline) CRC ¶
func (*MessageEntityUnderline) CRC() uint32
func (*MessageEntityUnderline) ImplementsMessageEntity ¶
func (*MessageEntityUnderline) ImplementsMessageEntity()
type MessageEntityUnknown ¶
messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity;
func (*MessageEntityUnknown) CRC ¶
func (*MessageEntityUnknown) CRC() uint32
func (*MessageEntityUnknown) ImplementsMessageEntity ¶
func (*MessageEntityUnknown) ImplementsMessageEntity()
type PhotoCachedSize ¶
type PhotoCachedSize struct {
Type string // type:string
Location FileLocation // location:FileLocation
W int32 // w:int
H int32 // h:int
Bytes []byte // bytes:bytes
}
photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
func (*PhotoCachedSize) CRC ¶
func (*PhotoCachedSize) CRC() uint32
func (*PhotoCachedSize) ImplementsPhotoSize ¶
func (*PhotoCachedSize) ImplementsPhotoSize()
type PhotoSizeEmpty ¶
type PhotoSizeEmpty struct {
Type string // type:string
}
photoSizeEmpty#e17e23c type:string = PhotoSize;
func (*PhotoSizeEmpty) CRC ¶
func (*PhotoSizeEmpty) CRC() uint32
func (*PhotoSizeEmpty) ImplementsPhotoSize ¶
func (*PhotoSizeEmpty) ImplementsPhotoSize()
type PhotoSizeObj ¶
type PhotoSizeObj struct {
Type string // type:string
Location FileLocation // location:FileLocation
W int32 // w:int
H int32 // h:int
Size int32 // size:int
}
photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
func (*PhotoSizeObj) CRC ¶
func (*PhotoSizeObj) CRC() uint32
func (*PhotoSizeObj) ImplementsPhotoSize ¶
func (*PhotoSizeObj) ImplementsPhotoSize()
type SecretChat ¶
type SecretChat struct {
ID int32
AccessHash int64
UserID int64
AdminID int64
KeyFingerprint int64
Layer int32 // Remote party's layer
InSeqNo int32 // Incoming sequence number
OutSeqNo int32 // Outgoing sequence number
TTL int32 // Default TTL for messages
IsOriginator bool // Whether we initiated the chat
State string // "requested", "accepted", "ready"
DH *DH // Diffie-Hellman instance
CreatedAt time.Time
LastMessageTime time.Time
// Perfect Forward Secrecy
MessageCount int32 // Messages encrypted with current key
KeyCreatedAt time.Time // When current key was created
PendingRekey bool // Whether rekey is in progress
// contains filtered or unexported fields
}
SecretChat represents an active secret chat session
func (*SecretChat) DecryptMessage ¶
func (chat *SecretChat) DecryptMessage(msgKey []byte, encrypted []byte) (plaintext []byte, err error)
DecryptMessage decrypts a message from a secret chat
func (*SecretChat) EncryptMessage ¶
func (chat *SecretChat) EncryptMessage(plaintext []byte) (msgKey []byte, encrypted []byte, err error)
EncryptMessage encrypts a message for a secret chat
func (*SecretChat) GetNextSeqNo ¶
func (chat *SecretChat) GetNextSeqNo() int32
GetNextSeqNo returns the next outgoing sequence number
func (*SecretChat) ShouldRekey ¶
func (chat *SecretChat) ShouldRekey() bool
ShouldRekey determines if we should initiate rekeying Rekey if: more than 100 messages OR key older than 1 week (and at least 1 message sent)
func (*SecretChat) UpdateLayer ¶
func (chat *SecretChat) UpdateLayer(layer int32)
UpdateLayer updates the remote party's layer
type SecretChatManager ¶
type SecretChatManager struct {
// contains filtered or unexported fields
}
SecretChatManager manages all secret chats
func NewSecretChatManager ¶
func NewSecretChatManager() *SecretChatManager
NewSecretChatManager creates a new secret chat manager
func (*SecretChatManager) AcceptSecretChat ¶
func (m *SecretChatManager) AcceptSecretChat(chatID int32, accessHash int64, userID int64, adminID int64, gA []byte, prime []byte, g int32) (*SecretChat, []byte, int64, error)
AcceptSecretChat accepts a secret chat request (as responder)
func (*SecretChatManager) Close ¶
func (m *SecretChatManager) Close(chatID int32)
Close closes a secret chat
func (*SecretChatManager) CompleteKeyExchange ¶
func (m *SecretChatManager) CompleteKeyExchange(chatID int32, gB []byte, fingerprint int64) error
CompleteKeyExchange completes the key exchange (for originator after receiving g_b)
func (*SecretChatManager) CreateSecretChat ¶
func (m *SecretChatManager) CreateSecretChat(chatID int32, userID int64, prime []byte, g int32) (*SecretChat, []byte, error)
CreateSecretChat creates a new secret chat (as originator)
func (*SecretChatManager) GetAllChats ¶
func (m *SecretChatManager) GetAllChats() []*SecretChat
GetAllChats returns all active secret chats
func (*SecretChatManager) GetSecretChat ¶
func (m *SecretChatManager) GetSecretChat(chatID int32) (*SecretChat, error)
GetSecretChat retrieves a secret chat by ID
func (*SecretChatManager) RemoveSecretChat ¶
func (m *SecretChatManager) RemoveSecretChat(chatID int32)
RemoveSecretChat removes a secret chat
func (*SecretChatManager) UpdateChatID ¶
func (m *SecretChatManager) UpdateChatID(oldID, newID int32)
UpdateChatID updates a chat's ID (used when server assigns actual ID)
type SendMessageAction ¶
type SendMessageCancelAction ¶
type SendMessageCancelAction struct{}
sendMessageCancelAction#fd5ec8f5 = SendMessageAction;
func (*SendMessageCancelAction) CRC ¶
func (*SendMessageCancelAction) CRC() uint32
func (*SendMessageCancelAction) ImplementsSendMessageAction ¶
func (*SendMessageCancelAction) ImplementsSendMessageAction()
type SendMessageChooseContactAction ¶
type SendMessageChooseContactAction struct{}
sendMessageChooseContactAction#628cbc6f = SendMessageAction;
func (*SendMessageChooseContactAction) CRC ¶
func (*SendMessageChooseContactAction) CRC() uint32
func (*SendMessageChooseContactAction) ImplementsSendMessageAction ¶
func (*SendMessageChooseContactAction) ImplementsSendMessageAction()
type SendMessageGeoLocationAction ¶
type SendMessageGeoLocationAction struct{}
sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
func (*SendMessageGeoLocationAction) CRC ¶
func (*SendMessageGeoLocationAction) CRC() uint32
func (*SendMessageGeoLocationAction) ImplementsSendMessageAction ¶
func (*SendMessageGeoLocationAction) ImplementsSendMessageAction()
type SendMessageRecordAudioAction ¶
type SendMessageRecordAudioAction struct{}
sendMessageRecordAudioAction#d52f73f7 = SendMessageAction;
func (*SendMessageRecordAudioAction) CRC ¶
func (*SendMessageRecordAudioAction) CRC() uint32
func (*SendMessageRecordAudioAction) ImplementsSendMessageAction ¶
func (*SendMessageRecordAudioAction) ImplementsSendMessageAction()
type SendMessageRecordRoundAction ¶
type SendMessageRecordRoundAction struct{}
sendMessageRecordRoundAction#88f27fbc = SendMessageAction; (Layer 66)
func (*SendMessageRecordRoundAction) CRC ¶
func (*SendMessageRecordRoundAction) CRC() uint32
func (*SendMessageRecordRoundAction) ImplementsSendMessageAction ¶
func (*SendMessageRecordRoundAction) ImplementsSendMessageAction()
type SendMessageRecordVideoAction ¶
type SendMessageRecordVideoAction struct{}
sendMessageRecordVideoAction#a187d66f = SendMessageAction;
func (*SendMessageRecordVideoAction) CRC ¶
func (*SendMessageRecordVideoAction) CRC() uint32
func (*SendMessageRecordVideoAction) ImplementsSendMessageAction ¶
func (*SendMessageRecordVideoAction) ImplementsSendMessageAction()
type SendMessageTypingAction ¶
type SendMessageTypingAction struct{}
sendMessageTypingAction#16bf744e = SendMessageAction;
func (*SendMessageTypingAction) CRC ¶
func (*SendMessageTypingAction) CRC() uint32
func (*SendMessageTypingAction) ImplementsSendMessageAction ¶
func (*SendMessageTypingAction) ImplementsSendMessageAction()
type SendMessageUploadAudioAction ¶
type SendMessageUploadAudioAction struct{}
sendMessageUploadAudioAction#e6ac8a6f = SendMessageAction;
func (*SendMessageUploadAudioAction) CRC ¶
func (*SendMessageUploadAudioAction) CRC() uint32
func (*SendMessageUploadAudioAction) ImplementsSendMessageAction ¶
func (*SendMessageUploadAudioAction) ImplementsSendMessageAction()
type SendMessageUploadDocumentAction ¶
type SendMessageUploadDocumentAction struct{}
sendMessageUploadDocumentAction#8faee98e = SendMessageAction;
func (*SendMessageUploadDocumentAction) CRC ¶
func (*SendMessageUploadDocumentAction) CRC() uint32
func (*SendMessageUploadDocumentAction) ImplementsSendMessageAction ¶
func (*SendMessageUploadDocumentAction) ImplementsSendMessageAction()
type SendMessageUploadPhotoAction ¶
type SendMessageUploadPhotoAction struct{}
sendMessageUploadPhotoAction#990a3c1a = SendMessageAction;
func (*SendMessageUploadPhotoAction) CRC ¶
func (*SendMessageUploadPhotoAction) CRC() uint32
func (*SendMessageUploadPhotoAction) ImplementsSendMessageAction ¶
func (*SendMessageUploadPhotoAction) ImplementsSendMessageAction()
type SendMessageUploadRoundAction ¶
type SendMessageUploadRoundAction struct{}
sendMessageUploadRoundAction#bb718624 = SendMessageAction; (Layer 66)
func (*SendMessageUploadRoundAction) CRC ¶
func (*SendMessageUploadRoundAction) CRC() uint32
func (*SendMessageUploadRoundAction) ImplementsSendMessageAction ¶
func (*SendMessageUploadRoundAction) ImplementsSendMessageAction()
type SendMessageUploadVideoAction ¶
type SendMessageUploadVideoAction struct{}
sendMessageUploadVideoAction#92042ff7 = SendMessageAction;
func (*SendMessageUploadVideoAction) CRC ¶
func (*SendMessageUploadVideoAction) CRC() uint32
func (*SendMessageUploadVideoAction) ImplementsSendMessageAction ¶
func (*SendMessageUploadVideoAction) ImplementsSendMessageAction()