Brijesh's Git Server — argus-core @ e91c2e6074eeaff5b3c104f750ad3ad3aac1cc6f

Logging service

rpc/apikeys/service.proto (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
syntax = "proto3";

package apikeys;
option go_package = "argus-core/rpc/apikeys";

// APIKeys service handles API key creation, listing, revocation, and deletion.
service APIKeysService {
  // CreateAPIKey creates a new API key for the authenticated user.
  rpc CreateAPIKey(CreateAPIKeyRequest) returns (CreateAPIKeyResponse);

  // ListAPIKeys lists all API keys for the authenticated user.
  rpc ListAPIKeys(ListAPIKeysRequest) returns (ListAPIKeysResponse);

  // RevokeAPIKey revokes an API key for the authenticated user.
  rpc RevokeAPIKey(RevokeAPIKeyRequest) returns (RevokeAPIKeyResponse);

  // DeleteAPIKey deletes an API key for the authenticated user.
  rpc DeleteAPIKey(DeleteAPIKeyRequest) returns (DeleteAPIKeyResponse);
}

// Request and Response messages
message CreateAPIKeyRequest {
  string name = 1;
  string expires_at = 2; // optional expiration date in RFC3339 format
}

message CreateAPIKeyResponse {
  APIKey api_key = 1;
  string key = 2; // the actual API key string
}

message ListAPIKeysRequest {}

message ListAPIKeysResponse {
  repeated APIKey api_keys = 1;
}

message RevokeAPIKeyRequest {
  string key_id = 1;
}

message RevokeAPIKeyResponse {}

message DeleteAPIKeyRequest {
  string key_id = 1;
}

message DeleteAPIKeyResponse {}

// Common messages
message APIKey {
  string id = 1;
  string user_id = 2;
  string name = 3;
  string created_at = 4;
  string last_used_at = 5;
  string expires_at = 6;
  bool is_active = 7;
}