Add accountdata constructor

This commit is contained in:
mcrakhman committed 2023-03-27 16:32:56 +02:00
1 parent 2225aca40f
commit eec2b842bc
1 file changed
+9
@@ -12,6 +12,15 @@ type AccountKeys struct {
PeerId string
}
func New(peerKey crypto.PrivKey, signKey crypto.PrivKey) *AccountKeys {
peerId, _ := peer.IdFromSigningPubKey(peerKey.GetPublic())
return &AccountKeys{
PeerKey: peerKey,
SignKey: signKey,
PeerId: peerId.String(),
}
}
func NewRandom() (*AccountKeys, error) {
peerKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
if err != nil {