package mtproto

import 

// Session represents connection state.
type Session struct {
	ID   int64
	Key  crypto.AuthKey
	Salt int64
}

// Session returns current connection session info.
func ( *Conn) () Session {
	.updateSalt()

	.sessionMux.RLock()
	defer .sessionMux.RUnlock()
	return Session{
		Key:  .authKey,
		Salt: .salt,
		ID:   .sessionID,
	}
}

// newSessionID sets session id to random value.
func ( *Conn) () error {
	,  := crypto.RandInt64(.rand)
	if  != nil {
		return 
	}

	.sessionMux.Lock()
	defer .sessionMux.Unlock()
	.sessionID = 

	return nil
}