Skip to content

Commit

Permalink
Add test for convertKeyPair with invalid key
Browse files Browse the repository at this point in the history
  • Loading branch information
dchest committed Dec 21, 2016
1 parent cf227db commit 5398dd6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,16 @@ test('ed2curve.convertPublicKey (invalid key)', function(t) {
t.equal(pk, null);
t.end();
});


test('ed2curve.convertKeyPair (invalid key)', function(t) {
var invalidKey = new Uint8Array(32);
for (var i = 0; i < 31; i++) invalidKey[i] = 0xff;
var keyPair = {
publicKey: invalidKey,
privateKey: new Uint8Array(32) // doesn't matter
}
var convertedKeyPair = ed2curve.convertKeyPair(keyPair);
t.equal(convertedKeyPair, null);
t.end();
});

0 comments on commit 5398dd6

Please sign in to comment.