Source File
encrypted_message.go
Belonging Package
github.com/gotd/td/internal/crypto
package crypto
import
// EncryptedMessage of protocol.
type EncryptedMessage struct {
AuthKeyID [8]byte
MsgKey bin.Int128
EncryptedData []byte
}
// Decode implements bin.Decoder.
func ( *EncryptedMessage) ( *bin.Buffer) error {
if := .ConsumeN(.AuthKeyID[:], 8); != nil {
return
}
{
, := .Int128()
if != nil {
return
}
.MsgKey =
}
// Consuming the rest of the buffer.
.EncryptedData = append(.EncryptedData[:0], make([]byte, .Len())...)
if := .ConsumeN(.EncryptedData, .Len()); != nil {
return
}
return nil
}
// DecodeWithoutCopy is like Decode, but EncryptedData references to given buffer instead of
// copying.
func ( *EncryptedMessage) ( *bin.Buffer) error {
if := .ConsumeN(.AuthKeyID[:], 8); != nil {
return
}
{
, := .Int128()
if != nil {
return
}
.MsgKey =
}
// Consuming the rest of the buffer.
.EncryptedData = .Buf
return nil
}
// Encode implements bin.Encoder.
func ( EncryptedMessage) ( *bin.Buffer) error {
.Put(.AuthKeyID[:])
.PutInt128(.MsgKey)
.Put(.EncryptedData)
return nil
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |