syntax = "proto3"; package state.v1; import "google/protobuf/timestamp.proto"; import "state/v1/types.proto"; service AccountService { rpc GetAuthenticationSettings(GetAuthenticationSettingsRequest) returns (GetAuthenticationSettingsResponse); rpc SaveAuthenticationSettings(SaveAuthenticationSettingsRequest) returns (SaveAuthenticationSettingsResponse); rpc BeginPasskey(BeginPasskeyRequest) returns (BeginPasskeyResponse); rpc FinishPasskey(FinishPasskeyRequest) returns (FinishPasskeyResponse); rpc ListPasskeys(ListPasskeysRequest) returns (ListPasskeysResponse); rpc DeletePasskey(DeletePasskeyRequest) returns (DeletePasskeyResponse); rpc OpenAccountSession(OpenAccountSessionRequest) returns (OpenAccountSessionResponse); rpc RequireFreshAccountSession(RequireFreshAccountSessionRequest) returns (RequireFreshAccountSessionResponse); rpc CreateAccountRecovery(CreateAccountRecoveryRequest) returns (CreateAccountRecoveryResponse); rpc RecoverAccount(RecoverAccountRequest) returns (RecoverAccountResponse); rpc AccountSetup(AccountSetupRequest) returns (AccountSetupResponse); rpc RegisterAccount(RegisterAccountRequest) returns (RegisterAccountResponse); rpc SignInAccount(SignInAccountRequest) returns (SignInAccountResponse); rpc ResolveAccountSession(ResolveAccountSessionRequest) returns (ResolveAccountSessionResponse); rpc SignOutAccount(SignOutAccountRequest) returns (SignOutAccountResponse); rpc ChangeAccountPassword(ChangeAccountPasswordRequest) returns (ChangeAccountPasswordResponse); // Personal API tokens act on the caller's own principal: the State Store // refuses a call that carries none. rpc AddPersonalToken(AddPersonalTokenRequest) returns (AddPersonalTokenResponse); rpc ListPersonalTokens(ListPersonalTokensRequest) returns (ListPersonalTokensResponse); rpc RevokePersonalToken(RevokePersonalTokenRequest) returns (RevokePersonalTokenResponse); } // PersonalToken identifies a token by the SHA-256 it binds as; the token // itself never reaches the State Store. message PersonalToken { string id = 1; google.protobuf.Timestamp created_at = 2; } message AddPersonalTokenRequest { string id = 1; } message AddPersonalTokenResponse {} message ListPersonalTokensRequest {} message ListPersonalTokensResponse { repeated PersonalToken tokens = 1; } message RevokePersonalTokenRequest { string id = 1; } message RevokePersonalTokenResponse {} message AccountSetupRequest {} message AccountSetupResponse { bool required = 1; } message RegisterAccountRequest { string email = 1; string display_name = 2; string password = 3; string role = 4; bool bootstrap = 5; string organisation_name = 6; string workspace_name = 7; string public_url = 8; } message RegisterAccountResponse { Identity identity = 1; } message SignInAccountRequest { string email = 1; string password = 2; } message SignInAccountResponse { Identity identity = 1; string token = 2; google.protobuf.Timestamp expires_at = 3; } message ResolveAccountSessionRequest { string token = 1; } message ResolveAccountSessionResponse { Identity identity = 1; } message SignOutAccountRequest { string token = 1; } message SignOutAccountResponse {} message ChangeAccountPasswordRequest { string current_password = 1; string new_password = 2; } message ChangeAccountPasswordResponse {} message AuthenticationSettings { string public_url = 1; string oidc_issuer = 2; string oidc_audience = 3; string oidc_client_id = 4; } message GetAuthenticationSettingsRequest {} message GetAuthenticationSettingsResponse { AuthenticationSettings settings = 1; } message SaveAuthenticationSettingsRequest { AuthenticationSettings settings = 1; } message SaveAuthenticationSettingsResponse {} message BeginPasskeyRequest { bool registration = 1; } message BeginPasskeyResponse { string token = 1; bytes options = 2; } message FinishPasskeyRequest { string token = 1; bytes credential = 2; bool registration = 3; string name = 4; } message FinishPasskeyResponse { Identity identity = 1; string token = 2; google.protobuf.Timestamp expires_at = 3; } message Passkey { string id = 1; string name = 2; } message ListPasskeysRequest {} message ListPasskeysResponse { repeated Passkey passkeys = 1; } message DeletePasskeyRequest { string id = 1; } message DeletePasskeyResponse {} message OpenAccountSessionRequest { google.protobuf.Timestamp expires_at = 1; } message OpenAccountSessionResponse { Identity identity = 1; string token = 2; google.protobuf.Timestamp expires_at = 3; } message RequireFreshAccountSessionRequest { string token = 1; } message RequireFreshAccountSessionResponse {} message CreateAccountRecoveryRequest {} message CreateAccountRecoveryResponse { string code = 1; } message RecoverAccountRequest { string email = 1; string code = 2; string password = 3; } message RecoverAccountResponse {}