Skip to content

Commit

Permalink
circular dependancy
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinmetcalf committed Dec 9, 2014
1 parent 1af0e38 commit 1c15e75
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions inject.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var sign = require('./sign');
var verify = require('./verify');
var Writable = require('readable-stream').Writable;
var stream = require('readable-stream');
var inherits = require('inherits');
var algos = require('./algos');
'use strict';
Expand All @@ -15,17 +15,17 @@ module.exports = function (exports, crypto) {
return new Verify(algorithm, crypto);
}
};
inherits(Sign, Writable);
inherits(Sign, stream.Writable);
function Sign(algorithm, crypto) {
Writable.call(this);
stream.Writable.call(this);
var data = algos[algorithm];
if (!data) {
throw new Error('Unknown message digest');
}
this._hash = crypto.createHash(data.hash);
this._tag = data.id;
this._crypto = crypto;
};
}
Sign.prototype._write = function _write(data, _, done) {
this._hash.update(data);
done();
Expand All @@ -45,16 +45,16 @@ Sign.prototype.sign = function signMethod(key, enc) {
return sig;
};

inherits(Verify, Writable);
inherits(Verify, stream.Writable);
function Verify(algorithm, crypto) {
Writable.call(this);
stream.Writable.call(this);
var data = algos[algorithm];
if (!data) {
throw new Error('Unknown message digest');
}
this._hash = crypto.createHash(data.hash);
this._tag = data.id;
};
}
Verify.prototype._write = function _write(data, _, done) {
this._hash.update(data);
done();
Expand Down

0 comments on commit 1c15e75

Please sign in to comment.