Skip to content

Commit 2a2898a

Browse files
Merge pull request #6196 from BitGo/WP-4242/audit-key-follow-ups
chore(root): follow up comments on auditKey
2 parents 484f67d + 4f04646 commit 2a2898a

File tree

10 files changed

+10
-7
lines changed

10 files changed

+10
-7
lines changed

modules/abstract-lightning/src/abstractLightningCoin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export abstract class AbstractLightningCoin extends BaseCoin {
6565

6666
/** @inheritDoc */
6767
auditDecryptedKey(params: AuditDecryptedKeyParams) {
68+
/** https://bitgoinc.atlassian.net/browse/BTC-2149 */
6869
throw new Error('Method not implemented.');
6970
}
7071
}

modules/sdk-coin-algo/src/algo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ export class Algo extends BaseCoin {
858858
try {
859859
algoKey = new AlgoLib.KeyPair({ prv });
860860
} catch (e) {
861-
throw new Error('Invalid private key');
861+
throw new Error(`Invalid private key: ${e.message}`);
862862
}
863863
if (publicKey && publicKey !== algoKey.getKeys().pub) {
864864
throw new Error('Invalid public key');

modules/sdk-coin-algo/test/unit/algo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ describe('ALGO:', function () {
11761176
walletPassphrase,
11771177
});
11781178
},
1179-
{ message: 'Invalid private key' }
1179+
{ message: 'Invalid private key: Invalid base32 characters' }
11801180
);
11811181
});
11821182
});

modules/sdk-coin-avaxp/src/avaxp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ export class AvaxP extends BaseCoin {
369369

370370
/** @inheritDoc */
371371
auditDecryptedKey(params: AuditDecryptedKeyParams): void {
372+
/** https://bitgoinc.atlassian.net/browse/COIN-4213 */
372373
throw new MethodNotImplementedError();
373374
}
374375
}

modules/sdk-coin-hbar/src/hbar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ export class Hbar extends BaseCoin {
642642
try {
643643
hbarKeyPair = new HbarKeyPair({ prv });
644644
} catch (e) {
645-
throw new Error('Invalid private key');
645+
throw new Error(`Invalid private key: ${e.message}`);
646646
}
647647
const genPubKey = hbarKeyPair.getKeys().pub;
648648
if (publicKey && publicKey !== genPubKey) {

modules/sdk-coin-hbar/test/unit/hbar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ describe('Hedera Hashgraph:', function () {
13741374
walletPassphrase,
13751375
}),
13761376
{
1377-
message: 'Invalid private key',
1377+
message: 'Invalid private key: Invalid private key length. Must be a hex and multiple of 2',
13781378
}
13791379
);
13801380
});

modules/sdk-coin-vet/src/vet.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export class Vet extends BaseCoin {
120120

121121
/** @inheritDoc */
122122
auditDecryptedKey(params: AuditDecryptedKeyParams) {
123+
/** https://bitgoinc.atlassian.net/browse/COIN-4213 */
123124
throw new Error('Method not implemented.');
124125
}
125126
}

modules/sdk-coin-xlm/src/xlm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,8 @@ export class Xlm extends BaseCoin {
11991199
try {
12001200
xlmKeyPair = new StellarKeyPair({ prv });
12011201
} catch (e) {
1202-
throw new Error('Invalid private key');
1202+
// Avoid adding the error message to the thrown error because it can contain sensitive information
1203+
throw new Error(`Invalid private key: Unable to generate keypair from prv`);
12031204
}
12041205

12051206
if (publicKey && publicKey !== xlmKeyPair.getKeys().pub) {

modules/sdk-coin-xlm/test/unit/xlm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ describe('XLM:', function () {
11611161
walletPassphrase,
11621162
}),
11631163
{
1164-
message: 'Invalid private key',
1164+
message: 'Invalid private key: Unable to generate keypair from prv',
11651165
}
11661166
);
11671167
});

modules/sdk-core/src/bitgo/baseCoin/baseCoin.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,6 @@ export abstract class BaseCoin implements IBaseCoin {
642642
* @param {string} params.prv - the decrypted private key
643643
* @param {string} params.publicKey - the public key, or common keychain
644644
* @param {string} params.multiSigType - the multi-sig type, if applicable
645-
* @returns {AuditKeyResponse} - result of the audit
646645
*/
647646
abstract auditDecryptedKey(params: AuditDecryptedKeyParams): void;
648647
}

0 commit comments

Comments
 (0)