Add accountdata constructor
This commit is contained in:
parent
79419b3f71
commit
c3e6af0032
@ -12,6 +12,15 @@ type AccountKeys struct {
|
|||||||
PeerId string
|
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) {
|
func NewRandom() (*AccountKeys, error) {
|
||||||
peerKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
peerKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user