-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
libp2phttp: HTTP Peer ID Authentication #2854
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
c2d12e7
to
2a55ceb
Compare
I've completely refactored this. The handshake logic is now neatly in
when you get a chance, could I get a review here and in the spec libp2p/specs#564 @sukunrt . |
fccc2d5
to
fbcede2
Compare
p2p/http/auth/client.go
Outdated
} | ||
resp.Body.Close() | ||
|
||
err = handshake.ParseHeader(resp.Header) |
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.
Do we need to set the status code first?
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.
On the client? Or do you mean assert the status code is 401?
The new spec is much nicer! Thanks @MarcoPolo |
Because otherwise the body is not copied.
dbd59dc
to
37cb110
Compare
This enables HTTP peers to authenticate each other's peer ID. This would allow users to use an http transport that has a peer id component (e.g.
/dns/example.com/http/p2p/12Foo
). I think it's nice to have this for completeness so that an http transport has the same semantics as a libp2p stream transport when doing HTTP with regard to Peer IDs.There's more testing I want to do here, but I think this is more or less ready for a review.
For a high level overview of the authentication protocol refer to the overview in the spec: https://github.com/libp2p/specs/blob/45006f17d2fa0cede50b2db2311a55061011a3fc/http/peer-id-auth.md#mutual-client-and-server-peer-id-authentication-overview