sessionMaker

package
v1.0.0-my-beta21 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InMemorySessionName = ":memory:"
)

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 SessionName

type SessionName struct {
	// contains filtered or unexported fields
}

SessionName object consists of name and SessionType.

func NewInMemorySession

func NewInMemorySession(sessionName string, sessionType SessionType) *SessionName

NewInMemorySession Used for create Session with in memory type

func NewSession

func NewSession(sessionName string, sessionType SessionType) *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 through provided SessionName type.

func (*SessionName) GetName

func (s *SessionName) GetName() string

GetName is used for retrieving name of the session.

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. It consists of three types: Session, StringSession, TelethonSession.

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
)

Jump to

Keyboard shortcuts

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