sessionMaker

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePyrogramSession

func DecodePyrogramSession(hx string) (*session.Data, error)

Types

type AuthKey

type AuthKey struct {
	Value Key
	ID    [8]byte
}

AuthKey is a Key with cached id.

type Key

type Key [256]byte

func (Key) ID

func (k Key) ID() [8]byte

ID returns auth_key_id.

func (Key) WithID

func (k Key) WithID() AuthKey

WithID creates new AuthKey from Key.

type NewSessionOpts

type NewSessionOpts struct {
	SessionName string
	SessionPath string
}

NewSessionOpts is the options for creating a new session.

type SessionName

type SessionName struct {
	Name        string
	FileName    string
	Path        string
	SessionType SessionType
	Data        []byte
	Err         error
}

SessionName object consists of name and SessionType.

func NewSession

func NewSession(sessionName string, sessionType SessionType, newSessionOpts ...NewSessionOpts) *SessionName

NewSession creates a new session with provided name string and SessionType.

func (*SessionName) GetData

func (s *SessionName) GetData() ([]byte, error)

GetData is used for retrieving session data.

func (*SessionName) GetName

func (s *SessionName) GetName() string

GetName is used for retrieving the name of the session.

func (*SessionName) OptimizeSessionData added in v1.1.4

func (s *SessionName) OptimizeSessionData() ([]byte, error)

OptimizeSessionData optimizes session data based on the session type.

type SessionStorage

type SessionStorage struct {
	Session *SessionName
	// contains filtered or unexported fields
}

SessionStorage implements SessionStorage for file system as file stored in Path.

func (*SessionStorage) LoadSession

func (f *SessionStorage) LoadSession(_ context.Context) ([]byte, error)

LoadSession loads session from file.

func (*SessionStorage) StoreSession

func (f *SessionStorage) StoreSession(_ context.Context, data []byte) error

StoreSession stores session to sqlite storage.

type SessionType

type SessionType int

SessionType is the type of session you want to log in through.

const (
	// Session should be used for authorizing into session with default settings.
	Session SessionType = iota
	// StringSession is used as SessionType when you want to log in through the string session made by gotgproto.
	StringSession
	// TelethonSession is used as SessionType when you want to log in through the string session made by telethon - a Python MTProto library.
	TelethonSession
	// PyrogramSession is used as SessionType when you want to log in through the string session made by pyrogram - a Python MTProto library.
	PyrogramSession
	// TDataSession is used as SessionType when you want to log in through the string session made by Telegram Client - a C++ MTProto library.
	TDataSession
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL