auth_session

package
v0.0.0-...-e41513e Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

salt cache

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBySalt

func CheckBySalt(keyId, salt int64) bool

Server Salt

A (random) 64-bit number periodically (say, every 24 hours) changed (separately for each session) at the request of the server. All subsequent messages must contain the new salt (although, messages with the old salt are still accepted for a further 300 seconds). Required to protect against replay attacks and certain tricks associated with adjusting the client clock to a moment in the distant future.

func GetOrInsertSalt

func GetOrInsertSalt(keyId int64) (int64, error)

func GetOrInsertSaltList

func GetOrInsertSaltList(keyId int64, size int) ([]*mtproto.TLFutureSalt, error)

Types

type AuthSessionModel

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

func NewAuthSessionModel

func NewAuthSessionModel(dbName, redisName string) *AuthSessionModel

func (*AuthSessionModel) BindAuthKeyUser

func (m *AuthSessionModel) BindAuthKeyUser(authKeyId int64, userId int32) bool

func (*AuthSessionModel) GetApiLayer

func (m *AuthSessionModel) GetApiLayer(authKeyId int64) int32

func (*AuthSessionModel) GetAuthKeyUserId

func (m *AuthSessionModel) GetAuthKeyUserId(authKeyId int64) int32

func (*AuthSessionModel) GetAuthorizations

func (m *AuthSessionModel) GetAuthorizations(userId int32) (authorizations []*mtproto.Authorization)

func (*AuthSessionModel) InsertAuthKey

func (m *AuthSessionModel) InsertAuthKey(authKeyId int64, authKey []byte, salt *mtproto.TLFutureSalt) (err error)

func (*AuthSessionModel) QueryAuthKey

func (m *AuthSessionModel) QueryAuthKey(authKeyId int64) (*mtproto.AuthKeyInfo, error)

func (*AuthSessionModel) ResetAuthorization

func (m *AuthSessionModel) ResetAuthorization(hash int64) int64

func (*AuthSessionModel) SetClientSessionInfo

func (m *AuthSessionModel) SetClientSessionInfo(session *mtproto.TLClientSessionInfo) bool

func (*AuthSessionModel) UnbindAuthUser

func (m *AuthSessionModel) UnbindAuthUser(authKeyId int64, userId int32) bool

Jump to

Keyboard shortcuts

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