core-lightning/doc/schemas/lightning-checkmessage.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

108 lines
3.2 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "checkmessage",
"title": "Command to check if a signature is from a node",
"description": [
"The **checkmessage** RPC command is the counterpart to **signmessage**: given a node id (*pubkey*), signature (*zbase*) and a *message*, it verifies that the signature was generated by that node for that message (more technically: by someone who knows that node's secret).",
"",
"As a special case, if *pubkey* is not specified, we will try every known node key (as per *listnodes*), and verification succeeds if it matches for any one of them. Note: this is implemented far more efficiently than trying each one, so performance is not a concern."
],
"request": {
"required": [
"message",
"zbase"
],
"additionalProperties": false,
"properties": {
"message": {
"type": "string",
"description": [
"Message to be checked against the signature."
]
},
"zbase": {
"type": "string",
"description": [
"The Zbase32 encoded signature to verify."
]
},
"pubkey": {
"type": "pubkey",
"description": [
"The Zbase32 encoded signature to verify."
]
}
}
},
"response": {
"required": [
"verified",
"pubkey"
],
"additionalProperties": false,
"properties": {
"verified": {
"type": "boolean",
"enum": [
true
],
"description": [
"Whether the signature was valid."
]
},
"pubkey": {
"type": "pubkey",
"description": [
"The *pubkey* parameter, or the pubkey found by looking for known nodes."
]
}
}
},
"errors": [
"On failure, an error is returned and core lightning exit with the following error code:",
"",
"- -32602: Parameter missed or malformed;",
"- 1301: *pubkey* not found in the graph."
],
"author": [
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
],
"see_also": [
"lightning-signmessage(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:checkmessage#1",
"method": "checkmessage",
"params": {
"message": "testcase to check new rpc error",
"zbase": "d66bqz3qsku5fxtqsi37j11pci47ydxa95iusphutggz9ezaxt56neh77kxe5hyr41kwgkncgiu94p9ecxiexgpgsz8daoq4tw8kj8yx",
"pubkey": "03be3b0e9992153b1d5a6e1623670b6c3663f72ce6cf2e0dd39c0a373a7de5a3b7"
}
},
"response": {
"pubkey": "03be3b0e9992153b1d5a6e1623670b6c3663f72ce6cf2e0dd39c0a373a7de5a3b7",
"verified": true
}
},
{
"request": {
"id": "example:checkmessage#2",
"method": "checkmessage",
"params": {
"message": "this is a test!",
"zbase": "d6tqaeuonjhi98mmont9m4wag7gg4krg1f4txonug3h31e9h6p6k6nbwjondnj46dkyausobstnk7fhyy998bhgc1yr98dfmhb4k54d7"
}
},
"response": {
"pubkey": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
"verified": true
}
}
]
}