Browse Source

Rename NameLedger to NameLedgerEd25519

pull/1782/head
Ethan Frey 7 years ago
parent
commit
1b8d52bb82
3 changed files with 7 additions and 7 deletions
  1. +2
    -2
      keys/cryptostore/generator.go
  2. +1
    -1
      keys/cryptostore/holder_test.go
  3. +4
    -4
      nano/keys.go

+ 2
- 2
keys/cryptostore/generator.go View File

@ -68,7 +68,7 @@ func getGenerator(algo string) Generator {
return GenEd25519 return GenEd25519
case crypto.NameSecp256k1: case crypto.NameSecp256k1:
return GenSecp256k1 return GenSecp256k1
case nano.NameLedger:
case nano.NameLedgerEd25519:
return GenLedger return GenLedger
default: default:
return genInvalidAlgo{algo} return genInvalidAlgo{algo}
@ -81,7 +81,7 @@ func getGeneratorByType(typ byte) Generator {
return GenEd25519 return GenEd25519
case crypto.TypeSecp256k1: case crypto.TypeSecp256k1:
return GenSecp256k1 return GenSecp256k1
case nano.TypeLedger:
case nano.TypeLedgerEd25519:
return GenLedger return GenLedger
default: default:
return genInvalidByte{typ} return genInvalidByte{typ}


+ 1
- 1
keys/cryptostore/holder_test.go View File

@ -173,7 +173,7 @@ func TestSignWithLedger(t *testing.T) {
p := "hard2hack" p := "hard2hack"
// create a nano user // create a nano user
c, _, err := cstore.Create(n, p, nano.NameLedger)
c, _, err := cstore.Create(n, p, nano.NameLedgerEd25519)
require.Nil(err, "%+v", err) require.Nil(err, "%+v", err)
assert.Equal(c.Name, n) assert.Equal(c.Name, n)
_, ok := c.PubKey.Unwrap().(nano.PubKeyLedger) _, ok := c.PubKey.Unwrap().(nano.PubKeyLedger)


+ 4
- 4
nano/keys.go View File

@ -13,8 +13,8 @@ import (
) )
const ( const (
NameLedger = "ledger"
TypeLedger = 0x10
NameLedgerEd25519 = "ledger"
TypeLedgerEd25519 = 0x10
) )
var device *ledger.Ledger var device *ledger.Ledger
@ -229,11 +229,11 @@ func (pk PubKeyLedger) Equals(other crypto.PubKey) bool {
func init() { func init() {
crypto.PrivKeyMapper. crypto.PrivKeyMapper.
RegisterImplementation(&PrivKeyLedger{}, NameLedger, TypeLedger).
RegisterImplementation(&PrivKeyLedger{}, NameLedgerEd25519, TypeLedgerEd25519).
RegisterImplementation(MockPrivKeyLedger{}, "mock-ledger", 0x11) RegisterImplementation(MockPrivKeyLedger{}, "mock-ledger", 0x11)
crypto.PubKeyMapper. crypto.PubKeyMapper.
RegisterImplementation(PubKeyLedger{}, NameLedger, TypeLedger)
RegisterImplementation(PubKeyLedger{}, NameLedgerEd25519, TypeLedgerEd25519)
} }
// Wrap fulfils interface for PrivKey struct // Wrap fulfils interface for PrivKey struct


Loading…
Cancel
Save