ax(node): replace prose comments with usage examples on private identity methods
Some checks failed
Security Scan / security (push) Successful in 29s
Test / test (push) Has been cancelled

AX-2: comments that restate the function name add zero information.
savePrivateKey, saveIdentity, and loadIdentity now show a concrete
call-site with context on when each is invoked.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 10:25:57 +01:00
parent 092aaf4870
commit 6d70f4a85f
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -206,7 +206,7 @@ func (n *NodeManager) DeriveSharedSecret(peerPubKeyBase64 string) ([]byte, error
return hash[:], nil
}
// savePrivateKey saves the private key to disk with restricted permissions.
// n.savePrivateKey() // called from GenerateIdentity after keypair generation
func (n *NodeManager) savePrivateKey() error {
// Ensure directory exists
dir := filepath.Dir(n.keyPath)
@ -222,7 +222,7 @@ func (n *NodeManager) savePrivateKey() error {
return nil
}
// saveIdentity saves the public identity to the config file.
// n.saveIdentity() // called from GenerateIdentity after savePrivateKey succeeds
func (n *NodeManager) saveIdentity() error {
// Ensure directory exists
dir := filepath.Dir(n.configPath)
@ -242,7 +242,7 @@ func (n *NodeManager) saveIdentity() error {
return nil
}
// loadIdentity loads the node identity from disk.
// n.loadIdentity() // called from NewNodeManagerWithPaths on startup; nil error means identity is ready
func (n *NodeManager) loadIdentity() error {
// Load identity config
data, err := os.ReadFile(n.configPath)