🗃️ Updated protobuf specs

This commit is contained in:
2025-07-06 21:51:37 +08:00
parent bb2f88cc54
commit cb4acbb3fc
2 changed files with 62 additions and 25 deletions

View File

@ -3,26 +3,49 @@ syntax = "proto3";
package dyson_network.sphere.account; package dyson_network.sphere.account;
import "google/protobuf/empty.proto"; import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "DysonNetwork.Sphere.Account.Proto"; option csharp_namespace = "DysonNetwork.Sphere.Account.Proto";
service AccountService { service AccountService {
// Retrieves the current user's account information
rpc GetAccount(google.protobuf.Empty) returns (AccountResponse); rpc GetAccount(google.protobuf.Empty) returns (AccountResponse);
// Updates the current user's account information
rpc UpdateAccount(UpdateAccountRequest) returns (AccountResponse); rpc UpdateAccount(UpdateAccountRequest) returns (AccountResponse);
} }
message AccountResponse { message AccountResponse {
string id = 1; string id = 1;
string username = 2; string name = 2;
string email = 3; string nick = 3;
string display_name = 4; string language = 4;
google.protobuf.Timestamp activated_at = 5;
bool is_superuser = 6;
Profile profile = 7;
}
message Profile {
string first_name = 1;
string last_name = 2;
string bio = 3;
string gender = 4;
string pronouns = 5;
string time_zone = 6;
string location = 7;
google.protobuf.Timestamp birthday = 8;
google.protobuf.Timestamp last_seen_at = 9;
int32 experience = 10;
int32 level = 11;
double leveling_progress = 12;
} }
message UpdateAccountRequest { message UpdateAccountRequest {
// Fields to update optional string nick = 1;
optional string email = 1; optional string language = 2;
optional string display_name = 2; optional string first_name = 3;
optional string last_name = 4;
optional string bio = 5;
optional string gender = 6;
optional string pronouns = 7;
optional string time_zone = 8;
optional string location = 9;
optional google.protobuf.Timestamp birthday = 10;
} }

View File

@ -8,21 +8,15 @@ import "google/protobuf/timestamp.proto";
option csharp_namespace = "DysonNetwork.Sphere.Auth.Proto"; option csharp_namespace = "DysonNetwork.Sphere.Auth.Proto";
service AuthService { service AuthService {
// Standard username/password login
rpc Login(LoginRequest) returns (LoginResponse); rpc Login(LoginRequest) returns (LoginResponse);
// Introspects an OAuth 2.0 access token.
rpc IntrospectToken(IntrospectTokenRequest) returns (IntrospectionResponse); rpc IntrospectToken(IntrospectTokenRequest) returns (IntrospectionResponse);
// Logs out the current session
rpc Logout(google.protobuf.Empty) returns (google.protobuf.Empty); rpc Logout(google.protobuf.Empty) returns (google.protobuf.Empty);
} }
message LoginRequest { message LoginRequest {
string username = 1; string username = 1;
string password = 2; string password = 2;
// Optional: for 2FA optional string two_factor_code = 3;
string two_factor_code = 3;
} }
message LoginResponse { message LoginResponse {
@ -33,23 +27,43 @@ message LoginResponse {
message IntrospectTokenRequest { message IntrospectTokenRequest {
string token = 1; string token = 1;
// Optional: token_type_hint can be "access_token" or "refresh_token" optional string token_type_hint = 2;
string token_type_hint = 2;
} }
message IntrospectionResponse { message IntrospectionResponse {
// Indicates whether or not the token is currently active.
bool active = 1; bool active = 1;
// A JSON string containing the claims of the token.
string claims = 2; string claims = 2;
// The client identifier for the OAuth 2.0 client that requested the token.
string client_id = 3; string client_id = 3;
// The username of the resource owner who authorized the token.
string username = 4; string username = 4;
// The scope of the access token.
string scope = 5; string scope = 5;
// The time at which the token was issued.
google.protobuf.Timestamp iat = 6; google.protobuf.Timestamp iat = 6;
// The time at which the token expires.
google.protobuf.Timestamp exp = 7; google.protobuf.Timestamp exp = 7;
} }
message Session {
string id = 1;
string label = 2;
google.protobuf.Timestamp last_granted_at = 3;
google.protobuf.Timestamp expired_at = 4;
string account_id = 5;
string challenge_id = 6;
optional string app_id = 7;
}
message Challenge {
string id = 1;
google.protobuf.Timestamp expired_at = 2;
int32 step_remain = 3;
int32 step_total = 4;
int32 failed_attempts = 5;
string platform = 6;
string type = 7;
repeated string blacklist_factors = 8;
repeated string audiences = 9;
repeated string scopes = 10;
string ip_address = 11;
string user_agent = 12;
optional string device_id = 13;
optional string nonce = 14;
string account_id = 15;
}