305 lines
8.6 KiB
JSON
305 lines
8.6 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"title": "ACLDB API",
|
|
"description": "API for the ACLDB module which implements an Access Control List layer on top of the existing ourdb and tst databases.",
|
|
"version": "1.0.0"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "http://localhost:8080",
|
|
"description": "Local development server"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/rpc": {
|
|
"post": {
|
|
"summary": "RPC endpoint",
|
|
"description": "Handles all RPC requests to the ACLDB system",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/RpcRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/RpcResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/health": {
|
|
"get": {
|
|
"summary": "Health check",
|
|
"description": "Returns the health status of the server",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Server is healthy",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"status": {
|
|
"type": "string",
|
|
"example": "ok"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"RpcRequest": {
|
|
"type": "object",
|
|
"required": ["method", "params", "signature"],
|
|
"properties": {
|
|
"method": {
|
|
"type": "string",
|
|
"description": "The name of the method to call",
|
|
"example": "set"
|
|
},
|
|
"params": {
|
|
"type": "object",
|
|
"description": "The parameters for the method"
|
|
},
|
|
"signature": {
|
|
"type": "string",
|
|
"description": "Cryptographic signature of the request"
|
|
}
|
|
}
|
|
},
|
|
"RpcResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"result": {
|
|
"type": "object",
|
|
"description": "The result of the method call if successful"
|
|
},
|
|
"error": {
|
|
"type": "string",
|
|
"description": "Error message if the method call failed"
|
|
}
|
|
}
|
|
},
|
|
"ErrorResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"error": {
|
|
"type": "string",
|
|
"description": "Error message"
|
|
}
|
|
}
|
|
},
|
|
"AclUpdateParams": {
|
|
"type": "object",
|
|
"required": ["caller_pubkey", "circle_id", "name", "pubkeys", "right"],
|
|
"properties": {
|
|
"caller_pubkey": {
|
|
"type": "string",
|
|
"description": "Public key of the requesting user"
|
|
},
|
|
"circle_id": {
|
|
"type": "string",
|
|
"description": "ID of the circle where the ACL exists"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Unique name for the ACL within the circle"
|
|
},
|
|
"pubkeys": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"description": "Array of public keys to grant permissions to"
|
|
},
|
|
"right": {
|
|
"type": "string",
|
|
"description": "Permission level (read/write/delete/execute/admin)",
|
|
"enum": ["read", "write", "delete", "execute", "admin"]
|
|
}
|
|
}
|
|
},
|
|
"AclRemoveParams": {
|
|
"type": "object",
|
|
"required": ["caller_pubkey", "circle_id", "name", "pubkeys"],
|
|
"properties": {
|
|
"caller_pubkey": {
|
|
"type": "string",
|
|
"description": "Public key of the requesting user"
|
|
},
|
|
"circle_id": {
|
|
"type": "string",
|
|
"description": "ID of the circle where the ACL exists"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Name of the ACL to modify"
|
|
},
|
|
"pubkeys": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"description": "Array of public keys to remove from the ACL"
|
|
}
|
|
}
|
|
},
|
|
"AclDelParams": {
|
|
"type": "object",
|
|
"required": ["caller_pubkey", "circle_id", "name"],
|
|
"properties": {
|
|
"caller_pubkey": {
|
|
"type": "string",
|
|
"description": "Public key of the requesting user"
|
|
},
|
|
"circle_id": {
|
|
"type": "string",
|
|
"description": "ID of the circle where the ACL exists"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Name of the ACL to delete"
|
|
}
|
|
}
|
|
},
|
|
"SetParams": {
|
|
"type": "object",
|
|
"required": ["caller_pubkey", "circle_id", "topic", "value"],
|
|
"properties": {
|
|
"caller_pubkey": {
|
|
"type": "string",
|
|
"description": "Public key of the requesting user"
|
|
},
|
|
"circle_id": {
|
|
"type": "string",
|
|
"description": "ID of the circle where the data belongs"
|
|
},
|
|
"topic": {
|
|
"type": "string",
|
|
"description": "String identifier for the database category"
|
|
},
|
|
"key": {
|
|
"type": "string",
|
|
"description": "Optional string key for the record"
|
|
},
|
|
"id": {
|
|
"type": "integer",
|
|
"description": "Optional numeric ID for direct access"
|
|
},
|
|
"value": {
|
|
"type": "string",
|
|
"description": "Base64-encoded data to store"
|
|
},
|
|
"acl_id": {
|
|
"type": "integer",
|
|
"description": "ID of the ACL to protect this record (0 for public access)"
|
|
}
|
|
}
|
|
},
|
|
"DelParams": {
|
|
"type": "object",
|
|
"required": ["caller_pubkey", "circle_id", "topic"],
|
|
"properties": {
|
|
"caller_pubkey": {
|
|
"type": "string",
|
|
"description": "Public key of the requesting user"
|
|
},
|
|
"circle_id": {
|
|
"type": "string",
|
|
"description": "ID of the circle where the data belongs"
|
|
},
|
|
"topic": {
|
|
"type": "string",
|
|
"description": "String identifier for the database category"
|
|
},
|
|
"key": {
|
|
"type": "string",
|
|
"description": "Optional string key for the record"
|
|
},
|
|
"id": {
|
|
"type": "integer",
|
|
"description": "Optional numeric ID for direct access"
|
|
}
|
|
}
|
|
},
|
|
"GetParams": {
|
|
"type": "object",
|
|
"required": ["caller_pubkey", "circle_id", "topic"],
|
|
"properties": {
|
|
"caller_pubkey": {
|
|
"type": "string",
|
|
"description": "Public key of the requesting user"
|
|
},
|
|
"circle_id": {
|
|
"type": "string",
|
|
"description": "ID of the circle where the data belongs"
|
|
},
|
|
"topic": {
|
|
"type": "string",
|
|
"description": "String identifier for the database category"
|
|
},
|
|
"key": {
|
|
"type": "string",
|
|
"description": "Optional string key for the record"
|
|
},
|
|
"id": {
|
|
"type": "integer",
|
|
"description": "Optional numeric ID for direct access"
|
|
}
|
|
}
|
|
},
|
|
"PrefixParams": {
|
|
"type": "object",
|
|
"required": ["caller_pubkey", "circle_id", "topic", "prefix"],
|
|
"properties": {
|
|
"caller_pubkey": {
|
|
"type": "string",
|
|
"description": "Public key of the requesting user"
|
|
},
|
|
"circle_id": {
|
|
"type": "string",
|
|
"description": "ID of the circle where the data belongs"
|
|
},
|
|
"topic": {
|
|
"type": "string",
|
|
"description": "String identifier for the database category"
|
|
},
|
|
"prefix": {
|
|
"type": "string",
|
|
"description": "Prefix to search for"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|