circles/docs/openrpc.json
2025-06-19 05:17:14 +03:00

126 lines
3.2 KiB
JSON

{
"openrpc": "1.2.6",
"info": {
"title": "Circles RPC",
"description": "A JSON-RPC API for interacting with a Circle, allowing script execution and authentication.",
"version": "1.0.0"
},
"methods": [
{
"name": "fetch_nonce",
"summary": "Fetches a cryptographic nonce for a given public key.",
"params": [
{
"name": "pubkey",
"description": "The client's public key.",
"required": true,
"schema": {
"type": "string"
}
}
],
"result": {
"name": "nonce_response",
"description": "The cryptographic nonce to be signed.",
"schema": {
"$ref": "#/components/schemas/NonceResponse"
}
}
},
{
"name": "authenticate",
"summary": "Authenticates the client using a signed nonce.",
"params": [
{
"name": "credentials",
"description": "The authentication credentials, including the public key and the signed nonce.",
"required": true,
"schema": {
"$ref": "#/components/schemas/AuthCredentials"
}
}
],
"result": {
"name": "authentication_status",
"description": "The result of the authentication attempt.",
"schema": {
"type": "object",
"properties": {
"authenticated": {
"type": "boolean"
}
},
"required": ["authenticated"]
}
},
"errors": [
{
"code": -32002,
"message": "Invalid Credentials",
"description": "The provided credentials were not valid."
}
]
},
{
"name": "play",
"summary": "Executes a Rhai script and returns the result.",
"params": [
{
"name": "script",
"description": "The Rhai script to execute.",
"required": true,
"schema": {
"type": "string"
}
}
],
"result": {
"name": "play_result",
"description": "The output of the executed script.",
"schema": {
"type": "string"
}
},
"errors": [
{
"code": -32000,
"message": "Execution Error",
"description": "The script failed to execute."
},
{
"code": -32001,
"message": "Authentication Required",
"description": "The client must be authenticated to use this method."
}
]
}
],
"components": {
"schemas": {
"AuthCredentials": {
"type": "object",
"properties": {
"pubkey": {
"type": "string",
"description": "The public key of the client."
},
"signature": {
"type": "string",
"description": "The nonce signed with the client's private key."
}
},
"required": ["pubkey", "signature"]
},
"NonceResponse": {
"type": "object",
"properties": {
"nonce": {
"type": "string",
"description": "The single-use cryptographic nonce."
}
},
"required": ["nonce"]
}
}
}
}