lnsocket icon indicating copy to clipboard operation
lnsocket copied to clipboard

Static Key

Open lnbc1QWFyb24 opened this issue 3 years ago • 11 comments

Is it possible to have a static public key so that the remote node can limit the rune to that key? Or does a new key need to be created every time it is initialised with the gen_key method?

lnbc1QWFyb24 avatar Jul 09 '22 02:07 lnbc1QWFyb24

yes this will be easy to add and why there is a generate_key step. I planned on having a set_key function as well. I haven't had the need for it yet though which is why it doesn't exist.

jb55 avatar Jul 11 '22 16:07 jb55

Yeah the use case I am thinking is for a server to communicate to a core ln node. The idea I am playing with would be a simple API that can be deployed to run in front of your node at home. So it would be great to have a rune with full permissions, but limit it to the public key of the lnsocket.

lnbc1QWFyb24 avatar Jul 11 '22 22:07 lnbc1QWFyb24

On Mon, Jul 11, 2022 at 03:52:09PM -0700, Aaron Barnard wrote:

Yeah the use case I am thinking is for a server to communicate to a core ln node. The idea I am playing with would be a simple API that can be deployed to run in front of your node at home. So it would be great to have a rune with full permissions, but limit it to the public key of the lnsocket.

kk I'll add this soon

jb55 avatar Jul 12 '22 15:07 jb55

Legend thank you!

lnbc1QWFyb24 avatar Jul 13 '22 03:07 lnbc1QWFyb24

there is now an lnsocket_setkey in v0.3.2 for setting static keys. Let me know if you run into any issues!

jb55 avatar Jul 15 '22 20:07 jb55

js example here: https://github.com/jb55/lnsocket/blob/dead45a7a5220ae8b3b0833b2d553815452ccb6e/test/connection.js#L15-L20

jb55 avatar Jul 15 '22 20:07 jb55

hmm it might be good to have a method that gets the pubkey...

jb55 avatar Jul 15 '22 23:07 jb55

Awesome will give this a go.

lnbc1QWFyb24 avatar Jul 19 '22 00:07 lnbc1QWFyb24

Yeah a method that gets the pubkey would be super handy. Saves having to load tiny-secp256k1 in the browser to derive the pub key.

lnbc1QWFyb24 avatar Jul 22 '22 00:07 lnbc1QWFyb24

Or even a method to get the keypair after generating the key. That way you can use set key in a later session with the private key

lnbc1QWFyb24 avatar Jul 22 '22 00:07 lnbc1QWFyb24

yup it's definitely needed... will add in a bit

jb55 avatar Jul 22 '22 01:07 jb55