...
This commit is contained in:
304
acldb/static/openapi.json
Normal file
304
acldb/static/openapi.json
Normal file
@@ -0,0 +1,304 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
54
acldb/static/swagger-ui.html
Normal file
54
acldb/static/swagger-ui.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ACLDB API Documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui.css" />
|
||||
<link rel="icon" type="image/png" href="https://unpkg.com/swagger-ui-dist@4.5.0/favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="https://unpkg.com/swagger-ui-dist@4.5.0/favicon-16x16.png" sizes="16x16" />
|
||||
<style>
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script src="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui-bundle.js"></script>
|
||||
<script src="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui-standalone-preset.js"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "/openapi.json",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout"
|
||||
});
|
||||
|
||||
window.ui = ui;
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user