diff --git a/internal/_schema/schema.tl b/internal/_schema/schema.tl index 9d6ade50a8..4b12815328 100644 --- a/internal/_schema/schema.tl +++ b/internal/_schema/schema.tl @@ -12,6 +12,8 @@ resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_finge p_q_inner_data#83c95aec pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data; +p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data; + server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params; diff --git a/internal/exchange/server_flow.go b/internal/exchange/server_flow.go index 30dec50d00..bca7902f07 100644 --- a/internal/exchange/server_flow.go +++ b/internal/exchange/server_flow.go @@ -37,6 +37,60 @@ func serverError(code int32, err error) error { } } +// req_pq#60469778 or req_pq_multi#be7e8ef1 +type reqPQ struct { + Type uint32 + Nonce bin.Int128 +} + +func (r *reqPQ) Decode(b *bin.Buffer) error { + var ( + legacy mt.ReqPqRequest + multi mt.ReqPqMultiRequest + ) + id, err := b.PeekID() + if err != nil { + return err + } + r.Type = id + switch id { + case legacy.TypeID(): + if err := legacy.Decode(b); err != nil { + return err + } + r.Nonce = legacy.Nonce + return nil + case multi.TypeID(): + if err := multi.Decode(b); err != nil { + return err + } + r.Nonce = multi.Nonce + return nil + default: + return bin.NewUnexpectedID(id) + } +} + +type reqOrDH struct { + Type uint32 + DH mt.ReqDHParamsRequest + Req reqPQ +} + +func (r *reqOrDH) Decode(b *bin.Buffer) error { + id, err := b.PeekID() + if err != nil { + return err + } + r.Type = id + switch id { + case r.DH.TypeID(): + return r.DH.Decode(b) + default: + return r.Req.Decode(b) + } +} + // Run runs server-side flow. // If b parameter is not nil, it will be used as first read message. // Otherwise, it will be read from connection. @@ -46,11 +100,11 @@ func (s ServerExchange) Run(ctx context.Context) (ServerExchangeResult, error) { } // 1. Client sends query to server - // + // req_pq#60469778 nonce:int128 = ResPQ; // legacy // req_pq_multi#be7e8ef1 nonce:int128 = ResPQ; - var pqReq mt.ReqPqMultiRequest + var req reqPQ b := new(bin.Buffer) - if err := s.readUnencrypted(ctx, b, &pqReq); err != nil { + if err := s.readUnencrypted(ctx, b, &req); err != nil { return ServerExchangeResult{}, err } s.log.Debug("Received client ReqPqMultiRequest") @@ -68,10 +122,11 @@ func (s ServerExchange) Run(ctx context.Context) (ServerExchangeResult, error) { return ServerExchangeResult{}, errors.Wrap(err, "generate pq") } +SendResPQ: s.log.Debug("Sending ResPQ", zap.String("pq", pq.String())) if err := s.writeUnencrypted(ctx, b, &mt.ResPQ{ Pq: pq.Bytes(), - Nonce: pqReq.Nonce, + Nonce: req.Nonce, ServerNonce: serverNonce, ServerPublicKeyFingerprints: []int64{ s.key.Fingerprint(), @@ -84,15 +139,25 @@ func (s ServerExchange) Run(ctx context.Context) (ServerExchangeResult, error) { // // req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string // q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params - var dhParams mt.ReqDHParamsRequest + var dhParams reqOrDH if err := s.readUnencrypted(ctx, b, &dhParams); err != nil { return ServerExchangeResult{}, err } - s.log.Debug("Received client ReqDHParamsRequest") + switch dhParams.Type { + case mt.ReqPqRequestTypeID, mt.ReqPqMultiRequestTypeID: + // Client can send fake req_pq on start. Ignore it. + // + // Next one should be not fake. + s.log.Debug("Received ReqPQ again") + req = dhParams.Req + goto SendResPQ + default: + s.log.Debug("Received client ReqDHParamsRequest") + } var innerData mt.PQInnerData { - r, err := crypto.DecodeRSAPad(dhParams.EncryptedData, s.key.RSA) + r, err := crypto.DecodeRSAPad(dhParams.DH.EncryptedData, s.key.RSA) if err != nil { return ServerExchangeResult{}, wrapKeyNotFound(err) } @@ -133,7 +198,7 @@ func (s ServerExchange) Run(ctx context.Context) (ServerExchangeResult, error) { } data := mt.ServerDHInnerData{ - Nonce: pqReq.Nonce, + Nonce: req.Nonce, ServerNonce: serverNonce, G: g, GA: ga.Bytes(), @@ -155,7 +220,7 @@ func (s ServerExchange) Run(ctx context.Context) (ServerExchangeResult, error) { s.log.Debug("Sending ServerDHParamsOk", zap.Int("g", g)) // 5. Server responds with Server_DH_Params. if err := s.writeUnencrypted(ctx, b, &mt.ServerDHParamsOk{ - Nonce: pqReq.Nonce, + Nonce: req.Nonce, ServerNonce: serverNonce, EncryptedAnswer: answer, }); err != nil { @@ -193,7 +258,7 @@ func (s ServerExchange) Run(ctx context.Context) (ServerExchangeResult, error) { // new_nonce_hash1:int128 = Set_client_DH_params_answer; s.log.Debug("Sending DhGenOk") if err := s.writeUnencrypted(ctx, b, &mt.DhGenOk{ - Nonce: pqReq.Nonce, + Nonce: req.Nonce, ServerNonce: serverNonce, NewNonceHash1: crypto.NonceHash1(innerData.NewNonce, authKey), }); err != nil { diff --git a/internal/generate.go b/internal/generate.go index 3c3a5834ce..00ba1482ff 100644 --- a/internal/generate.go +++ b/internal/generate.go @@ -1,3 +1,3 @@ package internal -//go:generate go run github.com/gotd/td/cmd/gotdgen --clean --package mt --target mt --client=false --schema _schema/schema.tl +//go:generate go run github.com/gotd/td/cmd/gotdgen --clean --package mt --target mt --schema _schema/schema.tl diff --git a/internal/mt/tl_client_gen.go b/internal/mt/tl_client_gen.go new file mode 100644 index 0000000000..1565ff93b9 --- /dev/null +++ b/internal/mt/tl_client_gen.go @@ -0,0 +1,54 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package mt + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// Invoker can invoke raw MTProto rpc calls. +type Invoker interface { + Invoke(ctx context.Context, input bin.Encoder, output bin.Decoder) error +} + +// Client implement methods for calling functions from TL schema via Invoker. +type Client struct { + rpc Invoker +} + +// Invoker returns Invoker used by this client. +func (c *Client) Invoker() Invoker { + return c.rpc +} + +// NewClient creates new Client. +func NewClient(invoker Invoker) *Client { + return &Client{ + rpc: invoker, + } +} diff --git a/internal/mt/tl_destroy_session_gen.go b/internal/mt/tl_destroy_session_gen.go index 288decdfe9..1a6502d79a 100644 --- a/internal/mt/tl_destroy_session_gen.go +++ b/internal/mt/tl_destroy_session_gen.go @@ -150,3 +150,16 @@ func (d *DestroySessionRequest) GetSessionID() (value int64) { } return d.SessionID } + +// DestroySession invokes method destroy_session#e7512126 returning error if any. +func (c *Client) DestroySession(ctx context.Context, sessionid int64) (DestroySessionResClass, error) { + var result DestroySessionResBox + + request := &DestroySessionRequest{ + SessionID: sessionid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.DestroySessionRes, nil +} diff --git a/internal/mt/tl_get_future_salts_gen.go b/internal/mt/tl_get_future_salts_gen.go index 0757912d13..b1bc10e478 100644 --- a/internal/mt/tl_get_future_salts_gen.go +++ b/internal/mt/tl_get_future_salts_gen.go @@ -150,3 +150,16 @@ func (g *GetFutureSaltsRequest) GetNum() (value int) { } return g.Num } + +// GetFutureSalts invokes method get_future_salts#b921bd04 returning error if any. +func (c *Client) GetFutureSalts(ctx context.Context, num int) (*FutureSalts, error) { + var result FutureSalts + + request := &GetFutureSaltsRequest{ + Num: num, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/internal/mt/tl_p_q_inner_data_gen.go b/internal/mt/tl_p_q_inner_data_gen.go index 6f7b11e4fb..1687cbab21 100644 --- a/internal/mt/tl_p_q_inner_data_gen.go +++ b/internal/mt/tl_p_q_inner_data_gen.go @@ -556,6 +556,306 @@ func (p *PQInnerDataDC) GetDC() (value int) { return p.DC } +// PQInnerDataTempDC represents TL type `p_q_inner_data_temp_dc#56fddf88`. +type PQInnerDataTempDC struct { + // Pq field of PQInnerDataTempDC. + Pq []byte + // P field of PQInnerDataTempDC. + P []byte + // Q field of PQInnerDataTempDC. + Q []byte + // Nonce field of PQInnerDataTempDC. + Nonce bin.Int128 + // ServerNonce field of PQInnerDataTempDC. + ServerNonce bin.Int128 + // NewNonce field of PQInnerDataTempDC. + NewNonce bin.Int256 + // DC field of PQInnerDataTempDC. + DC int + // ExpiresIn field of PQInnerDataTempDC. + ExpiresIn int +} + +// PQInnerDataTempDCTypeID is TL type id of PQInnerDataTempDC. +const PQInnerDataTempDCTypeID = 0x56fddf88 + +// construct implements constructor of PQInnerDataClass. +func (p PQInnerDataTempDC) construct() PQInnerDataClass { return &p } + +// Ensuring interfaces in compile-time for PQInnerDataTempDC. +var ( + _ bin.Encoder = &PQInnerDataTempDC{} + _ bin.Decoder = &PQInnerDataTempDC{} + _ bin.BareEncoder = &PQInnerDataTempDC{} + _ bin.BareDecoder = &PQInnerDataTempDC{} + + _ PQInnerDataClass = &PQInnerDataTempDC{} +) + +func (p *PQInnerDataTempDC) Zero() bool { + if p == nil { + return true + } + if !(p.Pq == nil) { + return false + } + if !(p.P == nil) { + return false + } + if !(p.Q == nil) { + return false + } + if !(p.Nonce == bin.Int128{}) { + return false + } + if !(p.ServerNonce == bin.Int128{}) { + return false + } + if !(p.NewNonce == bin.Int256{}) { + return false + } + if !(p.DC == 0) { + return false + } + if !(p.ExpiresIn == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PQInnerDataTempDC) String() string { + if p == nil { + return "PQInnerDataTempDC(nil)" + } + type Alias PQInnerDataTempDC + return fmt.Sprintf("PQInnerDataTempDC%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PQInnerDataTempDC) TypeID() uint32 { + return PQInnerDataTempDCTypeID +} + +// TypeName returns name of type in TL schema. +func (*PQInnerDataTempDC) TypeName() string { + return "p_q_inner_data_temp_dc" +} + +// TypeInfo returns info about TL type. +func (p *PQInnerDataTempDC) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "p_q_inner_data_temp_dc", + ID: PQInnerDataTempDCTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Pq", + SchemaName: "pq", + }, + { + Name: "P", + SchemaName: "p", + }, + { + Name: "Q", + SchemaName: "q", + }, + { + Name: "Nonce", + SchemaName: "nonce", + }, + { + Name: "ServerNonce", + SchemaName: "server_nonce", + }, + { + Name: "NewNonce", + SchemaName: "new_nonce", + }, + { + Name: "DC", + SchemaName: "dc", + }, + { + Name: "ExpiresIn", + SchemaName: "expires_in", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *PQInnerDataTempDC) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode p_q_inner_data_temp_dc#56fddf88 as nil") + } + b.PutID(PQInnerDataTempDCTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PQInnerDataTempDC) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode p_q_inner_data_temp_dc#56fddf88 as nil") + } + b.PutBytes(p.Pq) + b.PutBytes(p.P) + b.PutBytes(p.Q) + b.PutInt128(p.Nonce) + b.PutInt128(p.ServerNonce) + b.PutInt256(p.NewNonce) + b.PutInt(p.DC) + b.PutInt(p.ExpiresIn) + return nil +} + +// Decode implements bin.Decoder. +func (p *PQInnerDataTempDC) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode p_q_inner_data_temp_dc#56fddf88 to nil") + } + if err := b.ConsumeID(PQInnerDataTempDCTypeID); err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PQInnerDataTempDC) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode p_q_inner_data_temp_dc#56fddf88 to nil") + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field pq: %w", err) + } + p.Pq = value + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field p: %w", err) + } + p.P = value + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field q: %w", err) + } + p.Q = value + } + { + value, err := b.Int128() + if err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field nonce: %w", err) + } + p.Nonce = value + } + { + value, err := b.Int128() + if err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field server_nonce: %w", err) + } + p.ServerNonce = value + } + { + value, err := b.Int256() + if err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field new_nonce: %w", err) + } + p.NewNonce = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field dc: %w", err) + } + p.DC = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field expires_in: %w", err) + } + p.ExpiresIn = value + } + return nil +} + +// GetPq returns value of Pq field. +func (p *PQInnerDataTempDC) GetPq() (value []byte) { + if p == nil { + return + } + return p.Pq +} + +// GetP returns value of P field. +func (p *PQInnerDataTempDC) GetP() (value []byte) { + if p == nil { + return + } + return p.P +} + +// GetQ returns value of Q field. +func (p *PQInnerDataTempDC) GetQ() (value []byte) { + if p == nil { + return + } + return p.Q +} + +// GetNonce returns value of Nonce field. +func (p *PQInnerDataTempDC) GetNonce() (value bin.Int128) { + if p == nil { + return + } + return p.Nonce +} + +// GetServerNonce returns value of ServerNonce field. +func (p *PQInnerDataTempDC) GetServerNonce() (value bin.Int128) { + if p == nil { + return + } + return p.ServerNonce +} + +// GetNewNonce returns value of NewNonce field. +func (p *PQInnerDataTempDC) GetNewNonce() (value bin.Int256) { + if p == nil { + return + } + return p.NewNonce +} + +// GetDC returns value of DC field. +func (p *PQInnerDataTempDC) GetDC() (value int) { + if p == nil { + return + } + return p.DC +} + +// GetExpiresIn returns value of ExpiresIn field. +func (p *PQInnerDataTempDC) GetExpiresIn() (value int) { + if p == nil { + return + } + return p.ExpiresIn +} + // PQInnerDataClassName is schema name of PQInnerDataClass. const PQInnerDataClassName = "P_Q_inner_data" @@ -570,6 +870,7 @@ const PQInnerDataClassName = "P_Q_inner_data" // switch v := g.(type) { // case *mt.PQInnerData: // p_q_inner_data#83c95aec // case *mt.PQInnerDataDC: // p_q_inner_data_dc#a9f55f95 +// case *mt.PQInnerDataTempDC: // p_q_inner_data_temp_dc#56fddf88 // default: panic(v) // } type PQInnerDataClass interface { @@ -625,6 +926,13 @@ func DecodePQInnerData(buf *bin.Buffer) (PQInnerDataClass, error) { return nil, fmt.Errorf("unable to decode PQInnerDataClass: %w", err) } return &v, nil + case PQInnerDataTempDCTypeID: + // Decoding p_q_inner_data_temp_dc#56fddf88. + v := PQInnerDataTempDC{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PQInnerDataClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PQInnerDataClass: %w", bin.NewUnexpectedID(id)) } diff --git a/internal/mt/tl_ping_delay_disconnect_gen.go b/internal/mt/tl_ping_delay_disconnect_gen.go index 0b4cba7546..034d159f0d 100644 --- a/internal/mt/tl_ping_delay_disconnect_gen.go +++ b/internal/mt/tl_ping_delay_disconnect_gen.go @@ -175,3 +175,13 @@ func (p *PingDelayDisconnectRequest) GetDisconnectDelay() (value int) { } return p.DisconnectDelay } + +// PingDelayDisconnect invokes method ping_delay_disconnect#f3427b8c returning error if any. +func (c *Client) PingDelayDisconnect(ctx context.Context, request *PingDelayDisconnectRequest) (*Pong, error) { + var result Pong + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/internal/mt/tl_ping_gen.go b/internal/mt/tl_ping_gen.go index 858be176e0..847bbda73e 100644 --- a/internal/mt/tl_ping_gen.go +++ b/internal/mt/tl_ping_gen.go @@ -150,3 +150,16 @@ func (p *PingRequest) GetPingID() (value int64) { } return p.PingID } + +// Ping invokes method ping#7abe77ec returning error if any. +func (c *Client) Ping(ctx context.Context, pingid int64) (*Pong, error) { + var result Pong + + request := &PingRequest{ + PingID: pingid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/internal/mt/tl_registry_gen.go b/internal/mt/tl_registry_gen.go index 407a482f74..4727c32fd2 100644 --- a/internal/mt/tl_registry_gen.go +++ b/internal/mt/tl_registry_gen.go @@ -37,6 +37,7 @@ func TypesMap() map[uint32]string { ResPQTypeID: "resPQ#5162463", PQInnerDataTypeID: "p_q_inner_data#83c95aec", PQInnerDataDCTypeID: "p_q_inner_data_dc#a9f55f95", + PQInnerDataTempDCTypeID: "p_q_inner_data_temp_dc#56fddf88", ServerDHParamsFailTypeID: "server_DH_params_fail#79cb045d", ServerDHParamsOkTypeID: "server_DH_params_ok#d0e8075c", ServerDHInnerDataTypeID: "server_DH_inner_data#b5890dba", @@ -87,6 +88,7 @@ func NamesMap() map[string]uint32 { "resPQ": ResPQTypeID, "p_q_inner_data": PQInnerDataTypeID, "p_q_inner_data_dc": PQInnerDataDCTypeID, + "p_q_inner_data_temp_dc": PQInnerDataTempDCTypeID, "server_DH_params_fail": ServerDHParamsFailTypeID, "server_DH_params_ok": ServerDHParamsOkTypeID, "server_DH_inner_data": ServerDHInnerDataTypeID, @@ -137,6 +139,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ResPQTypeID: func() bin.Object { return &ResPQ{} }, PQInnerDataTypeID: func() bin.Object { return &PQInnerData{} }, PQInnerDataDCTypeID: func() bin.Object { return &PQInnerDataDC{} }, + PQInnerDataTempDCTypeID: func() bin.Object { return &PQInnerDataTempDC{} }, ServerDHParamsFailTypeID: func() bin.Object { return &ServerDHParamsFail{} }, ServerDHParamsOkTypeID: func() bin.Object { return &ServerDHParamsOk{} }, ServerDHInnerDataTypeID: func() bin.Object { return &ServerDHInnerData{} }, @@ -199,6 +202,7 @@ func ClassConstructorsMap() map[string][]uint32 { PQInnerDataClassName: { PQInnerDataTypeID, PQInnerDataDCTypeID, + PQInnerDataTempDCTypeID, }, RPCDropAnswerClassName: { RPCAnswerUnknownTypeID, diff --git a/internal/mt/tl_req_d_h_params_gen.go b/internal/mt/tl_req_d_h_params_gen.go index 6729a6ceb0..95083cd2dd 100644 --- a/internal/mt/tl_req_d_h_params_gen.go +++ b/internal/mt/tl_req_d_h_params_gen.go @@ -275,3 +275,13 @@ func (r *ReqDHParamsRequest) GetEncryptedData() (value []byte) { } return r.EncryptedData } + +// ReqDHParams invokes method req_DH_params#d712e4be returning error if any. +func (c *Client) ReqDHParams(ctx context.Context, request *ReqDHParamsRequest) (ServerDHParamsClass, error) { + var result ServerDHParamsBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Server_DH_Params, nil +} diff --git a/internal/mt/tl_req_pq_gen.go b/internal/mt/tl_req_pq_gen.go index 814a7ad85d..09049a0fa7 100644 --- a/internal/mt/tl_req_pq_gen.go +++ b/internal/mt/tl_req_pq_gen.go @@ -150,3 +150,16 @@ func (r *ReqPqRequest) GetNonce() (value bin.Int128) { } return r.Nonce } + +// ReqPq invokes method req_pq#60469778 returning error if any. +func (c *Client) ReqPq(ctx context.Context, nonce bin.Int128) (*ResPQ, error) { + var result ResPQ + + request := &ReqPqRequest{ + Nonce: nonce, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/internal/mt/tl_req_pq_multi_gen.go b/internal/mt/tl_req_pq_multi_gen.go index f4fa2165aa..e6c76a79e5 100644 --- a/internal/mt/tl_req_pq_multi_gen.go +++ b/internal/mt/tl_req_pq_multi_gen.go @@ -150,3 +150,16 @@ func (r *ReqPqMultiRequest) GetNonce() (value bin.Int128) { } return r.Nonce } + +// ReqPqMulti invokes method req_pq_multi#be7e8ef1 returning error if any. +func (c *Client) ReqPqMulti(ctx context.Context, nonce bin.Int128) (*ResPQ, error) { + var result ResPQ + + request := &ReqPqMultiRequest{ + Nonce: nonce, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/internal/mt/tl_rpc_drop_answer_const_gen.go b/internal/mt/tl_rpc_drop_answer_const_gen.go index 410ef49949..a6007c3c14 100644 --- a/internal/mt/tl_rpc_drop_answer_const_gen.go +++ b/internal/mt/tl_rpc_drop_answer_const_gen.go @@ -150,3 +150,16 @@ func (r *RPCDropAnswerRequest) GetReqMsgID() (value int64) { } return r.ReqMsgID } + +// RPCDropAnswer invokes method rpc_drop_answer#58e4a740 returning error if any. +func (c *Client) RPCDropAnswer(ctx context.Context, reqmsgid int64) (RPCDropAnswerClass, error) { + var result RPCDropAnswerBox + + request := &RPCDropAnswerRequest{ + ReqMsgID: reqmsgid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.RpcDropAnswer, nil +} diff --git a/internal/mt/tl_set_client_d_h_params_gen.go b/internal/mt/tl_set_client_d_h_params_gen.go index 7518c3f116..29040ba1c9 100644 --- a/internal/mt/tl_set_client_d_h_params_gen.go +++ b/internal/mt/tl_set_client_d_h_params_gen.go @@ -200,3 +200,13 @@ func (s *SetClientDHParamsRequest) GetEncryptedData() (value []byte) { } return s.EncryptedData } + +// SetClientDHParams invokes method set_client_DH_params#f5045f1f returning error if any. +func (c *Client) SetClientDHParams(ctx context.Context, request *SetClientDHParamsRequest) (SetClientDHParamsAnswerClass, error) { + var result SetClientDHParamsAnswerBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Set_client_DH_params_answer, nil +}