perlin-network / noise

A decentralized P2P networking stack written in Go.
https://godoc.org/github.com/perlin-network/noise
MIT License
1.78k stars 213 forks source link

Authentication example #275

Open bgokden opened 4 years ago

bgokden commented 4 years ago

Hello, I am looking for an example where two nodes authenticate with a pre-shared key. Is it possible or should I add a new extension?

iwasaki-kenta commented 4 years ago

It is not possible just yet to authenticate with a pre-shared key, though exposing the option to provide a pre-shared key should be straightforward. It would involve modifying the handshake function in client.go.

However, I currently am busy right now with other projects, unfortunately. I will only be able to integrate in this option around next week. However, if you need it and able are to tackle it now, I would appreciate a PR! Happy to help out should that be the case too :).

haukened commented 4 years ago

any update on this? we're starting a project with Noise and just identified a need for this today, to prevent a "poisoned peer" situation where anyone running the noise protocol could attempt to talk to your peer network.

bgokden commented 4 years ago

@haukened I actually don't have a working solution for this. I have thought of two solutions. The first one was editing the first message exchange. The second one was adding a new protocol that looked nicer solution, but I couldn't finish it and I am not working on it anymore.

haukened commented 4 years ago

Thanks for the update bgkoden. i think adding a protocol might be what i need here! I'll likely extend gossip to have a PSK field.

danthegoodman1 commented 3 years ago

@haukened What did you end up doing? I am working on something with a similar need.