core

package
v0.96.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthsessionCore

type AuthsessionCore struct {
	logx.Logger
	MD *metadata.RpcMetadata
	// contains filtered or unexported fields
}

func New

func (*AuthsessionCore) AuthsessionBindAuthKeyUser

func (c *AuthsessionCore) AuthsessionBindAuthKeyUser(in *authsession.TLAuthsessionBindAuthKeyUser) (*mtproto.Int64, error)

AuthsessionBindAuthKeyUser authsession.bindAuthKeyUser auth_key_id:long user_id:long = Int64;

func (*AuthsessionCore) AuthsessionBindTempAuthKey

func (c *AuthsessionCore) AuthsessionBindTempAuthKey(in *authsession.TLAuthsessionBindTempAuthKey) (*mtproto.Bool, error)

AuthsessionBindTempAuthKey ## android client source code:

```

    TL_auth_bindTempAuthKey *request = new TL_auth_bindTempAuthKey();
    request->initFunc = [&, request, connection](int64_t messageId) {
        TL_bind_auth_key_inner *inner = new TL_bind_auth_key_inner();
        inner->expires_at = ConnectionsManager::getInstance(currentDatacenter->instanceNum).getCurrentTime() + timeDifference + TEMP_AUTH_KEY_EXPIRE_TIME;
        inner->perm_auth_key_id = currentDatacenter->authKeyPermId;
        inner->temp_auth_key_id = authKeyTempPendingId;
        RAND_bytes((uint8_t *) &inner->nonce, 8);
        inner->temp_session_id = connection->getSessionId();

        NetworkMessage *networkMessage = new NetworkMessage();
        networkMessage->message = std::unique_ptr<TL_message>(new TL_message());
        networkMessage->message->msg_id = authKeyPendingMessageId = messageId;
        networkMessage->message->bytes = inner->getObjectSize();
        networkMessage->message->body = std::unique_ptr<TLObject>(inner);
        networkMessage->message->seqno = 0;

        std::vector<std::unique_ptr<NetworkMessage>> array;
        array.push_back(std::unique_ptr<NetworkMessage>(networkMessage));

        request->perm_auth_key_id = inner->perm_auth_key_id;
        request->nonce = inner->nonce;
        request->expires_at = inner->expires_at;
        request->encrypted_message = currentDatacenter->createRequestsData(array, nullptr, connection, true);
    };

    authKeyPendingRequestId = ConnectionsManager::getInstance(currentDatacenter->instanceNum).sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType) {
        authKeyPendingMessageId = 0;
        authKeyPendingRequestId = 0;
        if (response != nullptr && typeid(*response) == typeid(TL_boolTrue)) {
            if (LOGS_ENABLED) DEBUG_D("account%u dc%u handshake: bind completed", currentDatacenter->instanceNum, currentDatacenter->datacenterId);
            ConnectionsManager::getInstance(currentDatacenter->instanceNum).scheduleTask([&] {
                ByteArray *authKey = authKeyTempPending;
                authKeyTempPending = nullptr;
                delegate->onHandshakeComplete(this, authKeyTempPendingId, authKey, timeDifference);
            });
        } else if (error == nullptr || error->code != 400 || error->text.find("ENCRYPTED_MESSAGE_INVALID") == std::string::npos) {
            ConnectionsManager::getInstance(currentDatacenter->instanceNum).scheduleTask([&] {
                beginHandshake(true);
            });
        }
    }, nullptr, RequestFlagWithoutLogin | RequestFlagEnableUnauthorized | RequestFlagUseUnboundKey, currentDatacenter->datacenterId, connection->getConnectionType(), true, 0);
}

```

authsession.bindTempAuthKey perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool;

func (*AuthsessionCore) AuthsessionGetAuthStateData

AuthsessionGetAuthStateData authsession.getAuthStateData auth_key_id:long = AuthKeyStateData;

func (*AuthsessionCore) AuthsessionGetAuthorization

func (c *AuthsessionCore) AuthsessionGetAuthorization(in *authsession.TLAuthsessionGetAuthorization) (*mtproto.Authorization, error)

AuthsessionGetAuthorization authsession.getAuthorization auth_key_id:long = Authorization;

func (*AuthsessionCore) AuthsessionGetAuthorizations

AuthsessionGetAuthorizations authsession.getAuthorizations user_id:long exclude_auth_keyId:long = account.Authorizations;

func (*AuthsessionCore) AuthsessionGetClient

func (c *AuthsessionCore) AuthsessionGetClient(in *authsession.TLAuthsessionGetClient) (*mtproto.String, error)

AuthsessionGetClient authsession.getClient auth_key_id:long = String;

func (*AuthsessionCore) AuthsessionGetFutureSalts

func (c *AuthsessionCore) AuthsessionGetFutureSalts(in *authsession.TLAuthsessionGetFutureSalts) (*mtproto.FutureSalts, error)

AuthsessionGetFutureSalts authsession.getFutureSalts auth_key_id:long num:int = FutureSalts;

func (*AuthsessionCore) AuthsessionGetLangCode

func (c *AuthsessionCore) AuthsessionGetLangCode(in *authsession.TLAuthsessionGetLangCode) (*mtproto.String, error)

AuthsessionGetLangCode authsession.getLangCode auth_key_id:long = String;

func (*AuthsessionCore) AuthsessionGetLangPack

func (c *AuthsessionCore) AuthsessionGetLangPack(in *authsession.TLAuthsessionGetLangPack) (*mtproto.String, error)

AuthsessionGetLangPack authsession.getLangPack auth_key_id:long = String;

func (*AuthsessionCore) AuthsessionGetLayer

func (c *AuthsessionCore) AuthsessionGetLayer(in *authsession.TLAuthsessionGetLayer) (*mtproto.Int32, error)

AuthsessionGetLayer authsession.getLayer auth_key_id:long = Int32;

func (*AuthsessionCore) AuthsessionGetPermAuthKeyId

func (c *AuthsessionCore) AuthsessionGetPermAuthKeyId(in *authsession.TLAuthsessionGetPermAuthKeyId) (*mtproto.Int64, error)

AuthsessionGetPermAuthKeyId authsession.getPermAuthKeyId auth_key_id:long= Int64;

func (*AuthsessionCore) AuthsessionGetPushSessionId

func (c *AuthsessionCore) AuthsessionGetPushSessionId(in *authsession.TLAuthsessionGetPushSessionId) (*mtproto.Int64, error)

AuthsessionGetPushSessionId authsession.getPushSessionId user_id:long auth_key_id:long token_type:int = Int64;

func (*AuthsessionCore) AuthsessionGetUserId

func (c *AuthsessionCore) AuthsessionGetUserId(in *authsession.TLAuthsessionGetUserId) (*mtproto.Int64, error)

AuthsessionGetUserId authsession.getUserId auth_key_id:long = Int64;

func (*AuthsessionCore) AuthsessionQueryAuthKey

func (c *AuthsessionCore) AuthsessionQueryAuthKey(in *authsession.TLAuthsessionQueryAuthKey) (*mtproto.AuthKeyInfo, error)

AuthsessionQueryAuthKey authsession.queryAuthKey auth_key_id:long = AuthKeyInfo;

func (*AuthsessionCore) AuthsessionResetAuthorization

func (c *AuthsessionCore) AuthsessionResetAuthorization(in *authsession.TLAuthsessionResetAuthorization) (*authsession.Vector_Long, error)

AuthsessionResetAuthorization authsession.resetAuthorization user_id:long auth_key_id:long hash:long = Vector<long>;

func (*AuthsessionCore) AuthsessionSetAuthKey

func (c *AuthsessionCore) AuthsessionSetAuthKey(in *authsession.TLAuthsessionSetAuthKey) (*mtproto.Bool, error)

AuthsessionSetAuthKey authsession.setAuthKey auth_key:AuthKeyInfo future_salt:FutureSalt = Bool;

func (*AuthsessionCore) AuthsessionSetClientSessionInfo

func (c *AuthsessionCore) AuthsessionSetClientSessionInfo(in *authsession.TLAuthsessionSetClientSessionInfo) (*mtproto.Bool, error)

AuthsessionSetClientSessionInfo authsession.setClientSessionInfo data:ClientSession = Bool;

func (*AuthsessionCore) AuthsessionSetInitConnection added in v0.96.0

func (c *AuthsessionCore) AuthsessionSetInitConnection(in *authsession.TLAuthsessionSetInitConnection) (*mtproto.Bool, error)

AuthsessionSetInitConnection authsession.setInitConnection auth_key_id:long ip:string api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:string params:string = Bool;

func (*AuthsessionCore) AuthsessionSetLayer added in v0.96.0

func (c *AuthsessionCore) AuthsessionSetLayer(in *authsession.TLAuthsessionSetLayer) (*mtproto.Bool, error)

AuthsessionSetLayer authsession.setLayer auth_key_id:long ip:string layer:int = Bool;

func (*AuthsessionCore) AuthsessionUnbindAuthKeyUser

func (c *AuthsessionCore) AuthsessionUnbindAuthKeyUser(in *authsession.TLAuthsessionUnbindAuthKeyUser) (*mtproto.Bool, error)

AuthsessionUnbindAuthKeyUser authsession.unbindAuthKeyUser auth_key_id:long user_id:long = Bool;

Jump to

Keyboard shortcuts

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