diff --git a/ci/generate_protobuf.sh b/ci/generate_protobuf.sh index 9e70408c..166d45bc 100755 --- a/ci/generate_protobuf.sh +++ b/ci/generate_protobuf.sh @@ -13,9 +13,7 @@ protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/logout.proto -I protobuf/daemon protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/login_with_token.proto -I protobuf/daemon protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/ping.proto -I protobuf/daemon -protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/plans.proto -I protobuf/daemon protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/rate.proto -I protobuf/daemon -protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/register.proto -I protobuf/daemon protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/set.proto -I protobuf/daemon protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/settings.proto -I protobuf/daemon protoc --go_opt=module=github.com/NordSecurity/nordvpn-linux --go_out=. protobuf/daemon/status.proto -I protobuf/daemon diff --git a/cli/cli_click.go b/cli/cli_click.go index 9496564a..b260e14d 100644 --- a/cli/cli_click.go +++ b/cli/cli_click.go @@ -7,6 +7,7 @@ import ( "fmt" "net/url" "os" + "strings" "time" "github.com/NordSecurity/nordvpn-linux/daemon/pb" @@ -54,8 +55,15 @@ func (c *cmd) Click(ctx *cli.Context) (err error) { return formatError(err) } - if url.Scheme == "nordvpn" { - if url.Host == "claim-online-purchase" { + //TODO/FIXME: remove after testing + fmt.Println("~~~URL") + fmt.Printf("%#v\n", url) + fmt.Println("~~~URL <<<<") + + if strings.ToLower(url.Scheme) == "nordvpn" { + + switch strings.ToLower(url.Host) { + case "claim-online-purchase": resp, err := c.client.ClaimOnlinePurchase(context.Background(), &pb.Empty{}) if err != nil { return formatError(err) @@ -67,17 +75,26 @@ func (c *cmd) Click(ctx *cli.Context) (err error) { color.Green(ClaimOnlinePurchaseSuccess) return nil - } - // if arg is given - // run the same as: login --callback %arg - if err := c.oauth2(ctx); err != nil { - return formatError(err) + case "login": + // login can be regular, or after new account setup & vpn service purchase (signup) + regularLogin := true + if strings.ToLower(url.Query().Get("action")) == "signup" { + regularLogin = false + } + + // if arg is given + // run the same as: login --callback %arg + if err := c.oauth2(ctx, regularLogin); err != nil { + return formatError(err) + } + return nil } } - } else { - cli.ShowAppHelp(ctx) } + // for all unhandled cases + cli.ShowAppHelp(ctx) + return nil } diff --git a/cli/cli_login.go b/cli/cli_login.go index 19ac6b8f..90736899 100644 --- a/cli/cli_login.go +++ b/cli/cli_login.go @@ -30,7 +30,7 @@ func (c *cmd) Login(ctx *cli.Context) error { } if ctx.IsSet(flagLoginCallback) { - return c.oauth2(ctx) + return c.oauth2(ctx, true) } if ctx.IsSet(flagToken) { @@ -44,7 +44,9 @@ func (c *cmd) Login(ctx *cli.Context) error { cl, err := c.client.LoginOAuth2( context.Background(), - &pb.Empty{}, + &pb.LoginOAuth2Request{ + Type: pb.LoginType_LoginType_LOGIN, + }, ) if err != nil { return formatError(err) @@ -102,7 +104,7 @@ func LoginRespHandler(ctx *cli.Context, resp *pb.LoginResponse) error { } // oauth2 is called by the browser during login via OAuth2. -func (c *cmd) oauth2(ctx *cli.Context) error { +func (c *cmd) oauth2(ctx *cli.Context, regularLogin bool) error { if ctx.NArg() != 1 { return formatError(errors.New("expected a url")) } @@ -116,8 +118,14 @@ func (c *cmd) oauth2(ctx *cli.Context) error { return formatError(errors.New("expected a url with nordvpn scheme")) } - _, err = c.client.LoginOAuth2Callback(context.Background(), &pb.String{ - Data: url.Query().Get("exchange_token"), + loginType := pb.LoginType_LoginType_LOGIN + if !regularLogin { + loginType = pb.LoginType_LoginType_SIGNUP + } + + _, err = c.client.LoginOAuth2Callback(context.Background(), &pb.LoginOAuth2CallbackRequest{ + Token: url.Query().Get("exchange_token"), + Type: loginType, }) if err != nil { return formatError(err) diff --git a/cli/cli_register.go b/cli/cli_register.go index 153c844e..e89b0e5e 100644 --- a/cli/cli_register.go +++ b/cli/cli_register.go @@ -2,13 +2,9 @@ package cli import ( "context" - "errors" - "fmt" - "sort" + "io" - "github.com/NordSecurity/nordvpn-linux/client" "github.com/NordSecurity/nordvpn-linux/daemon/pb" - "github.com/NordSecurity/nordvpn-linux/internal" "github.com/fatih/color" "github.com/urfave/cli/v2" @@ -18,57 +14,28 @@ import ( const RegisterUsageText = "Registers a new user account" func (c *cmd) Register(ctx *cli.Context) error { - email, password, err := ReadCredentialsFromTerminal() + cl, err := c.client.LoginOAuth2( + context.Background(), + &pb.LoginOAuth2Request{ + Type: pb.LoginType_LoginType_SIGNUP, + }, + ) if err != nil { return formatError(err) } - resp, err := c.client.Register(context.Background(), &pb.RegisterRequest{ - Email: email, - Password: password, - }) - if err != nil { - return formatError(err) - } - - switch resp.Type { - case internal.CodeSuccess: - color.Green(AccountCreationSuccess) - case internal.CodeBadRequest: - err = errors.New(AccountInvalidData) - case internal.CodeConflict: - err = errors.New(AccountEmailTaken) - case internal.CodeInternalError: - err = errors.New(AccountInternalError) - case internal.CodeFailure: - err = internal.ErrUnhandled - } - - if err != nil { - return formatError(err) - } - - planResp, err := c.client.Plans(context.Background(), &pb.Empty{}) - if err != nil { - color.Red("Failed to retrieve subscription plans. Please finish the registration in NordVPN website.") - return browse(client.SubscriptionURL) - } - - plans := planResp.GetPlans() - // sort plans by cost in ascending order - sort.Slice(plans, func(i, j int) bool { - costI := plans[i].GetCost() - costJ := plans[j].GetCost() - // this is done to avoid string -> int conversions - if len(costI) == len(costJ) { - return costI < costJ + for { + resp, err := cl.Recv() + if err != nil { + if err == io.EOF { + break + } + return formatError(err) + } + if url := resp.GetData(); url != "" { + color.Green("Continue in the browser: %s", url) } - return len(costI) < len(costJ) - }) - for i, plan := range plans { - description := fmt.Sprintf("%s for %s %s", plan.GetTitle(), plan.GetCost(), plan.GetCurrency()) - fmt.Printf("%d) %s\n", i+1, description) } - return browse(client.SubscriptionURL) + return nil } diff --git a/core/authentication.go b/core/authentication.go index aae6f34a..1644e85f 100644 --- a/core/authentication.go +++ b/core/authentication.go @@ -13,7 +13,7 @@ import ( // Authentication is responsible for verifying user's identity. type Authentication interface { - Login() (string, error) + Login(bool) (string, error) Token(string) (*LoginResponse, error) } @@ -36,7 +36,7 @@ func NewOAuth2(client *http.Client, baseURL string) *OAuth2 { } } -func (o *OAuth2) Login() (string, error) { +func (o *OAuth2) Login(regularLogin bool) (string, error) { o.Lock() defer o.Unlock() @@ -52,8 +52,13 @@ func (o *OAuth2) Login() (string, error) { query := url.Values{} query.Add("challenge", o.challenge) - query.Add("preferred_flow", "login") - query.Add("redirect_flow", "default") + if regularLogin { + query.Add("preferred_flow", "login") + query.Add("redirect_flow", "default") + } else { + query.Add("preferred_flow", "registration") + query.Add("redirect_flow", "checkout") + } path.RawQuery = query.Encode() log.Println("oauth2 login url", path.String()) diff --git a/core/authentication_test.go b/core/authentication_test.go index e10c40b5..085559a3 100644 --- a/core/authentication_test.go +++ b/core/authentication_test.go @@ -57,7 +57,8 @@ func TestOAuth2_Login(t *testing.T) { defer server.Close() api := NewOAuth2(http.DefaultClient, server.URL) - url, err := api.Login() + //TODO/FIXME: add signup test cases + url, err := api.Login(true) assert.Equal(t, test.hasError, err != nil) if test.hasError { assert.True(t, strings.Contains(err.Error(), test.name)) diff --git a/daemon/pb/login.pb.go b/daemon/pb/login.pb.go index 81f88f9a..879a6df5 100644 --- a/daemon/pb/login.pb.go +++ b/daemon/pb/login.pb.go @@ -20,6 +20,153 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type LoginType int32 + +const ( + LoginType_LoginType_UNKNOWN LoginType = 0 + LoginType_LoginType_LOGIN LoginType = 1 + LoginType_LoginType_SIGNUP LoginType = 2 +) + +// Enum value maps for LoginType. +var ( + LoginType_name = map[int32]string{ + 0: "LoginType_UNKNOWN", + 1: "LoginType_LOGIN", + 2: "LoginType_SIGNUP", + } + LoginType_value = map[string]int32{ + "LoginType_UNKNOWN": 0, + "LoginType_LOGIN": 1, + "LoginType_SIGNUP": 2, + } +) + +func (x LoginType) Enum() *LoginType { + p := new(LoginType) + *p = x + return p +} + +func (x LoginType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LoginType) Descriptor() protoreflect.EnumDescriptor { + return file_login_proto_enumTypes[0].Descriptor() +} + +func (LoginType) Type() protoreflect.EnumType { + return &file_login_proto_enumTypes[0] +} + +func (x LoginType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use LoginType.Descriptor instead. +func (LoginType) EnumDescriptor() ([]byte, []int) { + return file_login_proto_rawDescGZIP(), []int{0} +} + +type LoginOAuth2Request struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type LoginType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.LoginType" json:"type,omitempty"` +} + +func (x *LoginOAuth2Request) Reset() { + *x = LoginOAuth2Request{} + mi := &file_login_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginOAuth2Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginOAuth2Request) ProtoMessage() {} + +func (x *LoginOAuth2Request) ProtoReflect() protoreflect.Message { + mi := &file_login_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginOAuth2Request.ProtoReflect.Descriptor instead. +func (*LoginOAuth2Request) Descriptor() ([]byte, []int) { + return file_login_proto_rawDescGZIP(), []int{0} +} + +func (x *LoginOAuth2Request) GetType() LoginType { + if x != nil { + return x.Type + } + return LoginType_LoginType_UNKNOWN +} + +type LoginOAuth2CallbackRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + Type LoginType `protobuf:"varint,2,opt,name=type,proto3,enum=pb.LoginType" json:"type,omitempty"` +} + +func (x *LoginOAuth2CallbackRequest) Reset() { + *x = LoginOAuth2CallbackRequest{} + mi := &file_login_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginOAuth2CallbackRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginOAuth2CallbackRequest) ProtoMessage() {} + +func (x *LoginOAuth2CallbackRequest) ProtoReflect() protoreflect.Message { + mi := &file_login_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginOAuth2CallbackRequest.ProtoReflect.Descriptor instead. +func (*LoginOAuth2CallbackRequest) Descriptor() ([]byte, []int) { + return file_login_proto_rawDescGZIP(), []int{1} +} + +func (x *LoginOAuth2CallbackRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *LoginOAuth2CallbackRequest) GetType() LoginType { + if x != nil { + return x.Type + } + return LoginType_LoginType_UNKNOWN +} + type LoginResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -31,7 +178,7 @@ type LoginResponse struct { func (x *LoginResponse) Reset() { *x = LoginResponse{} - mi := &file_login_proto_msgTypes[0] + mi := &file_login_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -43,7 +190,7 @@ func (x *LoginResponse) String() string { func (*LoginResponse) ProtoMessage() {} func (x *LoginResponse) ProtoReflect() protoreflect.Message { - mi := &file_login_proto_msgTypes[0] + mi := &file_login_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -56,7 +203,7 @@ func (x *LoginResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead. func (*LoginResponse) Descriptor() ([]byte, []int) { - return file_login_proto_rawDescGZIP(), []int{0} + return file_login_proto_rawDescGZIP(), []int{2} } func (x *LoginResponse) GetType() int64 { @@ -83,7 +230,7 @@ type String struct { func (x *String) Reset() { *x = String{} - mi := &file_login_proto_msgTypes[1] + mi := &file_login_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95,7 +242,7 @@ func (x *String) String() string { func (*String) ProtoMessage() {} func (x *String) ProtoReflect() protoreflect.Message { - mi := &file_login_proto_msgTypes[1] + mi := &file_login_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108,7 +255,7 @@ func (x *String) ProtoReflect() protoreflect.Message { // Deprecated: Use String.ProtoReflect.Descriptor instead. func (*String) Descriptor() ([]byte, []int) { - return file_login_proto_rawDescGZIP(), []int{1} + return file_login_proto_rawDescGZIP(), []int{3} } func (x *String) GetData() string { @@ -122,16 +269,29 @@ var File_login_proto protoreflect.FileDescriptor var file_login_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, - 0x62, 0x22, 0x35, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x62, 0x22, 0x37, 0x0a, 0x12, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x55, 0x0a, 0x1a, 0x4c, 0x6f, + 0x67, 0x69, 0x6e, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, + 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x22, 0x35, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x1c, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4e, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, - 0x79, 0x2f, 0x6e, 0x6f, 0x72, 0x64, 0x76, 0x70, 0x6e, 0x2d, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x2f, - 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x2a, 0x4d, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x6f, + 0x67, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x4f, 0x47, 0x49, 0x4e, 0x10, 0x01, 0x12, + 0x14, 0x0a, 0x10, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x49, 0x47, + 0x4e, 0x55, 0x50, 0x10, 0x02, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x4e, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, + 0x2f, 0x6e, 0x6f, 0x72, 0x64, 0x76, 0x70, 0x6e, 0x2d, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x2f, 0x64, + 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -146,17 +306,23 @@ func file_login_proto_rawDescGZIP() []byte { return file_login_proto_rawDescData } -var file_login_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_login_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_login_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_login_proto_goTypes = []any{ - (*LoginResponse)(nil), // 0: pb.LoginResponse - (*String)(nil), // 1: pb.String + (LoginType)(0), // 0: pb.LoginType + (*LoginOAuth2Request)(nil), // 1: pb.LoginOAuth2Request + (*LoginOAuth2CallbackRequest)(nil), // 2: pb.LoginOAuth2CallbackRequest + (*LoginResponse)(nil), // 3: pb.LoginResponse + (*String)(nil), // 4: pb.String } var file_login_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: pb.LoginOAuth2Request.type:type_name -> pb.LoginType + 0, // 1: pb.LoginOAuth2CallbackRequest.type:type_name -> pb.LoginType + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_login_proto_init() } @@ -169,13 +335,14 @@ func file_login_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_login_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, + NumEnums: 1, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, GoTypes: file_login_proto_goTypes, DependencyIndexes: file_login_proto_depIdxs, + EnumInfos: file_login_proto_enumTypes, MessageInfos: file_login_proto_msgTypes, }.Build() File_login_proto = out.File diff --git a/daemon/pb/plans.pb.go b/daemon/pb/plans.pb.go deleted file mode 100644 index df2b9e3c..00000000 --- a/daemon/pb/plans.pb.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.35.1 -// protoc v3.21.6 -// source: plans.proto - -package pb - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type PlansResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type int64 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` - Plans []*Plan `protobuf:"bytes,2,rep,name=plans,proto3" json:"plans,omitempty"` -} - -func (x *PlansResponse) Reset() { - *x = PlansResponse{} - mi := &file_plans_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PlansResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PlansResponse) ProtoMessage() {} - -func (x *PlansResponse) ProtoReflect() protoreflect.Message { - mi := &file_plans_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PlansResponse.ProtoReflect.Descriptor instead. -func (*PlansResponse) Descriptor() ([]byte, []int) { - return file_plans_proto_rawDescGZIP(), []int{0} -} - -func (x *PlansResponse) GetType() int64 { - if x != nil { - return x.Type - } - return 0 -} - -func (x *PlansResponse) GetPlans() []*Plan { - if x != nil { - return x.Plans - } - return nil -} - -type Plan struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - Cost string `protobuf:"bytes,3,opt,name=cost,proto3" json:"cost,omitempty"` - Currency string `protobuf:"bytes,4,opt,name=currency,proto3" json:"currency,omitempty"` -} - -func (x *Plan) Reset() { - *x = Plan{} - mi := &file_plans_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Plan) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Plan) ProtoMessage() {} - -func (x *Plan) ProtoReflect() protoreflect.Message { - mi := &file_plans_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Plan.ProtoReflect.Descriptor instead. -func (*Plan) Descriptor() ([]byte, []int) { - return file_plans_proto_rawDescGZIP(), []int{1} -} - -func (x *Plan) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Plan) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Plan) GetCost() string { - if x != nil { - return x.Cost - } - return "" -} - -func (x *Plan) GetCurrency() string { - if x != nil { - return x.Currency - } - return "" -} - -var File_plans_proto protoreflect.FileDescriptor - -var file_plans_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, - 0x62, 0x22, 0x43, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x05, 0x70, 0x6c, 0x61, 0x6e, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x52, - 0x05, 0x70, 0x6c, 0x61, 0x6e, 0x73, 0x22, 0x5c, 0x0a, 0x04, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, - 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x63, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x63, 0x79, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x4e, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f, - 0x6e, 0x6f, 0x72, 0x64, 0x76, 0x70, 0x6e, 0x2d, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x2f, 0x64, 0x61, - 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_plans_proto_rawDescOnce sync.Once - file_plans_proto_rawDescData = file_plans_proto_rawDesc -) - -func file_plans_proto_rawDescGZIP() []byte { - file_plans_proto_rawDescOnce.Do(func() { - file_plans_proto_rawDescData = protoimpl.X.CompressGZIP(file_plans_proto_rawDescData) - }) - return file_plans_proto_rawDescData -} - -var file_plans_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_plans_proto_goTypes = []any{ - (*PlansResponse)(nil), // 0: pb.PlansResponse - (*Plan)(nil), // 1: pb.Plan -} -var file_plans_proto_depIdxs = []int32{ - 1, // 0: pb.PlansResponse.plans:type_name -> pb.Plan - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_plans_proto_init() } -func file_plans_proto_init() { - if File_plans_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_plans_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_plans_proto_goTypes, - DependencyIndexes: file_plans_proto_depIdxs, - MessageInfos: file_plans_proto_msgTypes, - }.Build() - File_plans_proto = out.File - file_plans_proto_rawDesc = nil - file_plans_proto_goTypes = nil - file_plans_proto_depIdxs = nil -} diff --git a/daemon/pb/register.pb.go b/daemon/pb/register.pb.go deleted file mode 100644 index f98d51f1..00000000 --- a/daemon/pb/register.pb.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.35.1 -// protoc v3.21.6 -// source: register.proto - -package pb - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type RegisterRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` -} - -func (x *RegisterRequest) Reset() { - *x = RegisterRequest{} - mi := &file_register_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RegisterRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegisterRequest) ProtoMessage() {} - -func (x *RegisterRequest) ProtoReflect() protoreflect.Message { - mi := &file_register_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead. -func (*RegisterRequest) Descriptor() ([]byte, []int) { - return file_register_proto_rawDescGZIP(), []int{0} -} - -func (x *RegisterRequest) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *RegisterRequest) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -var File_register_proto protoreflect.FileDescriptor - -var file_register_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x02, 0x70, 0x62, 0x22, 0x43, 0x0a, 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4e, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, - 0x72, 0x69, 0x74, 0x79, 0x2f, 0x6e, 0x6f, 0x72, 0x64, 0x76, 0x70, 0x6e, 0x2d, 0x6c, 0x69, 0x6e, - 0x75, 0x78, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_register_proto_rawDescOnce sync.Once - file_register_proto_rawDescData = file_register_proto_rawDesc -) - -func file_register_proto_rawDescGZIP() []byte { - file_register_proto_rawDescOnce.Do(func() { - file_register_proto_rawDescData = protoimpl.X.CompressGZIP(file_register_proto_rawDescData) - }) - return file_register_proto_rawDescData -} - -var file_register_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_register_proto_goTypes = []any{ - (*RegisterRequest)(nil), // 0: pb.RegisterRequest -} -var file_register_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_register_proto_init() } -func file_register_proto_init() { - if File_register_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_register_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_register_proto_goTypes, - DependencyIndexes: file_register_proto_depIdxs, - MessageInfos: file_register_proto_msgTypes, - }.Build() - File_register_proto = out.File - file_register_proto_rawDesc = nil - file_register_proto_goTypes = nil - file_register_proto_depIdxs = nil -} diff --git a/daemon/pb/service_grpc.pb.go b/daemon/pb/service_grpc.pb.go index 86d0b0ed..eb92f09d 100644 --- a/daemon/pb/service_grpc.pb.go +++ b/daemon/pb/service_grpc.pb.go @@ -32,10 +32,8 @@ const ( Daemon_LoginOAuth2_FullMethodName = "/pb.Daemon/LoginOAuth2" Daemon_LoginOAuth2Callback_FullMethodName = "/pb.Daemon/LoginOAuth2Callback" Daemon_Logout_FullMethodName = "/pb.Daemon/Logout" - Daemon_Plans_FullMethodName = "/pb.Daemon/Plans" Daemon_Ping_FullMethodName = "/pb.Daemon/Ping" Daemon_RateConnection_FullMethodName = "/pb.Daemon/RateConnection" - Daemon_Register_FullMethodName = "/pb.Daemon/Register" Daemon_SetAutoConnect_FullMethodName = "/pb.Daemon/SetAutoConnect" Daemon_SetThreatProtectionLite_FullMethodName = "/pb.Daemon/SetThreatProtectionLite" Daemon_SetDefaults_FullMethodName = "/pb.Daemon/SetDefaults" @@ -80,13 +78,11 @@ type DaemonClient interface { Groups(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ServerGroupsList, error) IsLoggedIn(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Bool, error) LoginWithToken(ctx context.Context, in *LoginWithTokenRequest, opts ...grpc.CallOption) (*LoginResponse, error) - LoginOAuth2(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[String], error) - LoginOAuth2Callback(ctx context.Context, in *String, opts ...grpc.CallOption) (*Empty, error) + LoginOAuth2(ctx context.Context, in *LoginOAuth2Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[String], error) + LoginOAuth2Callback(ctx context.Context, in *LoginOAuth2CallbackRequest, opts ...grpc.CallOption) (*Empty, error) Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*Payload, error) - Plans(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PlansResponse, error) Ping(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PingResponse, error) RateConnection(ctx context.Context, in *RateRequest, opts ...grpc.CallOption) (*Payload, error) - Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*Payload, error) SetAutoConnect(ctx context.Context, in *SetAutoconnectRequest, opts ...grpc.CallOption) (*Payload, error) SetThreatProtectionLite(ctx context.Context, in *SetThreatProtectionLiteRequest, opts ...grpc.CallOption) (*SetThreatProtectionLiteResponse, error) SetDefaults(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Payload, error) @@ -243,13 +239,13 @@ func (c *daemonClient) LoginWithToken(ctx context.Context, in *LoginWithTokenReq return out, nil } -func (c *daemonClient) LoginOAuth2(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[String], error) { +func (c *daemonClient) LoginOAuth2(ctx context.Context, in *LoginOAuth2Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[String], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[2], Daemon_LoginOAuth2_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[Empty, String]{ClientStream: stream} + x := &grpc.GenericClientStream[LoginOAuth2Request, String]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -262,7 +258,7 @@ func (c *daemonClient) LoginOAuth2(ctx context.Context, in *Empty, opts ...grpc. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type Daemon_LoginOAuth2Client = grpc.ServerStreamingClient[String] -func (c *daemonClient) LoginOAuth2Callback(ctx context.Context, in *String, opts ...grpc.CallOption) (*Empty, error) { +func (c *daemonClient) LoginOAuth2Callback(ctx context.Context, in *LoginOAuth2CallbackRequest, opts ...grpc.CallOption) (*Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) err := c.cc.Invoke(ctx, Daemon_LoginOAuth2Callback_FullMethodName, in, out, cOpts...) @@ -282,16 +278,6 @@ func (c *daemonClient) Logout(ctx context.Context, in *LogoutRequest, opts ...gr return out, nil } -func (c *daemonClient) Plans(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PlansResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(PlansResponse) - err := c.cc.Invoke(ctx, Daemon_Plans_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *daemonClient) Ping(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PingResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PingResponse) @@ -312,16 +298,6 @@ func (c *daemonClient) RateConnection(ctx context.Context, in *RateRequest, opts return out, nil } -func (c *daemonClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*Payload, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Payload) - err := c.cc.Invoke(ctx, Daemon_Register_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *daemonClient) SetAutoConnect(ctx context.Context, in *SetAutoconnectRequest, opts ...grpc.CallOption) (*Payload, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Payload) @@ -625,13 +601,11 @@ type DaemonServer interface { Groups(context.Context, *Empty) (*ServerGroupsList, error) IsLoggedIn(context.Context, *Empty) (*Bool, error) LoginWithToken(context.Context, *LoginWithTokenRequest) (*LoginResponse, error) - LoginOAuth2(*Empty, grpc.ServerStreamingServer[String]) error - LoginOAuth2Callback(context.Context, *String) (*Empty, error) + LoginOAuth2(*LoginOAuth2Request, grpc.ServerStreamingServer[String]) error + LoginOAuth2Callback(context.Context, *LoginOAuth2CallbackRequest) (*Empty, error) Logout(context.Context, *LogoutRequest) (*Payload, error) - Plans(context.Context, *Empty) (*PlansResponse, error) Ping(context.Context, *Empty) (*PingResponse, error) RateConnection(context.Context, *RateRequest) (*Payload, error) - Register(context.Context, *RegisterRequest) (*Payload, error) SetAutoConnect(context.Context, *SetAutoconnectRequest) (*Payload, error) SetThreatProtectionLite(context.Context, *SetThreatProtectionLiteRequest) (*SetThreatProtectionLiteResponse, error) SetDefaults(context.Context, *Empty) (*Payload, error) @@ -700,27 +674,21 @@ func (UnimplementedDaemonServer) IsLoggedIn(context.Context, *Empty) (*Bool, err func (UnimplementedDaemonServer) LoginWithToken(context.Context, *LoginWithTokenRequest) (*LoginResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LoginWithToken not implemented") } -func (UnimplementedDaemonServer) LoginOAuth2(*Empty, grpc.ServerStreamingServer[String]) error { +func (UnimplementedDaemonServer) LoginOAuth2(*LoginOAuth2Request, grpc.ServerStreamingServer[String]) error { return status.Errorf(codes.Unimplemented, "method LoginOAuth2 not implemented") } -func (UnimplementedDaemonServer) LoginOAuth2Callback(context.Context, *String) (*Empty, error) { +func (UnimplementedDaemonServer) LoginOAuth2Callback(context.Context, *LoginOAuth2CallbackRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method LoginOAuth2Callback not implemented") } func (UnimplementedDaemonServer) Logout(context.Context, *LogoutRequest) (*Payload, error) { return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") } -func (UnimplementedDaemonServer) Plans(context.Context, *Empty) (*PlansResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Plans not implemented") -} func (UnimplementedDaemonServer) Ping(context.Context, *Empty) (*PingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") } func (UnimplementedDaemonServer) RateConnection(context.Context, *RateRequest) (*Payload, error) { return nil, status.Errorf(codes.Unimplemented, "method RateConnection not implemented") } -func (UnimplementedDaemonServer) Register(context.Context, *RegisterRequest) (*Payload, error) { - return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") -} func (UnimplementedDaemonServer) SetAutoConnect(context.Context, *SetAutoconnectRequest) (*Payload, error) { return nil, status.Errorf(codes.Unimplemented, "method SetAutoConnect not implemented") } @@ -993,18 +961,18 @@ func _Daemon_LoginWithToken_Handler(srv interface{}, ctx context.Context, dec fu } func _Daemon_LoginOAuth2_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(Empty) + m := new(LoginOAuth2Request) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(DaemonServer).LoginOAuth2(m, &grpc.GenericServerStream[Empty, String]{ServerStream: stream}) + return srv.(DaemonServer).LoginOAuth2(m, &grpc.GenericServerStream[LoginOAuth2Request, String]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type Daemon_LoginOAuth2Server = grpc.ServerStreamingServer[String] func _Daemon_LoginOAuth2Callback_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(String) + in := new(LoginOAuth2CallbackRequest) if err := dec(in); err != nil { return nil, err } @@ -1016,7 +984,7 @@ func _Daemon_LoginOAuth2Callback_Handler(srv interface{}, ctx context.Context, d FullMethod: Daemon_LoginOAuth2Callback_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DaemonServer).LoginOAuth2Callback(ctx, req.(*String)) + return srv.(DaemonServer).LoginOAuth2Callback(ctx, req.(*LoginOAuth2CallbackRequest)) } return interceptor(ctx, in, info, handler) } @@ -1039,24 +1007,6 @@ func _Daemon_Logout_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } -func _Daemon_Plans_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DaemonServer).Plans(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Daemon_Plans_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DaemonServer).Plans(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - func _Daemon_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Empty) if err := dec(in); err != nil { @@ -1093,24 +1043,6 @@ func _Daemon_RateConnection_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Daemon_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RegisterRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DaemonServer).Register(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Daemon_Register_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DaemonServer).Register(ctx, req.(*RegisterRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Daemon_SetAutoConnect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SetAutoconnectRequest) if err := dec(in); err != nil { @@ -1655,10 +1587,6 @@ var Daemon_ServiceDesc = grpc.ServiceDesc{ MethodName: "Logout", Handler: _Daemon_Logout_Handler, }, - { - MethodName: "Plans", - Handler: _Daemon_Plans_Handler, - }, { MethodName: "Ping", Handler: _Daemon_Ping_Handler, @@ -1667,10 +1595,6 @@ var Daemon_ServiceDesc = grpc.ServiceDesc{ MethodName: "RateConnection", Handler: _Daemon_RateConnection_Handler, }, - { - MethodName: "Register", - Handler: _Daemon_Register_Handler, - }, { MethodName: "SetAutoConnect", Handler: _Daemon_SetAutoConnect_Handler, diff --git a/daemon/rpc_connect_test.go b/daemon/rpc_connect_test.go index 2723bf6c..6ed0f4ef 100644 --- a/daemon/rpc_connect_test.go +++ b/daemon/rpc_connect_test.go @@ -28,7 +28,7 @@ func (m *mockRPCServer) Send(p *pb.Payload) error { m.msg = p; return nil } type mockAuthenticationAPI struct{} -func (mockAuthenticationAPI) Login() (string, error) { +func (mockAuthenticationAPI) Login(bool) (string, error) { return "", nil } diff --git a/daemon/rpc_login.go b/daemon/rpc_login.go index 842b3ae8..d42ab1c9 100644 --- a/daemon/rpc_login.go +++ b/daemon/rpc_login.go @@ -59,7 +59,12 @@ func (r *RPC) loginCommon(customCB customCallbackType) (payload *pb.LoginRespons } loginStartTime := time.Now() - r.events.User.Login.Publish(events.DataAuthorization{DurationMs: -1, EventTrigger: events.TriggerUser, EventStatus: events.StatusAttempt}) + r.events.User.Login.Publish(events.DataAuthorization{ + DurationMs: -1, + EventTrigger: events.TriggerUser, + EventStatus: events.StatusAttempt, + EventType: events.LoginLogin, + }) defer func() { eventStatus := events.StatusSuccess @@ -70,6 +75,7 @@ func (r *RPC) loginCommon(customCB customCallbackType) (payload *pb.LoginRespons DurationMs: max(int(time.Since(loginStartTime).Milliseconds()), 1), EventTrigger: events.TriggerUser, EventStatus: eventStatus, + EventType: events.LoginLogin, }) }() @@ -135,14 +141,24 @@ func (r *RPC) loginCommon(customCB customCallbackType) (payload *pb.LoginRespons } // LoginOAuth2 is called when logging in with OAuth2. -func (r *RPC) LoginOAuth2(in *pb.Empty, srv pb.Daemon_LoginOAuth2Server) error { +func (r *RPC) LoginOAuth2(in *pb.LoginOAuth2Request, srv pb.Daemon_LoginOAuth2Server) error { if r.ac.IsLoggedIn() { return internal.ErrAlreadyLoggedIn } - r.events.User.Login.Publish(events.DataAuthorization{DurationMs: -1, EventTrigger: events.TriggerUser, EventStatus: events.StatusAttempt}) + eventType := events.LoginLogin + if in.GetType() == pb.LoginType_LoginType_SIGNUP { + eventType = events.LoginSignUp + } - url, err := r.authentication.Login() + r.events.User.Login.Publish(events.DataAuthorization{ + DurationMs: -1, + EventTrigger: events.TriggerUser, + EventStatus: events.StatusAttempt, + EventType: eventType, + }) + + url, err := r.authentication.Login(in.GetType() == pb.LoginType_LoginType_LOGIN) if err != nil { return err } @@ -151,25 +167,35 @@ func (r *RPC) LoginOAuth2(in *pb.Empty, srv pb.Daemon_LoginOAuth2Server) error { } // LoginOAuth2Callback is called by the browser via cli during OAuth2 login. -func (r *RPC) LoginOAuth2Callback(ctx context.Context, in *pb.String) (payload *pb.Empty, retErr error) { +func (r *RPC) LoginOAuth2Callback(ctx context.Context, in *pb.LoginOAuth2CallbackRequest) (payload *pb.Empty, retErr error) { if r.ac.IsLoggedIn() { return &pb.Empty{}, internal.ErrAlreadyLoggedIn } + loginType := events.LoginLogin + if in.GetType() == pb.LoginType_LoginType_SIGNUP { + loginType = events.LoginSignUp + } + defer func() { eventStatus := events.StatusSuccess if retErr != nil { eventStatus = events.StatusFailure } - r.events.User.Login.Publish(events.DataAuthorization{DurationMs: -1, EventTrigger: events.TriggerUser, EventStatus: eventStatus}) + r.events.User.Login.Publish(events.DataAuthorization{ + DurationMs: -1, + EventTrigger: events.TriggerUser, + EventStatus: eventStatus, + EventType: loginType, + }) }() - if in.GetData() == "" { + if in.GetToken() == "" { r.publisher.Publish(ErrMissingExchangeToken.Error()) return &pb.Empty{}, ErrMissingExchangeToken } - resp, err := r.authentication.Token(in.GetData()) + resp, err := r.authentication.Token(in.GetToken()) if err != nil { r.publisher.Publish(err.Error()) return &pb.Empty{}, err diff --git a/daemon/rpc_plans.go b/daemon/rpc_plans.go deleted file mode 100644 index 1b677cb4..00000000 --- a/daemon/rpc_plans.go +++ /dev/null @@ -1,35 +0,0 @@ -package daemon - -import ( - "context" - "log" - - "github.com/NordSecurity/nordvpn-linux/daemon/pb" - "github.com/NordSecurity/nordvpn-linux/internal" -) - -func (r *RPC) Plans(ctx context.Context, in *pb.Empty) (*pb.PlansResponse, error) { - resp, err := r.api.Plans() - if err != nil { - log.Println(internal.ErrorPrefix, "retrieving plans:", err) - return &pb.PlansResponse{ - Type: internal.CodeFailure, - }, nil - } - - var ret []*pb.Plan - for _, plan := range *resp { - p := &pb.Plan{ - Id: plan.Identifier, - Title: plan.Title, - Cost: plan.Cost, - Currency: plan.Currency, - } - ret = append(ret, p) - } - - return &pb.PlansResponse{ - Type: internal.CodeSuccess, - Plans: ret, - }, nil -} diff --git a/daemon/rpc_register.go b/daemon/rpc_register.go deleted file mode 100644 index 2ae56d83..00000000 --- a/daemon/rpc_register.go +++ /dev/null @@ -1,40 +0,0 @@ -package daemon - -import ( - "context" - "errors" - "log" - - "github.com/NordSecurity/nordvpn-linux/core" - "github.com/NordSecurity/nordvpn-linux/daemon/pb" - "github.com/NordSecurity/nordvpn-linux/internal" -) - -func (r *RPC) Register(ctx context.Context, in *pb.RegisterRequest) (*pb.Payload, error) { - _, err := r.api.CreateUser(in.GetEmail(), in.GetPassword()) - if err != nil { - log.Println(internal.ErrorPrefix, "registering user:", err) - switch { - case errors.Is(err, core.ErrBadRequest): - return &pb.Payload{ - Type: internal.CodeBadRequest, - }, nil - case errors.Is(err, core.ErrConflict): - return &pb.Payload{ - Type: internal.CodeConflict, - }, nil - case errors.Is(err, core.ErrServerInternal): - return &pb.Payload{ - Type: internal.CodeInternalError, - }, nil - default: - return &pb.Payload{ - Type: internal.CodeFailure, - }, nil - } - } - - return &pb.Payload{ - Type: internal.CodeSuccess, - }, nil -} diff --git a/events/events.go b/events/events.go index 3a97812f..45c04875 100644 --- a/events/events.go +++ b/events/events.go @@ -54,6 +54,13 @@ const ( TriggerUser ) +type TypeLoginType int + +const ( + LoginLogin TypeLoginType = iota // regular login + LoginSignUp // login after signup +) + type DataConnect struct { IsMeshnetPeer bool APIHostname string @@ -92,6 +99,7 @@ type DataAuthorization struct { DurationMs int EventTrigger TypeEventTrigger EventStatus TypeEventStatus + EventType TypeLoginType } type DataRequestAPI struct { diff --git a/events/moose/moose.go b/events/moose/moose.go index f6c4bf39..ceebfdfa 100644 --- a/events/moose/moose.go +++ b/events/moose/moose.go @@ -266,7 +266,13 @@ func (s *Subscriber) NotifyLogin(data events.DataAuthorization) error { eventStatus = moose.NordvpnappEventStatusAttempt } - if err := s.response(moose.NordvpnappSendServiceQualityAuthorizationLogin( + // regular login, or login after signup + mooseFn := moose.NordvpnappSendServiceQualityAuthorizationLogin + if data.EventType == events.LoginSignUp { + mooseFn = moose.NordvpnappSendServiceQualityAuthorizationRegister + } + + if err := s.response(mooseFn( int32(data.DurationMs), eventTrigger, eventStatus, @@ -276,6 +282,7 @@ func (s *Subscriber) NotifyLogin(data events.DataAuthorization) error { )); err != nil { return err } + if data.EventStatus == events.StatusSuccess { return s.fetchSubscriptions() } diff --git a/protobuf/daemon/login.proto b/protobuf/daemon/login.proto index 06a966e1..85aef1a0 100644 --- a/protobuf/daemon/login.proto +++ b/protobuf/daemon/login.proto @@ -4,6 +4,21 @@ package pb; option go_package = "github.com/NordSecurity/nordvpn-linux/daemon/pb"; +enum LoginType { + LoginType_UNKNOWN = 0; + LoginType_LOGIN = 1; + LoginType_SIGNUP = 2; +} + +message LoginOAuth2Request { + LoginType type = 1; +} + +message LoginOAuth2CallbackRequest { + string token = 1; + LoginType type = 2; +} + message LoginResponse { int64 type = 1; string url = 5; diff --git a/protobuf/daemon/plans.proto b/protobuf/daemon/plans.proto deleted file mode 100644 index 69242a88..00000000 --- a/protobuf/daemon/plans.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; - -package pb; - -option go_package = "github.com/NordSecurity/nordvpn-linux/daemon/pb"; - -message PlansResponse { - int64 type = 1; - repeated Plan plans = 2; -} - -message Plan { - string id = 1; - string title = 2; - string cost = 3; - string currency = 4; -} diff --git a/protobuf/daemon/register.proto b/protobuf/daemon/register.proto deleted file mode 100644 index a6060d74..00000000 --- a/protobuf/daemon/register.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package pb; - -option go_package = "github.com/NordSecurity/nordvpn-linux/daemon/pb"; - -message RegisterRequest { - string email = 1; - string password = 2; -} diff --git a/protobuf/daemon/service.proto b/protobuf/daemon/service.proto index 362780bd..eb562594 100644 --- a/protobuf/daemon/service.proto +++ b/protobuf/daemon/service.proto @@ -12,9 +12,7 @@ import "login.proto"; import "logout.proto"; import "login_with_token.proto"; import "ping.proto"; -import "plans.proto"; import "rate.proto"; -import "register.proto"; import "set.proto"; import "settings.proto"; import "status.proto"; @@ -34,13 +32,11 @@ service Daemon { rpc Groups(Empty) returns (ServerGroupsList); rpc IsLoggedIn(Empty) returns (Bool); rpc LoginWithToken(LoginWithTokenRequest) returns (LoginResponse); - rpc LoginOAuth2(Empty) returns (stream String); - rpc LoginOAuth2Callback(String) returns (Empty); + rpc LoginOAuth2(LoginOAuth2Request) returns (stream String); + rpc LoginOAuth2Callback(LoginOAuth2CallbackRequest) returns (Empty); rpc Logout(LogoutRequest) returns (Payload); - rpc Plans(Empty) returns (PlansResponse); rpc Ping(Empty) returns (PingResponse); rpc RateConnection(RateRequest) returns (Payload); - rpc Register(RegisterRequest) returns (Payload); rpc SetAutoConnect(SetAutoconnectRequest) returns (Payload); rpc SetThreatProtectionLite(SetThreatProtectionLiteRequest) returns (SetThreatProtectionLiteResponse); rpc SetDefaults(Empty) returns (Payload); diff --git a/test/qa/lib/protobuf/daemon/login_pb2.py b/test/qa/lib/protobuf/daemon/login_pb2.py index 2330f133..2371c6f1 100644 --- a/test/qa/lib/protobuf/daemon/login_pb2.py +++ b/test/qa/lib/protobuf/daemon/login_pb2.py @@ -24,7 +24,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0blogin.proto\x12\x02pb\"*\n\rLoginResponse\x12\x0c\n\x04type\x18\x01 \x01(\x03\x12\x0b\n\x03url\x18\x05 \x01(\t\"\x16\n\x06String\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\tB1Z/github.com/NordSecurity/nordvpn-linux/daemon/pbb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0blogin.proto\x12\x02pb\"1\n\x12LoginOAuth2Request\x12\x1b\n\x04type\x18\x01 \x01(\x0e\x32\r.pb.LoginType\"H\n\x1aLoginOAuth2CallbackRequest\x12\r\n\x05token\x18\x01 \x01(\t\x12\x1b\n\x04type\x18\x02 \x01(\x0e\x32\r.pb.LoginType\"*\n\rLoginResponse\x12\x0c\n\x04type\x18\x01 \x01(\x03\x12\x0b\n\x03url\x18\x05 \x01(\t\"\x16\n\x06String\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\t*M\n\tLoginType\x12\x15\n\x11LoginType_UNKNOWN\x10\x00\x12\x13\n\x0fLoginType_LOGIN\x10\x01\x12\x14\n\x10LoginType_SIGNUP\x10\x02\x42\x31Z/github.com/NordSecurity/nordvpn-linux/daemon/pbb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -32,8 +32,14 @@ if not _descriptor._USE_C_DESCRIPTORS: _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z/github.com/NordSecurity/nordvpn-linux/daemon/pb' - _globals['_LOGINRESPONSE']._serialized_start=19 - _globals['_LOGINRESPONSE']._serialized_end=61 - _globals['_STRING']._serialized_start=63 - _globals['_STRING']._serialized_end=85 + _globals['_LOGINTYPE']._serialized_start=212 + _globals['_LOGINTYPE']._serialized_end=289 + _globals['_LOGINOAUTH2REQUEST']._serialized_start=19 + _globals['_LOGINOAUTH2REQUEST']._serialized_end=68 + _globals['_LOGINOAUTH2CALLBACKREQUEST']._serialized_start=70 + _globals['_LOGINOAUTH2CALLBACKREQUEST']._serialized_end=142 + _globals['_LOGINRESPONSE']._serialized_start=144 + _globals['_LOGINRESPONSE']._serialized_end=186 + _globals['_STRING']._serialized_start=188 + _globals['_STRING']._serialized_end=210 # @@protoc_insertion_point(module_scope) diff --git a/test/qa/lib/protobuf/daemon/login_pb2.pyi b/test/qa/lib/protobuf/daemon/login_pb2.pyi index d35bb625..c13b0e69 100644 --- a/test/qa/lib/protobuf/daemon/login_pb2.pyi +++ b/test/qa/lib/protobuf/daemon/login_pb2.pyi @@ -1,9 +1,33 @@ +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from typing import ClassVar as _ClassVar, Optional as _Optional +from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor +class LoginType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + LoginType_UNKNOWN: _ClassVar[LoginType] + LoginType_LOGIN: _ClassVar[LoginType] + LoginType_SIGNUP: _ClassVar[LoginType] +LoginType_UNKNOWN: LoginType +LoginType_LOGIN: LoginType +LoginType_SIGNUP: LoginType + +class LoginOAuth2Request(_message.Message): + __slots__ = ("type",) + TYPE_FIELD_NUMBER: _ClassVar[int] + type: LoginType + def __init__(self, type: _Optional[_Union[LoginType, str]] = ...) -> None: ... + +class LoginOAuth2CallbackRequest(_message.Message): + __slots__ = ("token", "type") + TOKEN_FIELD_NUMBER: _ClassVar[int] + TYPE_FIELD_NUMBER: _ClassVar[int] + token: str + type: LoginType + def __init__(self, token: _Optional[str] = ..., type: _Optional[_Union[LoginType, str]] = ...) -> None: ... + class LoginResponse(_message.Message): __slots__ = ("type", "url") TYPE_FIELD_NUMBER: _ClassVar[int] diff --git a/test/qa/lib/protobuf/daemon/plans_pb2.py b/test/qa/lib/protobuf/daemon/plans_pb2.py deleted file mode 100644 index c1581b81..00000000 --- a/test/qa/lib/protobuf/daemon/plans_pb2.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE -# source: plans.proto -# Protobuf Python Version: 5.28.1 -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version -from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 5, - 28, - 1, - '', - 'plans.proto' -) -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0bplans.proto\x12\x02pb\"6\n\rPlansResponse\x12\x0c\n\x04type\x18\x01 \x01(\x03\x12\x17\n\x05plans\x18\x02 \x03(\x0b\x32\x08.pb.Plan\"A\n\x04Plan\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05title\x18\x02 \x01(\t\x12\x0c\n\x04\x63ost\x18\x03 \x01(\t\x12\x10\n\x08\x63urrency\x18\x04 \x01(\tB1Z/github.com/NordSecurity/nordvpn-linux/daemon/pbb\x06proto3') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'plans_pb2', _globals) -if not _descriptor._USE_C_DESCRIPTORS: - _globals['DESCRIPTOR']._loaded_options = None - _globals['DESCRIPTOR']._serialized_options = b'Z/github.com/NordSecurity/nordvpn-linux/daemon/pb' - _globals['_PLANSRESPONSE']._serialized_start=19 - _globals['_PLANSRESPONSE']._serialized_end=73 - _globals['_PLAN']._serialized_start=75 - _globals['_PLAN']._serialized_end=140 -# @@protoc_insertion_point(module_scope) diff --git a/test/qa/lib/protobuf/daemon/plans_pb2.pyi b/test/qa/lib/protobuf/daemon/plans_pb2.pyi deleted file mode 100644 index da9321ab..00000000 --- a/test/qa/lib/protobuf/daemon/plans_pb2.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from google.protobuf.internal import containers as _containers -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union - -DESCRIPTOR: _descriptor.FileDescriptor - -class PlansResponse(_message.Message): - __slots__ = ("type", "plans") - TYPE_FIELD_NUMBER: _ClassVar[int] - PLANS_FIELD_NUMBER: _ClassVar[int] - type: int - plans: _containers.RepeatedCompositeFieldContainer[Plan] - def __init__(self, type: _Optional[int] = ..., plans: _Optional[_Iterable[_Union[Plan, _Mapping]]] = ...) -> None: ... - -class Plan(_message.Message): - __slots__ = ("id", "title", "cost", "currency") - ID_FIELD_NUMBER: _ClassVar[int] - TITLE_FIELD_NUMBER: _ClassVar[int] - COST_FIELD_NUMBER: _ClassVar[int] - CURRENCY_FIELD_NUMBER: _ClassVar[int] - id: str - title: str - cost: str - currency: str - def __init__(self, id: _Optional[str] = ..., title: _Optional[str] = ..., cost: _Optional[str] = ..., currency: _Optional[str] = ...) -> None: ... diff --git a/test/qa/lib/protobuf/daemon/register_pb2.py b/test/qa/lib/protobuf/daemon/register_pb2.py deleted file mode 100644 index 73fa8ceb..00000000 --- a/test/qa/lib/protobuf/daemon/register_pb2.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE -# source: register.proto -# Protobuf Python Version: 5.28.1 -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version -from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 5, - 28, - 1, - '', - 'register.proto' -) -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eregister.proto\x12\x02pb\"2\n\x0fRegisterRequest\x12\r\n\x05\x65mail\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\tB1Z/github.com/NordSecurity/nordvpn-linux/daemon/pbb\x06proto3') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'register_pb2', _globals) -if not _descriptor._USE_C_DESCRIPTORS: - _globals['DESCRIPTOR']._loaded_options = None - _globals['DESCRIPTOR']._serialized_options = b'Z/github.com/NordSecurity/nordvpn-linux/daemon/pb' - _globals['_REGISTERREQUEST']._serialized_start=22 - _globals['_REGISTERREQUEST']._serialized_end=72 -# @@protoc_insertion_point(module_scope) diff --git a/test/qa/lib/protobuf/daemon/register_pb2.pyi b/test/qa/lib/protobuf/daemon/register_pb2.pyi deleted file mode 100644 index b7e05087..00000000 --- a/test/qa/lib/protobuf/daemon/register_pb2.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from typing import ClassVar as _ClassVar, Optional as _Optional - -DESCRIPTOR: _descriptor.FileDescriptor - -class RegisterRequest(_message.Message): - __slots__ = ("email", "password") - EMAIL_FIELD_NUMBER: _ClassVar[int] - PASSWORD_FIELD_NUMBER: _ClassVar[int] - email: str - password: str - def __init__(self, email: _Optional[str] = ..., password: _Optional[str] = ...) -> None: ... diff --git a/test/qa/lib/protobuf/daemon/service_pb2.py b/test/qa/lib/protobuf/daemon/service_pb2.py index 8826027a..c197c59a 100644 --- a/test/qa/lib/protobuf/daemon/service_pb2.py +++ b/test/qa/lib/protobuf/daemon/service_pb2.py @@ -30,9 +30,7 @@ import logout_pb2 as logout__pb2 import login_with_token_pb2 as login__with__token__pb2 import ping_pb2 as ping__pb2 -import plans_pb2 as plans__pb2 import rate_pb2 as rate__pb2 -import register_pb2 as register__pb2 import set_pb2 as set__pb2 import settings_pb2 as settings__pb2 import status_pb2 as status__pb2 @@ -42,7 +40,7 @@ import servers_pb2 as servers__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x12\x02pb\x1a\raccount.proto\x1a\x0c\x63ities.proto\x1a\x0c\x63ommon.proto\x1a\rconnect.proto\x1a\x0blogin.proto\x1a\x0clogout.proto\x1a\x16login_with_token.proto\x1a\nping.proto\x1a\x0bplans.proto\x1a\nrate.proto\x1a\x0eregister.proto\x1a\tset.proto\x1a\x0esettings.proto\x1a\x0cstatus.proto\x1a\x0btoken.proto\x1a\x0epurchase.proto\x1a\x0bstate.proto\x1a\rservers.proto2\xe3\x11\n\x06\x44\x61\x65mon\x12-\n\x0b\x41\x63\x63ountInfo\x12\t.pb.Empty\x1a\x13.pb.AccountResponse\x12-\n\tTokenInfo\x12\t.pb.Empty\x1a\x15.pb.TokenInfoResponse\x12\x31\n\x06\x43ities\x12\x11.pb.CitiesRequest\x1a\x14.pb.ServerGroupsList\x12,\n\x07\x43onnect\x12\x12.pb.ConnectRequest\x1a\x0b.pb.Payload0\x01\x12\'\n\rConnectCancel\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12,\n\tCountries\x12\t.pb.Empty\x1a\x14.pb.ServerGroupsList\x12&\n\nDisconnect\x12\t.pb.Empty\x1a\x0b.pb.Payload0\x01\x12)\n\x06Groups\x12\t.pb.Empty\x1a\x14.pb.ServerGroupsList\x12!\n\nIsLoggedIn\x12\t.pb.Empty\x1a\x08.pb.Bool\x12>\n\x0eLoginWithToken\x12\x19.pb.LoginWithTokenRequest\x1a\x11.pb.LoginResponse\x12&\n\x0bLoginOAuth2\x12\t.pb.Empty\x1a\n.pb.String0\x01\x12,\n\x13LoginOAuth2Callback\x12\n.pb.String\x1a\t.pb.Empty\x12(\n\x06Logout\x12\x11.pb.LogoutRequest\x1a\x0b.pb.Payload\x12%\n\x05Plans\x12\t.pb.Empty\x1a\x11.pb.PlansResponse\x12#\n\x04Ping\x12\t.pb.Empty\x1a\x10.pb.PingResponse\x12.\n\x0eRateConnection\x12\x0f.pb.RateRequest\x1a\x0b.pb.Payload\x12,\n\x08Register\x12\x13.pb.RegisterRequest\x1a\x0b.pb.Payload\x12\x38\n\x0eSetAutoConnect\x12\x19.pb.SetAutoconnectRequest\x1a\x0b.pb.Payload\x12\x62\n\x17SetThreatProtectionLite\x12\".pb.SetThreatProtectionLiteRequest\x1a#.pb.SetThreatProtectionLiteResponse\x12%\n\x0bSetDefaults\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12/\n\x06SetDNS\x12\x11.pb.SetDNSRequest\x1a\x12.pb.SetDNSResponse\x12\x31\n\x0bSetFirewall\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x34\n\x0fSetFirewallMark\x12\x14.pb.SetUint32Request\x1a\x0b.pb.Payload\x12\x30\n\nSetRouting\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x32\n\x0cSetAnalytics\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x36\n\rSetKillSwitch\x12\x18.pb.SetKillSwitchRequest\x1a\x0b.pb.Payload\x12.\n\tSetNotify\x12\x14.pb.SetNotifyRequest\x1a\x0b.pb.Payload\x12*\n\x07SetTray\x12\x12.pb.SetTrayRequest\x1a\x0b.pb.Payload\x12\x32\n\x0cSetObfuscate\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12>\n\x0bSetProtocol\x12\x16.pb.SetProtocolRequest\x1a\x17.pb.SetProtocolResponse\x12\x36\n\rSetTechnology\x12\x18.pb.SetTechnologyRequest\x1a\x0b.pb.Payload\x12J\n\x0fSetLANDiscovery\x12\x1a.pb.SetLANDiscoveryRequest\x1a\x1b.pb.SetLANDiscoveryResponse\x12\x34\n\x0cSetAllowlist\x12\x17.pb.SetAllowlistRequest\x1a\x0b.pb.Payload\x12\x36\n\x0eUnsetAllowlist\x12\x17.pb.SetAllowlistRequest\x1a\x0b.pb.Payload\x12+\n\x11UnsetAllAllowlist\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12+\n\x08Settings\x12\t.pb.Empty\x1a\x14.pb.SettingsResponse\x12+\n\x11SettingsProtocols\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12.\n\x14SettingsTechnologies\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12\'\n\x06Status\x12\t.pb.Empty\x1a\x12.pb.StatusResponse\x12-\n\x07SetIpv6\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x41\n\x13\x43laimOnlinePurchase\x12\t.pb.Empty\x1a\x1f.pb.ClaimOnlinePurchaseResponse\x12\x38\n\x12SetVirtualLocation\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x34\n\x17SubscribeToStateChanges\x12\t.pb.Empty\x1a\x0c.pb.AppState0\x01\x12,\n\nGetServers\x12\t.pb.Empty\x1a\x13.pb.ServersResponse\x12\x34\n\x0eSetPostQuantum\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.PayloadB1Z/github.com/NordSecurity/nordvpn-linux/daemon/pbb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x12\x02pb\x1a\raccount.proto\x1a\x0c\x63ities.proto\x1a\x0c\x63ommon.proto\x1a\rconnect.proto\x1a\x0blogin.proto\x1a\x0clogout.proto\x1a\x16login_with_token.proto\x1a\nping.proto\x1a\nrate.proto\x1a\tset.proto\x1a\x0esettings.proto\x1a\x0cstatus.proto\x1a\x0btoken.proto\x1a\x0epurchase.proto\x1a\x0bstate.proto\x1a\rservers.proto2\xaf\x11\n\x06\x44\x61\x65mon\x12-\n\x0b\x41\x63\x63ountInfo\x12\t.pb.Empty\x1a\x13.pb.AccountResponse\x12-\n\tTokenInfo\x12\t.pb.Empty\x1a\x15.pb.TokenInfoResponse\x12\x31\n\x06\x43ities\x12\x11.pb.CitiesRequest\x1a\x14.pb.ServerGroupsList\x12,\n\x07\x43onnect\x12\x12.pb.ConnectRequest\x1a\x0b.pb.Payload0\x01\x12\'\n\rConnectCancel\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12,\n\tCountries\x12\t.pb.Empty\x1a\x14.pb.ServerGroupsList\x12&\n\nDisconnect\x12\t.pb.Empty\x1a\x0b.pb.Payload0\x01\x12)\n\x06Groups\x12\t.pb.Empty\x1a\x14.pb.ServerGroupsList\x12!\n\nIsLoggedIn\x12\t.pb.Empty\x1a\x08.pb.Bool\x12>\n\x0eLoginWithToken\x12\x19.pb.LoginWithTokenRequest\x1a\x11.pb.LoginResponse\x12\x33\n\x0bLoginOAuth2\x12\x16.pb.LoginOAuth2Request\x1a\n.pb.String0\x01\x12@\n\x13LoginOAuth2Callback\x12\x1e.pb.LoginOAuth2CallbackRequest\x1a\t.pb.Empty\x12(\n\x06Logout\x12\x11.pb.LogoutRequest\x1a\x0b.pb.Payload\x12#\n\x04Ping\x12\t.pb.Empty\x1a\x10.pb.PingResponse\x12.\n\x0eRateConnection\x12\x0f.pb.RateRequest\x1a\x0b.pb.Payload\x12\x38\n\x0eSetAutoConnect\x12\x19.pb.SetAutoconnectRequest\x1a\x0b.pb.Payload\x12\x62\n\x17SetThreatProtectionLite\x12\".pb.SetThreatProtectionLiteRequest\x1a#.pb.SetThreatProtectionLiteResponse\x12%\n\x0bSetDefaults\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12/\n\x06SetDNS\x12\x11.pb.SetDNSRequest\x1a\x12.pb.SetDNSResponse\x12\x31\n\x0bSetFirewall\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x34\n\x0fSetFirewallMark\x12\x14.pb.SetUint32Request\x1a\x0b.pb.Payload\x12\x30\n\nSetRouting\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x32\n\x0cSetAnalytics\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x36\n\rSetKillSwitch\x12\x18.pb.SetKillSwitchRequest\x1a\x0b.pb.Payload\x12.\n\tSetNotify\x12\x14.pb.SetNotifyRequest\x1a\x0b.pb.Payload\x12*\n\x07SetTray\x12\x12.pb.SetTrayRequest\x1a\x0b.pb.Payload\x12\x32\n\x0cSetObfuscate\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12>\n\x0bSetProtocol\x12\x16.pb.SetProtocolRequest\x1a\x17.pb.SetProtocolResponse\x12\x36\n\rSetTechnology\x12\x18.pb.SetTechnologyRequest\x1a\x0b.pb.Payload\x12J\n\x0fSetLANDiscovery\x12\x1a.pb.SetLANDiscoveryRequest\x1a\x1b.pb.SetLANDiscoveryResponse\x12\x34\n\x0cSetAllowlist\x12\x17.pb.SetAllowlistRequest\x1a\x0b.pb.Payload\x12\x36\n\x0eUnsetAllowlist\x12\x17.pb.SetAllowlistRequest\x1a\x0b.pb.Payload\x12+\n\x11UnsetAllAllowlist\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12+\n\x08Settings\x12\t.pb.Empty\x1a\x14.pb.SettingsResponse\x12+\n\x11SettingsProtocols\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12.\n\x14SettingsTechnologies\x12\t.pb.Empty\x1a\x0b.pb.Payload\x12\'\n\x06Status\x12\t.pb.Empty\x1a\x12.pb.StatusResponse\x12-\n\x07SetIpv6\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x41\n\x13\x43laimOnlinePurchase\x12\t.pb.Empty\x1a\x1f.pb.ClaimOnlinePurchaseResponse\x12\x38\n\x12SetVirtualLocation\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.Payload\x12\x34\n\x17SubscribeToStateChanges\x12\t.pb.Empty\x1a\x0c.pb.AppState0\x01\x12,\n\nGetServers\x12\t.pb.Empty\x1a\x13.pb.ServersResponse\x12\x34\n\x0eSetPostQuantum\x12\x15.pb.SetGenericRequest\x1a\x0b.pb.PayloadB1Z/github.com/NordSecurity/nordvpn-linux/daemon/pbb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -50,6 +48,6 @@ if not _descriptor._USE_C_DESCRIPTORS: _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z/github.com/NordSecurity/nordvpn-linux/daemon/pb' - _globals['_DAEMON']._serialized_start=282 - _globals['_DAEMON']._serialized_end=2557 + _globals['_DAEMON']._serialized_start=253 + _globals['_DAEMON']._serialized_end=2476 # @@protoc_insertion_point(module_scope) diff --git a/test/qa/lib/protobuf/daemon/service_pb2.pyi b/test/qa/lib/protobuf/daemon/service_pb2.pyi index 88c6d823..2fcf1a42 100644 --- a/test/qa/lib/protobuf/daemon/service_pb2.pyi +++ b/test/qa/lib/protobuf/daemon/service_pb2.pyi @@ -6,9 +6,7 @@ import login_pb2 as _login_pb2 import logout_pb2 as _logout_pb2 import login_with_token_pb2 as _login_with_token_pb2 import ping_pb2 as _ping_pb2 -import plans_pb2 as _plans_pb2 import rate_pb2 as _rate_pb2 -import register_pb2 as _register_pb2 import set_pb2 as _set_pb2 import settings_pb2 as _settings_pb2 import status_pb2 as _status_pb2 diff --git a/test/qa/lib/protobuf/daemon/service_pb2_grpc.py b/test/qa/lib/protobuf/daemon/service_pb2_grpc.py index edd813da..535b0c93 100644 --- a/test/qa/lib/protobuf/daemon/service_pb2_grpc.py +++ b/test/qa/lib/protobuf/daemon/service_pb2_grpc.py @@ -11,10 +11,8 @@ import login_with_token_pb2 as login__with__token__pb2 import logout_pb2 as logout__pb2 import ping_pb2 as ping__pb2 -import plans_pb2 as plans__pb2 import purchase_pb2 as purchase__pb2 import rate_pb2 as rate__pb2 -import register_pb2 as register__pb2 import servers_pb2 as servers__pb2 import set_pb2 as set__pb2 import settings_pb2 as settings__pb2 @@ -103,12 +101,12 @@ def __init__(self, channel): _registered_method=True) self.LoginOAuth2 = channel.unary_stream( '/pb.Daemon/LoginOAuth2', - request_serializer=common__pb2.Empty.SerializeToString, + request_serializer=login__pb2.LoginOAuth2Request.SerializeToString, response_deserializer=login__pb2.String.FromString, _registered_method=True) self.LoginOAuth2Callback = channel.unary_unary( '/pb.Daemon/LoginOAuth2Callback', - request_serializer=login__pb2.String.SerializeToString, + request_serializer=login__pb2.LoginOAuth2CallbackRequest.SerializeToString, response_deserializer=common__pb2.Empty.FromString, _registered_method=True) self.Logout = channel.unary_unary( @@ -116,11 +114,6 @@ def __init__(self, channel): request_serializer=logout__pb2.LogoutRequest.SerializeToString, response_deserializer=common__pb2.Payload.FromString, _registered_method=True) - self.Plans = channel.unary_unary( - '/pb.Daemon/Plans', - request_serializer=common__pb2.Empty.SerializeToString, - response_deserializer=plans__pb2.PlansResponse.FromString, - _registered_method=True) self.Ping = channel.unary_unary( '/pb.Daemon/Ping', request_serializer=common__pb2.Empty.SerializeToString, @@ -131,11 +124,6 @@ def __init__(self, channel): request_serializer=rate__pb2.RateRequest.SerializeToString, response_deserializer=common__pb2.Payload.FromString, _registered_method=True) - self.Register = channel.unary_unary( - '/pb.Daemon/Register', - request_serializer=register__pb2.RegisterRequest.SerializeToString, - response_deserializer=common__pb2.Payload.FromString, - _registered_method=True) self.SetAutoConnect = channel.unary_unary( '/pb.Daemon/SetAutoConnect', request_serializer=set__pb2.SetAutoconnectRequest.SerializeToString, @@ -359,12 +347,6 @@ def Logout(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def Plans(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - def Ping(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -377,12 +359,6 @@ def RateConnection(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def Register(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - def SetAutoConnect(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -606,12 +582,12 @@ def add_DaemonServicer_to_server(servicer, server): ), 'LoginOAuth2': grpc.unary_stream_rpc_method_handler( servicer.LoginOAuth2, - request_deserializer=common__pb2.Empty.FromString, + request_deserializer=login__pb2.LoginOAuth2Request.FromString, response_serializer=login__pb2.String.SerializeToString, ), 'LoginOAuth2Callback': grpc.unary_unary_rpc_method_handler( servicer.LoginOAuth2Callback, - request_deserializer=login__pb2.String.FromString, + request_deserializer=login__pb2.LoginOAuth2CallbackRequest.FromString, response_serializer=common__pb2.Empty.SerializeToString, ), 'Logout': grpc.unary_unary_rpc_method_handler( @@ -619,11 +595,6 @@ def add_DaemonServicer_to_server(servicer, server): request_deserializer=logout__pb2.LogoutRequest.FromString, response_serializer=common__pb2.Payload.SerializeToString, ), - 'Plans': grpc.unary_unary_rpc_method_handler( - servicer.Plans, - request_deserializer=common__pb2.Empty.FromString, - response_serializer=plans__pb2.PlansResponse.SerializeToString, - ), 'Ping': grpc.unary_unary_rpc_method_handler( servicer.Ping, request_deserializer=common__pb2.Empty.FromString, @@ -634,11 +605,6 @@ def add_DaemonServicer_to_server(servicer, server): request_deserializer=rate__pb2.RateRequest.FromString, response_serializer=common__pb2.Payload.SerializeToString, ), - 'Register': grpc.unary_unary_rpc_method_handler( - servicer.Register, - request_deserializer=register__pb2.RegisterRequest.FromString, - response_serializer=common__pb2.Payload.SerializeToString, - ), 'SetAutoConnect': grpc.unary_unary_rpc_method_handler( servicer.SetAutoConnect, request_deserializer=set__pb2.SetAutoconnectRequest.FromString, @@ -1075,7 +1041,7 @@ def LoginOAuth2(request, request, target, '/pb.Daemon/LoginOAuth2', - common__pb2.Empty.SerializeToString, + login__pb2.LoginOAuth2Request.SerializeToString, login__pb2.String.FromString, options, channel_credentials, @@ -1102,7 +1068,7 @@ def LoginOAuth2Callback(request, request, target, '/pb.Daemon/LoginOAuth2Callback', - login__pb2.String.SerializeToString, + login__pb2.LoginOAuth2CallbackRequest.SerializeToString, common__pb2.Empty.FromString, options, channel_credentials, @@ -1141,33 +1107,6 @@ def Logout(request, metadata, _registered_method=True) - @staticmethod - def Plans(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/pb.Daemon/Plans', - common__pb2.Empty.SerializeToString, - plans__pb2.PlansResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - @staticmethod def Ping(request, target, @@ -1222,33 +1161,6 @@ def RateConnection(request, metadata, _registered_method=True) - @staticmethod - def Register(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/pb.Daemon/Register', - register__pb2.RegisterRequest.SerializeToString, - common__pb2.Payload.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - @staticmethod def SetAutoConnect(request, target, diff --git a/tray/actions.go b/tray/actions.go index d66b047d..4505d808 100644 --- a/tray/actions.go +++ b/tray/actions.go @@ -28,7 +28,9 @@ func (ti *Instance) login() { cl, err := ti.client.LoginOAuth2( context.Background(), - &pb.Empty{}, + &pb.LoginOAuth2Request{ + Type: pb.LoginType_LoginType_LOGIN, + }, ) if err != nil { ti.notify("Login error: %s", err)