Skip to content

Commit fccd299

Browse files
committed
log on verification failure
1 parent 88384f7 commit fccd299

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

packages/bitcore-wallet-client/src/lib/api.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ export class API extends EventEmitter {
580580

581581
if (this.credentials.walletPrivKey) {
582582
if (!Verifier.checkCopayers(this.credentials, wallet.copayers)) {
583+
log.error('Copayer verification falied on openWallet');
583584
return cb(new Errors.SERVER_COMPROMISED());
584585
}
585586
} else {
@@ -1457,6 +1458,7 @@ export class API extends EventEmitter {
14571458
this.credentials.sharedEncryptingKey
14581459
)
14591460
) {
1461+
log.error('Transaction proposal verification falied on createTxProposal');
14601462
return cb(new Errors.SERVER_COMPROMISED());
14611463
}
14621464

@@ -1520,6 +1522,7 @@ export class API extends EventEmitter {
15201522
if (err) return cb(err);
15211523

15221524
if (!Verifier.checkAddress(this.credentials, address)) {
1525+
log.error('Address verification falied on createAddress');
15231526
return cb(new Errors.SERVER_COMPROMISED());
15241527
}
15251528

@@ -1555,7 +1558,10 @@ export class API extends EventEmitter {
15551558

15561559
if (!opts.doNotVerify) {
15571560
const fake = (addresses || []).some(address => !Verifier.checkAddress(this.credentials, address));
1558-
if (fake) return cb(new Errors.SERVER_COMPROMISED());
1561+
if (fake) {
1562+
log.error('Address verification falied on getMainAddresses');
1563+
return cb(new Errors.SERVER_COMPROMISED());
1564+
}
15591565
}
15601566
return cb(null, addresses);
15611567
});
@@ -1636,7 +1642,10 @@ export class API extends EventEmitter {
16361642
});
16371643
},
16381644
isLegit => {
1639-
if (!isLegit) return cb(new Errors.SERVER_COMPROMISED());
1645+
if (!isLegit) {
1646+
log.error('Transaction proposal verification falied on getTxProposals');
1647+
return cb(new Errors.SERVER_COMPROMISED());
1648+
}
16401649

16411650
var result;
16421651
if (opts.forAirGapped) {
@@ -1724,7 +1733,10 @@ export class API extends EventEmitter {
17241733
this.getPayProV2(txp)
17251734
.then(paypro => {
17261735
const isLegit = Verifier.checkTxProposal(this.credentials, txp, { paypro });
1727-
if (!isLegit) return cb(new Errors.SERVER_COMPROMISED());
1736+
if (!isLegit) {
1737+
log.error('Transaction proposal verification falied on pushSignatures');
1738+
return cb(new Errors.SERVER_COMPROMISED());
1739+
}
17281740

17291741
baseUrl = baseUrl || '/v2/txproposals/';
17301742
const url = baseUrl + txp.id + '/signatures/';
@@ -2924,6 +2936,7 @@ export class API extends EventEmitter {
29242936

29252937
if (credentials.walletPrivKey) {
29262938
if (!Verifier.checkCopayers(credentials, wallet.copayers)) {
2939+
log.error('Copayer verification falied on serverAssistedImport');
29272940
return cb2(null, new Errors.SERVER_COMPROMISED());
29282941
}
29292942
} else {

packages/bitcore-wallet-client/src/lib/verifier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export class Verifier {
206206
} else {
207207
creatorSigningPubKey = creatorKeys.requestPubKey;
208208
}
209-
if (!creatorSigningPubKey){
209+
if (!creatorSigningPubKey) {
210210
log.error('Missing creator signing key');
211211
}
212212

@@ -232,7 +232,7 @@ export class Verifier {
232232
}
233233

234234
if (!verified && txp.prePublishRaw && !Utils.verifyMessage(txp.prePublishRaw, txp.proposalSignature, creatorSigningPubKey)) {
235-
log.error('Invalid proposal signature');'Invalid refreshed proposal signature');
235+
log.error('Invalid refreshed proposal signature');
236236
return false
237237
}
238238

0 commit comments

Comments
 (0)