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.

105 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. 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. }
  26. message UserRole {
  27. int64 id = 1;
  28. string name = 2;
  29. }
  30. message RegisterRequest {
  31. UserForm form = 1;
  32. }
  33. message RegisterResponse {
  34. }
  35. message LoginRequest {
  36. UserForm form = 1;
  37. }
  38. message LoginResponse {
  39. UserToken token = 1;
  40. }
  41. message LogoutRequest {
  42. UserToken token = 1;
  43. }
  44. message LogoutResponse {
  45. }
  46. message AuthorizeRequest {
  47. string secret = 1;
  48. UserToken token = 2;
  49. }
  50. message AuthorizeResponse {
  51. UserInfo user = 1;
  52. repeated UserRole roles = 2;
  53. }
  54. message ResetPasswordRequest {
  55. UserForm form = 1;
  56. }
  57. message ResetPasswordResponse {
  58. UserToken token = 1;
  59. }
  60. message ChangePasswordRequest {
  61. UserToken token = 1;
  62. UserForm form = 2;
  63. }
  64. message ChangePasswordResponse {
  65. }
  66. message ListRolesRequest {
  67. string secret = 1;
  68. }
  69. message ListRolesResponse {
  70. repeated UserRole roles = 2;
  71. }
  72. message SetRolesRequest {
  73. string secret = 1;
  74. UserInfo user = 2;
  75. repeated UserRole roles = 3;
  76. }
  77. message SetRolesResponse {
  78. }