Conversation
|
Works now. Use |
|
According to Greg, we can ignore the Jenkins failure. |
6dd92f7 to
12c0e2c
Compare
12c0e2c to
e6d0ade
Compare
|
6da505e to
ee411da
Compare
|
Can be reviewed. |
ValarDragon
left a comment
There was a problem hiding this comment.
Looks good to me, though I think we may want to test the signing of messages significantly larger than one hash block size.
amino.go
Outdated
| cdc.RegisterConcrete(PubKeyEd25519{}, | ||
| "tendermint/PubKeyEd25519", nil) | ||
| cdc.RegisterConcrete(PubKeyLedgerEd25519{}, | ||
| "tendermint/PubKeyLedgerEd25519", nil) |
There was a problem hiding this comment.
(Maybe stupid) question: Do we actually need to support Ed25519 here? Isn't this ledger device for end-user wallets? My understanding was we do only use Secp256k1 for user wallets. Might have misunderstood that though.
There was a problem hiding this comment.
Per discussion now removed.
amino.go
Outdated
| cdc.RegisterConcrete(PrivKeyLedgerSecp256k1{}, | ||
| "tendermint/PrivKeyLedgerSecp256k1", nil) | ||
| cdc.RegisterConcrete(PrivKeyLedgerEd25519{}, | ||
| "tendermint/PrivKeyLedgerEd25519", nil) |
ledger_ed25519.go
Outdated
| "fmt" | ||
| "github.com/pkg/errors" | ||
|
|
||
| // "github.com/tendermint/ed25519" |
|
|
||
| [[projects]] | ||
| branch = "master" | ||
| name = "github.com/brejski/hid" |
There was a problem hiding this comment.
Question: Is this package used anywhere? Can't find it. Is it necessary to include it because of ledger-goclient ?
There was a problem hiding this comment.
Pulled in because of ledger-goclient, yes
ledger_ed25519.go
Outdated
| } | ||
|
|
||
| // PubKey returns the stored PubKey | ||
| // TODO: query the ledger if not there, once it is not volatile |
There was a problem hiding this comment.
Is there an issue that keeps track of the open TODOs here?
Group them together and open issues for them. Ideally assign them to someone. Otherwise, they might be forgotten and always stay todos in the code.
There was a problem hiding this comment.
Indeed, these were left over from an older version of this code, moved to #114
ledger_ed25519.go
Outdated
| func (pk PrivKeyLedgerEd25519) forceGetPubKey() (key PubKey, err error) { | ||
| dev, err := getLedger() | ||
| if err != nil { | ||
| return key, errors.New(fmt.Sprintf("Cannot connect to Ledger device - error: %v", err)) |
There was a problem hiding this comment.
fmt.Errorf instead of errors.New(fmt.Sprintf(..? (here and everywhere else)?
ledger_ed25519.go
Outdated
| func pubkeyLedgerEd25519(device *ledger.Ledger, path DerivationPath) (pub PubKey, err error) { | ||
| key, err := device.GetPublicKeyED25519(path) | ||
| if err != nil { | ||
| return pub, fmt.Errorf("Error fetching public key: %v", err) |
There was a problem hiding this comment.
pub will be nil in this case. Make this explicit by writing return nil, fmt.Errof(...). Also, error messages are usually not capitalized (as the error might bubble up and wrapped into another error msg).
There was a problem hiding this comment.
Updated, lowercased error messages
ledger_ed25519.go
Outdated
| } | ||
| var p PubKeyLedgerEd25519 | ||
| copy(p[:], key[0:32]) | ||
| return p, err |
There was a problem hiding this comment.
err should be nil here. Either write this, or:
var p PubKeyLedgerEd25519
copy(p[:], key[0:32])
pub = p
return
ledger_ed25519.go
Outdated
| func signLedgerEd25519(device *ledger.Ledger, path DerivationPath, msg []byte) (sig Signature, err error) { | ||
| bsig, err := device.SignED25519(path, msg) | ||
| if err != nil { | ||
| return sig, err |
There was a problem hiding this comment.
just return, similarly below
liamsi
left a comment
There was a problem hiding this comment.
all comments addressed :-) LGTM
Refactored the existing API, although I'm not quite sure if that interface is necessary - did we use to use this in the keybase more directly?
CC @adrianbrink is #68 a duplicate?
(@liamsi edited to autom. close related issues on merge):
resolves #99
resolves #93