MCPcopy Create free account
hub / github.com/Atsika/aznet / WriteMessage

Method WriteMessage

crypto.go:73–84  ·  view source on GitHub ↗

WriteMessage creates the next handshake message, encrypting the payload. It returns the message to send to the peer.

(payload []byte)

Source from the content-addressed store, hash-verified

71 return &Noise{hs: hs, isInitiator: false}, nil
72}
73
74// WriteMessage creates the next handshake message, encrypting the payload.
75// It returns the message to send to the peer.
76func (nh *Noise) WriteMessage(payload []byte) ([]byte, error) {
77 msg, cs1, cs2, err := nh.hs.WriteMessage(nil, payload)
78 if err != nil {
79 return nil, err
80 }
81 // If both cipher states are returned, handshake is complete
82 if cs1 != nil && cs2 != nil {
83 nh.cs1, nh.cs2 = cs1, cs2
84 nh.isComplete = true
85 }
86 return msg, nil
87}

Callers 2

DialFunction · 0.80
AcceptMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected