You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
1.8 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. syntax = "proto3";
  2. package users;
  3. option go_package = "git.chrishayward.xyz/x/users/proto";
  4. service Users {
  5. rpc Register (RegisterRequest) returns (RegisterResponse) {}
  6. rpc Login (LoginRequest) returns (LoginResponse) {}
  7. rpc Logout (LogoutRequest) returns (LogoutResponse) {}
  8. rpc Authorize (AuthorizeRequest) returns (AuthorizeResponse) {}
  9. rpc ResetPassword (ResetPasswordRequest) returns (ResetPasswordResponse) {}
  10. rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse) {}
  11. rpc ListRoles (ListRolesRequest) returns (ListRolesResponse) {}
  12. rpc SetRoles (SetRolesRequest) returns (SetRolesResponse) {}
  13. }
  14. message UserForm {
  15. string email = 1;
  16. optional string password = 2;
  17. optional string password_again = 3;
  18. }
  19. message UserToken {
  20. string token = 1;
  21. optional int64 expires = 2;
  22. }
  23. message UserInfo {
  24. int64 id = 1;
  25. string uuid = 2;
  26. }
  27. message UserRole {
  28. int64 id = 1;
  29. string name = 2;
  30. }
  31. message RegisterRequest {
  32. UserForm form = 1;
  33. }
  34. message RegisterResponse {
  35. }
  36. message LoginRequest {
  37. UserForm form = 1;
  38. }
  39. message LoginResponse {
  40. UserToken token = 1;
  41. }
  42. message LogoutRequest {
  43. UserToken token = 1;
  44. }
  45. message LogoutResponse {
  46. }
  47. message AuthorizeRequest {
  48. string secret = 1;
  49. UserToken token = 2;
  50. }
  51. message AuthorizeResponse {
  52. UserInfo user = 1;
  53. repeated UserRole roles = 2;
  54. }
  55. message ResetPasswordRequest {
  56. UserForm form = 1;
  57. }
  58. message ResetPasswordResponse {
  59. UserToken token = 1;
  60. }
  61. message ChangePasswordRequest {
  62. UserToken token = 1;
  63. UserForm form = 2;
  64. }
  65. message ChangePasswordResponse {
  66. }
  67. message ListRolesRequest {
  68. string secret = 1;
  69. }
  70. message ListRolesResponse {
  71. repeated UserRole roles = 2;
  72. }
  73. message SetRolesRequest {
  74. string secret = 1;
  75. UserInfo user = 2;
  76. repeated UserRole roles = 3;
  77. }
  78. message SetRolesResponse {
  79. }