Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

35/WAKU2-NOISE 37/WAKU2-NOISE-SESSIONS 43/WAKU2-NOISE-PAIRING #950

Open
2 of 4 tasks
fryorcraken opened this issue Sep 12, 2022 · 16 comments
Open
2 of 4 tasks

35/WAKU2-NOISE 37/WAKU2-NOISE-SESSIONS 43/WAKU2-NOISE-PAIRING #950

fryorcraken opened this issue Sep 12, 2022 · 16 comments
Assignees
Labels
enhancement New feature or request track:conversational-security Conversational security track (Secure Messaging)

Comments

@fryorcraken
Copy link
Collaborator

fryorcraken commented Sep 12, 2022

This is a bug report/feature or change request/support request

Problem

There are no documented or proposed way to create a secure session between two nodes.

Proposed Solutions

Implement vacp2p/rfc#531

Acceptance Criteria

Notes

This needs support for https://rfc.vac.dev/spec/35/ and https://rfc.vac.dev/spec/37/
Implementation of these two specs should be planned and track in this issue.

Noise pairing needs a handshake before a Decoder and Encoder can be generated to send and receive messages over the encrypted channel.

Most likely, the API would look like that:

  1. Construct noise pairing object, pass WakuRelay or WakuFilter+ WakuLightPush objects
  2. initiate pairing, passed objects are used to send and receive messages
  3. get a Decoder and Encoder from the noise pairing object

For (1), we are likely to wait to define a Sender and Receiver interfaces so that the noise pairing oblivious to the waku protocol used to send and receive messages.

We could also have a fallback strategy for the pairing by using WakuStore if passed and if a timeout is reached.
In this case, #964 could be handy as the store retrieval could be done from the last handshake message received or sent.

@fryorcraken fryorcraken added enhancement New feature or request track:conversational-security Conversational security track (Secure Messaging) labels Sep 12, 2022
@fryorcraken
Copy link
Collaborator Author

@s1fr0 if we want to do an example with nwaku, to create a session channel between js-waku and nwaku, how would it look like? I guess we would need to build a small binary that enables 1:1 chats?

@s1fr0
Copy link

s1fr0 commented Oct 27, 2022

Of course we can have a separate binary, but we can also enrich current nwaku/js chat2 client with a /start-handshake <content-topic> command (not sure if this can apply to js as well). In fact, as a starting PoC we might do the full key-exchange by sending the necessary crypto information as normal chat messages (i.e. the full WakuMessage payload corresponding to the Payload V2 as hex string). Then is a matter of exchanging messages and complete the handshake. Is something like this that did you mean?

@fryorcraken
Copy link
Collaborator Author

fryorcraken commented Oct 28, 2022

The way I see it would be:

Browser<>Browser:

  1. https://examples.waku.org/pairing-js shows a QR code. data is URL A https://examples.waku.org/pairing-js?<necessary crypto information>
  2. User opens https://examples.waku.org/pairing-js on desktop browser
  3. User scans QR code from mobile open URL A
  4. js-waku in user's mobile browser starts handshake session with user's desktop browser
  5. handshake done, user can exchange encrypted chat messages between both devices

Browser<>go-waku/nwaku

  1. https://examples.waku.org/pairing-js shows a <necessary crypto information> in some easy copy-pastable format (single line string)
  2. User opens https://examples.waku.org/pairing-js on desktop browser, copies <necessary crypto information>
  3. User opens chat2 (or other binary) and pass the <necessary crypto information>
  4. chat2 does device pairing with user's desktop browser
  5. handshake done, user can exchange encrypted chat messages between both devices

So yes, chat2 could work but I MO it should be a private message only mode that expect <necessary crypto information> on the command line.

@richard-ramos
Copy link
Member

Code for browser <> browser pairing is available at: https://github.com/waku-org/js-noise

The following actions are still pending:

  1. Instead of connecting to a hardcoded node, to just connect to the prod fleet instead
  2. Add minimal chat example like the one on js-rln.
  3. Move the example to js-waku-examples
  4. We are currently exporting everything in index.js. It probably makes sense to create separate exports.
  5. Add docs to functions

@fryorcraken
Copy link
Collaborator Author

We are currently exporting everything in index.js. It probably makes sense to create separate exports.

do note it's usually easier to use if the user can important everything from @waku/noise. I did use several items in js-waku exports map but moved away from it for simplicity.

@richard-ramos
Copy link
Member

In this PR waku-org/js-noise#11 the following items were implemented:

  1. Example connects to the test fleet
  2. Add minimal chat example like the one on js-rln.

I'll follow your suggestion of having everything imported from index.js, so IMO the only things pending are adding documentation to the functions/readme, and moving the example to js-waku-examples. (Of course, PRs to improve code org / style / logic are always welcome :) )

@richard-ramos
Copy link
Member

I'm currently attempting to implement a js-waku <> go-waku example as I have created a pairing object with similar functionality to js-noise in go-waku

@fryorcraken
Copy link
Collaborator Author

fryorcraken commented Jan 31, 2023

Todo:

The waku socket PoC can be tacked in the existing issue.

@fryorcraken
Copy link
Collaborator Author

@weboko can we track the improvement of the existing noise API to replace the sender and responder API with more generic waku interfaces ISender and IReceiver implemented by light push, relay and filter.

@weboko
Copy link
Collaborator

weboko commented Feb 1, 2023

@weboko can we track the improvement of the existing noise API to replace the sender and responder API with more generic waku interfaces ISender and IReceiver implemented by light push, relay and filter.

I made this issue to track it waku-org/js-noise#14

@fryorcraken
Copy link
Collaborator Author

@richard-ramos what is the state of the go-waku example?

@richard-ramos
Copy link
Member

richard-ramos commented Feb 20, 2023

Go-waku's example is complete and pointing to https://examples.waku.org/

@fryorcraken
Copy link
Collaborator Author

fryorcraken commented Feb 22, 2023

Go-waku's example is complete and pointing to examples.waku.org

Can't compile unfortunately (with v0.5.0): works on master

▶ make
go build -o build/noise .
# noise
./chat2.pb.go:26:17: undefined: proto.ProtoPackageIsVersion4
./main.go:39:28: cannot use context.Background() (value of type context.Context) as type node.WakuNodeOption in argument to node.New
./main.go:49:12: not enough arguments in call to wakuNode.Start
    have ()
    want (context.Context)
make: *** [Makefile:4: build] Error 2

Next steps:

@fryorcraken
Copy link
Collaborator Author

fryorcraken commented Mar 7, 2023

Also:

  • Need to update noise example to use latest js-noise as encoding URL as changed.

@weboko
Copy link
Collaborator

weboko commented Apr 4, 2023

I think now those are done:

Is there any necessity for this one, @fryorcraken ?

  • Add noise binary as part of go-waku release

@fryorcraken
Copy link
Collaborator Author

Is there any necessity for this one, @fryorcraken ?
Add noise binary as part of go-waku release

Yes so that one can just download the bin to play with device pairing.

@richard-ramos can you please handle that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request track:conversational-security Conversational security track (Secure Messaging)
Projects
Status: To Do
Development

No branches or pull requests

4 participants