Skip to content

Commit

Permalink
Added logging for ignored keyfiles in keystore.List and minor improve…
Browse files Browse the repository at this point in the history
…ments.

License: MIT
Signed-off-by: matrushka <barisgumustas@gmail.com>
  • Loading branch information
matrushka committed Feb 15, 2018
1 parent 23e1179 commit 40aeea6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions keystore/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import (
"path/filepath"
"strings"

logging "gx/ipfs/QmRb5jh8z2E8hMGN2tkvs1yHynUanqnZ3UeKwgN1i9P1F8/go-log"
ci "gx/ipfs/QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo/go-libp2p-crypto"
)

var log = logging.Logger("keystore")

// Keystore provides a key management interface
type Keystore interface {
// Has returns whether or not a key exist in the Keystore
Expand Down Expand Up @@ -158,14 +161,16 @@ func (ks *FSKeystore) List() ([]string, error) {
return nil, err
}

var list []string
list := make([]string, 0)

for _, name := range dirs {
err := validateName(name)
if err == nil {
list = append(list, name)
} else {
log.Warningf("Ignoring the invalid keyfile: %s", name)
}
}

return list, err
return list, nil
}

0 comments on commit 40aeea6

Please sign in to comment.