🗃️ 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

@ -8,21 +8,15 @@ import "google/protobuf/timestamp.proto";
option csharp_namespace = "DysonNetwork.Sphere.Auth.Proto";
service AuthService {
// Standard username/password login
rpc Login(LoginRequest) returns (LoginResponse);
// Introspects an OAuth 2.0 access token.
rpc IntrospectToken(IntrospectTokenRequest) returns (IntrospectionResponse);
// Logs out the current session
rpc Logout(google.protobuf.Empty) returns (google.protobuf.Empty);
}
message LoginRequest {
string username = 1;
string password = 2;
// Optional: for 2FA
string two_factor_code = 3;
optional string two_factor_code = 3;
}
message LoginResponse {
@ -33,23 +27,43 @@ message LoginResponse {
message IntrospectTokenRequest {
string token = 1;
// Optional: token_type_hint can be "access_token" or "refresh_token"
string token_type_hint = 2;
optional string token_type_hint = 2;
}
message IntrospectionResponse {
// Indicates whether or not the token is currently active.
bool active = 1;
// A JSON string containing the claims of the token.
string claims = 2;
// The client identifier for the OAuth 2.0 client that requested the token.
string client_id = 3;
// The username of the resource owner who authorized the token.
string username = 4;
// The scope of the access token.
string scope = 5;
// The time at which the token was issued.
google.protobuf.Timestamp iat = 6;
// The time at which the token expires.
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;
}