-
Notifications
You must be signed in to change notification settings - Fork 111
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
add shs/350 #36
base: master
Are you sure you want to change the base?
add shs/350 #36
Conversation
Great! Maybe add some tests to https://github.com/multiformats/go-multiaddr/blob/master/multiaddr_test.go to make sure it encodes/decodes as expected |
How could I forget that, done. |
@@ -374,7 +382,7 @@ func TestFuzzBytes(t *testing.T) { | |||
} | |||
|
|||
func randMaddrString() string { | |||
good_corpus := []string{"tcp", "ip", "udp", "ipfs", "0.0.0.0", "127.0.0.1", "12345", "QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP"} | |||
good_corpus := []string{"tcp", "ip", "udp", "ipfs", "shs", "0.0.0.0", "127.0.0.1", "12345", "QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP", ""} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty is fine? this is the good corpus so should be a valid shs
addr, no?
Weird that tests pass... cc @Kubuxu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, empty is not fine. Copypaste mistake.
I realized that the shs protocol only uses ed25519 keys, so I changed it from length prefixed var size to ed25519.PublicKeySize
and added length checks in codec.go
. The test still passes both with the correct and with empty string, though.
Should I import agl's ed25519 just for using that constant or should I copy it into this package? In case I should import it, how? By vendoring, gx or directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that the shs protocol only uses ed25519 keys
Ahh, only ed25519? bummer
The test still passes both with the correct and with empty string, though.
yeah this is weird, and seems incorrect. @Kubuxu thoughts?
Should I import agl's ed25519 just for using that constant or should I copy it into this package? In case I should import it, how? By vendoring, gx or directly?
if its just that constant, nah, just copy it in, i think. (deps are unfortunately expensive :( )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had similar issue in go-ipfs, even empty, no protocol maddr is a valid maddr.
Should we change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that the shs protocol only uses ed25519 keys, so I changed it from length prefixed var size to ed25519.PublicKeySize and added length checks in codec.go. The test still passes both with the correct and with empty string, though.
is there a chance that SHS will support other key algorithms in the future? if so, it should stay variable-length. cc @dominictarr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
short answer: no.
shs is designed to be maximally metadata private (as is reasonable). so for this reason, there is no ciphersuite negioation. That also means downgrade attacks are simply not possible.
This also means you can't change shs -- to change shs you have to change it into another protocol, and then the new protocol gets a new multiformat name.
The plan is, as you are phasing in a new protocol, you just run it in parallel, say, on a different port.
then remove it when enough of the network has upgraded.
Rest LGTM |
I would be for making csv registry of transports and then assigning them and keeping parsing in packages with the transports. Which will be possible with #42 |
I didn't get your plan from that one sentence but I also don't get what this has to do with this PR. I mean this was laying around for a month now (idk why it wasn't merged). |
Is there a chance of this being merged? Is there something I can do to make it happen? paging @jbenet @whyrusleeping |
Or when #42 is merged the parser can be part of the shs transport itself. |
The protocol number should be added to protocols.csv in multiformats/multiaddr before merging. |
Make PacketConn more idiomatic and direct
…github.com/onsi/ginkgo-1.10.3 Bump github.com/onsi/ginkgo from 1.8.0 to 1.10.3
Here is a pull request to add the shs protocol suite designed and first implemented in JS by @dominictarr.
It is used by go-libp2p-shs.
I used protocol code 350 because it feels like it belongs below
ipfs
but in top ofudt
/utp
.