MCPcopy Create free account
hub / github.com/compozy/agh / RouteToken

Function RouteToken

internal/network/validate.go:363–371  ·  view source on GitHub ↗

RouteToken derives the deterministic NATS route token for one peer.

(peerID string)

Source from the content-addressed store, hash-verified

361
362// RouteToken derives the deterministic NATS route token for one peer.
363func RouteToken(peerID string) (string, error) {
364 peerID = strings.TrimSpace(peerID)
365 if err := ValidatePeerID(peerID); err != nil {
366 return "", err
367 }
368
369 sum := sha256.Sum256([]byte(peerID))
370 return hex.EncodeToString(sum[:16]), nil
371}
372
373// DecodeBody parses and validates one kind-specific envelope body.
374func DecodeBody(kind Kind, raw json.RawMessage) (Body, error) {

Callers 2

DirectSubjectFunction · 0.85

Calls 1

ValidatePeerIDFunction · 0.85

Tested by 1