()
| 42 | } |
| 43 | |
| 44 | func GenerateKeyPair() (*KeyPair, error) { |
| 45 | pubKey, privKey, err := ed25519.GenerateKey(rand.Reader) |
| 46 | if err != nil { |
| 47 | return nil, fmt.Errorf("failed to generate key pair: %w", err) |
| 48 | } |
| 49 | |
| 50 | return &KeyPair{ |
| 51 | PublicKey: pubKey, |
| 52 | PrivateKey: privKey, |
| 53 | }, nil |
| 54 | } |
| 55 | |
| 56 | func SetPublicKey(keyData []byte) error { |
| 57 | if len(keyData) != ed25519.PublicKeySize { |
no outgoing calls
no test coverage detected