Skip to main content

auth.bindTempAuthKey

Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. For more information, see Perfect Forward Secrecy.

func (c *Client) AuthBindTempAuthKey(ctx context.Context, request *AuthBindTempAuthKeyRequest) (bool, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.AuthBindTempAuthKey(ctx, &tg.AuthBindTempAuthKeyRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})

Parameters

NameTypeRequiredDescription
PermAuthKeyIDint64yesPermanent auth_key_id to bind to
Nonceint64yesRandom long from Binding message contents
ExpiresAtintyesUnix timestamp to invalidate temporary key, see Binding message contents
EncryptedMessage[]byteyesSee Generating encrypted_message

Returns

bool

Possible errors

CodeTypeDescription
400ENCRYPTED_MESSAGE_INVALIDEncrypted message invalid.
400EXPIRES_AT_INVALIDThe specified expires_at timestamp is invalid.
400TEMP_AUTH_KEY_ALREADY_BOUNDThe passed temporary key is already bound to another perm_auth_key_id.
400TEMP_AUTH_KEY_EMPTYNo temporary auth key provided.

References