Commit 673bb1ba authored by Brian Tiger Chow's avatar Brian Tiger Chow

refactor(crypto/spipe) move proto to internal pb package

https://docs.google.com/document/d/1e8kOo3r51b2BWtTs_1uADIA5djfXhPT36s6eHVRIvaU/edit
parent 488515c2
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto" proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto"
ci "github.com/jbenet/go-ipfs/crypto" ci "github.com/jbenet/go-ipfs/crypto"
pb "github.com/jbenet/go-ipfs/crypto/spipe/internal/pb"
peer "github.com/jbenet/go-ipfs/peer" peer "github.com/jbenet/go-ipfs/peer"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
) )
...@@ -58,7 +59,7 @@ func (s *SecurePipe) handshake() error { ...@@ -58,7 +59,7 @@ func (s *SecurePipe) handshake() error {
return err return err
} }
proposeMsg := new(Propose) proposeMsg := new(pb.Propose)
proposeMsg.Rand = nonce proposeMsg.Rand = nonce
proposeMsg.Pubkey = myPubKey proposeMsg.Pubkey = myPubKey
proposeMsg.Exchanges = &SupportedExchanges proposeMsg.Exchanges = &SupportedExchanges
...@@ -87,7 +88,7 @@ func (s *SecurePipe) handshake() error { ...@@ -87,7 +88,7 @@ func (s *SecurePipe) handshake() error {
} }
// u.POut("received encoded handshake\n") // u.POut("received encoded handshake\n")
proposeResp := new(Propose) proposeResp := new(pb.Propose)
err = proto.Unmarshal(resp, proposeResp) err = proto.Unmarshal(resp, proposeResp)
if err != nil { if err != nil {
return err return err
...@@ -129,7 +130,7 @@ func (s *SecurePipe) handshake() error { ...@@ -129,7 +130,7 @@ func (s *SecurePipe) handshake() error {
handshake.Write(resp) handshake.Write(resp)
handshake.Write(epubkey) handshake.Write(epubkey)
exPacket := new(Exchange) exPacket := new(pb.Exchange)
exPacket.Epubkey = epubkey exPacket.Epubkey = epubkey
exPacket.Signature, err = s.local.PrivKey().Sign(handshake.Bytes()) exPacket.Signature, err = s.local.PrivKey().Sign(handshake.Bytes())
...@@ -155,7 +156,7 @@ func (s *SecurePipe) handshake() error { ...@@ -155,7 +156,7 @@ func (s *SecurePipe) handshake() error {
case resp1 = <-s.insecure.In: case resp1 = <-s.insecure.In:
} }
exchangeResp := new(Exchange) exchangeResp := new(pb.Exchange)
err = proto.Unmarshal(resp1, exchangeResp) err = proto.Unmarshal(resp1, exchangeResp)
if err != nil { if err != nil {
return err return err
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment