{"record":{"id":"ad59cef857700a4e","repo":"OpenNHP/opennhp","slug":"relay-invalid-privatekeybase64-w","errorCode":null,"errorMessage":"relay: invalid privateKeyBase64: %w","messagePattern":"relay: invalid privateKeyBase64: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"endpoints/relay/relay.go","lineNumber":196,"sourceCode":"\tsendMsgCh chan *core.MsgData\n\trecvMsgCh <-chan *core.PacketParserData\n\n\twg      sync.WaitGroup\n\trunning atomic.Bool\n\tstopCh  chan struct{}\n\n\tstats struct {\n\t\ttotalRecvBytes uint64\n\t\ttotalSendBytes uint64\n\t}\n}\n\n// New creates a RelayServer from the given configuration.\nfunc New(cfg *Config) (*RelayServer, error) {\n\t// Decode relay private key.\n\tprk, err := base64.StdEncoding.DecodeString(cfg.PrivateKeyBase64)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"relay: invalid privateKeyBase64: %w\", err)\n\t}\n\n\t// Create NHP device with relay identity.\n\tdevice := core.NewDevice(core.NHP_RELAY, prk, nil)\n\tif device == nil {\n\t\treturn nil, fmt.Errorf(\"relay: failed to create NHP device\")\n\t}\n\n\trs := &RelayServer{\n\t\tconfig:    cfg,\n\t\tdevice:    device,\n\t\tservers:   make(map[string]*serverRuntime, len(cfg.Servers)),\n\t\tsendMsgCh: make(chan *core.MsgData, PacketQueueSizePerConnection),\n\t\tstopCh:    make(chan struct{}),\n\t}\n\trs.recvMsgCh = device.DecryptedMsgQueue\n\n\tfor i := range cfg.Servers {","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/endpoints/relay/relay.go#L178-L214","documentation":"Raised in relay New while constructing the RelayServer: base64.StdEncoding.DecodeString of cfg.PrivateKeyBase64 failed. The relay's identity private key in config.toml is not valid standard base64 (wrong length, invalid characters, or URL-safe base64 pasted instead of Std).","triggerScenarios":"Thrown at endpoints/relay/relay.go:196 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the relay key pair (e.g. keygen --curve) and paste the fresh PrivateKeyBase64 into config.toml","Ensure the value was copied completely without truncation, whitespace or newlines","Confirm the key was encoded with standard base64, not base64url"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}