diff --git a/config.yaml b/config.yaml index f5dba71..56de33b 100644 --- a/config.yaml +++ b/config.yaml @@ -38,7 +38,7 @@ services: identification: local: jwt_secret: JWT_KEY - ttl: 120s + ttl: 20000s carpooling_proofs: rpc_registry: diff --git a/go.mod b/go.mod index ec66cca..0bbafca 100644 --- a/go.mod +++ b/go.mod @@ -21,6 +21,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-stack/stack v1.8.0 // indirect diff --git a/go.sum b/go.sum index e4068e6..beec789 100644 --- a/go.sum +++ b/go.sum @@ -64,6 +64,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= diff --git a/handler/authentication.go b/handler/authentication.go index 5f4b362..02ba00a 100644 --- a/handler/authentication.go +++ b/handler/authentication.go @@ -10,15 +10,12 @@ func (h *SilvermobiHandler) Login(ctx context.Context, username string, password if err != nil { return } - key := h.Config.GetString("identification.local.jwt_secret") ttl := h.Config.GetString("identification.local.ttl") - parsedttl, err := time.ParseDuration(ttl) if err != nil { return "", err } - return account.CreateToken(parsedttl, key) } diff --git a/handler/onboarding_validation.go b/handler/onboarding_validation.go index 785cd27..19cb261 100644 --- a/handler/onboarding_validation.go +++ b/handler/onboarding_validation.go @@ -10,15 +10,11 @@ import ( "math/rand" ) -func (h *SilvermobiHandler) UpdatePhoneNumber(ctx context.Context, email string, phone_number string) error { +func (h *SilvermobiHandler) UpdatePhoneNumber(ctx context.Context, id string, phone_number string) error { code := rand.Intn(9999) - account, err := h.Services.MobilityAccounts.GetAccountUsername(ctx, email, "silvermobi") - if err != nil { - return err - } - err = h.Services.MobilityAccounts.UpdatePhoneNumber( + err := h.Services.MobilityAccounts.UpdatePhoneNumber( ctx, - account.ID, + id, phone_number, false, fmt.Sprintf("%04d", code), @@ -44,10 +40,9 @@ func (h *SilvermobiHandler) UpdatePhoneNumber(ctx context.Context, email string, return nil } -func (h *SilvermobiHandler) VerifyPhoneNumber(ctx context.Context, email string, phone_number string, verification_code string) error { - account, err := h.Services.MobilityAccounts.GetAccountUsername(ctx, email, "silvermobi") +func (h *SilvermobiHandler) VerifyPhoneNumber(ctx context.Context, id string, phone_number string, verification_code string) error { request := &grpcapi.GetAccountRequest{ - Id: account.ID, + Id: id, } resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request) if err != nil { @@ -69,7 +64,7 @@ func (h *SilvermobiHandler) VerifyPhoneNumber(ctx context.Context, email string, err = h.Services.MobilityAccounts.UpdatePhoneNumber( ctx, - account.ID, + id, phone_number, true, "", @@ -81,29 +76,62 @@ func (h *SilvermobiHandler) VerifyPhoneNumber(ctx context.Context, email string, return nil } -func (h *SilvermobiHandler) UpdateBirthDate(ctx context.Context, username string, birthdate string) error { - err := h.Services.MobilityAccounts.UpdateAccountBirthDate(ctx, username, "silvermobi", birthdate) +func (h *SilvermobiHandler) UpdateBirthDate(ctx context.Context, id string, birthdate string) error { + err := h.Services.MobilityAccounts.UpdateAccountBirthDate(ctx, id, "silvermobi", birthdate) if err != nil { return err } return nil } -func (h *SilvermobiHandler) CheckValidation(ctx context.Context, email string) (phone_validation, birth_validation bool, err error) { - account, err := h.Services.MobilityAccounts.GetAccountUsername(ctx, email, "silvermobi") +func (h *SilvermobiHandler) SetAccountType(ctx context.Context, id string, accountType string) error { + err := h.Services.MobilityAccounts.SetAccountType(ctx, id, accountType) if err != nil { - return false, false, err + return err + } + return nil +} +func (h *SilvermobiHandler) GetAccountType(ctx context.Context, id string) (account_type string, err error) { + request := &grpcapi.GetAccountRequest{ + Id: id, + } + resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request) + if err != nil { + return "", err + log.Error().Err(err).Msg("Failed get account type") + } + account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType()) + if account.Type != "" { + + return account.Type, nil + } + return "", errors.New("account type not set") +} + +func (h *SilvermobiHandler) CheckValidation(ctx context.Context, id string) (phone_validation, birth_validation, type_validation bool, err error) { + request := &grpcapi.GetAccountRequest{ + Id: id, + } + resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request) + if err != nil { + return false, false, false, err log.Error().Err(err).Msg("Failed get validation response") } + account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType()) phone_validation = false birth_validation = false + type_validation = false if account.LocalCredentials.PhoneNumberVerified { phone_validation = true - } if account.BirthDate != "" { birth_validation = true } - log.Info().Msg("Getting phone and birth validation for " + email) - return phone_validation, birth_validation, nil + fmt.Println(account.Type) + if account.Type != "" { + type_validation = true + } + + log.Info().Msg("Getting phone and birth validation for " + account.Email) + return phone_validation, birth_validation, type_validation, nil } diff --git a/models/accounts.go b/models/accounts.go index 5e997ef..e4cdcfc 100644 --- a/models/accounts.go +++ b/models/accounts.go @@ -11,6 +11,7 @@ type Account struct { LastName string `json:"lastName,omitempty"` VerifiedIdentity *bool `json:"verifiedIdentity,omitempty"` BirthDate string `json:"birthdate,omitempty"` + Type string `json:"type,omitempty"` LocalCredentials } @@ -31,7 +32,7 @@ func (account Account) CreateToken(ttl time.Duration, key string) (token string, expires_at := jwt.NewNumericDate(time.Now().Add(ttl)) claims := UserClaims{ RegisteredClaims: jwt.RegisteredClaims{ - Subject: account.Email, + Subject: account.ID, ExpiresAt: expires_at, }, } diff --git a/servers/git.coopgo.io/coopgo-apps/silvermobi/grpcapi/proto/silvermobi-service.pb.go b/servers/git.coopgo.io/coopgo-apps/silvermobi/grpcapi/proto/silvermobi-service.pb.go deleted file mode 100644 index 3d6a8eb..0000000 --- a/servers/git.coopgo.io/coopgo-apps/silvermobi/grpcapi/proto/silvermobi-service.pb.go +++ /dev/null @@ -1,1002 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: silvermobi-service.proto - -package proto - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" - math "math" -) - -// 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 - -type AuthLoginRequest struct { - Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AuthLoginRequest) Reset() { *m = AuthLoginRequest{} } -func (m *AuthLoginRequest) String() string { return proto.CompactTextString(m) } -func (*AuthLoginRequest) ProtoMessage() {} -func (*AuthLoginRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{0} -} - -func (m *AuthLoginRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AuthLoginRequest.Unmarshal(m, b) -} -func (m *AuthLoginRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AuthLoginRequest.Marshal(b, m, deterministic) -} -func (m *AuthLoginRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthLoginRequest.Merge(m, src) -} -func (m *AuthLoginRequest) XXX_Size() int { - return xxx_messageInfo_AuthLoginRequest.Size(m) -} -func (m *AuthLoginRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthLoginRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthLoginRequest proto.InternalMessageInfo - -func (m *AuthLoginRequest) GetUsername() string { - if m != nil { - return m.Username - } - return "" -} - -func (m *AuthLoginRequest) GetPassword() string { - if m != nil { - return m.Password - } - return "" -} - -type AuthLoginResponse struct { - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AuthLoginResponse) Reset() { *m = AuthLoginResponse{} } -func (m *AuthLoginResponse) String() string { return proto.CompactTextString(m) } -func (*AuthLoginResponse) ProtoMessage() {} -func (*AuthLoginResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{1} -} - -func (m *AuthLoginResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AuthLoginResponse.Unmarshal(m, b) -} -func (m *AuthLoginResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AuthLoginResponse.Marshal(b, m, deterministic) -} -func (m *AuthLoginResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthLoginResponse.Merge(m, src) -} -func (m *AuthLoginResponse) XXX_Size() int { - return xxx_messageInfo_AuthLoginResponse.Size(m) -} -func (m *AuthLoginResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthLoginResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthLoginResponse proto.InternalMessageInfo - -func (m *AuthLoginResponse) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -type AuthRegisterRequest struct { - Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - FirstName string `protobuf:"bytes,3,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"` - LastName string `protobuf:"bytes,4,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"` - PhoneNumber string `protobuf:"bytes,5,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AuthRegisterRequest) Reset() { *m = AuthRegisterRequest{} } -func (m *AuthRegisterRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRegisterRequest) ProtoMessage() {} -func (*AuthRegisterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{2} -} - -func (m *AuthRegisterRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AuthRegisterRequest.Unmarshal(m, b) -} -func (m *AuthRegisterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AuthRegisterRequest.Marshal(b, m, deterministic) -} -func (m *AuthRegisterRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRegisterRequest.Merge(m, src) -} -func (m *AuthRegisterRequest) XXX_Size() int { - return xxx_messageInfo_AuthRegisterRequest.Size(m) -} -func (m *AuthRegisterRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRegisterRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthRegisterRequest proto.InternalMessageInfo - -func (m *AuthRegisterRequest) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *AuthRegisterRequest) GetPassword() string { - if m != nil { - return m.Password - } - return "" -} - -func (m *AuthRegisterRequest) GetFirstName() string { - if m != nil { - return m.FirstName - } - return "" -} - -func (m *AuthRegisterRequest) GetLastName() string { - if m != nil { - return m.LastName - } - return "" -} - -func (m *AuthRegisterRequest) GetPhoneNumber() string { - if m != nil { - return m.PhoneNumber - } - return "" -} - -type AuthRegisterResponse struct { - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AuthRegisterResponse) Reset() { *m = AuthRegisterResponse{} } -func (m *AuthRegisterResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRegisterResponse) ProtoMessage() {} -func (*AuthRegisterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{3} -} - -func (m *AuthRegisterResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AuthRegisterResponse.Unmarshal(m, b) -} -func (m *AuthRegisterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AuthRegisterResponse.Marshal(b, m, deterministic) -} -func (m *AuthRegisterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthRegisterResponse.Merge(m, src) -} -func (m *AuthRegisterResponse) XXX_Size() int { - return xxx_messageInfo_AuthRegisterResponse.Size(m) -} -func (m *AuthRegisterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AuthRegisterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthRegisterResponse proto.InternalMessageInfo - -func (m *AuthRegisterResponse) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -type ForgetAccountRequest struct { - Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ForgetAccountRequest) Reset() { *m = ForgetAccountRequest{} } -func (m *ForgetAccountRequest) String() string { return proto.CompactTextString(m) } -func (*ForgetAccountRequest) ProtoMessage() {} -func (*ForgetAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{4} -} - -func (m *ForgetAccountRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ForgetAccountRequest.Unmarshal(m, b) -} -func (m *ForgetAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ForgetAccountRequest.Marshal(b, m, deterministic) -} -func (m *ForgetAccountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ForgetAccountRequest.Merge(m, src) -} -func (m *ForgetAccountRequest) XXX_Size() int { - return xxx_messageInfo_ForgetAccountRequest.Size(m) -} -func (m *ForgetAccountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ForgetAccountRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ForgetAccountRequest proto.InternalMessageInfo - -func (m *ForgetAccountRequest) GetUsername() string { - if m != nil { - return m.Username - } - return "" -} - -func (m *ForgetAccountRequest) GetNamespace() string { - if m != nil { - return m.Namespace - } - return "" -} - -type ForgetAccountResponse struct { - Response bool `protobuf:"varint,1,opt,name=response,proto3" json:"response,omitempty"` - AccessCode string `protobuf:"bytes,2,opt,name=access_code,json=accessCode,proto3" json:"access_code,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ForgetAccountResponse) Reset() { *m = ForgetAccountResponse{} } -func (m *ForgetAccountResponse) String() string { return proto.CompactTextString(m) } -func (*ForgetAccountResponse) ProtoMessage() {} -func (*ForgetAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{5} -} - -func (m *ForgetAccountResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ForgetAccountResponse.Unmarshal(m, b) -} -func (m *ForgetAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ForgetAccountResponse.Marshal(b, m, deterministic) -} -func (m *ForgetAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ForgetAccountResponse.Merge(m, src) -} -func (m *ForgetAccountResponse) XXX_Size() int { - return xxx_messageInfo_ForgetAccountResponse.Size(m) -} -func (m *ForgetAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ForgetAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ForgetAccountResponse proto.InternalMessageInfo - -func (m *ForgetAccountResponse) GetResponse() bool { - if m != nil { - return m.Response - } - return false -} - -func (m *ForgetAccountResponse) GetAccessCode() string { - if m != nil { - return m.AccessCode - } - return "" -} - -type UpdatePasswordRequest struct { - Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UpdatePasswordRequest) Reset() { *m = UpdatePasswordRequest{} } -func (m *UpdatePasswordRequest) String() string { return proto.CompactTextString(m) } -func (*UpdatePasswordRequest) ProtoMessage() {} -func (*UpdatePasswordRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{6} -} - -func (m *UpdatePasswordRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdatePasswordRequest.Unmarshal(m, b) -} -func (m *UpdatePasswordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdatePasswordRequest.Marshal(b, m, deterministic) -} -func (m *UpdatePasswordRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdatePasswordRequest.Merge(m, src) -} -func (m *UpdatePasswordRequest) XXX_Size() int { - return xxx_messageInfo_UpdatePasswordRequest.Size(m) -} -func (m *UpdatePasswordRequest) XXX_DiscardUnknown() { - xxx_messageInfo_UpdatePasswordRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_UpdatePasswordRequest proto.InternalMessageInfo - -func (m *UpdatePasswordRequest) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *UpdatePasswordRequest) GetPassword() string { - if m != nil { - return m.Password - } - return "" -} - -type UpdatePasswordResponse struct { - Response bool `protobuf:"varint,1,opt,name=response,proto3" json:"response,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UpdatePasswordResponse) Reset() { *m = UpdatePasswordResponse{} } -func (m *UpdatePasswordResponse) String() string { return proto.CompactTextString(m) } -func (*UpdatePasswordResponse) ProtoMessage() {} -func (*UpdatePasswordResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{7} -} - -func (m *UpdatePasswordResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdatePasswordResponse.Unmarshal(m, b) -} -func (m *UpdatePasswordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdatePasswordResponse.Marshal(b, m, deterministic) -} -func (m *UpdatePasswordResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdatePasswordResponse.Merge(m, src) -} -func (m *UpdatePasswordResponse) XXX_Size() int { - return xxx_messageInfo_UpdatePasswordResponse.Size(m) -} -func (m *UpdatePasswordResponse) XXX_DiscardUnknown() { - xxx_messageInfo_UpdatePasswordResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_UpdatePasswordResponse proto.InternalMessageInfo - -func (m *UpdatePasswordResponse) GetResponse() bool { - if m != nil { - return m.Response - } - return false -} - -type SetPhoneNumberRequest struct { - PhoneNumber string `protobuf:"bytes,1,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` - Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetPhoneNumberRequest) Reset() { *m = SetPhoneNumberRequest{} } -func (m *SetPhoneNumberRequest) String() string { return proto.CompactTextString(m) } -func (*SetPhoneNumberRequest) ProtoMessage() {} -func (*SetPhoneNumberRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{8} -} - -func (m *SetPhoneNumberRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetPhoneNumberRequest.Unmarshal(m, b) -} -func (m *SetPhoneNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetPhoneNumberRequest.Marshal(b, m, deterministic) -} -func (m *SetPhoneNumberRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetPhoneNumberRequest.Merge(m, src) -} -func (m *SetPhoneNumberRequest) XXX_Size() int { - return xxx_messageInfo_SetPhoneNumberRequest.Size(m) -} -func (m *SetPhoneNumberRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SetPhoneNumberRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SetPhoneNumberRequest proto.InternalMessageInfo - -func (m *SetPhoneNumberRequest) GetPhoneNumber() string { - if m != nil { - return m.PhoneNumber - } - return "" -} - -func (m *SetPhoneNumberRequest) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -type SetPhoneNumberResponse struct { - Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetPhoneNumberResponse) Reset() { *m = SetPhoneNumberResponse{} } -func (m *SetPhoneNumberResponse) String() string { return proto.CompactTextString(m) } -func (*SetPhoneNumberResponse) ProtoMessage() {} -func (*SetPhoneNumberResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{9} -} - -func (m *SetPhoneNumberResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetPhoneNumberResponse.Unmarshal(m, b) -} -func (m *SetPhoneNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetPhoneNumberResponse.Marshal(b, m, deterministic) -} -func (m *SetPhoneNumberResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetPhoneNumberResponse.Merge(m, src) -} -func (m *SetPhoneNumberResponse) XXX_Size() int { - return xxx_messageInfo_SetPhoneNumberResponse.Size(m) -} -func (m *SetPhoneNumberResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SetPhoneNumberResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SetPhoneNumberResponse proto.InternalMessageInfo - -func (m *SetPhoneNumberResponse) GetOk() bool { - if m != nil { - return m.Ok - } - return false -} - -type VerifyPhoneNumberRequest struct { - PhoneNumber string `protobuf:"bytes,1,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` - VerificationCode string `protobuf:"bytes,2,opt,name=verification_code,json=verificationCode,proto3" json:"verification_code,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *VerifyPhoneNumberRequest) Reset() { *m = VerifyPhoneNumberRequest{} } -func (m *VerifyPhoneNumberRequest) String() string { return proto.CompactTextString(m) } -func (*VerifyPhoneNumberRequest) ProtoMessage() {} -func (*VerifyPhoneNumberRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{10} -} - -func (m *VerifyPhoneNumberRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_VerifyPhoneNumberRequest.Unmarshal(m, b) -} -func (m *VerifyPhoneNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_VerifyPhoneNumberRequest.Marshal(b, m, deterministic) -} -func (m *VerifyPhoneNumberRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_VerifyPhoneNumberRequest.Merge(m, src) -} -func (m *VerifyPhoneNumberRequest) XXX_Size() int { - return xxx_messageInfo_VerifyPhoneNumberRequest.Size(m) -} -func (m *VerifyPhoneNumberRequest) XXX_DiscardUnknown() { - xxx_messageInfo_VerifyPhoneNumberRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_VerifyPhoneNumberRequest proto.InternalMessageInfo - -func (m *VerifyPhoneNumberRequest) GetPhoneNumber() string { - if m != nil { - return m.PhoneNumber - } - return "" -} - -func (m *VerifyPhoneNumberRequest) GetVerificationCode() string { - if m != nil { - return m.VerificationCode - } - return "" -} - -func (m *VerifyPhoneNumberRequest) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -type VerifyPhoneNumberResponse struct { - Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *VerifyPhoneNumberResponse) Reset() { *m = VerifyPhoneNumberResponse{} } -func (m *VerifyPhoneNumberResponse) String() string { return proto.CompactTextString(m) } -func (*VerifyPhoneNumberResponse) ProtoMessage() {} -func (*VerifyPhoneNumberResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{11} -} - -func (m *VerifyPhoneNumberResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_VerifyPhoneNumberResponse.Unmarshal(m, b) -} -func (m *VerifyPhoneNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_VerifyPhoneNumberResponse.Marshal(b, m, deterministic) -} -func (m *VerifyPhoneNumberResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_VerifyPhoneNumberResponse.Merge(m, src) -} -func (m *VerifyPhoneNumberResponse) XXX_Size() int { - return xxx_messageInfo_VerifyPhoneNumberResponse.Size(m) -} -func (m *VerifyPhoneNumberResponse) XXX_DiscardUnknown() { - xxx_messageInfo_VerifyPhoneNumberResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_VerifyPhoneNumberResponse proto.InternalMessageInfo - -func (m *VerifyPhoneNumberResponse) GetOk() bool { - if m != nil { - return m.Ok - } - return false -} - -type BirthDateRequest struct { - Birthdate *timestamp.Timestamp `protobuf:"bytes,1,opt,name=birthdate,proto3" json:"birthdate,omitempty"` - Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BirthDateRequest) Reset() { *m = BirthDateRequest{} } -func (m *BirthDateRequest) String() string { return proto.CompactTextString(m) } -func (*BirthDateRequest) ProtoMessage() {} -func (*BirthDateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{12} -} - -func (m *BirthDateRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BirthDateRequest.Unmarshal(m, b) -} -func (m *BirthDateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BirthDateRequest.Marshal(b, m, deterministic) -} -func (m *BirthDateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BirthDateRequest.Merge(m, src) -} -func (m *BirthDateRequest) XXX_Size() int { - return xxx_messageInfo_BirthDateRequest.Size(m) -} -func (m *BirthDateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BirthDateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BirthDateRequest proto.InternalMessageInfo - -func (m *BirthDateRequest) GetBirthdate() *timestamp.Timestamp { - if m != nil { - return m.Birthdate - } - return nil -} - -func (m *BirthDateRequest) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -type BirthDateResponse struct { - Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BirthDateResponse) Reset() { *m = BirthDateResponse{} } -func (m *BirthDateResponse) String() string { return proto.CompactTextString(m) } -func (*BirthDateResponse) ProtoMessage() {} -func (*BirthDateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{13} -} - -func (m *BirthDateResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BirthDateResponse.Unmarshal(m, b) -} -func (m *BirthDateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BirthDateResponse.Marshal(b, m, deterministic) -} -func (m *BirthDateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BirthDateResponse.Merge(m, src) -} -func (m *BirthDateResponse) XXX_Size() int { - return xxx_messageInfo_BirthDateResponse.Size(m) -} -func (m *BirthDateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BirthDateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BirthDateResponse proto.InternalMessageInfo - -func (m *BirthDateResponse) GetOk() bool { - if m != nil { - return m.Ok - } - return false -} - -type KeyValueRequest struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *KeyValueRequest) Reset() { *m = KeyValueRequest{} } -func (m *KeyValueRequest) String() string { return proto.CompactTextString(m) } -func (*KeyValueRequest) ProtoMessage() {} -func (*KeyValueRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{14} -} - -func (m *KeyValueRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KeyValueRequest.Unmarshal(m, b) -} -func (m *KeyValueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KeyValueRequest.Marshal(b, m, deterministic) -} -func (m *KeyValueRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_KeyValueRequest.Merge(m, src) -} -func (m *KeyValueRequest) XXX_Size() int { - return xxx_messageInfo_KeyValueRequest.Size(m) -} -func (m *KeyValueRequest) XXX_DiscardUnknown() { - xxx_messageInfo_KeyValueRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_KeyValueRequest proto.InternalMessageInfo - -func (m *KeyValueRequest) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *KeyValueRequest) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -type KeyValueResponse struct { - Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *KeyValueResponse) Reset() { *m = KeyValueResponse{} } -func (m *KeyValueResponse) String() string { return proto.CompactTextString(m) } -func (*KeyValueResponse) ProtoMessage() {} -func (*KeyValueResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{15} -} - -func (m *KeyValueResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KeyValueResponse.Unmarshal(m, b) -} -func (m *KeyValueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KeyValueResponse.Marshal(b, m, deterministic) -} -func (m *KeyValueResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_KeyValueResponse.Merge(m, src) -} -func (m *KeyValueResponse) XXX_Size() int { - return xxx_messageInfo_KeyValueResponse.Size(m) -} -func (m *KeyValueResponse) XXX_DiscardUnknown() { - xxx_messageInfo_KeyValueResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_KeyValueResponse proto.InternalMessageInfo - -func (m *KeyValueResponse) GetOk() bool { - if m != nil { - return m.Ok - } - return false -} - -type KeyRequest struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *KeyRequest) Reset() { *m = KeyRequest{} } -func (m *KeyRequest) String() string { return proto.CompactTextString(m) } -func (*KeyRequest) ProtoMessage() {} -func (*KeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{16} -} - -func (m *KeyRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KeyRequest.Unmarshal(m, b) -} -func (m *KeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KeyRequest.Marshal(b, m, deterministic) -} -func (m *KeyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_KeyRequest.Merge(m, src) -} -func (m *KeyRequest) XXX_Size() int { - return xxx_messageInfo_KeyRequest.Size(m) -} -func (m *KeyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_KeyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_KeyRequest proto.InternalMessageInfo - -func (m *KeyRequest) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -type ValueResponse struct { - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ValueResponse) Reset() { *m = ValueResponse{} } -func (m *ValueResponse) String() string { return proto.CompactTextString(m) } -func (*ValueResponse) ProtoMessage() {} -func (*ValueResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{17} -} - -func (m *ValueResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ValueResponse.Unmarshal(m, b) -} -func (m *ValueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ValueResponse.Marshal(b, m, deterministic) -} -func (m *ValueResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValueResponse.Merge(m, src) -} -func (m *ValueResponse) XXX_Size() int { - return xxx_messageInfo_ValueResponse.Size(m) -} -func (m *ValueResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ValueResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ValueResponse proto.InternalMessageInfo - -func (m *ValueResponse) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -type ValidationRequest struct { - Phone bool `protobuf:"varint,1,opt,name=phone,proto3" json:"phone,omitempty"` - Birthdate bool `protobuf:"varint,2,opt,name=birthdate,proto3" json:"birthdate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ValidationRequest) Reset() { *m = ValidationRequest{} } -func (m *ValidationRequest) String() string { return proto.CompactTextString(m) } -func (*ValidationRequest) ProtoMessage() {} -func (*ValidationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{18} -} - -func (m *ValidationRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ValidationRequest.Unmarshal(m, b) -} -func (m *ValidationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ValidationRequest.Marshal(b, m, deterministic) -} -func (m *ValidationRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidationRequest.Merge(m, src) -} -func (m *ValidationRequest) XXX_Size() int { - return xxx_messageInfo_ValidationRequest.Size(m) -} -func (m *ValidationRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ValidationRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidationRequest proto.InternalMessageInfo - -func (m *ValidationRequest) GetPhone() bool { - if m != nil { - return m.Phone - } - return false -} - -func (m *ValidationRequest) GetBirthdate() bool { - if m != nil { - return m.Birthdate - } - return false -} - -type ValidationResponse struct { - Phone bool `protobuf:"varint,1,opt,name=phone,proto3" json:"phone,omitempty"` - Birthdate bool `protobuf:"varint,2,opt,name=birthdate,proto3" json:"birthdate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ValidationResponse) Reset() { *m = ValidationResponse{} } -func (m *ValidationResponse) String() string { return proto.CompactTextString(m) } -func (*ValidationResponse) ProtoMessage() {} -func (*ValidationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a78a5ce418359426, []int{19} -} - -func (m *ValidationResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ValidationResponse.Unmarshal(m, b) -} -func (m *ValidationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ValidationResponse.Marshal(b, m, deterministic) -} -func (m *ValidationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidationResponse.Merge(m, src) -} -func (m *ValidationResponse) XXX_Size() int { - return xxx_messageInfo_ValidationResponse.Size(m) -} -func (m *ValidationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ValidationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidationResponse proto.InternalMessageInfo - -func (m *ValidationResponse) GetPhone() bool { - if m != nil { - return m.Phone - } - return false -} - -func (m *ValidationResponse) GetBirthdate() bool { - if m != nil { - return m.Birthdate - } - return false -} - -func init() { - proto.RegisterType((*AuthLoginRequest)(nil), "AuthLoginRequest") - proto.RegisterType((*AuthLoginResponse)(nil), "AuthLoginResponse") - proto.RegisterType((*AuthRegisterRequest)(nil), "AuthRegisterRequest") - proto.RegisterType((*AuthRegisterResponse)(nil), "AuthRegisterResponse") - proto.RegisterType((*ForgetAccountRequest)(nil), "ForgetAccountRequest") - proto.RegisterType((*ForgetAccountResponse)(nil), "ForgetAccountResponse") - proto.RegisterType((*UpdatePasswordRequest)(nil), "UpdatePasswordRequest") - proto.RegisterType((*UpdatePasswordResponse)(nil), "UpdatePasswordResponse") - proto.RegisterType((*SetPhoneNumberRequest)(nil), "SetPhoneNumberRequest") - proto.RegisterType((*SetPhoneNumberResponse)(nil), "SetPhoneNumberResponse") - proto.RegisterType((*VerifyPhoneNumberRequest)(nil), "VerifyPhoneNumberRequest") - proto.RegisterType((*VerifyPhoneNumberResponse)(nil), "VerifyPhoneNumberResponse") - proto.RegisterType((*BirthDateRequest)(nil), "BirthDateRequest") - proto.RegisterType((*BirthDateResponse)(nil), "BirthDateResponse") - proto.RegisterType((*KeyValueRequest)(nil), "KeyValueRequest") - proto.RegisterType((*KeyValueResponse)(nil), "KeyValueResponse") - proto.RegisterType((*KeyRequest)(nil), "KeyRequest") - proto.RegisterType((*ValueResponse)(nil), "ValueResponse") - proto.RegisterType((*ValidationRequest)(nil), "ValidationRequest") - proto.RegisterType((*ValidationResponse)(nil), "ValidationResponse") -} - -func init() { - proto.RegisterFile("silvermobi-service.proto", fileDescriptor_a78a5ce418359426) -} - -var fileDescriptor_a78a5ce418359426 = []byte{ - // 776 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x5d, 0x4f, 0xdb, 0x4a, - 0x10, 0x75, 0x02, 0x5c, 0x91, 0x09, 0xe4, 0xc6, 0x4b, 0x12, 0x82, 0xef, 0x6d, 0x69, 0xb7, 0xaa, - 0x44, 0x05, 0x6c, 0x24, 0x1a, 0xa9, 0x1f, 0x52, 0xa5, 0x02, 0x55, 0xd3, 0x16, 0x84, 0xa2, 0x84, - 0xf2, 0xd0, 0x17, 0xe4, 0x38, 0x8b, 0x59, 0x25, 0xf1, 0xba, 0xde, 0x4d, 0xaa, 0xbc, 0xf5, 0xd7, - 0xf4, 0x37, 0xf6, 0xb1, 0xf2, 0xda, 0x8e, 0x1d, 0xc7, 0xa1, 0x2d, 0x4f, 0xf6, 0x7c, 0xec, 0x99, - 0xe3, 0xd9, 0x39, 0x23, 0x43, 0x5d, 0xb0, 0xe1, 0x84, 0x7a, 0x23, 0xde, 0x63, 0x87, 0x82, 0x7a, - 0x13, 0x66, 0x51, 0xe2, 0x7a, 0x5c, 0x72, 0x63, 0xd7, 0xe6, 0xdc, 0x1e, 0xd2, 0x86, 0xb2, 0x7a, - 0xe3, 0x9b, 0x86, 0x64, 0x23, 0x2a, 0xa4, 0x39, 0x72, 0x83, 0x04, 0xfc, 0x09, 0xca, 0xc7, 0x63, - 0x79, 0x7b, 0xce, 0x6d, 0xe6, 0x74, 0xe8, 0xd7, 0x31, 0x15, 0x12, 0x19, 0xb0, 0x3e, 0x16, 0xd4, - 0x73, 0xcc, 0x11, 0xad, 0xe7, 0x1e, 0xe5, 0xf6, 0x0a, 0x9d, 0x99, 0xed, 0xc7, 0x5c, 0x53, 0x88, - 0x6f, 0xdc, 0xeb, 0xd7, 0xf3, 0x41, 0x2c, 0xb2, 0xf1, 0x33, 0xd0, 0x13, 0x58, 0xc2, 0xe5, 0x8e, - 0xa0, 0xa8, 0x02, 0x6b, 0x92, 0x0f, 0xa8, 0x13, 0x22, 0x05, 0x06, 0xfe, 0x91, 0x83, 0x2d, 0x3f, - 0xb7, 0x43, 0x6d, 0x26, 0x24, 0xf5, 0xa2, 0xd2, 0x15, 0x58, 0xa3, 0x23, 0x93, 0x0d, 0xa3, 0x6c, - 0x65, 0xdc, 0x55, 0x14, 0x3d, 0x00, 0xb8, 0x61, 0x9e, 0x90, 0xd7, 0x8a, 0xee, 0x8a, 0x8a, 0x16, - 0x94, 0xe7, 0xc2, 0xe7, 0xfb, 0x1f, 0x14, 0x86, 0x66, 0x14, 0x5d, 0x0d, 0xce, 0xfa, 0x0e, 0x15, - 0x7c, 0x0c, 0x1b, 0xee, 0x2d, 0x77, 0xe8, 0xb5, 0x33, 0x1e, 0xf5, 0xa8, 0x57, 0x5f, 0x53, 0xf1, - 0xa2, 0xf2, 0x5d, 0x28, 0x17, 0x3e, 0x80, 0xca, 0x3c, 0xcf, 0x3b, 0x3f, 0xab, 0x0d, 0x95, 0xf7, - 0xdc, 0xb3, 0xa9, 0x3c, 0xb6, 0x2c, 0x3e, 0x76, 0xe4, 0x9f, 0x74, 0xf4, 0x7f, 0x28, 0xf8, 0x4f, - 0xe1, 0x9a, 0x16, 0x0d, 0xbf, 0x2e, 0x76, 0xe0, 0x4b, 0xa8, 0xa6, 0x10, 0x43, 0x02, 0x06, 0xac, - 0x7b, 0xe1, 0xbb, 0x82, 0x5c, 0xef, 0xcc, 0x6c, 0xb4, 0x0b, 0x45, 0xd3, 0xb2, 0xa8, 0x10, 0xd7, - 0x16, 0xef, 0x47, 0xa0, 0x10, 0xb8, 0x4e, 0x79, 0x9f, 0xe2, 0x8f, 0x50, 0xfd, 0xec, 0xf6, 0x4d, - 0x49, 0xdb, 0x61, 0x1b, 0xef, 0xdd, 0x7f, 0xdc, 0x84, 0x5a, 0x1a, 0xea, 0xf7, 0x0c, 0x71, 0x1b, - 0xaa, 0x5d, 0x2a, 0xdb, 0x71, 0xa3, 0x23, 0x02, 0xe9, 0x2b, 0xc9, 0x2d, 0x5c, 0x49, 0xcc, 0x31, - 0x9f, 0xe0, 0x88, 0xf7, 0xa0, 0x96, 0x46, 0x0c, 0x79, 0x94, 0x20, 0xcf, 0x07, 0x21, 0x83, 0x3c, - 0x1f, 0xe0, 0xef, 0x39, 0xa8, 0x5f, 0x51, 0x8f, 0xdd, 0x4c, 0xef, 0x57, 0x7f, 0x1f, 0xf4, 0x89, - 0x7f, 0x9c, 0x59, 0xa6, 0x64, 0xdc, 0x49, 0xf6, 0xb8, 0x9c, 0x0c, 0xf8, 0x9d, 0x8e, 0xc9, 0xae, - 0x24, 0xc9, 0xee, 0xc3, 0x4e, 0x06, 0x83, 0x25, 0x7c, 0x7b, 0x50, 0x3e, 0x61, 0x9e, 0xbc, 0x7d, - 0x67, 0x4a, 0x1a, 0xd1, 0x7c, 0x09, 0x85, 0x9e, 0xef, 0xf3, 0x1b, 0xaf, 0x52, 0x8b, 0x47, 0x06, - 0x09, 0xb4, 0x4e, 0x22, 0xad, 0x93, 0xcb, 0x48, 0xeb, 0x9d, 0x38, 0x79, 0x49, 0xf7, 0x9e, 0x80, - 0x9e, 0xa8, 0xb1, 0x84, 0xc8, 0x2b, 0xf8, 0xf7, 0x8c, 0x4e, 0xaf, 0xcc, 0xe1, 0x78, 0xc6, 0xa3, - 0x0c, 0x2b, 0x03, 0x3a, 0x0d, 0xbb, 0xe4, 0xbf, 0xfa, 0xf8, 0x13, 0x3f, 0x23, 0xc2, 0x57, 0x06, - 0xc6, 0x50, 0x8e, 0x8f, 0x2e, 0x81, 0x7f, 0x08, 0x70, 0x46, 0xa7, 0x4b, 0x91, 0xf1, 0x53, 0xd8, - 0x9c, 0x07, 0x98, 0x95, 0xca, 0x25, 0x4b, 0xb5, 0x40, 0xbf, 0x32, 0x87, 0xac, 0xaf, 0xee, 0x20, - 0x31, 0xd7, 0xea, 0x0a, 0xc3, 0x72, 0x81, 0xe1, 0x4b, 0x2f, 0xee, 0x62, 0x5e, 0x45, 0x62, 0x07, - 0xfe, 0x00, 0x28, 0x09, 0x14, 0x17, 0xfd, 0x5b, 0xa4, 0xa3, 0x9f, 0xab, 0x50, 0xea, 0xce, 0x56, - 0x74, 0xab, 0xd3, 0x3e, 0x45, 0x4d, 0x28, 0xcc, 0x76, 0x25, 0xd2, 0x49, 0x7a, 0x07, 0x1b, 0x88, - 0x2c, 0xac, 0x52, 0xac, 0xa1, 0x37, 0xb0, 0x91, 0xdc, 0x46, 0xa8, 0x42, 0x32, 0x96, 0xa8, 0x51, - 0x25, 0x59, 0x2b, 0x0b, 0x6b, 0xe8, 0x2d, 0x6c, 0xce, 0x2d, 0x13, 0x54, 0x25, 0x59, 0xeb, 0xca, - 0xa8, 0x91, 0xcc, 0x9d, 0x83, 0x35, 0x74, 0x0a, 0xa5, 0x79, 0xb5, 0xa3, 0x1a, 0xc9, 0xdc, 0x24, - 0xc6, 0x36, 0xc9, 0x5e, 0x0b, 0x01, 0xc8, 0xbc, 0x54, 0x51, 0x8d, 0x64, 0x6e, 0x03, 0x63, 0x9b, - 0x64, 0x6b, 0x1a, 0x6b, 0xe8, 0x1c, 0xf4, 0x05, 0x09, 0xa1, 0x1d, 0xb2, 0x4c, 0xd8, 0x86, 0x41, - 0x96, 0x2a, 0x0e, 0x6b, 0xe8, 0x05, 0x6c, 0x74, 0xa9, 0x9c, 0x49, 0x00, 0xe9, 0x24, 0x2d, 0x39, - 0x03, 0x91, 0x05, 0x85, 0x60, 0x0d, 0x35, 0xa1, 0xd8, 0xa5, 0x32, 0x9a, 0x6d, 0x54, 0x26, 0x29, - 0x85, 0x18, 0x3a, 0x49, 0x0f, 0x3e, 0xd6, 0xd0, 0x01, 0x14, 0x5b, 0x89, 0x53, 0x45, 0x12, 0x0f, - 0xbe, 0x51, 0x22, 0xe9, 0xec, 0xd7, 0xb0, 0xd9, 0xa2, 0x32, 0x9e, 0x45, 0x84, 0xc8, 0xc2, 0x84, - 0x1b, 0x5b, 0x64, 0x71, 0x58, 0xb1, 0x76, 0xd2, 0xfc, 0x72, 0x64, 0x33, 0x49, 0x2c, 0xce, 0x5d, - 0x9b, 0x13, 0xc6, 0x1b, 0xc1, 0xdb, 0xa1, 0xe9, 0xba, 0xa2, 0x11, 0xff, 0x36, 0x34, 0x6c, 0xcf, - 0xb5, 0x4c, 0x97, 0x85, 0x3f, 0x0a, 0xff, 0xa8, 0xc7, 0xf3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x2c, 0x6e, 0x3e, 0x6e, 0x59, 0x08, 0x00, 0x00, -} diff --git a/servers/grpcapi/proto/silvermobi-service.pb.go b/servers/grpcapi/proto/silvermobi-service.pb.go index 842c5fd..1348ac7 100644 --- a/servers/grpcapi/proto/silvermobi-service.pb.go +++ b/servers/grpcapi/proto/silvermobi-service.pb.go @@ -21,6 +21,98 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type AccountTypeRequest_AccountType int32 + +const ( + AccountTypeRequest_PASSENGER AccountTypeRequest_AccountType = 0 + AccountTypeRequest_DRIVER AccountTypeRequest_AccountType = 1 +) + +// Enum value maps for AccountTypeRequest_AccountType. +var ( + AccountTypeRequest_AccountType_name = map[int32]string{ + 0: "PASSENGER", + 1: "DRIVER", + } + AccountTypeRequest_AccountType_value = map[string]int32{ + "PASSENGER": 0, + "DRIVER": 1, + } +) + +func (x AccountTypeRequest_AccountType) Enum() *AccountTypeRequest_AccountType { + p := new(AccountTypeRequest_AccountType) + *p = x + return p +} + +func (x AccountTypeRequest_AccountType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AccountTypeRequest_AccountType) Descriptor() protoreflect.EnumDescriptor { + return file_silvermobi_service_proto_enumTypes[0].Descriptor() +} + +func (AccountTypeRequest_AccountType) Type() protoreflect.EnumType { + return &file_silvermobi_service_proto_enumTypes[0] +} + +func (x AccountTypeRequest_AccountType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AccountTypeRequest_AccountType.Descriptor instead. +func (AccountTypeRequest_AccountType) EnumDescriptor() ([]byte, []int) { + return file_silvermobi_service_proto_rawDescGZIP(), []int{20, 0} +} + +type AccountTypeResponse_AccountType int32 + +const ( + AccountTypeResponse_PASSENGER AccountTypeResponse_AccountType = 0 + AccountTypeResponse_DRIVER AccountTypeResponse_AccountType = 1 +) + +// Enum value maps for AccountTypeResponse_AccountType. +var ( + AccountTypeResponse_AccountType_name = map[int32]string{ + 0: "PASSENGER", + 1: "DRIVER", + } + AccountTypeResponse_AccountType_value = map[string]int32{ + "PASSENGER": 0, + "DRIVER": 1, + } +) + +func (x AccountTypeResponse_AccountType) Enum() *AccountTypeResponse_AccountType { + p := new(AccountTypeResponse_AccountType) + *p = x + return p +} + +func (x AccountTypeResponse_AccountType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AccountTypeResponse_AccountType) Descriptor() protoreflect.EnumDescriptor { + return file_silvermobi_service_proto_enumTypes[1].Descriptor() +} + +func (AccountTypeResponse_AccountType) Type() protoreflect.EnumType { + return &file_silvermobi_service_proto_enumTypes[1] +} + +func (x AccountTypeResponse_AccountType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AccountTypeResponse_AccountType.Descriptor instead. +func (AccountTypeResponse_AccountType) EnumDescriptor() ([]byte, []int) { + return file_silvermobi_service_proto_rawDescGZIP(), []int{21, 0} +} + type AuthLoginRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -467,7 +559,6 @@ type SetPhoneNumberRequest struct { unknownFields protoimpl.UnknownFields PhoneNumber string `protobuf:"bytes,1,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` - Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` } func (x *SetPhoneNumberRequest) Reset() { @@ -509,13 +600,6 @@ func (x *SetPhoneNumberRequest) GetPhoneNumber() string { return "" } -func (x *SetPhoneNumberRequest) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - type SetPhoneNumberResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -570,7 +654,6 @@ type VerifyPhoneNumberRequest struct { PhoneNumber string `protobuf:"bytes,1,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` VerificationCode string `protobuf:"bytes,2,opt,name=verification_code,json=verificationCode,proto3" json:"verification_code,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` } func (x *VerifyPhoneNumberRequest) Reset() { @@ -619,13 +702,6 @@ func (x *VerifyPhoneNumberRequest) GetVerificationCode() string { return "" } -func (x *VerifyPhoneNumberRequest) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - type VerifyPhoneNumberResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -679,7 +755,6 @@ type BirthDateRequest struct { unknownFields protoimpl.UnknownFields Birthdate *timestamp.Timestamp `protobuf:"bytes,1,opt,name=birthdate,proto3" json:"birthdate,omitempty"` - Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` } func (x *BirthDateRequest) Reset() { @@ -721,13 +796,6 @@ func (x *BirthDateRequest) GetBirthdate() *timestamp.Timestamp { return nil } -func (x *BirthDateRequest) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - type BirthDateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -975,8 +1043,6 @@ type ValidationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` } func (x *ValidationRequest) Reset() { @@ -1011,13 +1077,6 @@ func (*ValidationRequest) Descriptor() ([]byte, []int) { return file_silvermobi_service_proto_rawDescGZIP(), []int{18} } -func (x *ValidationRequest) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - type ValidationResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1025,6 +1084,7 @@ type ValidationResponse struct { Phone bool `protobuf:"varint,1,opt,name=phone,proto3" json:"phone,omitempty"` Birthdate bool `protobuf:"varint,2,opt,name=birthdate,proto3" json:"birthdate,omitempty"` + Type bool `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"` } func (x *ValidationResponse) Reset() { @@ -1073,6 +1133,123 @@ func (x *ValidationResponse) GetBirthdate() bool { return false } +func (x *ValidationResponse) GetType() bool { + if x != nil { + return x.Type + } + return false +} + +type AccountTypeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Request *bool `protobuf:"varint,2,opt,name=request,proto3,oneof" json:"request,omitempty"` + Type *AccountTypeRequest_AccountType `protobuf:"varint,1,opt,name=type,proto3,enum=AccountTypeRequest_AccountType,oneof" json:"type,omitempty"` +} + +func (x *AccountTypeRequest) Reset() { + *x = AccountTypeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_silvermobi_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AccountTypeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccountTypeRequest) ProtoMessage() {} + +func (x *AccountTypeRequest) ProtoReflect() protoreflect.Message { + mi := &file_silvermobi_service_proto_msgTypes[20] + 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 AccountTypeRequest.ProtoReflect.Descriptor instead. +func (*AccountTypeRequest) Descriptor() ([]byte, []int) { + return file_silvermobi_service_proto_rawDescGZIP(), []int{20} +} + +func (x *AccountTypeRequest) GetRequest() bool { + if x != nil && x.Request != nil { + return *x.Request + } + return false +} + +func (x *AccountTypeRequest) GetType() AccountTypeRequest_AccountType { + if x != nil && x.Type != nil { + return *x.Type + } + return AccountTypeRequest_PASSENGER +} + +type AccountTypeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` + Type *AccountTypeResponse_AccountType `protobuf:"varint,2,opt,name=type,proto3,enum=AccountTypeResponse_AccountType,oneof" json:"type,omitempty"` +} + +func (x *AccountTypeResponse) Reset() { + *x = AccountTypeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_silvermobi_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AccountTypeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccountTypeResponse) ProtoMessage() {} + +func (x *AccountTypeResponse) ProtoReflect() protoreflect.Message { + mi := &file_silvermobi_service_proto_msgTypes[21] + 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 AccountTypeResponse.ProtoReflect.Descriptor instead. +func (*AccountTypeResponse) Descriptor() ([]byte, []int) { + return file_silvermobi_service_proto_rawDescGZIP(), []int{21} +} + +func (x *AccountTypeResponse) GetOk() bool { + if x != nil { + return x.Ok + } + return false +} + +func (x *AccountTypeResponse) GetType() AccountTypeResponse_AccountType { + if x != nil && x.Type != nil { + return *x.Type + } + return AccountTypeResponse_PASSENGER +} + var File_silvermobi_service_proto protoreflect.FileDescriptor var file_silvermobi_service_proto_rawDesc = []byte{ @@ -1119,52 +1296,68 @@ var file_silvermobi_service_proto_rawDesc = []byte{ 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x50, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, + 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x6d, 0x61, 0x69, 0x6c, 0x22, 0x28, 0x0a, 0x16, 0x53, 0x65, 0x74, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x80, - 0x01, 0x0a, 0x18, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x70, - 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2b, - 0x0a, 0x11, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, - 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, - 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, - 0x6c, 0x22, 0x2b, 0x0a, 0x19, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x62, - 0x0a, 0x10, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x74, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x09, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, - 0x69, 0x6c, 0x22, 0x23, 0x0a, 0x11, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x39, 0x0a, 0x0f, 0x4b, 0x65, 0x79, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x22, 0x0a, 0x10, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x1e, 0x0a, 0x0a, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x25, 0x0a, 0x0d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x29, 0x0a, - 0x11, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x22, 0x48, 0x0a, 0x12, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x70, - 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x74, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, - 0x74, 0x65, 0x32, 0xf8, 0x04, 0x0a, 0x0e, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, + 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x28, + 0x0a, 0x16, 0x53, 0x65, 0x74, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x6a, 0x0a, 0x18, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x11, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x64, 0x65, 0x22, 0x2b, 0x0a, 0x19, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x50, 0x68, + 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, + 0x6b, 0x22, 0x4c, 0x0a, 0x10, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, + 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x74, 0x65, 0x22, + 0x23, 0x0a, 0x11, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x39, 0x0a, 0x0f, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x22, 0x0a, 0x10, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x02, 0x6f, 0x6b, 0x22, 0x1e, 0x0a, 0x0a, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x22, 0x25, 0x0a, 0x0d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x5c, 0x0a, 0x12, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, + 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, + 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xac, 0x01, + 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x38, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1f, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x48, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x22, 0x28, 0x0a, + 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, + 0x50, 0x41, 0x53, 0x53, 0x45, 0x4e, 0x47, 0x45, 0x52, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, + 0x52, 0x49, 0x56, 0x45, 0x52, 0x10, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x93, 0x01, 0x0a, + 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x02, 0x6f, 0x6b, 0x12, 0x39, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x22, + 0x28, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, + 0x0a, 0x09, 0x50, 0x41, 0x53, 0x53, 0x45, 0x4e, 0x47, 0x45, 0x52, 0x10, 0x00, 0x12, 0x0a, 0x0a, + 0x06, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x10, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x32, 0xf6, 0x05, 0x0a, 0x0e, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x47, 0x52, 0x50, 0x43, 0x12, 0x34, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x11, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4c, 0x6f, 0x67, 0x69, @@ -1193,21 +1386,29 @@ var file_silvermobi_service_proto_rawDesc = []byte{ 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x74, 0x65, 0x12, 0x11, 0x2e, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, - 0x0b, 0x53, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x2e, 0x4b, - 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, - 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x2c, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x0b, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x0e, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x3a, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x12, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x34, 0x5a, - 0x32, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, - 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x61, 0x70, 0x70, 0x73, 0x2f, 0x73, 0x69, 0x6c, 0x76, 0x65, - 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, + 0x0e, 0x53, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x13, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, + 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x0b, 0x53, + 0x65, 0x74, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x2e, 0x4b, 0x65, 0x79, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x4b, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x2c, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x0b, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x3a, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x12, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x34, 0x5a, 0x32, 0x67, + 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, + 0x70, 0x67, 0x6f, 0x2d, 0x61, 0x70, 0x70, 0x73, 0x2f, 0x73, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, + 0x6f, 0x62, 0x69, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1222,57 +1423,68 @@ func file_silvermobi_service_proto_rawDescGZIP() []byte { return file_silvermobi_service_proto_rawDescData } -var file_silvermobi_service_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_silvermobi_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_silvermobi_service_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_silvermobi_service_proto_goTypes = []interface{}{ - (*AuthLoginRequest)(nil), // 0: AuthLoginRequest - (*AuthLoginResponse)(nil), // 1: AuthLoginResponse - (*AuthRegisterRequest)(nil), // 2: AuthRegisterRequest - (*AuthRegisterResponse)(nil), // 3: AuthRegisterResponse - (*ForgetAccountRequest)(nil), // 4: ForgetAccountRequest - (*ForgetAccountResponse)(nil), // 5: ForgetAccountResponse - (*UpdatePasswordRequest)(nil), // 6: UpdatePasswordRequest - (*UpdatePasswordResponse)(nil), // 7: UpdatePasswordResponse - (*SetPhoneNumberRequest)(nil), // 8: SetPhoneNumberRequest - (*SetPhoneNumberResponse)(nil), // 9: SetPhoneNumberResponse - (*VerifyPhoneNumberRequest)(nil), // 10: VerifyPhoneNumberRequest - (*VerifyPhoneNumberResponse)(nil), // 11: VerifyPhoneNumberResponse - (*BirthDateRequest)(nil), // 12: BirthDateRequest - (*BirthDateResponse)(nil), // 13: BirthDateResponse - (*KeyValueRequest)(nil), // 14: KeyValueRequest - (*KeyValueResponse)(nil), // 15: KeyValueResponse - (*KeyRequest)(nil), // 16: KeyRequest - (*ValueResponse)(nil), // 17: ValueResponse - (*ValidationRequest)(nil), // 18: ValidationRequest - (*ValidationResponse)(nil), // 19: ValidationResponse - (*timestamp.Timestamp)(nil), // 20: google.protobuf.Timestamp + (AccountTypeRequest_AccountType)(0), // 0: AccountTypeRequest.AccountType + (AccountTypeResponse_AccountType)(0), // 1: AccountTypeResponse.AccountType + (*AuthLoginRequest)(nil), // 2: AuthLoginRequest + (*AuthLoginResponse)(nil), // 3: AuthLoginResponse + (*AuthRegisterRequest)(nil), // 4: AuthRegisterRequest + (*AuthRegisterResponse)(nil), // 5: AuthRegisterResponse + (*ForgetAccountRequest)(nil), // 6: ForgetAccountRequest + (*ForgetAccountResponse)(nil), // 7: ForgetAccountResponse + (*UpdatePasswordRequest)(nil), // 8: UpdatePasswordRequest + (*UpdatePasswordResponse)(nil), // 9: UpdatePasswordResponse + (*SetPhoneNumberRequest)(nil), // 10: SetPhoneNumberRequest + (*SetPhoneNumberResponse)(nil), // 11: SetPhoneNumberResponse + (*VerifyPhoneNumberRequest)(nil), // 12: VerifyPhoneNumberRequest + (*VerifyPhoneNumberResponse)(nil), // 13: VerifyPhoneNumberResponse + (*BirthDateRequest)(nil), // 14: BirthDateRequest + (*BirthDateResponse)(nil), // 15: BirthDateResponse + (*KeyValueRequest)(nil), // 16: KeyValueRequest + (*KeyValueResponse)(nil), // 17: KeyValueResponse + (*KeyRequest)(nil), // 18: KeyRequest + (*ValueResponse)(nil), // 19: ValueResponse + (*ValidationRequest)(nil), // 20: ValidationRequest + (*ValidationResponse)(nil), // 21: ValidationResponse + (*AccountTypeRequest)(nil), // 22: AccountTypeRequest + (*AccountTypeResponse)(nil), // 23: AccountTypeResponse + (*timestamp.Timestamp)(nil), // 24: google.protobuf.Timestamp } var file_silvermobi_service_proto_depIdxs = []int32{ - 20, // 0: BirthDateRequest.birthdate:type_name -> google.protobuf.Timestamp - 0, // 1: SilvermobiGRPC.AuthLogin:input_type -> AuthLoginRequest - 2, // 2: SilvermobiGRPC.AuthRegister:input_type -> AuthRegisterRequest - 4, // 3: SilvermobiGRPC.ForgetAccount:input_type -> ForgetAccountRequest - 6, // 4: SilvermobiGRPC.UpdatePassword:input_type -> UpdatePasswordRequest - 8, // 5: SilvermobiGRPC.SetPhoneNumber:input_type -> SetPhoneNumberRequest - 10, // 6: SilvermobiGRPC.VerifyPhoneNumber:input_type -> VerifyPhoneNumberRequest - 12, // 7: SilvermobiGRPC.SetBirthDate:input_type -> BirthDateRequest - 14, // 8: SilvermobiGRPC.SetKeyValue:input_type -> KeyValueRequest - 16, // 9: SilvermobiGRPC.GetKeyValue:input_type -> KeyRequest - 18, // 10: SilvermobiGRPC.GetValidation:input_type -> ValidationRequest - 1, // 11: SilvermobiGRPC.AuthLogin:output_type -> AuthLoginResponse - 3, // 12: SilvermobiGRPC.AuthRegister:output_type -> AuthRegisterResponse - 5, // 13: SilvermobiGRPC.ForgetAccount:output_type -> ForgetAccountResponse - 7, // 14: SilvermobiGRPC.UpdatePassword:output_type -> UpdatePasswordResponse - 9, // 15: SilvermobiGRPC.SetPhoneNumber:output_type -> SetPhoneNumberResponse - 11, // 16: SilvermobiGRPC.VerifyPhoneNumber:output_type -> VerifyPhoneNumberResponse - 13, // 17: SilvermobiGRPC.SetBirthDate:output_type -> BirthDateResponse - 15, // 18: SilvermobiGRPC.SetKeyValue:output_type -> KeyValueResponse - 17, // 19: SilvermobiGRPC.GetKeyValue:output_type -> ValueResponse - 19, // 20: SilvermobiGRPC.GetValidation:output_type -> ValidationResponse - 11, // [11:21] is the sub-list for method output_type - 1, // [1:11] 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 + 24, // 0: BirthDateRequest.birthdate:type_name -> google.protobuf.Timestamp + 0, // 1: AccountTypeRequest.type:type_name -> AccountTypeRequest.AccountType + 1, // 2: AccountTypeResponse.type:type_name -> AccountTypeResponse.AccountType + 2, // 3: SilvermobiGRPC.AuthLogin:input_type -> AuthLoginRequest + 4, // 4: SilvermobiGRPC.AuthRegister:input_type -> AuthRegisterRequest + 6, // 5: SilvermobiGRPC.ForgetAccount:input_type -> ForgetAccountRequest + 8, // 6: SilvermobiGRPC.UpdatePassword:input_type -> UpdatePasswordRequest + 10, // 7: SilvermobiGRPC.SetPhoneNumber:input_type -> SetPhoneNumberRequest + 12, // 8: SilvermobiGRPC.VerifyPhoneNumber:input_type -> VerifyPhoneNumberRequest + 14, // 9: SilvermobiGRPC.SetBirthDate:input_type -> BirthDateRequest + 22, // 10: SilvermobiGRPC.SetAccountType:input_type -> AccountTypeRequest + 22, // 11: SilvermobiGRPC.GetAccountType:input_type -> AccountTypeRequest + 16, // 12: SilvermobiGRPC.SetKeyValue:input_type -> KeyValueRequest + 18, // 13: SilvermobiGRPC.GetKeyValue:input_type -> KeyRequest + 20, // 14: SilvermobiGRPC.GetValidation:input_type -> ValidationRequest + 3, // 15: SilvermobiGRPC.AuthLogin:output_type -> AuthLoginResponse + 5, // 16: SilvermobiGRPC.AuthRegister:output_type -> AuthRegisterResponse + 7, // 17: SilvermobiGRPC.ForgetAccount:output_type -> ForgetAccountResponse + 9, // 18: SilvermobiGRPC.UpdatePassword:output_type -> UpdatePasswordResponse + 11, // 19: SilvermobiGRPC.SetPhoneNumber:output_type -> SetPhoneNumberResponse + 13, // 20: SilvermobiGRPC.VerifyPhoneNumber:output_type -> VerifyPhoneNumberResponse + 15, // 21: SilvermobiGRPC.SetBirthDate:output_type -> BirthDateResponse + 23, // 22: SilvermobiGRPC.SetAccountType:output_type -> AccountTypeResponse + 23, // 23: SilvermobiGRPC.GetAccountType:output_type -> AccountTypeResponse + 17, // 24: SilvermobiGRPC.SetKeyValue:output_type -> KeyValueResponse + 19, // 25: SilvermobiGRPC.GetKeyValue:output_type -> ValueResponse + 21, // 26: SilvermobiGRPC.GetValidation:output_type -> ValidationResponse + 15, // [15:27] is the sub-list for method output_type + 3, // [3:15] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_silvermobi_service_proto_init() } @@ -1521,19 +1733,46 @@ func file_silvermobi_service_proto_init() { return nil } } + file_silvermobi_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccountTypeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_silvermobi_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccountTypeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } + file_silvermobi_service_proto_msgTypes[20].OneofWrappers = []interface{}{} + file_silvermobi_service_proto_msgTypes[21].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_silvermobi_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 20, + NumEnums: 2, + NumMessages: 22, NumExtensions: 0, NumServices: 1, }, GoTypes: file_silvermobi_service_proto_goTypes, DependencyIndexes: file_silvermobi_service_proto_depIdxs, + EnumInfos: file_silvermobi_service_proto_enumTypes, MessageInfos: file_silvermobi_service_proto_msgTypes, }.Build() File_silvermobi_service_proto = out.File diff --git a/servers/grpcapi/proto/silvermobi-service.proto b/servers/grpcapi/proto/silvermobi-service.proto index 4bde8b0..dc325e4 100644 --- a/servers/grpcapi/proto/silvermobi-service.proto +++ b/servers/grpcapi/proto/silvermobi-service.proto @@ -3,17 +3,16 @@ import "google/protobuf/timestamp.proto"; option go_package = "git.coopgo.io/coopgo-apps/silvermobi/grpcapi/proto"; service SilvermobiGRPC { - // User authentication functions + rpc AuthLogin(AuthLoginRequest) returns (AuthLoginResponse) {} rpc AuthRegister(AuthRegisterRequest) returns (AuthRegisterResponse) {} - // User forget password rpc ForgetAccount(ForgetAccountRequest) returns (ForgetAccountResponse) {} rpc UpdatePassword(UpdatePasswordRequest) returns (UpdatePasswordResponse) {} - // phone_number rpc SetPhoneNumber(SetPhoneNumberRequest) returns (SetPhoneNumberResponse) {} rpc VerifyPhoneNumber(VerifyPhoneNumberRequest) returns (VerifyPhoneNumberResponse) {} rpc SetBirthDate(BirthDateRequest) returns (BirthDateResponse) {} - // redis + rpc SetAccountType(AccountTypeRequest) returns (AccountTypeResponse) {} + rpc GetAccountType(AccountTypeRequest) returns (AccountTypeResponse) {} rpc SetKeyValue(KeyValueRequest) returns (KeyValueResponse) {} rpc GetKeyValue(KeyRequest) returns (ValueResponse) {} rpc GetValidation(ValidationRequest) returns (ValidationResponse) {} @@ -63,7 +62,6 @@ message UpdatePasswordResponse{ message SetPhoneNumberRequest { string phone_number = 1; - string email = 2; } message SetPhoneNumberResponse { @@ -73,7 +71,6 @@ message SetPhoneNumberResponse { message VerifyPhoneNumberRequest { string phone_number = 1; string verification_code = 2; - string email = 3; } message VerifyPhoneNumberResponse { @@ -82,7 +79,6 @@ message VerifyPhoneNumberResponse { message BirthDateRequest { google.protobuf.Timestamp birthdate = 1 ; - string email = 2; } message BirthDateResponse { @@ -106,10 +102,28 @@ message ValueResponse{ } message ValidationRequest { - string email =1 ; } message ValidationResponse { bool phone = 1 ; bool birthdate = 2; + bool type = 3; +} + +message AccountTypeRequest { + enum AccountType { + PASSENGER = 0; + DRIVER = 1; + } + optional bool request = 2; + optional AccountType type = 1; +} + +message AccountTypeResponse { + bool ok = 1 ; + enum AccountType { + PASSENGER = 0; + DRIVER = 1; + } + optional AccountType type = 2; } \ No newline at end of file diff --git a/servers/grpcapi/proto/silvermobi-service_grpc.pb.go b/servers/grpcapi/proto/silvermobi-service_grpc.pb.go index 44c6d3c..7fdfbee 100644 --- a/servers/grpcapi/proto/silvermobi-service_grpc.pb.go +++ b/servers/grpcapi/proto/silvermobi-service_grpc.pb.go @@ -26,6 +26,8 @@ const ( SilvermobiGRPC_SetPhoneNumber_FullMethodName = "/SilvermobiGRPC/SetPhoneNumber" SilvermobiGRPC_VerifyPhoneNumber_FullMethodName = "/SilvermobiGRPC/VerifyPhoneNumber" SilvermobiGRPC_SetBirthDate_FullMethodName = "/SilvermobiGRPC/SetBirthDate" + SilvermobiGRPC_SetAccountType_FullMethodName = "/SilvermobiGRPC/SetAccountType" + SilvermobiGRPC_GetAccountType_FullMethodName = "/SilvermobiGRPC/GetAccountType" SilvermobiGRPC_SetKeyValue_FullMethodName = "/SilvermobiGRPC/SetKeyValue" SilvermobiGRPC_GetKeyValue_FullMethodName = "/SilvermobiGRPC/GetKeyValue" SilvermobiGRPC_GetValidation_FullMethodName = "/SilvermobiGRPC/GetValidation" @@ -35,17 +37,15 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SilvermobiGRPCClient interface { - // User authentication functions AuthLogin(ctx context.Context, in *AuthLoginRequest, opts ...grpc.CallOption) (*AuthLoginResponse, error) AuthRegister(ctx context.Context, in *AuthRegisterRequest, opts ...grpc.CallOption) (*AuthRegisterResponse, error) - // User forget password ForgetAccount(ctx context.Context, in *ForgetAccountRequest, opts ...grpc.CallOption) (*ForgetAccountResponse, error) UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, opts ...grpc.CallOption) (*UpdatePasswordResponse, error) - // phone_number SetPhoneNumber(ctx context.Context, in *SetPhoneNumberRequest, opts ...grpc.CallOption) (*SetPhoneNumberResponse, error) VerifyPhoneNumber(ctx context.Context, in *VerifyPhoneNumberRequest, opts ...grpc.CallOption) (*VerifyPhoneNumberResponse, error) SetBirthDate(ctx context.Context, in *BirthDateRequest, opts ...grpc.CallOption) (*BirthDateResponse, error) - // redis + SetAccountType(ctx context.Context, in *AccountTypeRequest, opts ...grpc.CallOption) (*AccountTypeResponse, error) + GetAccountType(ctx context.Context, in *AccountTypeRequest, opts ...grpc.CallOption) (*AccountTypeResponse, error) SetKeyValue(ctx context.Context, in *KeyValueRequest, opts ...grpc.CallOption) (*KeyValueResponse, error) GetKeyValue(ctx context.Context, in *KeyRequest, opts ...grpc.CallOption) (*ValueResponse, error) GetValidation(ctx context.Context, in *ValidationRequest, opts ...grpc.CallOption) (*ValidationResponse, error) @@ -122,6 +122,24 @@ func (c *silvermobiGRPCClient) SetBirthDate(ctx context.Context, in *BirthDateRe return out, nil } +func (c *silvermobiGRPCClient) SetAccountType(ctx context.Context, in *AccountTypeRequest, opts ...grpc.CallOption) (*AccountTypeResponse, error) { + out := new(AccountTypeResponse) + err := c.cc.Invoke(ctx, SilvermobiGRPC_SetAccountType_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *silvermobiGRPCClient) GetAccountType(ctx context.Context, in *AccountTypeRequest, opts ...grpc.CallOption) (*AccountTypeResponse, error) { + out := new(AccountTypeResponse) + err := c.cc.Invoke(ctx, SilvermobiGRPC_GetAccountType_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *silvermobiGRPCClient) SetKeyValue(ctx context.Context, in *KeyValueRequest, opts ...grpc.CallOption) (*KeyValueResponse, error) { out := new(KeyValueResponse) err := c.cc.Invoke(ctx, SilvermobiGRPC_SetKeyValue_FullMethodName, in, out, opts...) @@ -153,17 +171,15 @@ func (c *silvermobiGRPCClient) GetValidation(ctx context.Context, in *Validation // All implementations must embed UnimplementedSilvermobiGRPCServer // for forward compatibility type SilvermobiGRPCServer interface { - // User authentication functions AuthLogin(context.Context, *AuthLoginRequest) (*AuthLoginResponse, error) AuthRegister(context.Context, *AuthRegisterRequest) (*AuthRegisterResponse, error) - // User forget password ForgetAccount(context.Context, *ForgetAccountRequest) (*ForgetAccountResponse, error) UpdatePassword(context.Context, *UpdatePasswordRequest) (*UpdatePasswordResponse, error) - // phone_number SetPhoneNumber(context.Context, *SetPhoneNumberRequest) (*SetPhoneNumberResponse, error) VerifyPhoneNumber(context.Context, *VerifyPhoneNumberRequest) (*VerifyPhoneNumberResponse, error) SetBirthDate(context.Context, *BirthDateRequest) (*BirthDateResponse, error) - // redis + SetAccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error) + GetAccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error) SetKeyValue(context.Context, *KeyValueRequest) (*KeyValueResponse, error) GetKeyValue(context.Context, *KeyRequest) (*ValueResponse, error) GetValidation(context.Context, *ValidationRequest) (*ValidationResponse, error) @@ -195,6 +211,12 @@ func (UnimplementedSilvermobiGRPCServer) VerifyPhoneNumber(context.Context, *Ver func (UnimplementedSilvermobiGRPCServer) SetBirthDate(context.Context, *BirthDateRequest) (*BirthDateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetBirthDate not implemented") } +func (UnimplementedSilvermobiGRPCServer) SetAccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetAccountType not implemented") +} +func (UnimplementedSilvermobiGRPCServer) GetAccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccountType not implemented") +} func (UnimplementedSilvermobiGRPCServer) SetKeyValue(context.Context, *KeyValueRequest) (*KeyValueResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetKeyValue not implemented") } @@ -343,6 +365,42 @@ func _SilvermobiGRPC_SetBirthDate_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _SilvermobiGRPC_SetAccountType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AccountTypeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SilvermobiGRPCServer).SetAccountType(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SilvermobiGRPC_SetAccountType_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SilvermobiGRPCServer).SetAccountType(ctx, req.(*AccountTypeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SilvermobiGRPC_GetAccountType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AccountTypeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SilvermobiGRPCServer).GetAccountType(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SilvermobiGRPC_GetAccountType_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SilvermobiGRPCServer).GetAccountType(ctx, req.(*AccountTypeRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _SilvermobiGRPC_SetKeyValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(KeyValueRequest) if err := dec(in); err != nil { @@ -432,6 +490,14 @@ var SilvermobiGRPC_ServiceDesc = grpc.ServiceDesc{ MethodName: "SetBirthDate", Handler: _SilvermobiGRPC_SetBirthDate_Handler, }, + { + MethodName: "SetAccountType", + Handler: _SilvermobiGRPC_SetAccountType_Handler, + }, + { + MethodName: "GetAccountType", + Handler: _SilvermobiGRPC_GetAccountType_Handler, + }, { MethodName: "SetKeyValue", Handler: _SilvermobiGRPC_SetKeyValue_Handler, diff --git a/servers/grpcapi/server/onboarding_validation.go b/servers/grpcapi/server/onboarding_validation.go index 58a77f5..a714b25 100644 --- a/servers/grpcapi/server/onboarding_validation.go +++ b/servers/grpcapi/server/onboarding_validation.go @@ -2,14 +2,31 @@ package grpcserver import ( "context" + "encoding/base64" + "encoding/json" grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "strings" "time" ) func (s SilvermobiGRPCService) SetPhoneNumber(ctx context.Context, req *grpcproto.SetPhoneNumberRequest) (res *grpcproto.SetPhoneNumberResponse, err error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "Missing metadata") + } + + authHeader, ok := md["authorization"] + if !ok || len(authHeader) == 0 { + return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header") + } + tokenString := strings.TrimPrefix(authHeader[0], "Bearer ") + id := ExtractIdFromToken(tokenString) if err = s.Handler.UpdatePhoneNumber( context.Background(), - req.Email, + id, req.PhoneNumber, ); err != nil { return nil, err @@ -19,10 +36,20 @@ func (s SilvermobiGRPCService) SetPhoneNumber(ctx context.Context, req *grpcprot } func (s SilvermobiGRPCService) VerifyPhoneNumber(ctx context.Context, req *grpcproto.VerifyPhoneNumberRequest) (res *grpcproto.VerifyPhoneNumberResponse, err error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "Missing metadata") + } + authHeader, ok := md["authorization"] + if !ok || len(authHeader) == 0 { + return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header") + } + tokenString := strings.TrimPrefix(authHeader[0], "Bearer ") + id := ExtractIdFromToken(tokenString) if err = s.Handler.VerifyPhoneNumber( context.Background(), - req.Email, + id, req.PhoneNumber, req.VerificationCode, ); err != nil { @@ -33,23 +60,126 @@ func (s SilvermobiGRPCService) VerifyPhoneNumber(ctx context.Context, req *grpcp } func (s SilvermobiGRPCService) SetBirthDate(ctx context.Context, req *grpcproto.BirthDateRequest) (res *grpcproto.BirthDateResponse, err error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "Missing metadata") + } + + authHeader, ok := md["authorization"] + if !ok || len(authHeader) == 0 { + return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header") + } + tokenString := strings.TrimPrefix(authHeader[0], "Bearer ") + id := ExtractIdFromToken(tokenString) birthdate := time.Unix(req.Birthdate.Seconds, int64(req.Birthdate.Nanos)).UTC() birthdateString := birthdate.Format("2006-01-02T15:04:05Z") - if err = s.Handler.UpdateBirthDate(ctx, req.Email, birthdateString); err != nil { + if err = s.Handler.UpdateBirthDate(ctx, id, birthdateString); err != nil { return nil, err } + return &grpcproto.BirthDateResponse{ Ok: true, }, nil } +func (s SilvermobiGRPCService) SetAccountType(ctx context.Context, req *grpcproto.AccountTypeRequest) (res *grpcproto.AccountTypeResponse, err error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "Missing metadata") + } + authHeader, ok := md["authorization"] + if !ok || len(authHeader) == 0 { + return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header") + } + tokenString := strings.TrimPrefix(authHeader[0], "Bearer ") + id := ExtractIdFromToken(tokenString) + if req.GetType() != grpcproto.AccountTypeRequest_PASSENGER && req.GetType() != grpcproto.AccountTypeRequest_DRIVER { + return nil, status.Errorf(codes.InvalidArgument, "Type should be PASSENGER or DRIVER") + } + if err = s.Handler.SetAccountType(ctx, id, req.GetType().String()); err != nil { + return nil, err + } + return &grpcproto.AccountTypeResponse{ + Ok: true, + }, nil + +} + +func (s SilvermobiGRPCService) GetAccountType(ctx context.Context, req *grpcproto.AccountTypeRequest) (res *grpcproto.AccountTypeResponse, err error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "Missing metadata") + } + authHeader, ok := md["authorization"] + if !ok || len(authHeader) == 0 { + return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header") + } + tokenString := strings.TrimPrefix(authHeader[0], "Bearer ") + id := ExtractIdFromToken(tokenString) + if req.Request == nil || !*req.Request { + return nil, status.Errorf(codes.InvalidArgument, "request arg should be true") + } + account_type, err := s.Handler.GetAccountType(ctx, id) + if err != nil { + return nil, err + } + var responseType grpcproto.AccountTypeResponse_AccountType + switch account_type { + case "PASSENGER": + responseType = grpcproto.AccountTypeResponse_PASSENGER + case "DRIVER": + responseType = grpcproto.AccountTypeResponse_DRIVER + default: + return nil, status.Errorf(codes.InvalidArgument, "Invalid account type") + } + + response := &grpcproto.AccountTypeResponse{ + Type: &responseType, + } + + return response, nil + +} + func (s SilvermobiGRPCService) GetValidation(ctx context.Context, req *grpcproto.ValidationRequest) (res *grpcproto.ValidationResponse, err error) { - phone_validation, birth_validation, err := s.Handler.CheckValidation(ctx, req.Email) + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "Missing metadata") + } + + authHeader, ok := md["authorization"] + if !ok || len(authHeader) == 0 { + return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header") + } + tokenString := strings.TrimPrefix(authHeader[0], "Bearer ") + id := ExtractIdFromToken(tokenString) + phone_validation, birth_validation, type_validation, err := s.Handler.CheckValidation(ctx, id) if err != nil { return nil, err } return &grpcproto.ValidationResponse{ Phone: phone_validation, Birthdate: birth_validation, + Type: type_validation, }, nil } + +func ExtractIdFromToken(tokenString string) string { + parts := strings.Split(tokenString, ".") + if len(parts) != 3 { + return "" + } + payloadBytes, err := base64.RawStdEncoding.DecodeString(parts[1]) + if err != nil { + return "" + } + var payloadMap map[string]interface{} + if err := json.Unmarshal(payloadBytes, &payloadMap); err != nil { + return "" + } + id, ok := payloadMap["sub"].(string) + if !ok { + return "" + } + return id +} diff --git a/servers/grpcapi/server/silvermobi-grpc-server.go b/servers/grpcapi/server/silvermobi-grpc-server.go index 8531032..0f446d9 100644 --- a/servers/grpcapi/server/silvermobi-grpc-server.go +++ b/servers/grpcapi/server/silvermobi-grpc-server.go @@ -2,9 +2,6 @@ package grpcserver import ( "context" - "net" - "strings" - "git.coopgo.io/coopgo-apps/silvermobi/handler" grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto" "github.com/golang-jwt/jwt/v4" @@ -14,6 +11,9 @@ import ( "github.com/rs/zerolog/log" "github.com/spf13/viper" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "net" ) type contextKey string @@ -22,53 +22,25 @@ var ( contextKeyUser = contextKey("user") ) -type SilvermobiGRPCService struct { - Config *viper.Viper - Handler *handler.SilvermobiHandler - - grpcproto.UnimplementedSilvermobiGRPCServer -} - -func NewSilvermobiGRPCService(cfg *viper.Viper, handler *handler.SilvermobiHandler) SilvermobiGRPCService { - return SilvermobiGRPCService{ - Config: cfg, - Handler: handler, - } -} - -func Run(done chan error, cfg *viper.Viper, handler *handler.SilvermobiHandler) { - var ( - address = "127.0.0.1:" + cfg.GetString("services.external.grpc.port") - jwt_secret = cfg.GetString("identification.local.jwt_secret") - ) - - log.Info().Msg("GRPC server on " + address) - - server := grpc.NewServer( - grpc.StreamInterceptor(grpc_middleware.ChainStreamServer( - grpc_ctxtags.StreamServerInterceptor(), - StreamAuthServerInterceptor(GRPCAuthFunc(jwt_secret)), - )), - grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer( - grpc_ctxtags.UnaryServerInterceptor(), - UnaryAuthServerInterceptor(GRPCAuthFunc(jwt_secret)), - )), - ) - - grpcproto.RegisterSilvermobiGRPCServer(server, NewSilvermobiGRPCService(cfg, handler)) - l, err := net.Listen("tcp", address) - if err != nil { - log.Fatal().Err(err) +func NoAuth(method string) bool { + noAuthMethods := []string{ + "/SilvermobiGRPC/ForgetAccount", + "/SilvermobiGRPC/UpdatePassword", + "/SilvermobiGRPC/AuthRegister", + "/SilvermobiGRPC/AuthLogin", } - if err := server.Serve(l); err != nil { - log.Error().Err(err).Msg("gRPC service ended") - done <- err + for _, m := range noAuthMethods { + if method == m { + return true + } } + return false } func UnaryAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { + print(info.FullMethod) if NoAuth(info.FullMethod) { return handler(ctx, req) } @@ -81,7 +53,6 @@ func UnaryAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.UnaryServerInt return handler(newCtx, req) } } - func StreamAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.StreamServerInterceptor { return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { if NoAuth(info.FullMethod) { @@ -101,25 +72,65 @@ func StreamAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.StreamServerI } } +type SilvermobiGRPCService struct { + Config *viper.Viper + Handler *handler.SilvermobiHandler + grpcproto.UnimplementedSilvermobiGRPCServer +} + +func NewSilvermobiGRPCService(cfg *viper.Viper, handler *handler.SilvermobiHandler) SilvermobiGRPCService { + return SilvermobiGRPCService{ + Config: cfg, + Handler: handler, + } +} + +func Run(done chan error, cfg *viper.Viper, handler *handler.SilvermobiHandler) { + var ( + address = "0.0.0.0:" + cfg.GetString("services.external.grpc.port") + jwt_secret = cfg.GetString("identification.local.jwt_secret") + ) + + log.Info().Msg("GRPC server on " + address) + + server := grpc.NewServer( + grpc.StreamInterceptor(grpc_middleware.ChainStreamServer( + grpc_ctxtags.StreamServerInterceptor(), + StreamAuthServerInterceptor(GRPCAuthFunc(jwt_secret)), + )), + grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer( + grpc_ctxtags.UnaryServerInterceptor(), + UnaryAuthServerInterceptor(GRPCAuthFunc(jwt_secret)), + )), + ) + + service := NewSilvermobiGRPCService(cfg, handler) + grpcproto.RegisterSilvermobiGRPCServer(server, service) + l, err := net.Listen("tcp", address) + if err != nil { + log.Fatal().Err(err) + } + + if err := server.Serve(l); err != nil { + log.Error().Err(err).Msg("gRPC service ended") + done <- err + } +} + func GRPCAuthFunc(jwtKey string) grpc_auth.AuthFunc { return func(ctx context.Context) (context.Context, error) { tokenString, err := grpc_auth.AuthFromMD(ctx, "bearer") if err != nil { - log.Error().Err(err) return nil, err } - claims := jwt.MapClaims{} - jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) { + token, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) { return []byte(jwtKey), nil }) - + if err != nil || !token.Valid { + return nil, status.Errorf(codes.Unauthenticated, "Invalid or expired token") + } ctx = context.WithValue(ctx, contextKeyUser, claims["sub"].(string)) - return ctx, nil } } - -func NoAuth(method string) bool { - return strings.Contains(method, "Auth") -} diff --git a/services/mobility-accounts.go b/services/mobility-accounts.go index 54b18c3..7e3e7f8 100644 --- a/services/mobility-accounts.go +++ b/services/mobility-accounts.go @@ -37,7 +37,7 @@ func (s MobilityAccountService) Login(ctx context.Context, username, password, n } account := resp.Account.ToStorageType() - return toAccountModel(account), nil + return s.ToAccountModel(account), nil } func (s MobilityAccountService) UpdateAccountData(ctx context.Context, id string, data map[string]any) error { @@ -78,7 +78,7 @@ func (s MobilityAccountService) GetAccountUsername(ctx context.Context, username if err != nil { return nil, err } - return toAccountModel(resp.Account.ToStorageType()), nil + return s.ToAccountModel(resp.Account.ToStorageType()), nil } func (s MobilityAccountService) Register(ctx context.Context, username string, password string, email string, phone_number string, data map[string]any, namespace string) (*models.Account, error) { @@ -108,7 +108,7 @@ func (s MobilityAccountService) Register(ctx context.Context, username string, p return nil, err } - return toAccountModel(resp.Account.ToStorageType()), nil + return s.ToAccountModel(resp.Account.ToStorageType()), nil } func (s MobilityAccountService) UpdatePhoneNumber(ctx context.Context, accountid string, phone_number string, verified bool, verification_code string) error { _, err := s.Client.UpdatePhoneNumber( @@ -128,13 +128,45 @@ func (s MobilityAccountService) UpdatePhoneNumber(ctx context.Context, accountid return nil } -func (s MobilityAccountService) UpdateAccountBirthDate(ctx context.Context, username string, namespace string, birthdate string) error { - resp, err := s.Client.GetAccountUsername(ctx, &mobilityaccounts.GetAccountUsernameRequest{ - Username: username, - Namespace: namespace, - }) +func (s MobilityAccountService) SetAccountType(ctx context.Context, id string, accountType string) error { account, err := s.Client.GetAccount(ctx, &mobilityaccounts.GetAccountRequest{ - Id: resp.Account.Id, + Id: id, + }) + if err != nil { + return err + } + data := make(map[string]interface{}) + data["type"] = accountType + dataStruct := &structpb.Struct{ + Fields: make(map[string]*structpb.Value), + } + + for key, value := range data { + stringValue, ok := value.(string) + if !ok { + continue + } + + dataStruct.Fields[key] = &structpb.Value{ + Kind: &structpb.Value_StringValue{ + StringValue: stringValue, + }, + } + } + account.Account.Data = dataStruct + _, err = s.Client.UpdateData(ctx, &mobilityaccounts.UpdateDataRequest{ + Account: account.Account, + }) + if err != nil { + return err + } + return nil + +} + +func (s MobilityAccountService) UpdateAccountBirthDate(ctx context.Context, id string, namespace string, birthdate string) error { + account, err := s.Client.GetAccount(ctx, &mobilityaccounts.GetAccountRequest{ + Id: id, }) data := make(map[string]interface{}) data["birthdate"] = birthdate @@ -165,18 +197,23 @@ func (s MobilityAccountService) UpdateAccountBirthDate(ctx context.Context, user return nil } -func toAccountModel(account ma.Account) *models.Account { +func (s MobilityAccountService) ToAccountModel(account ma.Account) *models.Account { first_name := account.Data["first_name"].(string) last_name := account.Data["last_name"].(string) birth_date, ok := account.Data["birthdate"].(string) if !ok { birth_date = "" } + accountType, ok := account.Data["type"].(string) + if !ok { + accountType = "" + } return &models.Account{ ID: account.ID, FirstName: first_name, LastName: last_name, BirthDate: birth_date, + Type: accountType, LocalCredentials: models.LocalCredentials{ Email: account.Authentication.Local.Email, EmailVerified: account.Authentication.Local.EmailValidation.Validated,