diff --git a/pkg/accounts/v1/accounts_v1.pb.go b/pkg/accounts/v1/accounts_v1.pb.go index acbade7..9b0ee16 100644 --- a/pkg/accounts/v1/accounts_v1.pb.go +++ b/pkg/accounts/v1/accounts_v1.pb.go @@ -122,8 +122,8 @@ func (x *AccountData) GetEmail() string { type SignUpRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Data *AccountData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - Password *AccountPassword `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -158,24 +158,24 @@ func (*SignUpRequest) Descriptor() ([]byte, []int) { return file_accounts_v1_accounts_v1_proto_rawDescGZIP(), []int{2} } -func (x *SignUpRequest) GetData() *AccountData { +func (x *SignUpRequest) GetEmail() string { if x != nil { - return x.Data + return x.Email } - return nil + return "" } -func (x *SignUpRequest) GetPassword() *AccountPassword { +func (x *SignUpRequest) GetPassword() string { if x != nil { return x.Password } - return nil + return "" } type SignInRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` - Verifier string `protobuf:"bytes,2,opt,name=verifier,proto3" json:"verifier,omitempty"` + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -210,16 +210,16 @@ func (*SignInRequest) Descriptor() ([]byte, []int) { return file_accounts_v1_accounts_v1_proto_rawDescGZIP(), []int{3} } -func (x *SignInRequest) GetCode() string { +func (x *SignInRequest) GetEmail() string { if x != nil { - return x.Code + return x.Email } return "" } -func (x *SignInRequest) GetVerifier() string { +func (x *SignInRequest) GetPassword() string { if x != nil { - return x.Verifier + return x.Password } return "" } @@ -416,6 +416,50 @@ func (x *IsEmailVerifiedResponse) GetVerified() bool { return false } +type RefreshTokenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RefreshTokenRequest) Reset() { + *x = RefreshTokenRequest{} + mi := &file_accounts_v1_accounts_v1_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RefreshTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RefreshTokenRequest) ProtoMessage() {} + +func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_accounts_v1_accounts_v1_proto_msgTypes[8] + 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 RefreshTokenRequest.ProtoReflect.Descriptor instead. +func (*RefreshTokenRequest) Descriptor() ([]byte, []int) { + return file_accounts_v1_accounts_v1_proto_rawDescGZIP(), []int{8} +} + +func (x *RefreshTokenRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + var File_accounts_v1_accounts_v1_proto protoreflect.FileDescriptor const file_accounts_v1_accounts_v1_proto_rawDesc = "" + @@ -425,13 +469,13 @@ const file_accounts_v1_accounts_v1_proto_rawDesc = "" + "\bpassword\x18\x01 \x01(\tR\bpassword\"7\n" + "\vAccountData\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + - "\x05email\x18\x02 \x01(\tR\x05email\"w\n" + - "\rSignUpRequest\x12,\n" + - "\x04data\x18\x01 \x01(\v2\x18.accounts.v1.AccountDataR\x04data\x128\n" + - "\bpassword\x18\x02 \x01(\v2\x1c.accounts.v1.AccountPasswordR\bpassword\"?\n" + - "\rSignInRequest\x12\x12\n" + - "\x04code\x18\x01 \x01(\tR\x04code\x12\x1a\n" + - "\bverifier\x18\x02 \x01(\tR\bverifier\"D\n" + + "\x05email\x18\x02 \x01(\tR\x05email\"A\n" + + "\rSignUpRequest\x12\x14\n" + + "\x05email\x18\x01 \x01(\tR\x05email\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\"A\n" + + "\rSignInRequest\x12\x14\n" + + "\x05email\x18\x01 \x01(\tR\x05email\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\"D\n" + "\x14ResetPasswordRequest\x12,\n" + "\x04data\x18\x01 \x01(\v2\x18.accounts.v1.AccountDataR\x04data\"\x90\x01\n" + "\x12NewPasswordRequest\x12,\n" + @@ -441,12 +485,16 @@ const file_accounts_v1_accounts_v1_proto_rawDesc = "" + "\x16IsEmailVerifiedRequest\x12,\n" + "\x04data\x18\x01 \x01(\v2\x18.accounts.v1.AccountDataR\x04data\"5\n" + "\x17IsEmailVerifiedResponse\x12\x1a\n" + - "\bverified\x18\x01 \x01(\bR\bverified2W\n" + + "\bverified\x18\x01 \x01(\bR\bverified\"4\n" + + "\x13RefreshTokenRequest\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId2\xe3\x01\n" + "\x15AccountsNoAuthService\x12>\n" + - "\x06SignIn\x12\x1a.accounts.v1.SignInRequest\x1a\x16.google.protobuf.Empty\"\x002\xb7\x01\n" + + "\x06SignIn\x12\x1a.accounts.v1.SignInRequest\x1a\x16.google.protobuf.Empty\"\x00\x12>\n" + + "\x06SignUp\x12\x1a.accounts.v1.SignUpRequest\x1a\x16.google.protobuf.Empty\"\x00\x12J\n" + + "\fRefreshToken\x12 .accounts.v1.RefreshTokenRequest\x1a\x16.google.protobuf.Empty\"\x002u\n" + "\x13AccountsAuthService\x12^\n" + - "\x0fIsEmailVerified\x12#.accounts.v1.IsEmailVerifiedRequest\x1a$.accounts.v1.IsEmailVerifiedResponse\"\x00\x12@\n" + - "\fRefreshToken\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\"\x00BIZGgitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/accounts/v1b\x06proto3" + "\x0fIsEmailVerified\x12#.accounts.v1.IsEmailVerifiedRequest\x1a$.accounts.v1.IsEmailVerifiedResponse\"\x00BIZGgitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/accounts/v1b\x06proto3" var ( file_accounts_v1_accounts_v1_proto_rawDescOnce sync.Once @@ -460,7 +508,7 @@ func file_accounts_v1_accounts_v1_proto_rawDescGZIP() []byte { return file_accounts_v1_accounts_v1_proto_rawDescData } -var file_accounts_v1_accounts_v1_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_accounts_v1_accounts_v1_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_accounts_v1_accounts_v1_proto_goTypes = []any{ (*AccountPassword)(nil), // 0: accounts.v1.AccountPassword (*AccountData)(nil), // 1: accounts.v1.AccountData @@ -470,26 +518,27 @@ var file_accounts_v1_accounts_v1_proto_goTypes = []any{ (*NewPasswordRequest)(nil), // 5: accounts.v1.NewPasswordRequest (*IsEmailVerifiedRequest)(nil), // 6: accounts.v1.IsEmailVerifiedRequest (*IsEmailVerifiedResponse)(nil), // 7: accounts.v1.IsEmailVerifiedResponse - (*emptypb.Empty)(nil), // 8: google.protobuf.Empty + (*RefreshTokenRequest)(nil), // 8: accounts.v1.RefreshTokenRequest + (*emptypb.Empty)(nil), // 9: google.protobuf.Empty } var file_accounts_v1_accounts_v1_proto_depIdxs = []int32{ - 1, // 0: accounts.v1.SignUpRequest.data:type_name -> accounts.v1.AccountData - 0, // 1: accounts.v1.SignUpRequest.password:type_name -> accounts.v1.AccountPassword - 1, // 2: accounts.v1.ResetPasswordRequest.data:type_name -> accounts.v1.AccountData - 1, // 3: accounts.v1.NewPasswordRequest.data:type_name -> accounts.v1.AccountData - 0, // 4: accounts.v1.NewPasswordRequest.password:type_name -> accounts.v1.AccountPassword - 1, // 5: accounts.v1.IsEmailVerifiedRequest.data:type_name -> accounts.v1.AccountData - 3, // 6: accounts.v1.AccountsNoAuthService.SignIn:input_type -> accounts.v1.SignInRequest + 1, // 0: accounts.v1.ResetPasswordRequest.data:type_name -> accounts.v1.AccountData + 1, // 1: accounts.v1.NewPasswordRequest.data:type_name -> accounts.v1.AccountData + 0, // 2: accounts.v1.NewPasswordRequest.password:type_name -> accounts.v1.AccountPassword + 1, // 3: accounts.v1.IsEmailVerifiedRequest.data:type_name -> accounts.v1.AccountData + 3, // 4: accounts.v1.AccountsNoAuthService.SignIn:input_type -> accounts.v1.SignInRequest + 2, // 5: accounts.v1.AccountsNoAuthService.SignUp:input_type -> accounts.v1.SignUpRequest + 8, // 6: accounts.v1.AccountsNoAuthService.RefreshToken:input_type -> accounts.v1.RefreshTokenRequest 6, // 7: accounts.v1.AccountsAuthService.IsEmailVerified:input_type -> accounts.v1.IsEmailVerifiedRequest - 8, // 8: accounts.v1.AccountsAuthService.RefreshToken:input_type -> google.protobuf.Empty - 8, // 9: accounts.v1.AccountsNoAuthService.SignIn:output_type -> google.protobuf.Empty - 7, // 10: accounts.v1.AccountsAuthService.IsEmailVerified:output_type -> accounts.v1.IsEmailVerifiedResponse - 8, // 11: accounts.v1.AccountsAuthService.RefreshToken:output_type -> google.protobuf.Empty - 9, // [9:12] is the sub-list for method output_type - 6, // [6:9] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 9, // 8: accounts.v1.AccountsNoAuthService.SignIn:output_type -> google.protobuf.Empty + 9, // 9: accounts.v1.AccountsNoAuthService.SignUp:output_type -> google.protobuf.Empty + 9, // 10: accounts.v1.AccountsNoAuthService.RefreshToken:output_type -> google.protobuf.Empty + 7, // 11: accounts.v1.AccountsAuthService.IsEmailVerified:output_type -> accounts.v1.IsEmailVerifiedResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_accounts_v1_accounts_v1_proto_init() } @@ -503,7 +552,7 @@ func file_accounts_v1_accounts_v1_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_accounts_v1_accounts_v1_proto_rawDesc), len(file_accounts_v1_accounts_v1_proto_rawDesc)), NumEnums: 0, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 2, }, diff --git a/pkg/accounts/v1/accounts_v1_grpc.pb.go b/pkg/accounts/v1/accounts_v1_grpc.pb.go index e3bed6e..b2cbde3 100644 --- a/pkg/accounts/v1/accounts_v1_grpc.pb.go +++ b/pkg/accounts/v1/accounts_v1_grpc.pb.go @@ -22,7 +22,9 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - AccountsNoAuthService_SignIn_FullMethodName = "/accounts.v1.AccountsNoAuthService/SignIn" + AccountsNoAuthService_SignIn_FullMethodName = "/accounts.v1.AccountsNoAuthService/SignIn" + AccountsNoAuthService_SignUp_FullMethodName = "/accounts.v1.AccountsNoAuthService/SignUp" + AccountsNoAuthService_RefreshToken_FullMethodName = "/accounts.v1.AccountsNoAuthService/RefreshToken" ) // AccountsNoAuthServiceClient is the client API for AccountsNoAuthService service. @@ -34,6 +36,10 @@ const ( type AccountsNoAuthServiceClient interface { // Sing in into an existing account SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // Create a new account + SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // RefreshToken doesn't use regular auth methods + RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type accountsNoAuthServiceClient struct { @@ -54,6 +60,26 @@ func (c *accountsNoAuthServiceClient) SignIn(ctx context.Context, in *SignInRequ return out, nil } +func (c *accountsNoAuthServiceClient) SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, AccountsNoAuthService_SignUp_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *accountsNoAuthServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, AccountsNoAuthService_RefreshToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // AccountsNoAuthServiceServer is the server API for AccountsNoAuthService service. // All implementations should embed UnimplementedAccountsNoAuthServiceServer // for forward compatibility. @@ -63,6 +89,10 @@ func (c *accountsNoAuthServiceClient) SignIn(ctx context.Context, in *SignInRequ type AccountsNoAuthServiceServer interface { // Sing in into an existing account SignIn(context.Context, *SignInRequest) (*emptypb.Empty, error) + // Create a new account + SignUp(context.Context, *SignUpRequest) (*emptypb.Empty, error) + // RefreshToken doesn't use regular auth methods + RefreshToken(context.Context, *RefreshTokenRequest) (*emptypb.Empty, error) } // UnimplementedAccountsNoAuthServiceServer should be embedded to have @@ -75,6 +105,12 @@ type UnimplementedAccountsNoAuthServiceServer struct{} func (UnimplementedAccountsNoAuthServiceServer) SignIn(context.Context, *SignInRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method SignIn not implemented") } +func (UnimplementedAccountsNoAuthServiceServer) SignUp(context.Context, *SignUpRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method SignUp not implemented") +} +func (UnimplementedAccountsNoAuthServiceServer) RefreshToken(context.Context, *RefreshTokenRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method RefreshToken not implemented") +} func (UnimplementedAccountsNoAuthServiceServer) testEmbeddedByValue() {} // UnsafeAccountsNoAuthServiceServer may be embedded to opt out of forward compatibility for this service. @@ -113,6 +149,42 @@ func _AccountsNoAuthService_SignIn_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _AccountsNoAuthService_SignUp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SignUpRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountsNoAuthServiceServer).SignUp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AccountsNoAuthService_SignUp_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountsNoAuthServiceServer).SignUp(ctx, req.(*SignUpRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AccountsNoAuthService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RefreshTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountsNoAuthServiceServer).RefreshToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AccountsNoAuthService_RefreshToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountsNoAuthServiceServer).RefreshToken(ctx, req.(*RefreshTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + // AccountsNoAuthService_ServiceDesc is the grpc.ServiceDesc for AccountsNoAuthService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -124,6 +196,14 @@ var AccountsNoAuthService_ServiceDesc = grpc.ServiceDesc{ MethodName: "SignIn", Handler: _AccountsNoAuthService_SignIn_Handler, }, + { + MethodName: "SignUp", + Handler: _AccountsNoAuthService_SignUp_Handler, + }, + { + MethodName: "RefreshToken", + Handler: _AccountsNoAuthService_RefreshToken_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "accounts/v1/accounts_v1.proto", @@ -131,7 +211,6 @@ var AccountsNoAuthService_ServiceDesc = grpc.ServiceDesc{ const ( AccountsAuthService_IsEmailVerified_FullMethodName = "/accounts.v1.AccountsAuthService/IsEmailVerified" - AccountsAuthService_RefreshToken_FullMethodName = "/accounts.v1.AccountsAuthService/RefreshToken" ) // AccountsAuthServiceClient is the client API for AccountsAuthService service. @@ -144,7 +223,6 @@ const ( type AccountsAuthServiceClient interface { // Is email for the current account verified IsEmailVerified(ctx context.Context, in *IsEmailVerifiedRequest, opts ...grpc.CallOption) (*IsEmailVerifiedResponse, error) - RefreshToken(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) } type accountsAuthServiceClient struct { @@ -165,16 +243,6 @@ func (c *accountsAuthServiceClient) IsEmailVerified(ctx context.Context, in *IsE return out, nil } -func (c *accountsAuthServiceClient) RefreshToken(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, AccountsAuthService_RefreshToken_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - // AccountsAuthServiceServer is the server API for AccountsAuthService service. // All implementations should embed UnimplementedAccountsAuthServiceServer // for forward compatibility. @@ -185,7 +253,6 @@ func (c *accountsAuthServiceClient) RefreshToken(ctx context.Context, in *emptyp type AccountsAuthServiceServer interface { // Is email for the current account verified IsEmailVerified(context.Context, *IsEmailVerifiedRequest) (*IsEmailVerifiedResponse, error) - RefreshToken(context.Context, *emptypb.Empty) (*emptypb.Empty, error) } // UnimplementedAccountsAuthServiceServer should be embedded to have @@ -198,9 +265,6 @@ type UnimplementedAccountsAuthServiceServer struct{} func (UnimplementedAccountsAuthServiceServer) IsEmailVerified(context.Context, *IsEmailVerifiedRequest) (*IsEmailVerifiedResponse, error) { return nil, status.Error(codes.Unimplemented, "method IsEmailVerified not implemented") } -func (UnimplementedAccountsAuthServiceServer) RefreshToken(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method RefreshToken not implemented") -} func (UnimplementedAccountsAuthServiceServer) testEmbeddedByValue() {} // UnsafeAccountsAuthServiceServer may be embedded to opt out of forward compatibility for this service. @@ -239,24 +303,6 @@ func _AccountsAuthService_IsEmailVerified_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } -func _AccountsAuthService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AccountsAuthServiceServer).RefreshToken(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AccountsAuthService_RefreshToken_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AccountsAuthServiceServer).RefreshToken(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - // AccountsAuthService_ServiceDesc is the grpc.ServiceDesc for AccountsAuthService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -268,10 +314,6 @@ var AccountsAuthService_ServiceDesc = grpc.ServiceDesc{ MethodName: "IsEmailVerified", Handler: _AccountsAuthService_IsEmailVerified_Handler, }, - { - MethodName: "RefreshToken", - Handler: _AccountsAuthService_RefreshToken_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "accounts/v1/accounts_v1.proto",