Skip to content

Commit

Permalink
add private ed25519publickey from proto function
Browse files Browse the repository at this point in the history
  • Loading branch information
QuestofIranon committed Jan 9, 2020
1 parent 088a876 commit 704b596
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ func Ed25519PublicKeyFromBytes(bytes []byte) (Ed25519PublicKey, error) {
}, nil
}

func ed25519PublicKeyFromProto(proto proto.Key) (Ed25519PublicKey, error) {
rawKey := proto.GetEd25519()

if rawKey == nil {
return Ed25519PublicKey{}, fmt.Errorf("not an ed25519 key")
}

return Ed25519PublicKeyFromBytes(rawKey)
}

// SLIP-10/BIP-32 Child Key derivation
func deriveChildKey(parentKey []byte, chainCode []byte, index uint32) ([]byte, []byte) {
h := hmac.New(sha512.New, chainCode)
Expand Down

0 comments on commit 704b596

Please sign in to comment.