Sign authentication challenges from the server. Do not keep private seed in memory.
(nonce []byte, seedFile string)
| 6681 | // Sign authentication challenges from the server. |
| 6682 | // Do not keep private seed in memory. |
| 6683 | func 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 | |
| 6695 | type timeoutWriter struct { |
| 6696 | timeout time.Duration |
no test coverage detected