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

syntax = "proto3";
package users;
option go_package = "git.chrishayward.xyz/x/users/proto";
service Users {
rpc Register (RegisterRequest) returns (RegisterResponse) {}
rpc Login (LoginRequest) returns (LoginResponse) {}
rpc Logout (LogoutRequest) returns (LogoutResponse) {}
rpc Authorize (AuthorizeRequest) returns (AuthorizeResponse) {}
rpc ResetPassword (ResetPasswordRequest) returns (ResetPasswordResponse) {}
rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse) {}
rpc ListRoles (ListRolesRequest) returns (ListRolesResponse) {}
rpc SetRoles (SetRolesRequest) returns (SetRolesResponse) {}
}
message UserForm {
string email = 1;
optional string password = 2;
optional string password_again = 3;
}
message UserToken {
string token = 1;
optional int64 expires = 2;
}
message UserInfo {
int64 id = 1;
}
message UserRole {
int64 id = 1;
string name = 2;
}
message RegisterRequest {
UserForm form = 1;
}
message RegisterResponse {
}
message LoginRequest {
UserForm form = 1;
}
message LoginResponse {
UserToken token = 1;
}
message LogoutRequest {
UserToken token = 1;
}
message LogoutResponse {
}
message AuthorizeRequest {
string secret = 1;
UserToken token = 2;
}
message AuthorizeResponse {
UserInfo user = 1;
repeated UserRole roles = 2;
}
message ResetPasswordRequest {
UserForm form = 1;
}
message ResetPasswordResponse {
UserToken token = 1;
}
message ChangePasswordRequest {
UserToken token = 1;
UserForm form = 2;
}
message ChangePasswordResponse {
}
message ListRolesRequest {
string secret = 1;
}
message ListRolesResponse {
repeated UserRole roles = 2;
}
message SetRolesRequest {
string secret = 1;
UserInfo user = 2;
repeated UserRole roles = 3;
}
message SetRolesResponse {
}