Skip to content

Commit

Permalink
fix: error if incorrect ledger public key
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Mar 7, 2024
1 parent a1e3a85 commit b607615
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crypto/keyring/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,14 @@ func SignWithLedger(k *Record, msg []byte, signMode signing.SignMode) (sig []byt
if err != nil {
return nil, nil, err
}
ledgerPubKey := priv.PubKey()
pubKey, err := k.GetPubKey()
if err != nil {
return nil, nil, err
}
if !pubKey.Equals(ledgerPubKey) {
return nil, nil, fmt.Errorf("the public key that the user attempted to sign with %v does not match the public key on the ledger device %v", pubKey.String(), ledgerPubKey.String())
}

switch signMode {
case signing.SignMode_SIGN_MODE_TEXTUAL:
Expand Down

0 comments on commit b607615

Please sign in to comment.