gRPC API Reference

The Secrets Agent exposes a gRPC service over Unix domain socket for the AI Core to manage secrets.

Service Definition

proto/secrets.proto protobuf
service SecretsService {
  rpc Health(Empty) returns (HealthResponse);
  rpc StoreSecret(StoreSecretRequest) returns (StoreSecretResponse);
  rpc RequestSecretAccess(AccessRequest) returns (stream AccessResponse);
  rpc RequestUserSecret(UserSecretRequest) returns (stream AccessResponse);
  rpc ListSecrets(ListSecretsRequest) returns (ListSecretsResponse);
  rpc DeleteSecret(DeleteSecretRequest) returns (DeleteSecretResponse);
  rpc GetAuditLog(AuditLogRequest) returns (stream AuditLogEntry);
}

Transport

PropertyValue
Socket path/run/ultrasushitron/secrets-agent.sock
ProtocolgRPC over Unix domain socket
SerializationProtocol Buffers (proto3)

Methods

Health()

Check if the secrets agent is running and healthy.

Response: HealthResponse protobuf
message HealthResponse {
  bool healthy = 1;
  string version = 2;
  uint64 uptime_seconds = 3;
}

StoreSecret(StoreSecretRequest)

Store a new secret in the encrypted vault.

Request protobuf
message StoreSecretRequest {
  string name = 1;
  string value = 2;           // Plaintext β€” encrypted at rest
  SecretType secret_type = 3;
  map<string, string> metadata = 4;
}
Response protobuf
message StoreSecretResponse {
  string secret_id = 1;
  bool success = 2;
  string error = 3;
}

RequestSecretAccess(AccessRequest)

Request access to a stored secret. Returns a server-side stream that progresses through: Pending β†’ Token (approved) or Denied.

Request protobuf
message AccessRequest {
  string secret_name = 1;
  string tool_name = 2;       // Which tool needs the secret
  string reason = 3;          // Context shown to the user
  AccessDuration duration = 4;
}
Stream Response protobuf
message AccessResponse {
  AccessStatus status = 1;    // PENDING, APPROVED, DENIED, EXPIRED
  string token = 2;           // One-time access token (on APPROVED)
  string error = 3;
}

Timeout: If the user does not respond within 5 minutes, the request is automatically denied.

Approval cascade:

  1. Send approval request via local WebSocket to the mobile app
  2. If local WebSocket unavailable, try relay server
  3. If no response path available, deny the request

RequestUserSecret(UserSecretRequest)

Request a secret that the user must provide on-the-fly (not stored in the vault). Used for one-time credentials.

Request protobuf
message UserSecretRequest {
  string prompt = 1;          // What to ask the user
  string tool_name = 2;
  string reason = 3;
}

ListSecrets(ListSecretsRequest)

List all secrets in the vault (metadata only, not values).

Response protobuf
message ListSecretsResponse {
  repeated SecretMetadata secrets = 1;
}

message SecretMetadata {
  string id = 1;
  string name = 2;
  SecretType secret_type = 3;
  int64 created_at = 4;
  int64 last_accessed = 5;
}

DeleteSecret(DeleteSecretRequest)

Permanently delete a secret from the vault.

Request / Response protobuf
message DeleteSecretRequest {
  string secret_id = 1;
}

message DeleteSecretResponse {
  bool success = 1;
  string error = 2;
}

GetAuditLog(AuditLogRequest)

Stream the hash-chained, Ed25519-signed audit log. Each entry includes the SHA-256 hash of the previous entry for tamper detection.

Stream Response protobuf
message AuditLogEntry {
  string entry_id = 1;
  string action = 2;          // STORE, ACCESS, APPROVE, DENY, DELETE
  string secret_name = 3;
  string actor = 4;           // Who performed the action
  int64 timestamp = 5;
  string previous_hash = 6;   // SHA-256 chain
  bytes signature = 7;        // Ed25519 signature
}

Enums

SecretType

ValueDescription
PASSWORDLogin credentials
API_KEYAPI keys and tokens
SSH_KEYSSH private keys
CREDIT_CARDPayment information
PERSONAL_INFOPII (names, addresses, etc.)
NOTEFreeform secure notes

AccessDuration

ValueDescription
ONE_TIMESingle use, then revoked
FIVE_MINUTES5-minute access window
ONE_HOUR1-hour access window
ONE_DAY24-hour access window
ONE_WEEK7-day access window
ONE_MONTH30-day access window
ONE_YEAR365-day access window

Error Handling

gRPC status codes are used for transport errors. Application-level errors are returned in the error field of response messages:

  • NOT_FOUND β€” secret does not exist
  • ALREADY_EXISTS β€” secret name already taken
  • PERMISSION_DENIED β€” access denied by user or timeout
  • INTERNAL β€” vault encryption/decryption error