forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
938 additions
and
49 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
MANIFEST-000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
=============== Sep 4, 2021 (+07) =============== | ||
This comment has been minimized.
Sorry, something went wrong. |
||
18:00:07.262699 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed | ||
18:00:07.277435 db@open opening | ||
18:00:07.278588 version@stat F·[] S·0B[] Sc·[] | ||
18:00:07.284951 db@janitor F·2 G·0 | ||
18:00:07.285021 db@open done T·7.528466ms | ||
18:00:07.285037 db@close closing | ||
18:00:07.285159 db@close done T·115.847µs |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,19 +13,21 @@ require ( | |
github.com/gdamore/tcell/v2 v2.1.0 | ||
github.com/gnolang/cors v1.8.1 | ||
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 | ||
github.com/golang/protobuf v1.5.0 | ||
github.com/golang/protobuf v1.5.2 | ||
github.com/google/gofuzz v1.0.0 | ||
github.com/gorilla/websocket v1.4.2 | ||
github.com/jaekwon/testify v1.6.1 | ||
github.com/jmhodges/levigo v1.0.0 | ||
github.com/libp2p/go-buffer-pool v0.0.2 | ||
github.com/mattn/go-runewidth v0.0.10 | ||
github.com/pelletier/go-toml v1.9.3 // indirect | ||
github.com/stretchr/testify v1.6.1 | ||
github.com/syndtr/goleveldb v1.0.0 | ||
github.com/spf13/cobra v1.2.1 | ||
github.com/stretchr/testify v1.7.0 | ||
github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d | ||
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c | ||
github.com/tendermint/classic v0.0.0-20201012085102-0a11024b2668 | ||
This comment has been minimized.
Sorry, something went wrong.
jaekwon
|
||
go.etcd.io/bbolt v1.3.6 | ||
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d | ||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 | ||
golang.org/x/mod v0.4.2 | ||
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985 | ||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |
|
||
"github.com/gnolang/gno/pkgs/crypto" | ||
"github.com/gnolang/gno/pkgs/crypto/bip39" | ||
"github.com/gnolang/gno/pkgs/crypto/ed25519" | ||
"github.com/gnolang/gno/pkgs/crypto/hd" | ||
"github.com/gnolang/gno/pkgs/crypto/keys/armor" | ||
"github.com/gnolang/gno/pkgs/crypto/keys/keyerror" | ||
|
@@ -87,20 +88,31 @@ func NewInMemory() Keybase { return dbKeybase{dbm.NewMemDB()} } | |
// XXX NOTE: we are not saving the derivation path. | ||
// XXX but this doesn't help encrypted commnuication. | ||
// XXX also there is no document structure. | ||
func (kb dbKeybase) CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd string, account uint32, index uint32) (Info, error) { | ||
func (kb dbKeybase) CreateAccountBip44(name, mnemonic, bip39Passwd, encryptPasswd string, account uint32, index uint32) (Info, error) { | ||
coinType := crypto.CoinType | ||
hdPath := hd.NewFundraiserParams(account, coinType, index) | ||
return kb.CreateAccountBip44(name, mnemonic, bip39Passwd, encryptPasswd, *hdPath) | ||
return kb.CreateAccountCustomBip44(name, mnemonic, bip39Passwd, encryptPasswd, *hdPath) | ||
} | ||
|
||
func (kb dbKeybase) CreateAccountBip44(name, mnemonic, bip39Passphrase, encryptPasswd string, params hd.BIP44Params) (info Info, err error) { | ||
func (kb dbKeybase) CreateAccountSha256(name, mnemonic, encryptPasswd string) (info Info, err error) { | ||
mnemonicByte, err := bip39.MnemonicToByteArray(mnemonic) | ||
if err != nil { | ||
return nil, err | ||
} | ||
var privKeyByte [64]byte | ||
copy(privKeyByte[:], mnemonicByte[:64]) | ||
This comment has been minimized.
Sorry, something went wrong.
jaekwon
|
||
info, err = kb.persistDerivedEd25519Key(privKeyByte, name, encryptPasswd) | ||
return info, err | ||
} | ||
|
||
func (kb dbKeybase) CreateAccountCustomBip44(name, mnemonic, bip39Passphrase, encryptPasswd string, params hd.BIP44Params) (info Info, err error) { | ||
seed, err := bip39.NewSeedWithErrorChecking(mnemonic, bip39Passphrase) | ||
if err != nil { | ||
return | ||
return nil, err | ||
} | ||
|
||
info, err = kb.persistDerivedKey(seed, encryptPasswd, name, params.String()) | ||
return | ||
info, err = kb.persistDerivedSecp256k1Key(seed, encryptPasswd, name, params.String()) | ||
return info, err | ||
} | ||
|
||
// CreateLedger creates a new locally-stored reference to a Ledger keypair | ||
|
@@ -134,18 +146,23 @@ func (kb dbKeybase) CreateMulti(name string, pub crypto.PubKey) (Info, error) { | |
return kb.writeMultisigKey(name, pub), nil | ||
} | ||
|
||
func (kb *dbKeybase) persistDerivedKey(seed []byte, passwd, name, fullHdPath string) (info Info, err error) { | ||
func (kb *dbKeybase) persistDerivedEd25519Key(privKey [64]byte, passwd, name string) (info Info, err error) { | ||
info = kb.writeLocalKey(name, ed25519.PrivKeyEd25519(privKey), passwd) | ||
return info, nil | ||
} | ||
|
||
func (kb *dbKeybase) persistDerivedSecp256k1Key(seed []byte, passwd, name, fullHdPath string) (info Info, err error) { | ||
// create master key and derive first key: | ||
masterPriv, ch := hd.ComputeMastersFromSeed(seed) | ||
derivedPriv, err := hd.DerivePrivateKeyForPath(masterPriv, ch, fullHdPath) | ||
if err != nil { | ||
return | ||
return nil, err | ||
} | ||
|
||
// use possibly blank password to encrypt the private | ||
// key and store it. User must enforce good passwords. | ||
info = kb.writeLocalKey(name, secp256k1.PrivKeySecp256k1(derivedPriv), passwd) | ||
return | ||
return info, nil | ||
} | ||
|
||
// List returns the keys from storage in alphabetical order. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
seems like cmd/gnokey/data should be removed