Browse Source

use strict to extras

patch-2
Manuel Araoz 10 years ago
parent
commit
7650b35482
  1. 6
      lib/extra/identity.js
  2. 22
      lib/extra/message.js

6
lib/extra/identity.js

@ -1,6 +1,8 @@
var base58check = require('./base58check');
'use strict';
var base58check = require('../protocol/base58check');
var constants = require('./constants');
var Hash = require('./hash');
var Hash = require('../crypto/hash');
/**

22
lib/extra/message.js

@ -1,9 +1,11 @@
'use strict';
var ECDSA = require('./ecdsa');
var Keypair = require('./keypair');
var BufferWriter = require('./bufferwriter');
var Hash = require('./hash');
var Address = require('./address');
var Signature = require('./signature');
var Keypair = require('../keypair');
var BufferWriter = require('../protocol/bufferwriter');
var Hash = require('../crypto/hash');
var Address = require('../address');
var Signature = require('../signature');
var Message = function Message(obj) {
if (!(this instanceof Message))
@ -39,7 +41,10 @@ Message.magicHash = function(messagebuf) {
};
Message.sign = function(messagebuf, keypair) {
var m = Message({messagebuf: messagebuf, keypair: keypair});
var m = Message({
messagebuf: messagebuf,
keypair: keypair
});
m.sign();
var sigbuf = m.sig.toCompact();
var sigstr = sigbuf.toString('base64');
@ -58,7 +63,10 @@ Message.verify = function(messagebuf, sigstr, address) {
Message.prototype.sign = function() {
var hashbuf = Message.magicHash(this.messagebuf);
var ecdsa = ECDSA({hashbuf: hashbuf, keypair: this.keypair});
var ecdsa = ECDSA({
hashbuf: hashbuf,
keypair: this.keypair
});
ecdsa.signRandomK();
ecdsa.calci();
this.sig = ecdsa.sig;

Loading…
Cancel
Save