user1026: lightning-cli getinfo outputs my node's id, which is its public key. How can I get its underlying private key?

user1026: c-lightning uses this code to obtain the node's private key from the hsm_secret.
I've came up with a way to do the same using Python and posted my highly-commented tutorial-like code in this gist.
Basically you have to call an hkdf function with the hsm_secret contents, a salt which will usually be zero, \x00, and the label "nodeid".

1026: <p><code>lightning-cli getinfo</code> outputs my node's id, which is its public key. How can I get its underlying private key?</p>
 1026: <p>c-lightning uses <a href="https://github.com/ElementsProject/lightning/blob/bad0ac6ed615107e129458f0d40915847bdddd08/hsmd/hsmd.c#L300-L304" rel="nofollow noreferrer">this code</a> to obtain the node's private key from the <code>hsm_secret</code>.</p>

<p>I've came up with a way to do the same using Python and posted my highly-commented tutorial-like code in <a href="https://gist.github.com/fiatjaf/e3232bef6d59263b439b97b6d04d1bcc" rel="nofollow noreferrer">this gist</a>.</p>

<p>Basically you have to call an <a href="https://en.wikipedia.org/wiki/HKDF" rel="nofollow noreferrer"><code>hkdf</code></a> function with the <code>hsm_secret</code> contents, a salt which will usually be zero, <code>\x00</code>, and the label <code>"nodeid"</code>.</p>
