package session

Import Path
	github.com/gotd/td/session (on go.dev)

Dependency Relation
	imports 14 packages, and imported by one package

Involved Source Files Package session implements session storage. storage_file.go storage_mem.go tdesktop.go telethon.go
Package-Level Type Names (total 7, in which 6 are exported)
/* sort exporteds by: | */
Config is subset of tg.Config. Indicates that telegram is probably censored by governments/ISPs in the current region DC IP list Domain name for fetching encrypted DC list from DNS TXT record Current date at the server Expiration date of this config: when it expires it'll have to be refetched using help getConfig¹ Links: 1) https://core.telegram.org/method/help.getConfig Whether to forcefully try connecting using IPv6 dcOptions¹ Links: 1) https://core.telegram.org/type/DcOption Whether we're connected to the test DCs ID of the DC that returned the reply Temporary passport¹ sessions Links: 1) https://core.telegram.org/passport Use SetTmpSessions and GetTmpSessions helpers. DC ID to use to download webfiles¹ Links: 1) https://core.telegram.org/api/files#downloading-webfiles TG returns tg.Config from Config. Note that config is the subset of tg.Config, so some fields will be unset. func ConfigFromTG(c tg.Config) Config
Data of session. Addr string AuthKey []byte AuthKeyID []byte Config Config DC int Salt int64 func TDesktopSession(account tdesktop.Account) (*Data, error) func TelethonSession(hx string) (*Data, error) func (*Loader).Load(ctx context.Context) (*Data, error) func (*Loader).Save(ctx context.Context, data *Data) error
FileStorage implements SessionStorage for file system as file stored in Path. Path string LoadSession loads session from file. StoreSession stores session to file. *FileStorage : Storage
Loader wraps Storage implementing Data (un-)marshaling. Storage Storage Load loads Data from Storage. Save saves Data to Storage.
Storage is secure persistent storage for client session. NB: Implementation security is important, attacker can abuse it not only for connecting as authenticated user or bot, but even decrypting previous messages in some situations. ( Storage) LoadSession(ctx context.Context) ([]byte, error) ( Storage) StoreSession(ctx context.Context, data []byte) error *FileStorage *StorageMemory
StorageMemory implements in-memory session storage. Goroutine-safe. Bytes appends raw session data to the given slice. Returns ErrNotFound if storage is nil or if underlying session is empty. Clone creates a clone of existing StorageMemory, Dump dumps raw session data to the given writer. Returns ErrNotFound if storage is nil or if underlying session is empty. LoadSession loads session from memory. StoreSession stores session to memory. WriteFile dumps raw session data to the named file, creating it if necessary. Returns ErrNotFound if storage is nil or if underlying session is empty. *StorageMemory : Storage func (*StorageMemory).Clone() *StorageMemory
Package-Level Functions (total 6, in which 3 are exported)
ConfigFromTG converts tg.Config to Config. Note that Config is the subset of tg.Config, so data loss is possible.
TDesktopSession converts TDesktop's Account to Data.
TelethonSession decodes Telethon's StringSession string to the Data. Notice that Telethon does not save tg.Config and server salt. See https://docs.telethon.dev/en/latest/modules/sessions.html#telethon.sessions.string.StringSession. See https://github.com/LonamiWebs/Telethon/blob/master/telethon/sessions/string.py#L29-L46.
Package-Level Variables (only one, which is exported)
ErrNotFound means that session is not found in storage.
Package-Level Constants (total 2, neither is exported)