MCPcopy
hub / github.com/nats-io/nats.go / sigHandler

Function sigHandler

nats.go:6683–6693  ·  view source on GitHub ↗

Sign authentication challenges from the server. Do not keep private seed in memory.

(nonce []byte, seedFile string)

Source from the content-addressed store, hash-verified

6681// Sign authentication challenges from the server.
6682// Do not keep private seed in memory.
6683func sigHandler(nonce []byte, seedFile string) ([]byte, error) {
6684 kp, err := nkeyPairFromSeedFile(seedFile)
6685 if err != nil {
6686 return nil, fmt.Errorf("unable to extract key pair from file %q: %w", seedFile, err)
6687 }
6688 // Wipe our key on exit.
6689 defer kp.Wipe()
6690
6691 sig, _ := kp.Sign(nonce)
6692 return sig, nil
6693}
6694
6695type timeoutWriter struct {
6696 timeout time.Duration

Callers 2

UserCredentialsFunction · 0.85
NkeyOptionFromSeedFunction · 0.85

Calls 2

nkeyPairFromSeedFileFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected