Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- syntax = "proto3";
- option go_package = "pb";
- import "google/protobuf/empty.proto";
- import "google/protobuf/wrappers.proto";
- import "timestamp.proto";
- message UserRegistrationRequest {
- string email = 1;
- string Username = 2;
- string password = 3;
- }
- enum Status {
- ACTIVE = 0;
- UNVERIFIED_EMAIL = 1;
- BLOCKED = 2;
- }
- message User {
- string id = 1;
- string email = 2;
- string username = 3;
- bytes password = 4;
- bytes salt = 5;
- bytes totpKey = 6;
- Status status = 7;
- bytes email_verification_token = 8;
- Timestamp registrationTimestamp = 9;
- }
- message EmailVerificationRequest {
- string id = 1;
- bytes token = 2;
- }
- message PasswordChangeRequest {
- string id = 1;
- string newPassword = 2;
- }
- message PasswordCheckRequest {
- string id = 1;
- string password = 2;
- }
- message TOTPCodeCheckRequest {
- string id = 1;
- string code = 2;
- }
- message StatusChangeRequest {
- string id = 1;
- Status newStatus = 2;
- }
- // user management service
- service UserManagement {
- // RegisterUser registers a new user account
- rpc RegisterUser (UserRegistrationRequest) returns (google.protobuf.Empty);
- // FindUserByID finds a user by ID
- rpc FindUserByID (google.protobuf.StringValue) returns (User);
- // FindUserByEmail finds a user by email
- rpc FindUserByEmail (google.protobuf.StringValue) returns (User);
- // FindUserByUsername find a user by display name
- rpc FindUserByUsername (google.protobuf.StringValue) returns (User);
- // EmailVerificationToken retrieve email verification token
- rpc EmailVerificationToken (google.protobuf.StringValue) returns (google.protobuf.BytesValue);
- // VerifyEmail verify email
- rpc VerifyEmail (EmailVerificationRequest) returns (google.protobuf.Empty);
- // ChangePassword change password
- rpc ChangePassword (PasswordChangeRequest) returns (google.protobuf.Empty);
- // GenerateTOTPKey generate a new totp key
- rpc GenerateTOTPKey (google.protobuf.StringValue) returns (google.protobuf.BytesValue);
- // TOTPKey returns the totp key
- rpc TOTPKey (google.protobuf.StringValue) returns (google.protobuf.BytesValue);
- // CheckPassword checks a password
- rpc CheckPassword (PasswordCheckRequest) returns (google.protobuf.Empty);
- // CheckTOTPCode checks a totp code
- rpc CheckTOTPCode (TOTPCodeCheckRequest) returns (google.protobuf.Empty);
- // SetStatus sets the account status
- rpc SetStatus (StatusChangeRequest) returns (google.protobuf.Empty);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement