Completed
Push — main ( 523495...f20dc9 )
by Yume
25s queued 13s
created

crypto.GenerateKeyPair   A

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
dl 0
loc 7
rs 10
c 0
b 0
f 0
nop 0
1
package crypto
2
3
import (
4
	"crypto/ed25519"
5
	"crypto/rand"
6
7
	"github.com/pkg/errors"
8
)
9
10
func GenerateKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error) {
11
	publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
12
	if err != nil {
13
		return nil, nil, errors.Wrap(err, "Error generating keys")
14
	}
15
16
	return publicKey, privateKey, nil
17
}
18