Skip to content

Commit bc9b5ab

Browse files
committed
Throw Error if no private key found when calling toWIF()
1 parent 62bb17b commit bc9b5ab

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/ecpair.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ describe('ECPair', () => {
146146
assert.strictEqual(result, f.WIF);
147147
});
148148
});
149+
it('throws if no private key is found', () => {
150+
assert.throws(() => {
151+
const keyPair = ECPair.makeRandom();
152+
delete (keyPair as any).__D;
153+
keyPair.toWIF();
154+
}, /Missing private key/);
155+
});
149156
});
150157

151158
describe('makeRandom', () => {

0 commit comments

Comments
 (0)