diff --git a/doc/Makefile b/doc/Makefile index e3b8b4754..f9375b406 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -24,6 +24,7 @@ MANPAGES := doc/lightning-cli.1 \ doc/lightning-delpay.7 \ doc/lightning-disableoffer.7 \ doc/lightning-disconnect.7 \ + doc/lightning-emergencyrecover.7 \ doc/lightning-feerates.7 \ doc/lightning-fetchinvoice.7 \ doc/lightning-fundchannel.7 \ @@ -46,6 +47,7 @@ MANPAGES := doc/lightning-cli.1 \ doc/lightning-listpays.7 \ doc/lightning-listpeers.7 \ doc/lightning-listsendpays.7 \ + doc/lightning-makesecret.7 \ doc/lightning-multifundchannel.7 \ doc/lightning-multiwithdraw.7 \ doc/lightning-newaddr.7 \ @@ -60,6 +62,7 @@ MANPAGES := doc/lightning-cli.1 \ doc/lightning-pay.7 \ doc/lightning-parsefeerate.7 \ doc/lightning-plugin.7 \ + doc/lightning-recoverchannel.7 \ doc/lightning-reserveinputs.7 \ doc/lightning-sendinvoice.7 \ doc/lightning-sendonion.7 \ @@ -69,6 +72,7 @@ MANPAGES := doc/lightning-cli.1 \ doc/lightning-setchannelfee.7 \ doc/lightning-sendcustommsg.7 \ doc/lightning-signmessage.7 \ + doc/lightning-staticbackup.7 \ doc/lightning-txprepare.7 \ doc/lightning-txdiscard.7 \ doc/lightning-txsend.7 \ diff --git a/doc/index.rst b/doc/index.rst index abf699ff8..3d92e23ac 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -47,6 +47,7 @@ Core Lightning Documentation lightning-delpay lightning-disableoffer lightning-disconnect + lightning-emergencyrecover lightning-feerates lightning-fetchinvoice lightning-fundchannel @@ -75,6 +76,7 @@ Core Lightning Documentation lightning-listpeers lightning-listsendpays lightning-listtransactions + lightning-makesecret lightning-multifundchannel lightning-multiwithdraw lightning-newaddr @@ -90,6 +92,7 @@ Core Lightning Documentation lightning-pay lightning-ping lightning-plugin + lightning-recoverchannel lightning-reserveinputs lightning-sendcustommsg lightning-sendinvoice @@ -101,6 +104,7 @@ Core Lightning Documentation lightning-setchannelfee lightning-signmessage lightning-signpsbt + lightning-staticbackup lightning-stop lightning-txdiscard lightning-txprepare diff --git a/doc/lightning-emergencyrecover.7.md b/doc/lightning-emergencyrecover.7.md new file mode 100644 index 000000000..29e582e11 --- /dev/null +++ b/doc/lightning-emergencyrecover.7.md @@ -0,0 +1,43 @@ +lightning-emergencyrecover -- Command for recovering channels from the emergency.recovery file in the lightning directory +========================================================================================================================= + +SYNOPSIS +-------- + +**emergencyrecover** + +DESCRIPTION +----------- + +The **emergencyrecover** RPC command fetches data from the emergency.recover +file and tries to reconnect to the peer and force him to close the channel. +The data in this file has enough information to reconnect and sweep the funds. + +This recovery method is not spontaneous and it depends on the peer, so it should +be used as a last resort to recover the funds stored in a channel in case of severe +data loss. + +RETURN VALUE +------------ + +On success, an object is returned, containing: +- **stubs** (array of hexs): + - Each item is the channel ID of the channel successfully inserted + + +AUTHOR +------ + +Aditya <> is mainly responsible. + +SEE ALSO +-------- + +lightning-getsharedsecret(7) + +RESOURCES +--------- + +Main web site: + +[comment]: # ( SHA256STAMP:9cfaa9eb4609b36accc3e3b12a352c00ddd402307e4461f4df274146d12f6eb0) \ No newline at end of file diff --git a/doc/lightning-makesecret.7.md b/doc/lightning-makesecret.7.md new file mode 100644 index 000000000..2fdbf9755 --- /dev/null +++ b/doc/lightning-makesecret.7.md @@ -0,0 +1,44 @@ +lightning-makesecret -- Command for deriving pseudorandom key from HSM +===================================================================== + +SYNOPSIS +-------- + +**makesecret** *info_hex* + +DESCRIPTION +----------- + +The **makesecret** RPC command derives a secret key from the HSM_secret. + +The *info_hex* can be any hex data. + +RETURN VALUE +------------ + +[comment]: # (GENERATE-FROM-SCHEMA-START) +On success, an object is returned, containing: +- **secret** (secret): the pseudorandom key derived from HSM_secret (always 64 characters) + +[comment]: # (GENERATE-FROM-SCHEMA-END) + + +The following error codes may occur: +- -1: Catchall nonspecific error. + +AUTHOR +------ + +Aditya <> is mainly responsible. + +SEE ALSO +-------- + +lightning-getsharedsecret(7) + +RESOURCES +--------- + +Main web site: + +[comment]: # ( SHA256STAMP:1bd94ffa8440041efafe93440d9828be6baca199b0f5cb73220e4482582bf01d) diff --git a/doc/lightning-recoverchannel.7.md b/doc/lightning-recoverchannel.7.md new file mode 100644 index 000000000..c1d2e32da --- /dev/null +++ b/doc/lightning-recoverchannel.7.md @@ -0,0 +1,45 @@ +lightning-recoverchannel -- Command for recovering channels bundeled in an array in the form of *Static Backup* +=============================================================================================================== + +SYNOPSIS +-------- + +**recoverchannel** *scb* + +DESCRIPTION +----------- + +The **recoverchannel** RPC command tries to force the peer (with whom you +already had a channel) to close the channel and sweeps on-chain fund. This +method is not spontaneous and depends on the peer, so use it in case of +severe data loss. + +The *scb* parameter is an array containing minimum required info to +reconnect and sweep funds. You can get the scb for already stored channels +by using the RPC command 'staticbackup' + + +RETURN VALUE +------------ + +On success, an object is returned, containing: +- **stubs** (array of hexs): + - Each item is the channel ID of the channel successfully inserted + + +AUTHOR +------ + +Aditya <> is mainly responsible. + +SEE ALSO +-------- + +lightning-getsharedsecret(7) + +RESOURCES +--------- + +Main web site: + +[comment]: # ( SHA256STAMP:9cfaa9eb4609b36accc3e3b12a352c00ddd402307e4461f4df274146d12f6eb0) \ No newline at end of file diff --git a/doc/lightning-staticbackup.7.md b/doc/lightning-staticbackup.7.md new file mode 100644 index 000000000..8cb5bfa1c --- /dev/null +++ b/doc/lightning-staticbackup.7.md @@ -0,0 +1,38 @@ +lightning-staticbacup -- Command for deriving getting SCB of all the existing channels +====================================================================================== + +SYNOPSIS +-------- + +**staticbackup** + +DESCRIPTION +----------- + +The **staticbackup** RPC command returns an object with SCB of all the channels in an array. + + +RETURN VALUE +------------ + +On success, an object is returned, containing: +- **scb** (array of hexs): + - Each item is SCB of a channel in TLV format + + +AUTHOR +------ + +Aditya <> is mainly responsible. + +SEE ALSO +-------- + +lightning-getsharedsecret(7) + +RESOURCES +--------- + +Main web site: + +[comment]: # ( SHA256STAMP:9cfaa9eb4609b36accc3e3b12a352c00ddd402307e4461f4df274146d12f6eb0) diff --git a/doc/schemas/emergencyrecover.request.json b/doc/schemas/emergencyrecover.request.json new file mode 100644 index 000000000..f99496c5a --- /dev/null +++ b/doc/schemas/emergencyrecover.request.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [], + "additionalProperties": false, + "properties": {} +} diff --git a/doc/schemas/emergencyrecover.schema.json b/doc/schemas/emergencyrecover.schema.json new file mode 100644 index 000000000..127dfbc6b --- /dev/null +++ b/doc/schemas/emergencyrecover.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "required": [ + "stubs" + ], + "properties": { + "stubs": { + "type": "array", + "items": { + "type": "string", + "description": "Channel IDs of channels successfully inserted." + } + } + } +} diff --git a/doc/schemas/makesecret.request.json b/doc/schemas/makesecret.request.json new file mode 100644 index 000000000..a43ac493e --- /dev/null +++ b/doc/schemas/makesecret.request.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "required": [ + "info_hex" + ], + "properties": { + "info": { + "type": "hex", + "description": "This will be used for deriving the secret" + } + } +} diff --git a/doc/schemas/makesecret.schema.json b/doc/schemas/makesecret.schema.json new file mode 100644 index 000000000..ce17c2fcb --- /dev/null +++ b/doc/schemas/makesecret.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "required": [ + "secret" + ], + "properties": { + "secret": { + "type": "secret", + "description": "the pseudorandom key derived from HSM_secret", + "maxLength": 64, + "minLength": 64 + } + } +} diff --git a/doc/schemas/recoverchannel.request.json b/doc/schemas/recoverchannel.request.json new file mode 100644 index 000000000..ea6701bc2 --- /dev/null +++ b/doc/schemas/recoverchannel.request.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "required": [ + "scb" + ], + "scb": { + "type": "array", + "description": "SCB of the channels in an array", + "items": { + "type": "hexstr" + } + } +} diff --git a/doc/schemas/recoverchannel.schema.json b/doc/schemas/recoverchannel.schema.json new file mode 100644 index 000000000..127dfbc6b --- /dev/null +++ b/doc/schemas/recoverchannel.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "required": [ + "stubs" + ], + "properties": { + "stubs": { + "type": "array", + "items": { + "type": "string", + "description": "Channel IDs of channels successfully inserted." + } + } + } +} diff --git a/doc/schemas/staticbackup.request.json b/doc/schemas/staticbackup.request.json new file mode 100644 index 000000000..f99496c5a --- /dev/null +++ b/doc/schemas/staticbackup.request.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [], + "additionalProperties": false, + "properties": {} +} diff --git a/doc/schemas/staticbackup.schema.json b/doc/schemas/staticbackup.schema.json new file mode 100644 index 000000000..73b7009e7 --- /dev/null +++ b/doc/schemas/staticbackup.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "required": [ + "scb" + ], + "properties": { + "scb": { + "type": "array", + "items": { + "type": "string", + "description": "SCB of a channel in TLV format" + } + } + } +} diff --git a/tools/fromschema.py b/tools/fromschema.py index 350736f05..a8708c5fe 100755 --- a/tools/fromschema.py +++ b/tools/fromschema.py @@ -127,6 +127,17 @@ def output_members(sub, indent=''): # Remove deprecated and stub properties, collect warnings # (Stubs required to keep additionalProperties: false happy) + + # FIXME: It fails for schemas which have only an array type with + # no properties, ex: + # "abcd": { + # "type": "array", + # "items": { + # "type": "whatever", + # "description": "efgh" + # } + # } + # Checkout the schema of `staticbackup`. for p in list(sub['properties'].keys()): if len(sub['properties'][p]) == 0 or 'deprecated' in sub['properties'][p]: del sub['properties'][p]