From 81be8bbcdaedc92d4c58828a02b5798311596844 Mon Sep 17 00:00:00 2001 From: earonesty Date: Thu, 9 Aug 2018 11:20:21 -0400 Subject: [PATCH] Update key-encoder.js Without this, it's possible for asn1 to use one definition of Buffer and key-encoder to use another. --- lib/key-encoder.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/key-encoder.js b/lib/key-encoder.js index 286e522..4e82651 100644 --- a/lib/key-encoder.js +++ b/lib/key-encoder.js @@ -4,6 +4,9 @@ var asn1 = require('asn1.js'), BN = require('bn.js'), EC = require('elliptic').ec +// compatibility with asn1 +const Buffer = require('buffer').Buffer; + var ECPrivateKeyASN = asn1.define('ECPrivateKey', function() { this.seq().obj( this.key('version').int(), @@ -160,4 +163,4 @@ KeyEncoder.prototype.encodePublic = function(publicKey, originalFormat, destinat } } -module.exports = KeyEncoder \ No newline at end of file +module.exports = KeyEncoder