Documentation ¶
Overview ¶
Package tdesktop contains Telegram Desktop session decoder.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrKeyInfoDecrypt = errors.New("key data decrypt")
ErrKeyInfoDecrypt is returned when key data decrypt fails. It can happen if passed passcode is wrong.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { // IDx is an internal Telegram Desktop account ID. IDx uint32 // Authorization contains Telegram user and MTProto sessions. Authorization MTPAuthorization }
Account is a Telegram user account representation in Telegram Desktop storage.
func Read ¶
Read reads accounts info from given Telegram Desktop tdata root. Shorthand for:
ReadFS(os.DirFS(root), passcode)
Example ¶
package main import ( "fmt" "os" "path/filepath" "github.com/gotd/td/session/tdesktop" ) func main() { home, err := os.UserHomeDir() if err != nil { panic(err) } root := filepath.Join(home, "Downloads", "Telegram", "tdata") accounts, err := tdesktop.Read(root, nil) if err != nil { panic(err) } for _, account := range accounts { a := account.Authorization fmt.Println(a.UserID, a.MainDC) } }
Output:
type MTPAuthorization ¶
type MTPAuthorization struct { // UserID is a Telegram user ID. UserID int64 // MainDC is a main DC ID of this user. MainDC int // Key is a map of keys per DC ID. Keys map[int]crypto.Key // DC ID -> Key }
MTPAuthorization is a Telegram Desktop storage structure which stores MTProto session info.
type WrongMagicError ¶
type WrongMagicError struct {
Magic [4]byte
}
WrongMagicError is returned when tdesktop data file has wrong magic header.
Click to show internal directories.
Click to hide internal directories.