Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSessionNotFound = errors.New("session not found") ErrPathNotFound = "file not found" ErrFileNotExists = "no such file or directory" ErrNotImplementedInJS = "not implemented in js environment" )
View Source
var (
ErrInvalidSession = errors.New("the session string is invalid/has been tampered with")
)
Functions ¶
This section is empty.
Types ¶
type Session ¶
Session is a basic data of specific session. Typically, session stores default hostname of mtproto server (cause all accounts ties to specific server after sign in), session key, server hash and salt.
type SessionLoader ¶
type SessionLoader interface {
Load() (*Session, error)
Store(*Session) error
Path() string
Key() string
Delete() error
Exists() bool
}
SessionLoader is the interface which allows you to access sessions from different storages (like filesystem, database, s3 storage, etc.)
func NewFromFile ¶
func NewFromFile(path string, authAesKey string) SessionLoader
func NewInMemory ¶
func NewInMemory() SessionLoader
type StringSession ¶
type StringSession struct {
AuthKey []byte `json:"key,omitempty"` // AUTH_KEY
AuthKeyHash []byte `json:"hash,omitempty"` // AUTH_KEY_HASH
DcID int `json:"dc_id,omitempty"` // DC ID
IpAddr string `json:"ip_addr,omitempty"` // IP address of DC
AppID int32 `json:"app_id,omitempty"` // APP_ID
}
func NewEmptyStringSession ¶
func NewEmptyStringSession() *StringSession
func NewStringSession ¶
func NewStringSession(authKey, authKeyHash []byte, dcID int, ipAddr string, appID int32) *StringSession
func (*StringSession) Decode ¶
func (s *StringSession) Decode(encoded string) error
func (*StringSession) Encode ¶
func (s *StringSession) Encode() string
Click to show internal directories.
Click to hide internal directories.