Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. syntax = "proto3";
  2. option go_package = "pb";
  3. import "google/protobuf/empty.proto";
  4. import "google/protobuf/wrappers.proto";
  5. import "timestamp.proto";
  6.  
  7. message UserRegistrationRequest {
  8. string email = 1;
  9. string Username = 2;
  10. string password = 3;
  11. }
  12.  
  13. enum Status {
  14. ACTIVE = 0;
  15. UNVERIFIED_EMAIL = 1;
  16. BLOCKED = 2;
  17. }
  18.  
  19. message User {
  20. string id = 1;
  21. string email = 2;
  22. string username = 3;
  23. bytes password = 4;
  24. bytes salt = 5;
  25. bytes totpKey = 6;
  26. Status status = 7;
  27. bytes email_verification_token = 8;
  28. Timestamp registrationTimestamp = 9;
  29. }
  30.  
  31. message EmailVerificationRequest {
  32. string id = 1;
  33. bytes token = 2;
  34. }
  35.  
  36. message PasswordChangeRequest {
  37. string id = 1;
  38. string newPassword = 2;
  39. }
  40.  
  41. message PasswordCheckRequest {
  42. string id = 1;
  43. string password = 2;
  44. }
  45.  
  46. message TOTPCodeCheckRequest {
  47. string id = 1;
  48. string code = 2;
  49. }
  50.  
  51. message StatusChangeRequest {
  52. string id = 1;
  53. Status newStatus = 2;
  54. }
  55.  
  56. // user management service
  57. service UserManagement {
  58. // RegisterUser registers a new user account
  59. rpc RegisterUser (UserRegistrationRequest) returns (google.protobuf.Empty);
  60. // FindUserByID finds a user by ID
  61. rpc FindUserByID (google.protobuf.StringValue) returns (User);
  62. // FindUserByEmail finds a user by email
  63. rpc FindUserByEmail (google.protobuf.StringValue) returns (User);
  64. // FindUserByUsername find a user by display name
  65. rpc FindUserByUsername (google.protobuf.StringValue) returns (User);
  66. // EmailVerificationToken retrieve email verification token
  67. rpc EmailVerificationToken (google.protobuf.StringValue) returns (google.protobuf.BytesValue);
  68. // VerifyEmail verify email
  69. rpc VerifyEmail (EmailVerificationRequest) returns (google.protobuf.Empty);
  70. // ChangePassword change password
  71. rpc ChangePassword (PasswordChangeRequest) returns (google.protobuf.Empty);
  72. // GenerateTOTPKey generate a new totp key
  73. rpc GenerateTOTPKey (google.protobuf.StringValue) returns (google.protobuf.BytesValue);
  74. // TOTPKey returns the totp key
  75. rpc TOTPKey (google.protobuf.StringValue) returns (google.protobuf.BytesValue);
  76. // CheckPassword checks a password
  77. rpc CheckPassword (PasswordCheckRequest) returns (google.protobuf.Empty);
  78. // CheckTOTPCode checks a totp code
  79. rpc CheckTOTPCode (TOTPCodeCheckRequest) returns (google.protobuf.Empty);
  80. // SetStatus sets the account status
  81. rpc SetStatus (StatusChangeRequest) returns (google.protobuf.Empty);
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement