diff --git a/users/Dockerfile b/users/Dockerfile new file mode 100644 index 0000000..45a7a5a --- /dev/null +++ b/users/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.2 +ADD users /users +ENTRYPOINT [ "/users" ] diff --git a/users/Makefile b/users/Makefile new file mode 100644 index 0000000..ddbb866 --- /dev/null +++ b/users/Makefile @@ -0,0 +1,22 @@ + +GOPATH:=$(shell go env GOPATH) +.PHONY: init +init: + go get -u github.com/golang/protobuf/proto + go get -u github.com/golang/protobuf/protoc-gen-go + go get github.com/micro/micro/v3/cmd/protoc-gen-micro +.PHONY: proto +proto: + protoc --proto_path=. --micro_out=. --go_out=:. proto/users.proto + +.PHONY: build +build: + go build -o users *.go + +.PHONY: test +test: + go test -v ./... -cover + +.PHONY: docker +docker: + docker build . -t users:latest diff --git a/users/README.md b/users/README.md new file mode 100644 index 0000000..6c6dc08 --- /dev/null +++ b/users/README.md @@ -0,0 +1,6 @@ +User management and authentication + +# Users Service + +The users service provides user management and authentication + diff --git a/users/domain/domain.go b/users/domain/domain.go new file mode 100644 index 0000000..7f873ca --- /dev/null +++ b/users/domain/domain.go @@ -0,0 +1,150 @@ +package domain + +import ( + "errors" + "time" + + user "github.com/micro/services/users/proto" + "github.com/micro/micro/v3/service/model" +) + +type pw struct { + ID string `json:"id"` + Password string `json:"password"` + Salt string `json:"salt"` +} + +type Domain struct { + users model.Model + sessions model.Model + passwords model.Model + + nameIndex model.Index + emailIndex model.Index + idIndex model.Index +} + +func New() *Domain { + nameIndex := model.ByEquality("username") + nameIndex.Unique = true + nameIndex.Order.Type = model.OrderTypeUnordered + + emailIndex := model.ByEquality("email") + emailIndex.Unique = true + emailIndex.Order.Type = model.OrderTypeUnordered + + // @todo there should be a better way to get the default index from model + // than recreating the options here + idIndex := model.ByEquality("id") + idIndex.Order.Type = model.OrderTypeUnordered + + return &Domain{ + users: model.New(user.User{}, &model.Options{ + Indexes: []model.Index{nameIndex, emailIndex}, + }), + sessions: model.New(user.Session{}, nil), + passwords: model.New(pw{}, nil), + nameIndex: nameIndex, + emailIndex: emailIndex, + idIndex: idIndex, + } +} + +func (domain *Domain) CreateSession(sess *user.Session) error { + if sess.Created == 0 { + sess.Created = time.Now().Unix() + } + + if sess.Expires == 0 { + sess.Expires = time.Now().Add(time.Hour * 24 * 7).Unix() + } + + return domain.sessions.Create(sess) +} + +func (domain *Domain) DeleteSession(id string) error { + return domain.sessions.Delete(domain.idIndex.ToQuery(id)) +} + +func (domain *Domain) ReadSession(id string) (*user.Session, error) { + sess := &user.Session{} + // @todo there should be a Read in the model to get rid of this pattern + return sess, domain.sessions.Read(domain.idIndex.ToQuery(id), &sess) +} + +func (domain *Domain) Create(user *user.User, salt string, password string) error { + user.Created = time.Now().Unix() + user.Updated = time.Now().Unix() + err := domain.users.Create(user) + if err != nil { + return err + } + return domain.passwords.Create(pw{ + ID: user.Id, + Password: password, + Salt: salt, + }) +} + +func (domain *Domain) Delete(id string) error { + return domain.users.Delete(domain.idIndex.ToQuery(id)) +} + +func (domain *Domain) Update(user *user.User) error { + user.Updated = time.Now().Unix() + return domain.users.Create(user) +} + +func (domain *Domain) Read(id string) (*user.User, error) { + user := &user.User{} + return user, domain.users.Read(domain.idIndex.ToQuery(id), user) +} + +func (domain *Domain) Search(username, email string, limit, offset int64) ([]*user.User, error) { + var query model.Query + if len(username) > 0 { + query = domain.nameIndex.ToQuery(username) + } else if len(email) > 0 { + query = domain.emailIndex.ToQuery(email) + } else { + return nil, errors.New("username and email cannot be blank") + } + + users := []*user.User{} + return users, domain.users.Read(query, &users) +} + +func (domain *Domain) UpdatePassword(id string, salt string, password string) error { + return domain.passwords.Create(pw{ + ID: id, + Password: password, + Salt: salt, + }) +} + +func (domain *Domain) SaltAndPassword(username, email string) (string, string, error) { + var query model.Query + if len(username) > 0 { + query = domain.nameIndex.ToQuery(username) + } else if len(email) > 0 { + query = domain.emailIndex.ToQuery(email) + } else { + return "", "", errors.New("username and email cannot be blank") + } + + user := &user.User{} + err := domain.users.Read(query, &user) + if err != nil { + return "", "", err + } + + query = model.QueryEquals("id", user.Id) + query.Order.Type = model.OrderTypeUnordered + + password := &pw{} + err = domain.passwords.Read(query, password) + if err != nil { + return "", "", err + } + return password.Salt, password.Password, nil +} diff --git a/users/generate.go b/users/generate.go new file mode 100644 index 0000000..7d9db91 --- /dev/null +++ b/users/generate.go @@ -0,0 +1,3 @@ +package main + +//go:generate make proto diff --git a/users/handler/handler.go b/users/handler/handler.go new file mode 100644 index 0000000..3a16cd0 --- /dev/null +++ b/users/handler/handler.go @@ -0,0 +1,174 @@ +package handler + +import ( + "crypto/rand" + "encoding/base64" + "strings" + "time" + + "github.com/micro/services/users/domain" + pb "github.com/micro/services/users/proto" + "github.com/micro/micro/v3/service/errors" + "golang.org/x/crypto/bcrypt" + "golang.org/x/net/context" +) + +const ( + x = "cruft123" +) + +var ( + alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" +) + +func random(i int) string { + bytes := make([]byte, i) + for { + rand.Read(bytes) + for i, b := range bytes { + bytes[i] = alphanum[b%byte(len(alphanum))] + } + return string(bytes) + } + return "ughwhy?!!!" +} + +type Users struct { + domain *domain.Domain +} + +func NewUsers() *Users { + return &Users{ + domain: domain.New(), + } +} + +func (s *Users) Create(ctx context.Context, req *pb.CreateRequest, rsp *pb.CreateResponse) error { + if len(req.Password) < 8 { + return errors.InternalServerError("users.Create.Check", "Password is less than 8 characters") + } + salt := random(16) + h, err := bcrypt.GenerateFromPassword([]byte(x+salt+req.Password), 10) + if err != nil { + return errors.InternalServerError("users.Create", err.Error()) + } + pp := base64.StdEncoding.EncodeToString(h) + + return s.domain.Create(&pb.User{ + Id: req.Id, + Username: strings.ToLower(req.Username), + Email: strings.ToLower(req.Email), + }, salt, pp) +} + +func (s *Users) Read(ctx context.Context, req *pb.ReadRequest, rsp *pb.ReadResponse) error { + user, err := s.domain.Read(req.Id) + if err != nil { + return err + } + rsp.User = user + return nil +} + +func (s *Users) Update(ctx context.Context, req *pb.UpdateRequest, rsp *pb.UpdateResponse) error { + return s.domain.Update(&pb.User{ + Id: req.Id, + Username: strings.ToLower(req.Username), + Email: strings.ToLower(req.Email), + }) +} + +func (s *Users) Delete(ctx context.Context, req *pb.DeleteRequest, rsp *pb.DeleteResponse) error { + return s.domain.Delete(req.Id) +} + +func (s *Users) Search(ctx context.Context, req *pb.SearchRequest, rsp *pb.SearchResponse) error { + users, err := s.domain.Search(req.Username, req.Email, req.Limit, req.Offset) + if err != nil { + return err + } + rsp.Users = users + return nil +} + +func (s *Users) UpdatePassword(ctx context.Context, req *pb.UpdatePasswordRequest, rsp *pb.UpdatePasswordResponse) error { + usr, err := s.domain.Read(req.UserId) + if err != nil { + return errors.InternalServerError("users.updatepassword", err.Error()) + } + if req.NewPassword != req.ConfirmPassword { + return errors.InternalServerError("users.updatepassword", "Passwords don't math") + } + + salt, hashed, err := s.domain.SaltAndPassword(usr.Username, usr.Email) + if err != nil { + return errors.InternalServerError("users.updatepassword", err.Error()) + } + + hh, err := base64.StdEncoding.DecodeString(hashed) + if err != nil { + return errors.InternalServerError("users.updatepassword", err.Error()) + } + + if err := bcrypt.CompareHashAndPassword(hh, []byte(x+salt+req.OldPassword)); err != nil { + return errors.Unauthorized("users.updatepassword", err.Error()) + } + + salt = random(16) + h, err := bcrypt.GenerateFromPassword([]byte(x+salt+req.NewPassword), 10) + if err != nil { + return errors.InternalServerError("users.updatepassword", err.Error()) + } + pp := base64.StdEncoding.EncodeToString(h) + + if err := s.domain.UpdatePassword(req.UserId, salt, pp); err != nil { + return errors.InternalServerError("users.updatepassword", err.Error()) + } + return nil +} + +func (s *Users) Login(ctx context.Context, req *pb.LoginRequest, rsp *pb.LoginResponse) error { + username := strings.ToLower(req.Username) + email := strings.ToLower(req.Email) + + salt, hashed, err := s.domain.SaltAndPassword(username, email) + if err != nil { + return err + } + + hh, err := base64.StdEncoding.DecodeString(hashed) + if err != nil { + return errors.InternalServerError("users.Login", err.Error()) + } + + if err := bcrypt.CompareHashAndPassword(hh, []byte(x+salt+req.Password)); err != nil { + return errors.Unauthorized("users.login", err.Error()) + } + // save session + sess := &pb.Session{ + Id: random(128), + Username: username, + Email: email, + Created: time.Now().Unix(), + Expires: time.Now().Add(time.Hour * 24 * 7).Unix(), + } + + if err := s.domain.CreateSession(sess); err != nil { + return errors.InternalServerError("users.Login", err.Error()) + } + rsp.Session = sess + return nil +} + +func (s *Users) Logout(ctx context.Context, req *pb.LogoutRequest, rsp *pb.LogoutResponse) error { + return s.domain.DeleteSession(req.SessionId) +} + +func (s *Users) ReadSession(ctx context.Context, req *pb.ReadSessionRequest, rsp *pb.ReadSessionResponse) error { + sess, err := s.domain.ReadSession(req.SessionId) + if err != nil { + return err + } + rsp.Session = sess + return nil +} diff --git a/users/main.go b/users/main.go new file mode 100644 index 0000000..b606b63 --- /dev/null +++ b/users/main.go @@ -0,0 +1,22 @@ +package main + +import ( + "github.com/micro/services/users/handler" + proto "github.com/micro/services/users/proto" + "github.com/micro/micro/v3/service" + "github.com/micro/micro/v3/service/logger" +) + +func main() { + service := service.New( + service.Name("users"), + ) + + service.Init() + + proto.RegisterUsersHandler(service.Server(), handler.NewUsers()) + + if err := service.Run(); err != nil { + logger.Fatal(err) + } +} diff --git a/users/proto/users.pb.go b/users/proto/users.pb.go new file mode 100644 index 0000000..bcdf055 --- /dev/null +++ b/users/proto/users.pb.go @@ -0,0 +1,1536 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 +// source: proto/users.proto + +package users + +import ( + proto "github.com/golang/protobuf/proto" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // uuid + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // alphanumeric user or org + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` + Created int64 `protobuf:"varint,4,opt,name=created,proto3" json:"created,omitempty"` // unix + Updated int64 `protobuf:"varint,5,opt,name=updated,proto3" json:"updated,omitempty"` // unix +} + +func (x *User) Reset() { + *x = User{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{0} +} + +func (x *User) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *User) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *User) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *User) GetCreated() int64 { + if x != nil { + return x.Created + } + return 0 +} + +func (x *User) GetUpdated() int64 { + if x != nil { + return x.Updated + } + return 0 +} + +type Session struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` + Created int64 `protobuf:"varint,4,opt,name=created,proto3" json:"created,omitempty"` // unix + Expires int64 `protobuf:"varint,5,opt,name=expires,proto3" json:"expires,omitempty"` // unix +} + +func (x *Session) Reset() { + *x = Session{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Session) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Session) ProtoMessage() {} + +func (x *Session) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Session.ProtoReflect.Descriptor instead. +func (*Session) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{1} +} + +func (x *Session) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Session) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *Session) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *Session) GetCreated() int64 { + if x != nil { + return x.Created + } + return 0 +} + +func (x *Session) GetExpires() int64 { + if x != nil { + return x.Expires + } + return 0 +} + +type CreateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // uuid + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // alphanumeric user or org + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *CreateRequest) Reset() { + *x = CreateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRequest) ProtoMessage() {} + +func (x *CreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead. +func (*CreateRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CreateRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *CreateRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *CreateRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type CreateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CreateResponse) Reset() { + *x = CreateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateResponse) ProtoMessage() {} + +func (x *CreateResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead. +func (*CreateResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{3} +} + +type DeleteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeleteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{5} +} + +type ReadRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *ReadRequest) Reset() { + *x = ReadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadRequest) ProtoMessage() {} + +func (x *ReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead. +func (*ReadRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{6} +} + +func (x *ReadRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type ReadResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *ReadResponse) Reset() { + *x = ReadResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadResponse) ProtoMessage() {} + +func (x *ReadResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead. +func (*ReadResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{7} +} + +func (x *ReadResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type UpdateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // uuid + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // alphanumeric user or org + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` +} + +func (x *UpdateRequest) Reset() { + *x = UpdateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRequest) ProtoMessage() {} + +func (x *UpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead. +func (*UpdateRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UpdateRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +type UpdateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateResponse) Reset() { + *x = UpdateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateResponse) ProtoMessage() {} + +func (x *UpdateResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead. +func (*UpdateResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{9} +} + +type UpdatePasswordRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + OldPassword string `protobuf:"bytes,2,opt,name=oldPassword,proto3" json:"oldPassword,omitempty"` + NewPassword string `protobuf:"bytes,3,opt,name=newPassword,proto3" json:"newPassword,omitempty"` + ConfirmPassword string `protobuf:"bytes,4,opt,name=confirm_password,json=confirmPassword,proto3" json:"confirm_password,omitempty"` +} + +func (x *UpdatePasswordRequest) Reset() { + *x = UpdatePasswordRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePasswordRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePasswordRequest) ProtoMessage() {} + +func (x *UpdatePasswordRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdatePasswordRequest.ProtoReflect.Descriptor instead. +func (*UpdatePasswordRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{10} +} + +func (x *UpdatePasswordRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdatePasswordRequest) GetOldPassword() string { + if x != nil { + return x.OldPassword + } + return "" +} + +func (x *UpdatePasswordRequest) GetNewPassword() string { + if x != nil { + return x.NewPassword + } + return "" +} + +func (x *UpdatePasswordRequest) GetConfirmPassword() string { + if x != nil { + return x.ConfirmPassword + } + return "" +} + +type UpdatePasswordResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdatePasswordResponse) Reset() { + *x = UpdatePasswordResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePasswordResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePasswordResponse) ProtoMessage() {} + +func (x *UpdatePasswordResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdatePasswordResponse.ProtoReflect.Descriptor instead. +func (*UpdatePasswordResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{11} +} + +type SearchRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + Offset int64 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"` +} + +func (x *SearchRequest) Reset() { + *x = SearchRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest) ProtoMessage() {} + +func (x *SearchRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead. +func (*SearchRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{12} +} + +func (x *SearchRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *SearchRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *SearchRequest) GetLimit() int64 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *SearchRequest) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +type SearchResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` +} + +func (x *SearchResponse) Reset() { + *x = SearchResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchResponse) ProtoMessage() {} + +func (x *SearchResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead. +func (*SearchResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{13} +} + +func (x *SearchResponse) GetUsers() []*User { + if x != nil { + return x.Users + } + return nil +} + +type ReadSessionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SessionId string `protobuf:"bytes,1,opt,name=sessionId,proto3" json:"sessionId,omitempty"` +} + +func (x *ReadSessionRequest) Reset() { + *x = ReadSessionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadSessionRequest) ProtoMessage() {} + +func (x *ReadSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadSessionRequest.ProtoReflect.Descriptor instead. +func (*ReadSessionRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{14} +} + +func (x *ReadSessionRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +type ReadSessionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Session *Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` +} + +func (x *ReadSessionResponse) Reset() { + *x = ReadSessionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadSessionResponse) ProtoMessage() {} + +func (x *ReadSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadSessionResponse.ProtoReflect.Descriptor instead. +func (*ReadSessionResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{15} +} + +func (x *ReadSessionResponse) GetSession() *Session { + if x != nil { + return x.Session + } + return nil +} + +type LoginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *LoginRequest) Reset() { + *x = LoginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginRequest) ProtoMessage() {} + +func (x *LoginRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead. +func (*LoginRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{16} +} + +func (x *LoginRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *LoginRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *LoginRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type LoginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Session *Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` +} + +func (x *LoginResponse) Reset() { + *x = LoginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginResponse) ProtoMessage() {} + +func (x *LoginResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead. +func (*LoginResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{17} +} + +func (x *LoginResponse) GetSession() *Session { + if x != nil { + return x.Session + } + return nil +} + +type LogoutRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SessionId string `protobuf:"bytes,1,opt,name=sessionId,proto3" json:"sessionId,omitempty"` +} + +func (x *LogoutRequest) Reset() { + *x = LogoutRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogoutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogoutRequest) ProtoMessage() {} + +func (x *LogoutRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead. +func (*LogoutRequest) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{18} +} + +func (x *LogoutRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +type LogoutResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *LogoutResponse) Reset() { + *x = LogoutResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_users_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogoutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogoutResponse) ProtoMessage() {} + +func (x *LogoutResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_users_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogoutResponse.ProtoReflect.Descriptor instead. +func (*LogoutResponse) Descriptor() ([]byte, []int) { + return file_proto_users_proto_rawDescGZIP(), []int{19} +} + +var File_proto_users_proto protoreflect.FileDescriptor + +var file_proto_users_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x7c, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x22, 0x7f, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x18, + 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x69, + 0x72, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, + 0x65, 0x73, 0x22, 0x6d, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x29, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, + 0x22, 0x51, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, + 0x61, 0x69, 0x6c, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x6c, 0x64, 0x50, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x6c, + 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x77, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x6e, 0x65, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x6f, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, + 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x22, 0x2d, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, + 0x22, 0x32, 0x0a, 0x12, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x39, 0x0a, 0x13, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, + 0x5c, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x33, 0x0a, + 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, + 0x0a, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x08, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x22, 0x2d, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0xba, 0x03, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x2b, 0x0a, + 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x25, 0x0a, 0x04, 0x52, 0x65, + 0x61, 0x64, 0x12, 0x0c, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0d, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x2b, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2b, + 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x0e, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x06, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x0e, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x16, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x28, 0x0a, + 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0d, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x6f, 0x75, + 0x74, 0x12, 0x0e, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_users_proto_rawDescOnce sync.Once + file_proto_users_proto_rawDescData = file_proto_users_proto_rawDesc +) + +func file_proto_users_proto_rawDescGZIP() []byte { + file_proto_users_proto_rawDescOnce.Do(func() { + file_proto_users_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_users_proto_rawDescData) + }) + return file_proto_users_proto_rawDescData +} + +var file_proto_users_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_proto_users_proto_goTypes = []interface{}{ + (*User)(nil), // 0: User + (*Session)(nil), // 1: Session + (*CreateRequest)(nil), // 2: CreateRequest + (*CreateResponse)(nil), // 3: CreateResponse + (*DeleteRequest)(nil), // 4: DeleteRequest + (*DeleteResponse)(nil), // 5: DeleteResponse + (*ReadRequest)(nil), // 6: ReadRequest + (*ReadResponse)(nil), // 7: ReadResponse + (*UpdateRequest)(nil), // 8: UpdateRequest + (*UpdateResponse)(nil), // 9: UpdateResponse + (*UpdatePasswordRequest)(nil), // 10: UpdatePasswordRequest + (*UpdatePasswordResponse)(nil), // 11: UpdatePasswordResponse + (*SearchRequest)(nil), // 12: SearchRequest + (*SearchResponse)(nil), // 13: SearchResponse + (*ReadSessionRequest)(nil), // 14: ReadSessionRequest + (*ReadSessionResponse)(nil), // 15: ReadSessionResponse + (*LoginRequest)(nil), // 16: LoginRequest + (*LoginResponse)(nil), // 17: LoginResponse + (*LogoutRequest)(nil), // 18: LogoutRequest + (*LogoutResponse)(nil), // 19: LogoutResponse +} +var file_proto_users_proto_depIdxs = []int32{ + 0, // 0: ReadResponse.user:type_name -> User + 0, // 1: SearchResponse.users:type_name -> User + 1, // 2: ReadSessionResponse.session:type_name -> Session + 1, // 3: LoginResponse.session:type_name -> Session + 2, // 4: Users.Create:input_type -> CreateRequest + 6, // 5: Users.Read:input_type -> ReadRequest + 8, // 6: Users.Update:input_type -> UpdateRequest + 4, // 7: Users.Delete:input_type -> DeleteRequest + 12, // 8: Users.Search:input_type -> SearchRequest + 10, // 9: Users.UpdatePassword:input_type -> UpdatePasswordRequest + 16, // 10: Users.Login:input_type -> LoginRequest + 18, // 11: Users.Logout:input_type -> LogoutRequest + 14, // 12: Users.ReadSession:input_type -> ReadSessionRequest + 3, // 13: Users.Create:output_type -> CreateResponse + 7, // 14: Users.Read:output_type -> ReadResponse + 9, // 15: Users.Update:output_type -> UpdateResponse + 5, // 16: Users.Delete:output_type -> DeleteResponse + 13, // 17: Users.Search:output_type -> SearchResponse + 11, // 18: Users.UpdatePassword:output_type -> UpdatePasswordResponse + 17, // 19: Users.Login:output_type -> LoginResponse + 19, // 20: Users.Logout:output_type -> LogoutResponse + 15, // 21: Users.ReadSession:output_type -> ReadSessionResponse + 13, // [13:22] is the sub-list for method output_type + 4, // [4:13] 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_proto_users_proto_init() } +func file_proto_users_proto_init() { + if File_proto_users_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_users_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*User); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Session); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePasswordRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePasswordResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadSessionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadSessionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogoutRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_users_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogoutResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_users_proto_rawDesc, + NumEnums: 0, + NumMessages: 20, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_users_proto_goTypes, + DependencyIndexes: file_proto_users_proto_depIdxs, + MessageInfos: file_proto_users_proto_msgTypes, + }.Build() + File_proto_users_proto = out.File + file_proto_users_proto_rawDesc = nil + file_proto_users_proto_goTypes = nil + file_proto_users_proto_depIdxs = nil +} diff --git a/users/proto/users.pb.micro.go b/users/proto/users.pb.micro.go new file mode 100644 index 0000000..0e48876 --- /dev/null +++ b/users/proto/users.pb.micro.go @@ -0,0 +1,229 @@ +// Code generated by protoc-gen-micro. DO NOT EDIT. +// source: proto/users.proto + +package users + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +import ( + context "context" + api "github.com/micro/micro/v3/service/api" + client "github.com/micro/micro/v3/service/client" + server "github.com/micro/micro/v3/service/server" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Reference imports to suppress errors if they are not otherwise used. +var _ api.Endpoint +var _ context.Context +var _ client.Option +var _ server.Option + +// Api Endpoints for Users service + +func NewUsersEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for Users service + +type UsersService interface { + Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) + Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) + Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) + Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) + Search(ctx context.Context, in *SearchRequest, opts ...client.CallOption) (*SearchResponse, error) + UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, opts ...client.CallOption) (*UpdatePasswordResponse, error) + Login(ctx context.Context, in *LoginRequest, opts ...client.CallOption) (*LoginResponse, error) + Logout(ctx context.Context, in *LogoutRequest, opts ...client.CallOption) (*LogoutResponse, error) + ReadSession(ctx context.Context, in *ReadSessionRequest, opts ...client.CallOption) (*ReadSessionResponse, error) +} + +type usersService struct { + c client.Client + name string +} + +func NewUsersService(name string, c client.Client) UsersService { + return &usersService{ + c: c, + name: name, + } +} + +func (c *usersService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) { + req := c.c.NewRequest(c.name, "Users.Create", in) + out := new(CreateResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *usersService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) { + req := c.c.NewRequest(c.name, "Users.Read", in) + out := new(ReadResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *usersService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) { + req := c.c.NewRequest(c.name, "Users.Update", in) + out := new(UpdateResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *usersService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) { + req := c.c.NewRequest(c.name, "Users.Delete", in) + out := new(DeleteResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *usersService) Search(ctx context.Context, in *SearchRequest, opts ...client.CallOption) (*SearchResponse, error) { + req := c.c.NewRequest(c.name, "Users.Search", in) + out := new(SearchResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *usersService) UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, opts ...client.CallOption) (*UpdatePasswordResponse, error) { + req := c.c.NewRequest(c.name, "Users.UpdatePassword", in) + out := new(UpdatePasswordResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *usersService) Login(ctx context.Context, in *LoginRequest, opts ...client.CallOption) (*LoginResponse, error) { + req := c.c.NewRequest(c.name, "Users.Login", in) + out := new(LoginResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *usersService) Logout(ctx context.Context, in *LogoutRequest, opts ...client.CallOption) (*LogoutResponse, error) { + req := c.c.NewRequest(c.name, "Users.Logout", in) + out := new(LogoutResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *usersService) ReadSession(ctx context.Context, in *ReadSessionRequest, opts ...client.CallOption) (*ReadSessionResponse, error) { + req := c.c.NewRequest(c.name, "Users.ReadSession", in) + out := new(ReadSessionResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Users service + +type UsersHandler interface { + Create(context.Context, *CreateRequest, *CreateResponse) error + Read(context.Context, *ReadRequest, *ReadResponse) error + Update(context.Context, *UpdateRequest, *UpdateResponse) error + Delete(context.Context, *DeleteRequest, *DeleteResponse) error + Search(context.Context, *SearchRequest, *SearchResponse) error + UpdatePassword(context.Context, *UpdatePasswordRequest, *UpdatePasswordResponse) error + Login(context.Context, *LoginRequest, *LoginResponse) error + Logout(context.Context, *LogoutRequest, *LogoutResponse) error + ReadSession(context.Context, *ReadSessionRequest, *ReadSessionResponse) error +} + +func RegisterUsersHandler(s server.Server, hdlr UsersHandler, opts ...server.HandlerOption) error { + type users interface { + Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error + Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error + Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error + Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error + Search(ctx context.Context, in *SearchRequest, out *SearchResponse) error + UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, out *UpdatePasswordResponse) error + Login(ctx context.Context, in *LoginRequest, out *LoginResponse) error + Logout(ctx context.Context, in *LogoutRequest, out *LogoutResponse) error + ReadSession(ctx context.Context, in *ReadSessionRequest, out *ReadSessionResponse) error + } + type Users struct { + users + } + h := &usersHandler{hdlr} + return s.Handle(s.NewHandler(&Users{h}, opts...)) +} + +type usersHandler struct { + UsersHandler +} + +func (h *usersHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error { + return h.UsersHandler.Create(ctx, in, out) +} + +func (h *usersHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error { + return h.UsersHandler.Read(ctx, in, out) +} + +func (h *usersHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error { + return h.UsersHandler.Update(ctx, in, out) +} + +func (h *usersHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error { + return h.UsersHandler.Delete(ctx, in, out) +} + +func (h *usersHandler) Search(ctx context.Context, in *SearchRequest, out *SearchResponse) error { + return h.UsersHandler.Search(ctx, in, out) +} + +func (h *usersHandler) UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, out *UpdatePasswordResponse) error { + return h.UsersHandler.UpdatePassword(ctx, in, out) +} + +func (h *usersHandler) Login(ctx context.Context, in *LoginRequest, out *LoginResponse) error { + return h.UsersHandler.Login(ctx, in, out) +} + +func (h *usersHandler) Logout(ctx context.Context, in *LogoutRequest, out *LogoutResponse) error { + return h.UsersHandler.Logout(ctx, in, out) +} + +func (h *usersHandler) ReadSession(ctx context.Context, in *ReadSessionRequest, out *ReadSessionResponse) error { + return h.UsersHandler.ReadSession(ctx, in, out) +} diff --git a/users/proto/users.proto b/users/proto/users.proto new file mode 100644 index 0000000..8d9d0ce --- /dev/null +++ b/users/proto/users.proto @@ -0,0 +1,110 @@ +syntax = "proto3"; + +service Users { + rpc Create(CreateRequest) returns (CreateResponse) {} + rpc Read(ReadRequest) returns (ReadResponse) {} + rpc Update(UpdateRequest) returns (UpdateResponse) {} + rpc Delete(DeleteRequest) returns (DeleteResponse) {} + rpc Search(SearchRequest) returns (SearchResponse) {} + rpc UpdatePassword(UpdatePasswordRequest) returns (UpdatePasswordResponse) {} + rpc Login(LoginRequest) returns (LoginResponse) {} + rpc Logout(LogoutRequest) returns (LogoutResponse) {} + rpc ReadSession(ReadSessionRequest) returns(ReadSessionResponse) {} +} + +message User { + string id = 1; // uuid + string username = 2; // alphanumeric user or org + string email = 3; + int64 created = 4; // unix + int64 updated = 5; // unix +} + +message Session { + string id = 1; + string username = 2; + string email = 3; + int64 created = 4; // unix + int64 expires = 5; // unix +} + +message CreateRequest { + string id = 1; // uuid + string username = 2; // alphanumeric user or org + string email = 3; + string password = 4; +} + +message CreateResponse { +} + +message DeleteRequest { + string id = 1; +} + +message DeleteResponse { +} + +message ReadRequest { + string id = 1; +} + +message ReadResponse { + User user = 1; +} + +message UpdateRequest { + string id = 1; // uuid + string username = 2; // alphanumeric user or org + string email = 3; +} + +message UpdateResponse { +} + +message UpdatePasswordRequest { + string userId = 1; + string oldPassword = 2; + string newPassword = 3; + string confirm_password = 4; +} + +message UpdatePasswordResponse { +} + +message SearchRequest { + string username = 1; + string email = 2; + int64 limit = 3; + int64 offset = 4; +} + +message SearchResponse { + repeated User users = 1; +} + +message ReadSessionRequest { + string sessionId = 1; +} + +message ReadSessionResponse { + Session session = 1; +} + +message LoginRequest { + string username = 1; + string email = 2; + string password = 3; +} + +message LoginResponse { + Session session = 1; +} + +message LogoutRequest { + string sessionId = 1; +} + +message LogoutResponse { +} +