core-lightning/doc/schemas/lightning-checkrune.json
Rusty Russell b327bd30c3 doc: fix all JSON schemas to enforce no additional properties.
Without this, we have hardly any enforcement.  This is why the schema
mistake fixed in the previous patches weren't spotted immediately.

The hard work was done by:

```
$ for f in lightning-*.json; do grep -v '^  "additionalProperties": false,' $f | bagto $f; done
$ for f in lightning-*.json; do sed 's/"properties": {/"additionalProperties": false, "properties": {/' $f | bagto $f; done
$ make fmt-schemas
```

Then checking where 'additionalProperties: true' had been turned to
false (we deliberately use it in some places where there are if
statements in the schema, or occasionally where there can be arbitrary
fields).

[Including doc/rpc-schema-draft.json update by Shahana]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-30 15:39:12 +10:30

122 lines
3.2 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"added": "v23.08",
"rpc": "checkrune",
"title": "Command to Validate Rune",
"description": [
"The **checkrune** RPC command checks the validity/authorization rights of specified rune for the given nodeid, method, and params.",
"",
"If successful, the rune \"usage\" counter (used for ratelimiting) is incremented.",
"",
"See lightning-createrune(7) for the fields in the rune which are checked."
],
"request": {
"required": [
"rune"
],
"additionalProperties": false,
"properties": {
"rune": {
"type": "string",
"description": [
"Rune to check for authorization."
]
},
"nodeid": {
"type": "string",
"description": [
"Node id of requesting node *(required until v23.11)*."
]
},
"method": {
"type": "string",
"description": [
"Method for which rune needs to be validated *(required until v23.11)*."
]
},
"params": {
"oneOf": [
{
"type": "array",
"description": [
"Array of positional parameters."
]
},
{
"type": "object",
"description": [
"Parameters for method."
]
}
]
}
}
},
"response": {
"required": [
"valid"
],
"additionalProperties": false,
"properties": {
"valid": {
"type": "boolean",
"description": [
"True if the rune is valid."
]
}
}
},
"errors": [
"The following error codes may occur:",
"",
"- 1501 (RUNE_NOT_AUTHORIZED): rune is not for this node (or perhaps completely invalid)",
"- 1502 (RUNE_NOT_PERMITTED): rune does not allow this usage (includes a detailed reason why)",
"- 1503 (RUNE_BLACKLISTED): rune has been explicitly blacklisted."
],
"author": [
"Shahana Farooqui <<sfarooqui@blockstream.com>> is mainly responsible for consolidating logic from commando."
],
"see_also": [
"lightning-createrune(7)",
"lightning-blacklistrune(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:checkrune#1",
"method": "checkrune",
"params": {
"nodeid": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
"rune": "_RWaZZRI7wAYU2hqlFBmYgC_dFczcpAdI_9O87YbDpg9MCZtZXRob2RebGlzdHxtZXRob2ReZ2V0fG1ldGhvZD1zdW1tYXJ5Jm1ldGhvZC9saXN0ZGF0YXN0b3Jl",
"method": "listpeers",
"params": {}
}
},
"response": {
"valid": true
}
},
{
"request": {
"id": "example:checkrune#2",
"method": "checkrune",
"params": {
"nodeid": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
"rune": "QUJEYMLGgiaJvMDv_MhR2hiMKIBTbq-PrL-KxcIlirQ9MiZtZXRob2Q9cGF5JnBuYW1lYW1vdW50bXNhdDwxMDAwMA==",
"method": "pay",
"params": {
"amount_msat": 9999
}
}
},
"response": {
"valid": true
}
}
]
}