{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "additionalProperties": false,
  "rpc": "exposesecret",
  "title": "Command for extracting the hsm_secret file for backup",
  "description": [
    "The **exposesecret** RPC command allows you to read the HSM secret, and does not work with encrypted hsm secrets.  It only operates if the `exposesecret-passphrase` has been set in the configuration."
  ],
  "request": {
    "required": [
      "passphrase"
    ],
    "properties": {
      "passphrase": {
        "type": "string",
        "description": [
          "The passphrase, which must match the `exposesecret-passphrase` configuration parameter."
        ]
      },
      "identifier": {
        "type": "string",
        "description": [
          "A four-character, valid lowercase bech32 string (not 1, i, o or b) to use in the resulting BIP-93 output.  If not specified, this is generated from the node alias."
        ]
      }
    }
  },
  "response": {
    "required": [
      "identifier",
      "codex32"
    ],
    "properties": {
      "identifier": {
        "type": "string",
        "description": [
          "The four-character identifier used in the codex32 output.  Redundant, but presented separately for clarity."
        ]
      },
      "codex32": {
        "type": "string",
        "description": [
          "The full codex32-encoded (i.e. BIP-93 encoded) HSM secret."
        ]
      },
      "mnemonic": {
        "type": "string",
        "added": "v25.12",
        "description": [
          "The BIP39 mnemonic phrase for the HSM secret (only present for mnemonic-based secrets)."
        ]
      }
    }
  },
  "author": [
    "Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
  ],
  "see_also": [
    "lightning-hsmtool(8)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:exposesecret#1",
        "method": "exposesecret",
        "params": {
          "passphrase": "test_exposesecret"
        }
      },
      "response": {
        "identifier": "luea",
        "codex32": "cl10lueasd35kw6r5de5kueedxyesqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqanvrktzhlhusz"
      }
    },
    {
      "request": {
        "id": "example:exposesecret#2",
        "method": "exposesecret",
        "params": [
          "test_exposesecret",
          "cln2"
        ]
      },
      "response": {
        "identifier": "cln2",
        "codex32": "cl10cln2sd35kw6r5de5kueedxyesqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqn9lcvcu7cez4s"
      }
    },
    {
      "request": {
        "id": "example:exposesecret#3",
        "method": "exposesecret",
        "params": {
          "passphrase": "test_exposesecret"
        }
      },
      "response": {
        "identifier": "peev",
        "codex32": "cl10peevst6cqh0wu7p5ssjyf4z4ez42ks9jlt3zneju9uuypr2hddak6tlqsjhsks4laxts8q",
        "mnemonic": "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
      }
    }
  ]
}
