Skip to content

Commit

Permalink
going to Ryan's desk
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheng-Long authored and mehcode committed Nov 6, 2019
1 parent f29cc53 commit 56ff07d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
24 changes: 15 additions & 9 deletions crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@ import (
)

type Ed25519PrivateKey struct {
keyData []byte
asStringRaw string
chainCode []byte
publicKey Ed25519PublicKey
KeyData []byte
// asStringRaw string
// chainCode []byte
PublicKey Ed25519PublicKey
}

func NewEd25519PrivateKey() Ed25519PrivateKey {
_, privateKey := GenerateKeys()
return privateKey
publicKey, privateKey := GenerateKeys()
var edPrivKey Ed25519PrivateKey
var edPubKey Ed25519PublicKey

edPrivKey.KeyData = privateKey
edPubKey.KeyData = publicKey
edPrivKey.PublicKey = edPubKey
return edPrivKey
}

type Ed25519PublicKey struct {
keyData []byte
asStringRaw string
chainCode []byte
KeyData []byte
// asStringRaw string
// chainCode []byte
}

func GenerateKeys() (ed25519.PublicKey, ed25519.PrivateKey) {
Expand Down
18 changes: 2 additions & 16 deletions examples/generate_key/main.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
package main

import (
"bytes"
"fmt"

"github.com/hashgraph/hedera-sdk-go"
)

func main() {
publicKey, privateKey := hedera.GenerateKeys()
publicKeyBytes := hedera.FromBytes(publicKey)
privateKeyBytes := hedera.FromBytes(privateKey)
pubK2 := hedera.FromString(publicKeyBytes)
priK2 := hedera.FromString(privateKeyBytes)
if bytes.Equal(pubK2, publicKey) {
fmt.Println("Pub same")
} else {
fmt.Println("Pub diff")
}
if bytes.Equal(priK2, privateKey) {
fmt.Println("Pri same")
} else {
fmt.Println("Pri diff")
}
privateKey := hedera.NewEd25519PrivateKey()
fmt.Println(privateKey.PublicKey.KeyData)
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ require (
github.com/golang/protobuf v1.3.2
golang.org/x/tools v0.0.0-20191106185728-c2ac6c2a2d7e // indirect
google.golang.org/grpc v1.25.0
require github.com/rogpeppe/godef v1.1.1 // indirect
)

0 comments on commit 56ff07d

Please sign in to comment.