types: enforce consistent type checking

This commit is contained in:
Daniel Cousens 2014-09-15 14:21:01 +10:00
parent 166053a3e5
commit 35542e115d
10 changed files with 99 additions and 44 deletions

View file

@ -1,9 +1,12 @@
var assert = require('assert')
var enforceType = require('./types')
var BigInteger = require('bigi')
function ECSignature(r, s) {
assert(r instanceof BigInteger, 'Expected BigInteger, got ' + r)
assert(s instanceof BigInteger, 'Expected BigInteger, got ' + s)
enforceType(BigInteger, r)
enforceType(BigInteger, s)
this.r = r
this.s = s
}