Example #1
0
func (cah *connectionAwaitHandshake) makeHello() *capn.Segment {
	seg := capn.NewBuffer(nil)
	hello := cmsgs.NewRootHello(seg)
	hello.SetProduct(common.ProductName)
	hello.SetVersion(common.ProductVersion)
	hello.SetIsClient(false)
	return seg
}
Example #2
0
func (cah *connectionAwaitHandshake) makeHello() (*capn.Segment, error) {
	seg := capn.NewBuffer(nil)
	hello := msgs.NewRootHello(seg)
	hello.SetProduct(common.ProductName)
	hello.SetVersion(common.ProductVersion)
	publicKey, privateKey, err := box.GenerateKey(cr.Reader)
	if err != nil {
		return nil, err
	}
	cah.privateKey = privateKey
	hello.SetPublicKey(publicKey[:])
	hello.SetIsClient(false)
	return seg, nil
}