Add Email to send verification endpoints in user service (#277)

* Add Email to send verification endpoints in user service

* updates
This commit is contained in:
Asim Aslam
2021-11-17 16:44:42 +00:00
committed by GitHub
parent 4923f42da0
commit 54099a2df7
5 changed files with 310 additions and 139 deletions

View File

@@ -10,7 +10,6 @@ import (
"time" "time"
_struct "github.com/golang/protobuf/ptypes/struct" _struct "github.com/golang/protobuf/ptypes/struct"
"github.com/google/uuid"
"github.com/micro/micro/v3/service/config" "github.com/micro/micro/v3/service/config"
"github.com/micro/micro/v3/service/logger" "github.com/micro/micro/v3/service/logger"
db "github.com/micro/services/db/proto" db "github.com/micro/services/db/proto"
@@ -29,25 +28,37 @@ type pw struct {
type verificationToken struct { type verificationToken struct {
ID string `json:"id"` ID string `json:"id"`
UserID string `json:"userId"` UserID string `json:"userId"`
Token string `json:"token"`
} }
type passwordResetCode struct { type passwordResetCode struct {
ID string `json:"id"` ID string `json:"id"`
Expires time.Time `json:"expires"` Expires time.Time `json:"expires"`
UserID string `json:"userId"` UserID string `json:"userId"`
Code string `json:"code"`
} }
type Domain struct { type Domain struct {
db db.DbService db db.DbService
sengridKey string sengridKey string
fromEmail string
} }
var (
// TODO: use the config to drive this value
defaultSender = "noreply@email.m3ocontent.com"
)
func New(db db.DbService) *Domain { func New(db db.DbService) *Domain {
var key string var key, email string
cfg, err := config.Get("micro.user.sendgrid.api_key") cfg, err := config.Get("micro.user.sendgrid.api_key")
if err == nil { if err == nil {
key = cfg.String("") key = cfg.String("")
} }
cfg, err = config.Get("micro.user.sendgrid.from_email")
if err == nil {
email = cfg.String(defaultSender)
}
if len(key) == 0 { if len(key) == 0 {
logger.Info("No email key found") logger.Info("No email key found")
} else { } else {
@@ -56,6 +67,7 @@ func New(db db.DbService) *Domain {
return &Domain{ return &Domain{
sengridKey: key, sengridKey: key,
db: db, db: db,
fromEmail: email,
} }
} }
@@ -63,10 +75,14 @@ func (domain *Domain) SendEmail(fromName, toAddress, toUsername, subject, textCo
if domain.sengridKey == "" { if domain.sengridKey == "" {
return fmt.Errorf("empty email api key") return fmt.Errorf("empty email api key")
} }
from := mail.NewEmail(fromName, "support@m3o.com") from := mail.NewEmail(fromName, domain.fromEmail)
to := mail.NewEmail(toUsername, toAddress) to := mail.NewEmail(toUsername, toAddress)
// set the text content
textContent = strings.Replace(textContent, "$micro_verification_link", "https://user.m3o.com?token="+token+"&redirectUrl="+url.QueryEscape(redirctUrl)+"&failureRedirectUrl="+url.QueryEscape(failureRedirectUrl), -1) textContent = strings.Replace(textContent, "$micro_verification_link", "https://user.m3o.com?token="+token+"&redirectUrl="+url.QueryEscape(redirctUrl)+"&failureRedirectUrl="+url.QueryEscape(failureRedirectUrl), -1)
message := mail.NewSingleEmail(from, subject, to, textContent, "") message := mail.NewSingleEmail(from, subject, to, textContent, "")
// send the email
client := sendgrid.NewSendClient(domain.sengridKey) client := sendgrid.NewSendClient(domain.sengridKey)
response, err := client.Send(message) response, err := client.Send(message)
logger.Info(response) logger.Info(response)
@@ -74,11 +90,12 @@ func (domain *Domain) SendEmail(fromName, toAddress, toUsername, subject, textCo
return err return err
} }
func (domain *Domain) CreatePasswordResetCode(ctx context.Context, userID string) (*passwordResetCode, error) { func (domain *Domain) SavePasswordResetCode(ctx context.Context, userID, code string) (*passwordResetCode, error) {
pwcode := passwordResetCode{ pwcode := passwordResetCode{
ID: uuid.New().String(), ID: userID + "-" + code,
Expires: time.Now().Add(24 * time.Hour), Expires: time.Now().Add(24 * time.Hour),
UserID: userID, UserID: userID,
Code: code,
} }
s := &_struct.Struct{} s := &_struct.Struct{}
@@ -87,23 +104,28 @@ func (domain *Domain) CreatePasswordResetCode(ctx context.Context, userID string
if err != nil { if err != nil {
return nil, err return nil, err
} }
_, err = domain.db.Create(ctx, &db.CreateRequest{ _, err = domain.db.Create(ctx, &db.CreateRequest{
Table: "password-reset-codes", Table: "password-reset-codes",
Record: s, Record: s,
}) })
return &pwcode, err return &pwcode, err
} }
func (domain *Domain) DeletePasswordRestCode(ctx context.Context, id string) error { func (domain *Domain) DeletePasswordRestCode(ctx context.Context, userId, code string) error {
_, err := domain.db.Delete(ctx, &db.DeleteRequest{ _, err := domain.db.Delete(ctx, &db.DeleteRequest{
Table: "password-reset-codes", Table: "password-reset-codes",
Id: id, Id: userId + "-" + code,
}) })
return err return err
} }
// ReadToken returns the user id // ReadToken returns the user id
func (domain *Domain) ReadPasswordResetCode(ctx context.Context, id string) (*passwordResetCode, error) { func (domain *Domain) ReadPasswordResetCode(ctx context.Context, userId, code string) (*passwordResetCode, error) {
// generate the key
id := userId + "-" + code
if id == "" { if id == "" {
return nil, errors.New("password reset code id is empty") return nil, errors.New("password reset code id is empty")
} }
@@ -122,26 +144,37 @@ func (domain *Domain) ReadPasswordResetCode(ctx context.Context, id string) (*pa
m, _ := rsp.Records[0].MarshalJSON() m, _ := rsp.Records[0].MarshalJSON()
json.Unmarshal(m, token) json.Unmarshal(m, token)
// check the expiry
if token.Expires.Before(time.Now()) { if token.Expires.Before(time.Now()) {
return nil, errors.New("password reset code expired") return nil, errors.New("password reset code expired")
} }
return token, nil return token, nil
} }
func (domain *Domain) SendPasswordResetEmail(ctx context.Context, userId, fromName, toAddress, toUsername, subject, textContent string) error { func (domain *Domain) SendPasswordResetEmail(ctx context.Context, userId, codeStr, fromName, toAddress, toUsername, subject, textContent string) error {
if domain.sengridKey == "" { if domain.sengridKey == "" {
return fmt.Errorf("empty email api key") return fmt.Errorf("empty email api key")
} }
from := mail.NewEmail(fromName, "support@m3o.com")
from := mail.NewEmail(fromName, domain.fromEmail)
to := mail.NewEmail(toUsername, toAddress) to := mail.NewEmail(toUsername, toAddress)
code, err := domain.CreatePasswordResetCode(ctx, userId)
// save the password reset code
pw, err := domain.SavePasswordResetCode(ctx, userId, codeStr)
if err != nil { if err != nil {
return err return err
} }
textContent = strings.Replace(textContent, "$code", code.ID, -1)
// set the code in the text content
textContent = strings.Replace(textContent, "$code", pw.Code, -1)
message := mail.NewSingleEmail(from, subject, to, textContent, "") message := mail.NewSingleEmail(from, subject, to, textContent, "")
// send the email
client := sendgrid.NewSendClient(domain.sengridKey) client := sendgrid.NewSendClient(domain.sengridKey)
response, err := client.Send(message) response, err := client.Send(message)
// log the response
logger.Info(response) logger.Info(response)
return err return err
@@ -178,44 +211,53 @@ func (domain *Domain) DeleteSession(ctx context.Context, id string) error {
} }
// ReadToken returns the user id // ReadToken returns the user id
func (domain *Domain) ReadToken(ctx context.Context, tokenId string) (string, error) { func (domain *Domain) ReadToken(ctx context.Context, userId, token string) (string, error) {
if tokenId == "" { id := userId + "-" + token
if token == "" {
return "", errors.New("token id empty") return "", errors.New("token id empty")
} }
token := &verificationToken{}
tk := &verificationToken{}
rsp, err := domain.db.Read(ctx, &db.ReadRequest{ rsp, err := domain.db.Read(ctx, &db.ReadRequest{
Table: "tokens", Table: "tokens",
Query: fmt.Sprintf("id == '%v'", tokenId), Query: fmt.Sprintf("id == '%v'", id),
}) })
if err != nil { if err != nil {
return "", err return "", err
} }
if len(rsp.Records) == 0 { if len(rsp.Records) == 0 {
return "", errors.New("token not found") return "", errors.New("token not found")
} }
m, _ := rsp.Records[0].MarshalJSON() m, _ := rsp.Records[0].MarshalJSON()
json.Unmarshal(m, token) json.Unmarshal(m, tk)
return token.UserID, nil
return tk.UserID, nil
} }
// CreateToken returns the created and saved token // CreateToken returns the created and saved token
func (domain *Domain) CreateToken(ctx context.Context, userId string) (string, error) { func (domain *Domain) CreateToken(ctx context.Context, userId, token string) (string, error) {
s := &_struct.Struct{} s := &_struct.Struct{}
tokenId := uuid.New().String()
jso, _ := json.Marshal(verificationToken{ jso, _ := json.Marshal(verificationToken{
ID: tokenId, ID: userId + "-" + token,
UserID: userId, UserID: userId,
Token: token,
}) })
err := s.UnmarshalJSON(jso) err := s.UnmarshalJSON(jso)
if err != nil { if err != nil {
return "", err return "", err
} }
_, err = domain.db.Create(ctx, &db.CreateRequest{ _, err = domain.db.Create(ctx, &db.CreateRequest{
Table: "tokens", Table: "tokens",
Record: s, Record: s,
}) })
return tokenId, err
return token, err
} }
func (domain *Domain) ReadSession(ctx context.Context, id string) (*user.Session, error) { func (domain *Domain) ReadSession(ctx context.Context, id string) (*user.Session, error) {

View File

@@ -11,6 +11,7 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"github.com/micro/micro/v3/service/errors" "github.com/micro/micro/v3/service/errors"
db "github.com/micro/services/db/proto" db "github.com/micro/services/db/proto"
otp "github.com/micro/services/otp/proto"
"github.com/micro/services/user/domain" "github.com/micro/services/user/domain"
pb "github.com/micro/services/user/proto" pb "github.com/micro/services/user/proto"
"golang.org/x/crypto/bcrypt" "golang.org/x/crypto/bcrypt"
@@ -40,11 +41,13 @@ func random(i int) string {
type User struct { type User struct {
domain *domain.Domain domain *domain.Domain
Otp otp.OtpService
} }
func NewUser(db db.DbService) *User { func NewUser(db db.DbService, otp otp.OtpService) *User {
return &User{ return &User{
domain: domain.New(db), domain: domain.New(db),
Otp: otp,
} }
} }
@@ -224,21 +227,64 @@ func (s *User) ReadSession(ctx context.Context, req *pb.ReadSessionRequest, rsp
} }
func (s *User) VerifyEmail(ctx context.Context, req *pb.VerifyEmailRequest, rsp *pb.VerifyEmailResponse) error { func (s *User) VerifyEmail(ctx context.Context, req *pb.VerifyEmailRequest, rsp *pb.VerifyEmailResponse) error {
userId, err := s.domain.ReadToken(ctx, req.Token) if len(req.Email) == 0 {
return errors.BadRequest("user.verifyemail", "missing email")
}
if len(req.Token) == 0 {
return errors.BadRequest("user.verifyemail", "missing token")
}
// check the token exists
userId, err := s.domain.ReadToken(ctx, req.Email, req.Token)
if err != nil { if err != nil {
return err return err
} }
// validate the code, e.g its an OTP token and hasn't expired
resp, err := s.Otp.Validate(ctx, &otp.ValidateRequest{
Id: req.Email,
Code: req.Token,
})
if err != nil {
return err
}
// check if the code is actually valid
if !resp.Success {
return errors.BadRequest("user.resetpassword", "invalid code")
}
// mark user as verified
user, err := s.domain.Read(ctx, userId) user, err := s.domain.Read(ctx, userId)
user.Verified = true user.Verified = true
// update the user
return s.domain.Update(ctx, user) return s.domain.Update(ctx, user)
} }
func (s *User) SendVerificationEmail(ctx context.Context, req *pb.SendVerificationEmailRequest, rsp *pb.SendVerificationEmailResponse) error { func (s *User) SendVerificationEmail(ctx context.Context, req *pb.SendVerificationEmailRequest, rsp *pb.SendVerificationEmailResponse) error {
if len(req.Email) == 0 {
return errors.BadRequest("user.sendverificationemail", "missing email")
}
// search for the user
users, err := s.domain.Search(ctx, "", req.Email) users, err := s.domain.Search(ctx, "", req.Email)
if err != nil { if err != nil {
return err return err
} }
token, err := s.domain.CreateToken(ctx, users[0].Id)
// generate a new OTP code
resp, err := s.Otp.Generate(ctx, &otp.GenerateRequest{
Expiry: 300,
Id: req.Email,
})
if err != nil {
return err
}
// generate/save a token for verification
token, err := s.domain.CreateToken(ctx, req.Email, resp.Code)
if err != nil { if err != nil {
return err return err
} }
@@ -247,19 +293,67 @@ func (s *User) SendVerificationEmail(ctx context.Context, req *pb.SendVerificati
} }
func (s *User) SendPasswordResetEmail(ctx context.Context, req *pb.SendPasswordResetEmailRequest, rsp *pb.SendPasswordResetEmailResponse) error { func (s *User) SendPasswordResetEmail(ctx context.Context, req *pb.SendPasswordResetEmailRequest, rsp *pb.SendPasswordResetEmailResponse) error {
if len(req.Email) == 0 {
return errors.BadRequest("user.sendpasswordresetemail", "missing email")
}
// look for an existing user
users, err := s.domain.Search(ctx, "", req.Email) users, err := s.domain.Search(ctx, "", req.Email)
if err != nil { if err != nil {
return err return err
} }
return s.domain.SendPasswordResetEmail(ctx, users[0].Id, req.FromName, req.Email, users[0].Username, req.Subject, req.TextContent) // generate a new OTP code
} resp, err := s.Otp.Generate(ctx, &otp.GenerateRequest{
Expiry: 300,
Id: req.Email,
})
func (s *User) ResetPassword(ctx context.Context, req *pb.ResetPasswordRequest, rsp *pb.ResetPasswordResponse) error {
code, err := s.domain.ReadPasswordResetCode(ctx, req.Code)
if err != nil { if err != nil {
return err return err
} }
// save the code in the database and then send via email
return s.domain.SendPasswordResetEmail(ctx, users[0].Id, resp.Code, req.FromName, req.Email, users[0].Username, req.Subject, req.TextContent)
}
func (s *User) ResetPassword(ctx context.Context, req *pb.ResetPasswordRequest, rsp *pb.ResetPasswordResponse) error {
if len(req.Email) == 0 {
return errors.BadRequest("user.resetpassword", "missing email")
}
if len(req.Code) == 0 {
return errors.BadRequest("user.resetpassword", "missing code")
}
if len(req.ConfirmPassword) == 0 {
return errors.BadRequest("user.resetpassword", "missing confirm password")
}
if len(req.NewPassword) == 0 {
return errors.BadRequest("user.resetpassword", "missing new password")
}
if req.ConfirmPassword != req.NewPassword {
return errors.BadRequest("user.resetpassword", "passwords do not match")
}
// check if a request was made to reset the password, we should have saved it
code, err := s.domain.ReadPasswordResetCode(ctx, req.Email, req.Code)
if err != nil {
return err
}
// validate the code, e.g its an OTP token and hasn't expired
resp, err := s.Otp.Validate(ctx, &otp.ValidateRequest{
Id: req.Email,
Code: req.Code,
})
if err != nil {
return err
}
// check if the code is actually valid
if !resp.Success {
return errors.BadRequest("user.resetpassword", "invalid code")
}
// no error means it exists and not expired // no error means it exists and not expired
salt := random(16) salt := random(16)
h, err := bcrypt.GenerateFromPassword([]byte(x+salt+req.NewPassword), 10) h, err := bcrypt.GenerateFromPassword([]byte(x+salt+req.NewPassword), 10)
@@ -268,9 +362,13 @@ func (s *User) ResetPassword(ctx context.Context, req *pb.ResetPasswordRequest,
} }
pp := base64.StdEncoding.EncodeToString(h) pp := base64.StdEncoding.EncodeToString(h)
// update the user password
if err := s.domain.UpdatePassword(ctx, code.UserID, salt, pp); err != nil { if err := s.domain.UpdatePassword(ctx, code.UserID, salt, pp); err != nil {
return errors.InternalServerError("user.resetpassword", err.Error()) return errors.InternalServerError("user.resetpassword", err.Error())
} }
s.domain.DeletePasswordRestCode(ctx, req.Code)
// delete our saved code
s.domain.DeletePasswordRestCode(ctx, req.Email, req.Code)
return nil return nil
} }

View File

@@ -4,6 +4,7 @@ import (
"github.com/micro/micro/v3/service" "github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger" "github.com/micro/micro/v3/service/logger"
db "github.com/micro/services/db/proto" db "github.com/micro/services/db/proto"
otp "github.com/micro/services/otp/proto"
"github.com/micro/services/pkg/tracing" "github.com/micro/services/pkg/tracing"
"github.com/micro/services/user/handler" "github.com/micro/services/user/handler"
proto "github.com/micro/services/user/proto" proto "github.com/micro/services/user/proto"
@@ -15,9 +16,12 @@ func main() {
) )
service.Init() service.Init()
handl := handler.NewUser(db.NewDbService("db", service.Client())) hd := handler.NewUser(
db.NewDbService("db", service.Client()),
otp.NewOtpService("otp", service.Client()),
)
proto.RegisterUserHandler(service.Server(), handl) proto.RegisterUserHandler(service.Server(), hd)
traceCloser := tracing.SetupOpentracing("user") traceCloser := tracing.SetupOpentracing("user")
defer traceCloser.Close() defer traceCloser.Close()

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.26.0 // protoc-gen-go v1.27.1
// protoc v3.6.1 // protoc v3.15.6
// source: proto/user.proto // source: proto/user.proto
package user package user
@@ -1071,8 +1071,10 @@ type VerifyEmailRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// the email address to verify
Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
// The token from the verification email // The token from the verification email
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
} }
func (x *VerifyEmailRequest) Reset() { func (x *VerifyEmailRequest) Reset() {
@@ -1107,6 +1109,13 @@ func (*VerifyEmailRequest) Descriptor() ([]byte, []int) {
return file_proto_user_proto_rawDescGZIP(), []int{18} return file_proto_user_proto_rawDescGZIP(), []int{18}
} }
func (x *VerifyEmailRequest) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *VerifyEmailRequest) GetToken() string { func (x *VerifyEmailRequest) GetToken() string {
if x != nil { if x != nil {
return x.Token return x.Token
@@ -1287,7 +1296,9 @@ type SendPasswordResetEmailRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` // email address to send reset for
Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
// subject of the email
Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"`
// Text content of the email. Don't forget to include the string '$code' which will be replaced by the real verification link // Text content of the email. Don't forget to include the string '$code' which will be replaced by the real verification link
// HTML emails are not available currently. // HTML emails are not available currently.
@@ -1400,12 +1411,14 @@ type ResetPasswordRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// the email to reset the password for
Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
// The code from the verification email // The code from the verification email
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
// the new password // the new password
NewPassword string `protobuf:"bytes,2,opt,name=newPassword,proto3" json:"newPassword,omitempty"` NewPassword string `protobuf:"bytes,3,opt,name=newPassword,proto3" json:"newPassword,omitempty"`
// confirm new password // confirm new password
ConfirmPassword string `protobuf:"bytes,3,opt,name=confirmPassword,proto3" json:"confirmPassword,omitempty"` ConfirmPassword string `protobuf:"bytes,4,opt,name=confirmPassword,proto3" json:"confirmPassword,omitempty"`
} }
func (x *ResetPasswordRequest) Reset() { func (x *ResetPasswordRequest) Reset() {
@@ -1440,6 +1453,13 @@ func (*ResetPasswordRequest) Descriptor() ([]byte, []int) {
return file_proto_user_proto_rawDescGZIP(), []int{24} return file_proto_user_proto_rawDescGZIP(), []int{24}
} }
func (x *ResetPasswordRequest) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *ResetPasswordRequest) GetCode() string { func (x *ResetPasswordRequest) GetCode() string {
if x != nil { if x != nil {
return x.Code return x.Code
@@ -1606,100 +1626,103 @@ var file_proto_user_proto_rawDesc = []byte{
0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22,
0x10, 0x0a, 0x0e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x10, 0x0a, 0x0e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x2a, 0x0a, 0x12, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x65, 0x22, 0x40, 0x0a, 0x12, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 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, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x15, 0x0a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a,
0x13, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0xde, 0x01, 0x0a, 0x1c, 0x53, 0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x6b, 0x65, 0x6e, 0x22, 0x15, 0x0a, 0x13, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61,
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xde, 0x01, 0x0a, 0x1c, 0x53,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x73,
0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75,
0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x65, 0x78, 0x74, 0x43, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x65, 0x78, 0x74,
0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x72,
0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65,
0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x2e, 0x0a, 0x12, 0x66, 0x61, 0x69,
0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18,
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65,
0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x6f,
0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x6f,
0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x53, 0x65, 0x6e, 0x64, 0x56, 0x65, 0x72,
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1d, 0x53, 0x65, 0x6e, 0x64, 0x50,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x45, 0x6d, 0x61, 0x69,
0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69,
0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x18,
0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x65, 0x78, 0x74,
0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74,
0x65, 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72,
0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72,
0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x1e, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x61,
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x76, 0x0a, 0x14, 0x52, 0x65, 0x73, 0x65,
0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x63, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77,
0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, 0x77, 0x50, 0x61,
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72,
0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,
0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb9, 0x06, 0x0a, 0x04, 0x55, 0x73,
0x65, 0x72, 0x12, 0x35, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x75,
0x73, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x14, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x52, 0x65, 0x61,
0x64, 0x12, 0x11, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x75, 0x73, 0x65, 0x72,
0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x12, 0x35, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x75, 0x73,
0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x14, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65,
0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
0x12, 0x12, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06, 0x4c,
0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x13, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67,
0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x75, 0x73, 0x65,
0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x12, 0x44, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73,
0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0b, 0x56, 0x65, 0x72, 0x69,
0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x56,
0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45,
0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x62,
0x0a, 0x15, 0x53, 0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x22, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x53,
0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x75, 0x73, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65,
0x65, 0x72, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69,
0x69, 0x6f, 0x6e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01,
0x22, 0x00, 0x12, 0x65, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x74,
0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x23, 0x2e, 0x75, 0x65, 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x73, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x0b, 0x74, 0x65, 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a,
0x52, 0x65, 0x73, 0x65, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01,
0x74, 0x1a, 0x24, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x73, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12,
0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x2e, 0x0a, 0x12, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x66, 0x61, 0x69,
0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12,
0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x09, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x53,
0x73, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8d, 0x01, 0x0a,
0x3b, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x1d, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73,
0x65, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14,
0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
0x6d, 0x61, 0x69, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x20,
0x0a, 0x0b, 0x74, 0x65, 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x65, 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x1e,
0x53, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65,
0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8c,
0x01, 0x0a, 0x14, 0x52, 0x65, 0x73, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x12, 0x0a,
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77,
0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61,
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f,
0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x17, 0x0a,
0x15, 0x52, 0x65, 0x73, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb9, 0x06, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12,
0x35, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x75, 0x73, 0x65, 0x72,
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x11,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x12, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x12, 0x13, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35,
0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x12, 0x2e,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x13, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x6f,
0x75, 0x74, 0x12, 0x13, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c,
0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x44, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e,
0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45,
0x6d, 0x61, 0x69, 0x6c, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69,
0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69,
0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x62, 0x0a, 0x15, 0x53,
0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
0x6d, 0x61, 0x69, 0x6c, 0x12, 0x22, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x6e, 0x64,
0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6d, 0x61, 0x69,
0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e,
0x53, 0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x65, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52,
0x65, 0x73, 0x65, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x23, 0x2e, 0x75, 0x73, 0x65, 0x72,
0x2e, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73,
0x65, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,
0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x74, 0x50,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52,
0x65, 0x73, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74,
0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x75, 0x73,
0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@@ -158,8 +158,10 @@ message LogoutResponse {
// Verify the email address of an account from a token sent in an email to the user. // Verify the email address of an account from a token sent in an email to the user.
message VerifyEmailRequest { message VerifyEmailRequest {
// the email address to verify
string email = 1;
// The token from the verification email // The token from the verification email
string token = 1; string token = 2;
} }
message VerifyEmailResponse{ message VerifyEmailResponse{
@@ -191,7 +193,9 @@ message SendVerificationEmailResponse{}
// Send an email with a verification code to reset password. // Send an email with a verification code to reset password.
// Call "ResetPassword" endpoint once user provides the code. // Call "ResetPassword" endpoint once user provides the code.
message SendPasswordResetEmailRequest { message SendPasswordResetEmailRequest {
// email address to send reset for
string email = 1; string email = 1;
// subject of the email
string subject = 2; string subject = 2;
// Text content of the email. Don't forget to include the string '$code' which will be replaced by the real verification link // Text content of the email. Don't forget to include the string '$code' which will be replaced by the real verification link
// HTML emails are not available currently. // HTML emails are not available currently.
@@ -205,14 +209,14 @@ message SendPasswordResetEmailResponse {
// Reset password with the code sent by the "SendPasswordResetEmail" endoint. // Reset password with the code sent by the "SendPasswordResetEmail" endoint.
message ResetPasswordRequest { message ResetPasswordRequest {
// the email to reset the password for
string email = 1;
// The code from the verification email // The code from the verification email
string code = 1; string code = 2;
// the new password // the new password
string newPassword = 2; string newPassword = 3;
// confirm new password // confirm new password
string confirmPassword = 3; string confirmPassword = 4;
} }
message ResetPasswordResponse { message ResetPasswordResponse {}
}