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.

96 lines
1.6 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. 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 Authorize (AuthorizeRequest) returns (AuthorizeResponse) {}
  8. rpc ResetPassword (ResetPasswordRequest) returns (ResetPasswordResponse) {}
  9. rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse) {}
  10. rpc ListRoles (ListRolesRequest) returns (ListRolesResponse) {}
  11. rpc SetRoles (SetRolesRequest) returns (SetRolesResponse) {}
  12. }
  13. message UserForm {
  14. string email = 1;
  15. optional string password = 2;
  16. optional string password_again = 3;
  17. }
  18. message UserToken {
  19. string token = 1;
  20. optional int64 expires = 2;
  21. }
  22. message UserInfo {
  23. int64 id = 1;
  24. }
  25. message UserRole {
  26. int64 id = 1;
  27. string name = 2;
  28. }
  29. message RegisterRequest {
  30. UserForm form = 1;
  31. }
  32. message RegisterResponse {
  33. }
  34. message LoginRequest {
  35. UserForm form = 1;
  36. }
  37. message LoginResponse {
  38. UserToken token = 1;
  39. }
  40. message AuthorizeRequest {
  41. string secret = 1;
  42. UserToken token = 2;
  43. }
  44. message AuthorizeResponse {
  45. UserInfo user = 1;
  46. repeated UserRole roles = 2;
  47. }
  48. message ResetPasswordRequest {
  49. UserForm form = 1;
  50. }
  51. message ResetPasswordResponse {
  52. UserToken token = 1;
  53. }
  54. message ChangePasswordRequest {
  55. UserToken token = 1;
  56. UserForm form = 2;
  57. }
  58. message ChangePasswordResponse {
  59. }
  60. message ListRolesRequest {
  61. string secret = 1;
  62. }
  63. message ListRolesResponse {
  64. repeated UserRole roles = 2;
  65. }
  66. message SetRolesRequest {
  67. string secret = 1;
  68. UserInfo user = 2;
  69. repeated UserRole roles = 3;
  70. }
  71. message SetRolesResponse {
  72. }