You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue with the presharedkey seems to have been fixed (#11). Currently, there is no example (server, userspace or client) to provide a presharedkey.
In the following snippet of code from server.rs file you created 10 peers, you sat them up and you configured them :
Here is a little insights for people that want to know how to implement it :
You can insert your preshared key inside the peer using the insert method.
Let's take the example again. In the for loop, we first create the secret then we create the Publickey from the secret, push the peer key in the vec named peer_keys, then create a peer from the public key, create an address according to the peer id and then push in the allowed_ips field of the structure peer, then configure the peer to be written on the API.
This workflow does not include the preshared_keys yet. To do so, you must bear in mind that the preshared_keys are a type Key (same type as the key used to create the peer)
To create the key simply do :
let peer_psk_secret = StaticSecret::random();let peer_u8_psk:[u8;32] = peer_psk_secret.to_bytes().as_ref().try_into().expect(could not convert static secret to u8)let peer_psk_key:Key = peer_psk_secret.as_ref().try_into().expect("could not convert key u8 to key")
peer.preshared_keys.insert(peer_psk_key)
There might be unecessary steps for conversions but It works well for me.
Maybe @teon or @wojcik91 can add a sample of this to the server.rs example
Hi,
The issue with the presharedkey seems to have been fixed (#11). Currently, there is no example (server, userspace or client) to provide a presharedkey.
In the following snippet of code from
server.rs
file you created 10 peers, you sat them up and you configured them :Would it be possible to have an example on how to create the presharedkey from your library and set it to a peer?
I didn't see any setter for the presharedkey in the Peer implementation. Is it somewhere else ?
would something like this be sufficient ?
Thanks,
Ange
The text was updated successfully, but these errors were encountered: