tests: verify ECPair loops until within interval
This commit is contained in:
parent
610f342707
commit
f11cce0710
1 changed files with 10 additions and 0 deletions
|
@ -169,6 +169,16 @@ describe('ECPair', function () {
|
||||||
|
|
||||||
assert.strictEqual(keyPair.toWIF(), exWIF)
|
assert.strictEqual(keyPair.toWIF(), exWIF)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('loops until d is within interval [1, n - 1]', sinon.test(function () {
|
||||||
|
var rng = this.mock()
|
||||||
|
rng.exactly(3)
|
||||||
|
rng.onCall(0).returns(new BigInteger('0').toBuffer(32)) // < 1
|
||||||
|
rng.onCall(1).returns(curve.n.toBuffer(32)) // > n-1
|
||||||
|
rng.onCall(2).returns(new BigInteger('42').toBuffer(32)) // valid
|
||||||
|
|
||||||
|
ECPair.makeRandom({ rng: rng })
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getAddress', function () {
|
describe('getAddress', function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue