From 6e37bc1f2755ef2e2270d2c1cb988d14ff6d0957 Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Wed, 11 Mar 2026 11:20:38 +0100 Subject: Naming --- noise.go | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'noise.go') diff --git a/noise.go b/noise.go index 4ed792d..cba3606 100644 --- a/noise.go +++ b/noise.go @@ -396,7 +396,7 @@ func (ns *NoiseState) Recv(message []byte) ([]byte, error) { // final completes the handshake and derives transport keys. func (ns *NoiseState) final() error { - ns.hash = ns.getHandshakeHash() + ns.hash = ns.handshakeHash() keys, err := ns.split() if err != nil { @@ -456,8 +456,8 @@ func (ns *NoiseState) IsComplete() bool { return ns.complete } -// GetHash returns the handshake hash (only valid after completion). -func (ns *NoiseState) GetHash() []byte { +// Hash returns the handshake hash (only valid after completion). +func (ns *NoiseState) Hash() []byte { if ns.hash != nil { result := make([]byte, len(ns.hash)) copy(result, ns.hash) @@ -466,18 +466,18 @@ func (ns *NoiseState) GetHash() []byte { return nil } -// GetTX returns the transmit cipher state (only valid after completion). -func (ns *NoiseState) GetTX() *CipherState { +// Tx returns the transmit cipher state (only valid after completion). +func (ns *NoiseState) Tx() *CipherState { return ns.tx } -// GetRX returns the receive cipher state (only valid after completion). -func (ns *NoiseState) GetRX() *CipherState { +// Rx returns the receive cipher state (only valid after completion). +func (ns *NoiseState) Rx() *CipherState { return ns.rx } -// GetStaticPublicKey returns the local static public key. -func (ns *NoiseState) GetStaticPublicKey() []byte { +// StaticPublicKey returns the local static public key. +func (ns *NoiseState) StaticPublicKey() []byte { if ns.s != nil { key := make([]byte, len(ns.s.PublicKey)) copy(key, ns.s.PublicKey) @@ -486,8 +486,8 @@ func (ns *NoiseState) GetStaticPublicKey() []byte { return nil } -// GetRemoteStaticPublicKey returns a copy of the remote static public key (rs). -func (ns *NoiseState) GetRemoteStaticPublicKey() []byte { +// RemoteStaticPublicKey returns a copy of the remote static public key (rs). +func (ns *NoiseState) RemoteStaticPublicKey() []byte { if ns.rs == nil { return nil } @@ -503,9 +503,7 @@ type keyPatternResult struct { } // getKeyPattern determines which keys to use based on token and role. -func getKeyPattern(token Token, initiator bool) keyPatternResult { - result := keyPatternResult{} - +func getKeyPattern(token Token, initiator bool) (result keyPatternResult) { switch token { case TokenEE: // Both ephemeral -- cgit v1.3.1