Skip to content

Commit

Permalink
Merge pull request #2 from core-coin/feature/converters
Browse files Browse the repository at this point in the history
Added BytesToPublicKey and BytesToPrivateKey
  • Loading branch information
error2215 authored Aug 30, 2021
2 parents bcc6bbd + 244bf7c commit 4e9e228
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions goldilocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,19 @@ func Ed448GenerateKey(reader io.Reader) (PrivateKey, error) {
}
return *key, nil
}

func BytesToPublicKey(key []byte) (pk PublicKey) {
if len(key) != len(PublicKey{}) {
return PublicKey{}
}
copy(pk[:], key)
return
}

func BytesToPrivateKey(key []byte) (pk PrivateKey) {
if len(key) != len(PrivateKey{}) {
return PrivateKey{}
}
copy(pk[:], key)
return
}

0 comments on commit 4e9e228

Please sign in to comment.