Skip to content

Commit

Permalink
backend: remove unused getKeystoresHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Oct 6, 2023
1 parent 2c667fd commit 60bf6fc
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 46 deletions.
5 changes: 0 additions & 5 deletions backend/devices/bitbox/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ type keystore struct {
rootFinger []byte // cached result of RootFingerprint
}

// Type implements keystore.Keystore.
func (keystore *keystore) Type() keystorePkg.Type {
return keystorePkg.TypeHardware
}

// RootFingerprint implements keystore.Keystore.
func (keystore *keystore) RootFingerprint() ([]byte, error) {
keystore.rootFingerMu.Lock()
Expand Down
5 changes: 0 additions & 5 deletions backend/devices/bitbox02/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ type keystore struct {
rootFinger []byte // cached result of RootFingerprint
}

// Type implements keystore.Keystore.
func (keystore *keystore) Type() keystorePkg.Type {
return keystorePkg.TypeHardware
}

// RootFingerprint implements keystore.Keystore.
func (keystore *keystore) RootFingerprint() ([]byte, error) {
keystore.rootFingerMu.Lock()
Expand Down
16 changes: 0 additions & 16 deletions backend/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ func NewHandlers(
getAPIRouterNoError(apiRouter)("/version", handlers.getVersionHandler).Methods("GET")
getAPIRouterNoError(apiRouter)("/testing", handlers.getTestingHandler).Methods("GET")
getAPIRouterNoError(apiRouter)("/account-add", handlers.postAddAccountHandler).Methods("POST")
getAPIRouterNoError(apiRouter)("/keystores", handlers.getKeystoresHandler).Methods("GET")
getAPIRouterNoError(apiRouter)("/accounts", handlers.getAccountsHandler).Methods("GET")
getAPIRouter(apiRouter)("/accounts/total-balance", handlers.getAccountsTotalBalanceHandler).Methods("GET")
getAPIRouterNoError(apiRouter)("/set-account-active", handlers.postSetAccountActiveHandler).Methods("POST")
Expand Down Expand Up @@ -499,21 +498,6 @@ func (handlers *Handlers) postAddAccountHandler(r *http.Request) interface{} {
return response{Success: true, AccountCode: accountCode}
}

func (handlers *Handlers) getKeystoresHandler(_ *http.Request) interface{} {
type json struct {
Type keystore.Type `json:"type"`
}
keystores := []*json{}

keystore := handlers.backend.Keystore()
if keystore != nil {
keystores = append(keystores, &json{
Type: keystore.Type(),
})
}
return keystores
}

func (handlers *Handlers) getAccountsHandler(_ *http.Request) interface{} {
accounts := []*accountJSON{}
persistedAccounts := handlers.backend.Config().AccountsConfig()
Expand Down
14 changes: 0 additions & 14 deletions backend/keystore/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,13 @@ import (
"github.com/digitalbitbox/bitbox-wallet-app/backend/signing"
)

// Type denotes the type of a keystore.
type Type string

const (
// TypeHardware means the keystore is provided by a hardware wallet.
TypeHardware Type = "hardware"
// TypeSoftware mans the keystore is provided by a software (hot) wallet. Currently only used in
// devmode for testing.
TypeSoftware Type = "software"
)

// ErrSigningAborted is used when the user aborts a signing in process (e.g. abort on HW wallet).
var ErrSigningAborted = errors.New("signing aborted by user")

// Keystore supports hardened key derivation according to BIP32 and signing of transactions.
//
//go:generate moq -pkg mocks -out mocks/keystore.go . Keystore
type Keystore interface {
// Type denotes the type of the keystore.
Type() Type

// RootFingerprint returns the keystore's root fingerprint, which is the first 32 bits of the
// hash160 of the pubkey at the keypath m/.
//
Expand Down
6 changes: 0 additions & 6 deletions backend/keystore/software/software.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/digitalbitbox/bitbox-wallet-app/backend/coins/btc"
"github.com/digitalbitbox/bitbox-wallet-app/backend/coins/btc/types"
"github.com/digitalbitbox/bitbox-wallet-app/backend/coins/coin"
keystorePkg "github.com/digitalbitbox/bitbox-wallet-app/backend/keystore"
"github.com/digitalbitbox/bitbox-wallet-app/backend/signing"
"github.com/digitalbitbox/bitbox-wallet-app/util/errp"
"github.com/digitalbitbox/bitbox-wallet-app/util/logging"
Expand Down Expand Up @@ -68,11 +67,6 @@ func NewKeystoreFromPIN(pin string) *Keystore {
return NewKeystore(master)
}

// Type implements keystore.Keystore.
func (keystore *Keystore) Type() keystorePkg.Type {
return keystorePkg.TypeSoftware
}

// RootFingerprint implements keystore.Keystore.
func (keystore *Keystore) RootFingerprint() ([]byte, error) {
// The bip32 Go lib we use does not expose a key's fingerprint. We simply get an arbitrary child
Expand Down

0 comments on commit 60bf6fc

Please sign in to comment.