✨ Account and auth protobuf and client code
This commit is contained in:
22
DysonNetwork.Shared/DysonNetwork.Shared.csproj
Normal file
22
DysonNetwork.Shared/DysonNetwork.Shared.csproj
Normal file
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\*.proto" GrpcServices="Client" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.65.0" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.27.2" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.65.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
28
DysonNetwork.Shared/Protos/account.proto
Normal file
28
DysonNetwork.Shared/Protos/account.proto
Normal file
@ -0,0 +1,28 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package dyson_network.sphere.account;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option csharp_namespace = "DysonNetwork.Sphere.Account.Proto";
|
||||
|
||||
service AccountService {
|
||||
// Retrieves the current user's account information
|
||||
rpc GetAccount(google.protobuf.Empty) returns (AccountResponse);
|
||||
|
||||
// Updates the current user's account information
|
||||
rpc UpdateAccount(UpdateAccountRequest) returns (AccountResponse);
|
||||
}
|
||||
|
||||
message AccountResponse {
|
||||
string id = 1;
|
||||
string username = 2;
|
||||
string email = 3;
|
||||
string display_name = 4;
|
||||
}
|
||||
|
||||
message UpdateAccountRequest {
|
||||
// Fields to update
|
||||
optional string email = 1;
|
||||
optional string display_name = 2;
|
||||
}
|
55
DysonNetwork.Shared/Protos/auth.proto
Normal file
55
DysonNetwork.Shared/Protos/auth.proto
Normal file
@ -0,0 +1,55 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package dyson_network.sphere.auth;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
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;
|
||||
}
|
||||
|
||||
message LoginResponse {
|
||||
string access_token = 1;
|
||||
string refresh_token = 2;
|
||||
int64 expires_in = 3;
|
||||
}
|
||||
|
||||
message IntrospectTokenRequest {
|
||||
string token = 1;
|
||||
// Optional: token_type_hint can be "access_token" or "refresh_token"
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user