etkframework
Version:
First test release of Etk over colored coins SDK
2 lines • 388 kB
JavaScript
!function e(t,r,i){function n(f,a){if(!r[f]){if(!t[f]){var s="function"==typeof require&&require;if(!a&&s)return s(f,!0);if(o)return o(f,!0);var c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[f]={exports:{}};t[f][0].call(u.exports,function(e){var r=t[f][1][e];return n(r?r:e)},u,u.exports,e,t,r,i)}return r[f].exports}for(var o="function"==typeof require&&require,f=0;f<i.length;f++)n(i[f]);return n}({1:[function(e,t,r){"use strict";var i=e("bip38"),n=new i,o=function(e,t,r){return n.encrypt(e,t,r)},f=function(e,t){return n.decrypt(e,t)};r.bipEncrypt=o,r.bipDecrypt=f},{bip38:27}],2:[function(e,t,r){(function(t){"use strict";var i=e("crypto"),n=e("pbkdf2-sha256"),o="aes-256-ctr",f=4096,a=32,s=(i.randomBytes(32),function(e,r){r=r||16;for(var i=0,n=e.length;32-n>i;i++)e+=e[i];return new t(e).slice(0,r)}),c=function(e,t,r,s,c){var u;try{var h=n(e,s.toString("ascii"),f,a),d=i.createCipheriv(o,h,r),l=d.update(t,"utf8","hex")+d["final"]("hex");c(u,l,r)}catch(p){u=p,c(u,null,null)}},u=function(e,t,r,s,c){var u=void 0,h=n(e,t.toString("ascii"),f,a);try{if(r===h&&h===s&&null===s)throw Error("Null Values");var d=i.createDecipheriv(o,h,s),l=d.update(r,"hex","utf8")+d["final"]("utf8");c(u,l)}catch(p){c(u,null)}},h=function(e,t){var r=i.createCipher(o,t),n=r.update(e,"utf8","hex")+r["final"]("hex");return n},d=function(e,t){var r=i.createDecipher(o,t),n=r.update(e,"hex","utf8")+r["final"]("utf8");return n};r.hashedLen=s,r.encrypt=c,r.decrypt=u,r.hashCipherText=h,r.dehashCipherText=d}).call(this,e("buffer").Buffer)},{buffer:58,crypto:68,"pbkdf2-sha256":140}],3:[function(e,t,r){"use strict";var i=e("scryptsy"),n=16384,o=8,f=2,a=64,s=function(e,t){var r=i(e,t,n,o,f,a);return r=r.toString("hex")},c=function(){return{init:function(){this.acc=[],this.salt},push:function(e){this.acc.push(e),this._mergeHash()},_mergeHash:function(){this.acc.length>=2&&(this.salt=s(this.acc[0],this.acc[1]),this.acc.push(this.hash()))},unshift:function(e){this.acc.unshift(e),this._mergeHash()},hash:function(){return this.acc.splice(0,this.acc.length),this.salt}}}(),u=function(){if(!(arguments.length>1))throw Error("Not enough arguments. Inputs absent");for(var e=[],t="",r=Object.create(c),i=0,n=arguments.length;n>i;i++)e.push(arguments[i]);t=e[0],r.init(),e.slice(1).forEach(function(e,t){r.push(e)}),r.unshift(t);var o=r.hash();return o};r.savePass=s,r.compoundFunctionConstructor=c,r.compoundedSalt=u},{scryptsy:163}],4:[function(e,t,r){"use strict";var i=e("./passCrypt").compoundedSalt,n=e("./wifCrypto").pvtKeyWIFEncode,o=e("./wifCrypto").pvtKeyWIFDecode,f=e("./kdfCrypt").hashedLen,a=e("./kdfCrypt").encrypt,s=e("./kdfCrypt").hashCipherText,c=e("./bipCrypt").bipEncrypt,u=e("./bipCrypt").bipDecrypt,h=function(e,t,r,o,u,h,d){u.unshift(e),h.unshift(e);var l=f(s(e,i.apply(this,u))),p=f(s(e,i.apply(this,h))),b=n(r);a(e,o,l,p,function(e,r,i){if(e)throw Error(e);var n=s(r,i),o=c(b,n,t);d(o)})},d=function(e,t,r,n,c,h){n.unshift(e),c.unshift(e);var d=f(s(e,i.apply(this,n))),l=f(s(e,i.apply(this,c)));a(e,t,d,l,function(e,t,i){if(e)throw Error(e);var n=s(t,i),f=u(r,n),a=o(f);h(a)})};r.pvtKeyEnc=h,r.pvtKeyDec=d},{"./bipCrypt":1,"./kdfCrypt":2,"./passCrypt":3,"./wifCrypto":6}],5:[function(e,t,r){"use strict";var i=e("./passCrypt").compoundedSalt,n=e("./kdfCrypt").hashCipherText,o=e("./kdfCrypt").hashedLen,f=e("./kdfCrypt").encrypt,a=e("./kdfCrypt").decrypt,s=function(e,t,r,a,s){r.unshift(e),a.unshift(e);var c=o(n(e,i.apply(this,r))),u=o(n(e,i.apply(this,a)));f(e,t,c,u,function(e,t,r){if(e)throw Error(e);s(t,r)})},c=function(e,t,r,f,s){f.unshift(e);var c=o(n(e,i.apply(this,f)));a(e,c,t,r,function(e,t){if(e)throw Error(e);s(t.toString("utf8"))})};r.encryptSeed=s,r.decryptSeed=c},{"./kdfCrypt":2,"./passCrypt":3}],6:[function(e,t,r){(function(t){"use strict";var i=e("coinstring"),n=function(e,t){return i.decode(e,t||128).toString("hex")},o=function(e,r){return i.encode(new t(e,"hex"),r||128)};r.pvtKeyWIFDecode=n,r.pvtKeyWIFEncode=o}).call(this,e("buffer").Buffer)},{buffer:58,coinstring:61}],7:[function(e,t,r){var i=r;i.bignum=e("bn.js"),i.define=e("./asn1/api").define,i.base=e("./asn1/base"),i.constants=e("./asn1/constants"),i.decoders=e("./asn1/decoders"),i.encoders=e("./asn1/encoders")},{"./asn1/api":8,"./asn1/base":10,"./asn1/constants":14,"./asn1/decoders":16,"./asn1/encoders":19,"bn.js":28}],8:[function(e,t,r){function i(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}var n=e("../asn1"),o=e("inherits"),f=r;f.define=function(e,t){return new i(e,t)},i.prototype._createNamed=function(t){var r;try{r=e("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(i){r=function(e){this._initNamed(e)}}return o(r,t),r.prototype._initNamed=function(e){t.call(this,e)},new r(this)},i.prototype._getDecoder=function(e){return this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n.decoders[e])),this.decoders[e]},i.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},i.prototype._getEncoder=function(e){return this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n.encoders[e])),this.encoders[e]},i.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},{"../asn1":7,inherits:125,vm:186}],9:[function(e,t,r){function i(e,t){return f.call(this,t),a.isBuffer(e)?(this.base=e,this.offset=0,void(this.length=e.length)):void this.error("Input not Buffer")}function n(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof n||(e=new n(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(e>=0&&255>=e))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=a.byteLength(e);else{if(!a.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}var o=e("inherits"),f=e("../base").Reporter,a=e("buffer").Buffer;o(i,f),r.DecoderBuffer=i,i.prototype.save=function(){return{offset:this.offset,reporter:f.prototype.save.call(this)}},i.prototype.restore=function(e){var t=new i(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,f.prototype.restore.call(this,e.reporter),t},i.prototype.isEmpty=function(){return this.offset===this.length},i.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},i.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new i(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},i.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=n,n.prototype.join=function(e,t){return e||(e=new a(this.length)),t||(t=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):a.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},{"../base":10,buffer:58,inherits:125}],10:[function(e,t,r){var i=r;i.Reporter=e("./reporter").Reporter,i.DecoderBuffer=e("./buffer").DecoderBuffer,i.EncoderBuffer=e("./buffer").EncoderBuffer,i.Node=e("./node")},{"./buffer":9,"./node":11,"./reporter":12}],11:[function(e,t,r){function i(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r["default"]=null,r.explicit=null,r.implicit=null,r.parent||(r.children=[],this._wrap())}var n=e("../base").Reporter,o=e("../base").EncoderBuffer,f=e("minimalistic-assert"),a=["seq","seqof","set","setof","octstr","bitstr","objid","bool","gentime","utctime","null_","enum","int","ia5str","utf8str","bmpstr","numstr","printstr"],s=["key","obj","use","optional","explicit","implicit","def","choice","any"].concat(a),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];t.exports=i;var u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit"];i.prototype.clone=function(){var e=this._baseState,t={};u.forEach(function(r){t[r]=e[r]});var r=new this.constructor(t.parent);return r._baseState=t,r},i.prototype._wrap=function(){var e=this._baseState;s.forEach(function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},i.prototype._init=function(e){var t=this._baseState;f(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),f.equal(t.children.length,1,"Root node can have only one child")},i.prototype._useArgs=function(e){var t=this._baseState,r=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(f(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(f(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);var i=e[r];t[i]=r}),t}))},c.forEach(function(e){i.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),a.forEach(function(e){i.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return f(null===t.tag),t.tag=e,this._useArgs(r),this}}),i.prototype.use=function(e){var t=this._baseState;return f(null===t.use),t.use=e,this},i.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this},i.prototype.def=function(e){var t=this._baseState;return f(null===t["default"]),t["default"]=e,t.optional=!0,this},i.prototype.explicit=function(e){var t=this._baseState;return f(null===t.explicit&&null===t.implicit),t.explicit=e,this},i.prototype.implicit=function(e){var t=this._baseState;return f(null===t.explicit&&null===t.implicit),t.implicit=e,this},i.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},i.prototype.key=function(e){var t=this._baseState;return f(null===t.key),t.key=e,this},i.prototype.any=function(){var e=this._baseState;return e.any=!0,this},i.prototype.choice=function(e){var t=this._baseState;return f(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},i.prototype._decode=function(e){var t=this._baseState;if(null===t.parent)return e.wrapResult(t.children[0]._decode(e));var r,i=t["default"],n=!0;if(null!==t.key&&(r=e.enterKey(t.key)),t.optional){var o=null;if(null!==t.explicit?o=t.explicit:null!==t.implicit?o=t.implicit:null!==t.tag&&(o=t.tag),null!==o||t.any){if(n=this._peekTag(e,o,t.any),e.isError(n))return n}else{var f=e.save();try{null===t.choice?this._decodeGeneric(t.tag,e):this._decodeChoice(e),n=!0}catch(a){n=!1}e.restore(f)}}var s;if(t.obj&&n&&(s=e.enterObject()),n){if(null!==t.explicit){var c=this._decodeTag(e,t.explicit);if(e.isError(c))return c;e=c}if(null===t.use&&null===t.choice){if(t.any)var f=e.save();var u=this._decodeTag(e,null!==t.implicit?t.implicit:t.tag,t.any);if(e.isError(u))return u;t.any?i=e.raw(f):e=u}if(i=t.any?i:null===t.choice?this._decodeGeneric(t.tag,e):this._decodeChoice(e),e.isError(i))return i;if(!t.any&&null===t.choice&&null!==t.children){var h=t.children.some(function(t){t._decode(e)});if(h)return err}}return t.obj&&n&&(i=e.leaveObject(s)),null===t.key||null===i&&n!==!0||e.leaveKey(r,t.key,i),i},i.prototype._decodeGeneric=function(e,t){var r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0]):"octstr"===e||"bitstr"===e?this._decodeStr(t,e):"ia5str"===e||"utf8str"===e||"bmpstr"===e?this._decodeStr(t,e):"numstr"===e||"printstr"===e?this._decodeStr(t,e):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1]):"objid"===e?this._decodeObjid(t,null,null):"gentime"===e||"utctime"===e?this._decodeTime(t,e):"null_"===e?this._decodeNull(t):"bool"===e?this._decodeBool(t):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0]):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t):t.error("unknown tag: "+e)},i.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),f(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},i.prototype._decodeChoice=function(e){var t=this._baseState,r=null,i=!1;return Object.keys(t.choice).some(function(n){var o=e.save(),f=t.choice[n];try{var a=f._decode(e);if(e.isError(a))return!1;r={type:n,value:a},i=!0}catch(s){return e.restore(o),!1}return!0},this),i?r:e.error("Choice not matched")},i.prototype._createEncoderBuffer=function(e){return new o(e,this.reporter)},i.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i["default"]||i["default"]!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},i.prototype._encodeValue=function(e,t,r){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);var o=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i["default"])return;e=i["default"]}var f=null,a=!1;if(i.any)o=this._createEncoderBuffer(e);else if(i.choice)o=this._encodeChoice(e,t);else if(i.children)f=i.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n},this).filter(function(e){return e}),f=this._createEncoderBuffer(f);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var s=this.clone();s._baseState.implicit=null,f=this._createEncoderBuffer(e.map(function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)},s))}else null!==i.use?o=this._getUse(i.use,r)._encode(e,t):(f=this._encodePrimitive(i.tag,e),a=!0);var o;if(!i.any&&null===i.choice){var c=null!==i.implicit?i.implicit:i.tag,u=null===i.implicit?"universal":"context";null===c?null===i.use&&t.error("Tag could be ommited only for .use()"):null===i.use&&(o=this._encodeComposite(c,a,u,f))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},i.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||f(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},i.prototype._encodePrimitive=function(e,t){var r=this._baseState;if("octstr"===e||"bitstr"===e||"ia5str"===e)return this._encodeStr(t,e);if("utf8str"===e||"bmpstr"===e)return this._encodeStr(t,e);if("numstr"===e||"printstr"===e)return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);throw new Error("Unsupported tag: "+e)},i.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},i.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":10,"minimalistic-assert":131}],12:[function(e,t,r){function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function n(e,t){this.path=e,this.rethrow(t)}var o=e("inherits");r.Reporter=i,i.prototype.isError=function(e){return e instanceof n},i.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.leaveKey=function(e,t,r){var i=this._reporterState;i.path=i.path.slice(0,e-1),null!==i.obj&&(i.obj[t]=r)},i.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof n;if(t=i?e:new n(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},i.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},o(n,Error),n.prototype.rethrow=function(e){return this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace(this,n),this}},{inherits:125}],13:[function(e,t,r){var i=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=i._reverse(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=i._reverse(r.tag)},{"../constants":14}],14:[function(e,t,r){var i=r;i._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r=0|r);var i=e[r];t[i]=r}),t},i.der=e("./der")},{"./der":13}],15:[function(e,t,r){function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new n,this.tree._init(e.body)}function n(e){c.Node.call(this,"der",e)}function o(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=h.tagClass[r>>6],n=0===(32&r);if(31===(31&r)){var o=r;for(r=0;128===(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;var f=h.tag[r];return{cls:i,primitive:n,tag:r,tagStr:f}}function f(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if(0===(128&i))return i;var n=127&i;if(n>=4)return e.error("length octect is too long");i=0;for(var o=0;n>o;o++){i<<=8;var f=e.readUInt8(r);if(e.isError(f))return f;i|=f}return i}var a=e("inherits"),s=e("../../asn1"),c=s.base,u=s.bignum,h=s.constants.der;t.exports=i,i.prototype.decode=function(e,t){return e instanceof c.DecoderBuffer||(e=new c.DecoderBuffer(e,t)),this.tree._decode(e,t)},a(n,c.Node),n.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var i=e.save(),n=o(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(i),n.tag===t||n.tagStr===t||r)},n.prototype._decodeTag=function(e,t,r){var i=o(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var n=f(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var a=e.save(),s=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(s)?s:(n=e.offset-a.offset,e.restore(a),e.skip(n,'Failed to match body of: "'+t+'"'))},n.prototype._skipUntilEnd=function(e,t){for(;;){var r=o(e,t);if(e.isError(r))return r;var i=f(e,r.primitive,t);if(e.isError(i))return i;var n;if(n=r.primitive||null!==i?e.skip(i):this._skipUntilEnd(e,t),e.isError(n))return n;if("end"===r.tagStr)break}},n.prototype._decodeList=function(e,t,r){for(var i=[];!e.isEmpty();){var n=this._peekTag(e,"end");if(e.isError(n))return n;var o=r.decode(e,"der");if(e.isError(o)&&n)break;i.push(o)}return i},n.prototype._decodeStr=function(e,t){if("octstr"===t)return e.raw();if("bitstr"===t){var r=e.readUInt8();return e.isError(r)?r:{unused:r,data:e.raw()}}if("ia5str"===t||"utf8str"===t)return e.raw().toString();if("numstr"===t){var i=e.raw().toString("ascii");return this._isNumstr(i)?i:e.error("Decoding of string type: numstr unsupported characters")}if("printstr"===t){var n=e.raw().toString("ascii");return this._isPrintstr(n)?n:e.error("Decoding of string type: printstr unsupported characters")}if("bmpstr"===t){var o=e.raw();if(o.length%2===1)return e.error("Decoding of string type: bmpstr length mismatch");for(var f="",a=0;a<o.length/2;a++)f+=String.fromCharCode(o.readUInt16BE(2*a));return f}return e.error("Decoding of string type: "+t+" unsupported")},n.prototype._decodeObjid=function(e,t,r){for(var i=[],n=0;!e.isEmpty();){var o=e.readUInt8();n<<=7,n|=127&o,0===(128&o)&&(i.push(n),n=0)}128&o&&i.push(n);var f=i[0]/40|0,a=i[0]%40;if(r?result=i:result=[f,a].concat(i.slice(1)),t){var s=t[result.join(" ")];void 0===s&&(s=t[result.join(".")]),void 0!==s&&(result=s)}return result},n.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var i=0|r.slice(0,4),n=0|r.slice(4,6),o=0|r.slice(6,8),f=0|r.slice(8,10),a=0|r.slice(10,12),s=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");var i=0|r.slice(0,2),n=0|r.slice(2,4),o=0|r.slice(4,6),f=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12);i=70>i?2e3+i:1900+i}return Date.UTC(i,n-1,o,f,a,s,0)},n.prototype._decodeNull=function(e){return null},n.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},n.prototype._decodeInt=function(e,t){var r=e.raw(),i=new u(r);return t&&(i=t[i.toString(10)]||i),i},n.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":7,inherits:125}],16:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":15,"./pem":17}],17:[function(e,t,r){function i(e){f.call(this,e),this.enc="pem"}var n=e("inherits"),o=e("buffer").Buffer,f=(e("../../asn1"),e("./der"));n(i,f),t.exports=i,i.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),n=/^-----(BEGIN|END) ([^-]+)-----$/,a=-1,s=-1,c=0;c<r.length;c++){var u=r[c].match(n);if(null!==u&&u[2]===i){if(-1!==a){if("END"!==u[1])break;s=c;break}if("BEGIN"!==u[1])break;a=c}}if(-1===a||-1===s)throw new Error("PEM section not found for: "+i);var h=r.slice(a+1,s).join("");h.replace(/[^a-z0-9\+\/=]+/gi,"");var d=new o(h,"base64");return f.prototype.decode.call(this,d,t)}},{"../../asn1":7,"./der":15,buffer:58,inherits:125}],18:[function(e,t,r){function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new n,this.tree._init(e.body)}function n(e){u.Node.call(this,"der",e)}function o(e){return 10>e?"0"+e:e}function f(e,t,r,i){var n;if("seqof"===e?e="seq":"setof"===e&&(e="set"),h.tagByName.hasOwnProperty(e))n=h.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);n=e}return n>=31?i.error("Multi-octet tag encoding unsupported"):(t||(n|=32),n|=h.tagClassByName[r||"universal"]<<6)}var a=e("inherits"),s=e("buffer").Buffer,c=e("../../asn1"),u=c.base,h=(c.bignum,c.constants.der);t.exports=i,i.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},a(n,u.Node),n.prototype._encodeComposite=function(e,t,r,i){var n=f(e,t,r,this.reporter);if(i.length<128){var o=new s(2);return o[0]=n,o[1]=i.length,this._createEncoderBuffer([o,i])}for(var a=1,c=i.length;c>=256;c>>=8)a++;var o=new s(2+a);o[0]=n,o[1]=128|a;for(var c=1+a,u=i.length;u>0;c--,u>>=8)o[c]=255&u;return this._createEncoderBuffer([o,i])},n.prototype._encodeStr=function(e,t){if("octstr"===t)return this._createEncoderBuffer(e);if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("ia5str"===t||"utf8str"===t)return this._createEncoderBuffer(e);if("bmpstr"===t){for(var r=new s(2*e.length),i=0;i<e.length;i++)r.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):this.reporter.error("Encoding of string type: "+t+" unsupported")},n.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(var i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}for(var n=0,i=0;i<e.length;i++){var o=e[i];for(n++;o>=128;o>>=7)n++}for(var f=new s(n),a=f.length-1,i=e.length-1;i>=0;i--){var o=e[i];for(f[a--]=127&o;(o>>=7)>0;)f[a--]=128|127&o}return this._createEncoderBuffer(f)},n.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[o(i.getFullYear()),o(i.getUTCMonth()+1),o(i.getUTCDate()),o(i.getUTCHours()),o(i.getUTCMinutes()),o(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[o(i.getFullYear()%100),o(i.getUTCMonth()+1),o(i.getUTCDate()),o(i.getUTCHours()),o(i.getUTCMinutes()),o(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},n.prototype._encodeNull=function(){return this._createEncoderBuffer("")},n.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!s.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new s(r)}if(s.isBuffer(e)){var i=e.length;0===e.length&&i++;var n=new s(i);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(128>e)return this._createEncoderBuffer(e);if(256>e)return this._createEncoderBuffer([0,e]);for(var i=1,o=e;o>=256;o>>=8)i++;for(var n=new Array(i),o=n.length-1;o>=0;o--)n[o]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(new s(n))},n.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},n.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},n.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n["default"])return!1;var o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n["default"],t,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},{"../../asn1":7,buffer:58,inherits:125}],19:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":18,"./pem":20}],20:[function(e,t,r){function i(e){o.call(this,e),this.enc="pem"}var n=e("inherits"),o=(e("buffer").Buffer,e("../../asn1"),e("./der"));n(i,o),t.exports=i,i.prototype.encode=function(e,t){for(var r=o.prototype.encode.call(this,e),i=r.toString("base64"),n=["-----BEGIN "+t.label+"-----"],f=0;f<i.length;f+=64)n.push(i.slice(f,f+64));return n.push("-----END "+t.label+"-----"),n.join("\n")}},{"../../asn1":7,"./der":18,buffer:58,inherits:125}],21:[function(e,t,r){function i(e,t){return l.isUndefined(t)?""+t:l.isNumber(t)&&!isFinite(t)?t.toString():l.isFunction(t)||l.isRegExp(t)?t.toString():t}function n(e,t){return l.isString(e)?e.length<t?e:e.slice(0,t):e}function o(e){return n(JSON.stringify(e.actual,i),128)+" "+e.operator+" "+n(JSON.stringify(e.expected,i),128)}function f(e,t,r,i,n){throw new v.AssertionError({message:r,actual:e,expected:t,operator:i,stackStartFunction:n})}function a(e,t){e||f(e,!0,t,"==",v.ok)}function s(e,t){if(e===t)return!0;if(l.isBuffer(e)&&l.isBuffer(t)){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return l.isDate(e)&&l.isDate(t)?e.getTime()===t.getTime():l.isRegExp(e)&&l.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:l.isObject(e)||l.isObject(t)?u(e,t):e==t}function c(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function u(e,t){if(l.isNullOrUndefined(e)||l.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(l.isPrimitive(e)||l.isPrimitive(t))return e===t;var r=c(e),i=c(t);if(r&&!i||!r&&i)return!1;if(r)return e=p.call(e),t=p.call(t),s(e,t);var n,o,f=g(e),a=g(t);if(f.length!=a.length)return!1;for(f.sort(),a.sort(),o=f.length-1;o>=0;o--)if(f[o]!=a[o])return!1;for(o=f.length-1;o>=0;o--)if(n=f[o],!s(e[n],t[n]))return!1;return!0}function h(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1:!1}function d(e,t,r,i){var n;l.isString(r)&&(i=r,r=null);try{t()}catch(o){n=o}if(i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),e&&!n&&f(n,r,"Missing expected exception"+i),!e&&h(n,r)&&f(n,r,"Got unwanted exception"+i),e&&n&&r&&!h(n,r)||!e&&n)throw n}var l=e("util/"),p=Array.prototype.slice,b=Object.prototype.hasOwnProperty,v=t.exports=a;v.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=o(this),this.generatedMessage=!0);var t=e.stackStartFunction||f;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var i=r.stack,n=t.name,a=i.indexOf("\n"+n);if(a>=0){var s=i.indexOf("\n",a+1);i=i.substring(s+1)}this.stack=i}}},l.inherits(v.AssertionError,Error),v.fail=f,v.ok=a,v.equal=function(e,t,r){e!=t&&f(e,t,r,"==",v.equal)},v.notEqual=function(e,t,r){e==t&&f(e,t,r,"!=",v.notEqual)},v.deepEqual=function(e,t,r){s(e,t)||f(e,t,r,"deepEqual",v.deepEqual)},v.notDeepEqual=function(e,t,r){s(e,t)&&f(e,t,r,"notDeepEqual",v.notDeepEqual)},v.strictEqual=function(e,t,r){e!==t&&f(e,t,r,"===",v.strictEqual)},v.notStrictEqual=function(e,t,r){e===t&&f(e,t,r,"!==",v.notStrictEqual)},v["throws"]=function(e,t,r){d.apply(this,[!0].concat(p.call(arguments)))},v.doesNotThrow=function(e,t){d.apply(this,[!1].concat(p.call(arguments)))},v.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var r in e)b.call(e,r)&&t.push(r);return t}},{"util/":185}],22:[function(e,t,r){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===f||t===h?62:t===a||t===d?63:s>t?-1:s+10>t?t-s+26+26:u+26>t?t-u:c+26>t?t-c+26:void 0}function r(e){function r(e){c[h++]=e}var i,n,f,a,s,c;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=e.length;s="="===e.charAt(u-2)?2:"="===e.charAt(u-1)?1:0,c=new o(3*e.length/4-s),f=s>0?e.length-4:e.length;var h=0;for(i=0,n=0;f>i;i+=4,n+=3)a=t(e.charAt(i))<<18|t(e.charAt(i+1))<<12|t(e.charAt(i+2))<<6|t(e.charAt(i+3)),r((16711680&a)>>16),r((65280&a)>>8),r(255&a);return 2===s?(a=t(e.charAt(i))<<2|t(e.charAt(i+1))>>4,r(255&a)):1===s&&(a=t(e.charAt(i))<<10|t(e.charAt(i+1))<<4|t(e.charAt(i+2))>>2,r(a>>8&255),r(255&a)),c}function n(e){function t(e){return i.charAt(e)}function r(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var n,o,f,a=e.length%3,s="";for(n=0,f=e.length-a;f>n;n+=3)o=(e[n]<<16)+(e[n+1]<<8)+e[n+2],s+=r(o);switch(a){case 1:o=e[e.length-1],s+=t(o>>2),s+=t(o<<4&63),s+="==";break;
case 2:o=(e[e.length-2]<<8)+e[e.length-1],s+=t(o>>10),s+=t(o>>4&63),s+=t(o<<2&63),s+="="}return s}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,f="+".charCodeAt(0),a="/".charCodeAt(0),s="0".charCodeAt(0),c="a".charCodeAt(0),u="A".charCodeAt(0),h="-".charCodeAt(0),d="_".charCodeAt(0);e.toByteArray=r,e.fromByteArray=n}("undefined"==typeof r?this.base64js={}:r)},{}],23:[function(e,t,r){function i(e,t,r){return this instanceof i?void(null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))):new i(e,t,r)}function n(e,t,r,i,n,o){for(;--o>=0;){var f=t*this[e++]+r[i]+n;n=Math.floor(f/67108864),r[i++]=67108863&f}return n}function o(e){return ot.charAt(e)}function f(e,t){var r=ft[e.charCodeAt(t)];return null==r?-1:r}function a(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function s(e){this.t=1,this.s=0>e?-1:0,e>0?this[0]=e:-1>e?this[0]=e+tt:this.t=0}function c(e){var t=new i;return t.fromInt(e),t}function u(e,t){var r,n=this;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void n.fromRadix(e,t);r=2}n.t=0,n.s=0;for(var o=e.length,a=!1,s=0;--o>=0;){var c=8==r?255&e[o]:f(e,o);0>c?"-"==e.charAt(o)&&(a=!0):(a=!1,0==s?n[n.t++]=c:s+r>n.DB?(n[n.t-1]|=(c&(1<<n.DB-s)-1)<<s,n[n.t++]=c>>n.DB-s):n[n.t-1]|=c<<s,s+=r,s>=n.DB&&(s-=n.DB))}8==r&&0!=(128&e[0])&&(n.s=-1,s>0&&(n[n.t-1]|=(1<<n.DB-s)-1<<s)),n.clamp(),a&&i.ZERO.subTo(n,n)}function h(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function d(e){var t=this;if(t.s<0)return"-"+t.negate().toString(e);var r;if(16==e)r=4;else if(8==e)r=3;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return t.toRadix(e);r=2}var i,n=(1<<r)-1,f=!1,a="",s=t.t,c=t.DB-s*t.DB%r;if(s-- >0)for(c<t.DB&&(i=t[s]>>c)>0&&(f=!0,a=o(i));s>=0;)r>c?(i=(t[s]&(1<<c)-1)<<r-c,i|=t[--s]>>(c+=t.DB-r)):(i=t[s]>>(c-=r)&n,0>=c&&(c+=t.DB,--s)),i>0&&(f=!0),f&&(a+=o(i));return f?a:"0"}function l(){var e=new i;return i.ZERO.subTo(this,e),e}function p(){return this.s<0?this.negate():this}function b(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(t=r-e.t,0!=t)return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0}function v(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function g(){return this.t<=0?0:this.DB*(this.t-1)+v(this[this.t-1]^this.s&this.DM)}function y(){return this.bitLength()>>3}function m(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function w(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function _(e,t){var r,i=this,n=e%i.DB,o=i.DB-n,f=(1<<o)-1,a=Math.floor(e/i.DB),s=i.s<<n&i.DM;for(r=i.t-1;r>=0;--r)t[r+a+1]=i[r]>>o|s,s=(i[r]&f)<<n;for(r=a-1;r>=0;--r)t[r]=0;t[a]=s,t.t=i.t+a+1,t.s=i.s,t.clamp()}function S(e,t){var r=this;t.s=r.s;var i=Math.floor(e/r.DB);if(i>=r.t)return void(t.t=0);var n=e%r.DB,o=r.DB-n,f=(1<<n)-1;t[0]=r[i]>>n;for(var a=i+1;a<r.t;++a)t[a-i-1]|=(r[a]&f)<<o,t[a-i]=r[a]>>n;n>0&&(t[r.t-i-1]|=(r.s&f)<<o),t.t=r.t-i,t.clamp()}function E(e,t){for(var r=this,i=0,n=0,o=Math.min(e.t,r.t);o>i;)n+=r[i]-e[i],t[i++]=n&r.DM,n>>=r.DB;if(e.t<r.t){for(n-=e.s;i<r.t;)n+=r[i],t[i++]=n&r.DM,n>>=r.DB;n+=r.s}else{for(n+=r.s;i<e.t;)n-=e[i],t[i++]=n&r.DM,n>>=r.DB;n-=e.s}t.s=0>n?-1:0,-1>n?t[i++]=r.DV+n:n>0&&(t[i++]=n),t.t=i,t.clamp()}function M(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t[o]=0;for(o=0;o<n.t;++o)t[o+r.t]=r.am(0,n[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&i.ZERO.subTo(t,t)}function A(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var i=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,i,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var n=this,o=e.abs();if(!(o.t<=0)){var f=n.abs();if(f.t<o.t)return null!=t&&t.fromInt(0),void(null!=r&&n.copyTo(r));null==r&&(r=new i);var a=new i,s=n.s,c=e.s,u=n.DB-v(o[o.t-1]);u>0?(o.lShiftTo(u,a),f.lShiftTo(u,r)):(o.copyTo(a),f.copyTo(r));var h=a.t,d=a[h-1];if(0!=d){var l=d*(1<<n.F1)+(h>1?a[h-2]>>n.F2:0),p=n.FV/l,b=(1<<n.F1)/l,g=1<<n.F2,y=r.t,m=y-h,w=null==t?new i:t;for(a.dlShiftTo(m,w),r.compareTo(w)>=0&&(r[r.t++]=1,r.subTo(w,r)),i.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a[a.t++]=0;for(;--m>=0;){var _=r[--y]==d?n.DM:Math.floor(r[y]*p+(r[y-1]+g)*b);if((r[y]+=a.am(0,_,r,m,0,h))<_)for(a.dlShiftTo(m,w),r.subTo(w,r);r[y]<--_;)r.subTo(w,r)}null!=t&&(r.drShiftTo(h,t),s!=c&&i.ZERO.subTo(t,t)),r.t=h,r.clamp(),u>0&&r.rShiftTo(u,r),0>s&&i.ZERO.subTo(r,r)}}}function x(e){var t=new i;return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(i.ZERO)>0&&e.subTo(t,t),t}function I(e){this.m=e}function B(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function C(e){return e}function j(e){e.divRemTo(this.m,null,e)}function R(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function T(e,t){e.squareTo(t),this.reduce(t)}function P(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function D(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function O(e){var t=new i;return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(i.ZERO)>0&&this.m.subTo(t,t),t}function q(e){var t=new i;return e.copyTo(t),this.reduce(t),t}function L(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],i=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,i,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function z(e,t){e.squareTo(t),this.reduce(t)}function N(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function U(){return 0==(this.t>0?1&this[0]:this.s)}function F(e,t){if(e>4294967295||1>e)return i.ONE;var r=new i,n=new i,o=t.convert(this),f=v(e)-1;for(o.copyTo(r);--f>=0;)if(t.sqrTo(r,n),(e&1<<f)>0)t.mulTo(n,o,r);else{var a=r;r=n,n=a}return t.revert(r)}function K(e,t){var r;return r=256>e||t.isEven()?new I(t):new D(t),this.exp(e,r)}function H(){var e=new i;return this.copyTo(e),e}function V(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Y(){return 0==this.t?this.s:this[0]<<24>>24}function X(){return 0==this.t?this.s:this[0]<<16>>16}function W(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function G(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function J(e){if(null==e&&(e=10),0==this.signum()||2>e||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=c(r),o=new i,f=new i,a="";for(this.divRemTo(n,o,f);o.signum()>0;)a=(r+f.intValue()).toString(e).substr(1)+a,o.divRemTo(n,o,f);return f.intValue().toString(e)+a}function Z(e,t){var r=this;r.fromInt(0),null==t&&(t=10);for(var n=r.chunkSize(t),o=Math.pow(t,n),a=!1,s=0,c=0,u=0;u<e.length;++u){var h=f(e,u);0>h?"-"==e.charAt(u)&&0==r.signum()&&(a=!0):(c=t*c+h,++s>=n&&(r.dMultiply(o),r.dAddOffset(c,0),s=0,c=0))}s>0&&(r.dMultiply(Math.pow(t,s)),r.dAddOffset(c,0)),a&&i.ZERO.subTo(r,r)}function $(e,t,r){var n=this;if("number"==typeof t)if(2>e)n.fromInt(1);else for(n.fromNumber(e,r),n.testBit(e-1)||n.bitwiseTo(i.ONE.shiftLeft(e-1),fe,n),n.isEven()&&n.dAddOffset(1,0);!n.isProbablePrime(t);)n.dAddOffset(2,0),n.bitLength()>e&&n.subTo(i.ONE.shiftLeft(e-1),n);else{var o=new Array,f=7&e;o.length=(e>>3)+1,t.nextBytes(o),f>0?o[0]&=(1<<f)-1:o[0]=0,n.fromString(o,256)}}function Q(){var e=this,t=e.t,r=new Array;r[0]=e.s;var i,n=e.DB-t*e.DB%8,o=0;if(t-- >0)for(n<e.DB&&(i=e[t]>>n)!=(e.s&e.DM)>>n&&(r[o++]=i|e.s<<e.DB-n);t>=0;)8>n?(i=(e[t]&(1<<n)-1)<<8-n,i|=e[--t]>>(n+=e.DB-8)):(i=e[t]>>(n-=8)&255,0>=n&&(n+=e.DB,--t)),0!=(128&i)&&(i|=-256),0===o&&(128&e.s)!=(128&i)&&++o,(o>0||i!=e.s)&&(r[o++]=i);return r}function ee(e){return 0==this.compareTo(e)}function te(e){return this.compareTo(e)<0?this:e}function re(e){return this.compareTo(e)>0?this:e}function ie(e,t,r){var i,n,o=this,f=Math.min(e.t,o.t);for(i=0;f>i;++i)r[i]=t(o[i],e[i]);if(e.t<o.t){for(n=e.s&o.DM,i=f;i<o.t;++i)r[i]=t(o[i],n);r.t=o.t}else{for(n=o.s&o.DM,i=f;i<e.t;++i)r[i]=t(n,e[i]);r.t=e.t}r.s=t(o.s,e.s),r.clamp()}function ne(e,t){return e&t}function oe(e){var t=new i;return this.bitwiseTo(e,ne,t),t}function fe(e,t){return e|t}function ae(e){var t=new i;return this.bitwiseTo(e,fe,t),t}function se(e,t){return e^t}function ce(e){var t=new i;return this.bitwiseTo(e,se,t),t}function ue(e,t){return e&~t}function he(e){var t=new i;return this.bitwiseTo(e,ue,t),t}function de(){for(var e=new i,t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function le(e){var t=new i;return 0>e?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function pe(e){var t=new i;return 0>e?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function be(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function ve(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+be(this[e]);return this.s<0?this.t*this.DB:-1}function ge(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function ye(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=ge(this[r]^t);return e}function me(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)}function we(e,t){var r=i.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function _e(e){return this.changeBit(e,fe)}function Se(e){return this.changeBit(e,ue)}function Ee(e){return this.changeBit(e,se)}function Me(e,t){for(var r=this,i=0,n=0,o=Math.min(e.t,r.t);o>i;)n+=r[i]+e[i],t[i++]=n&r.DM,n>>=r.DB;if(e.t<r.t){for(n+=e.s;i<r.t;)n+=r[i],t[i++]=n&r.DM,n>>=r.DB;n+=r.s}else{for(n+=r.s;i<e.t;)n+=e[i],t[i++]=n&r.DM,n>>=r.DB;n+=e.s}t.s=0>n?-1:0,n>0?t[i++]=n:-1>n&&(t[i++]=r.DV+n),t.t=i,t.clamp()}function Ae(e){var t=new i;return this.addTo(e,t),t}function ke(e){var t=new i;return this.subTo(e,t),t}function xe(e){var t=new i;return this.multiplyTo(e,t),t}function Ie(){var e=new i;return this.squareTo(e),e}function Be(e){var t=new i;return this.divRemTo(e,t,null),t}function Ce(e){var t=new i;return this.divRemTo(e,null,t),t}function je(e){var t=new i,r=new i;return this.divRemTo(e,t,r),new Array(t,r)}function Re(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Te(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function Pe(){}function De(e){return e}function Oe(e,t,r){e.multiplyTo(t,r)}function qe(e,t){e.squareTo(t)}function Le(e){return this.exp(e,new Pe)}function ze(e,t,r){var i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;var n;for(n=r.t-this.t;n>i;++i)r[i+this.t]=this.am(0,e[i],r,i,0,this.t);for(n=Math.min(e.t,t);n>i;++i)this.am(0,e[i],r,i,0,t-i);r.clamp()}function Ne(e,t,r){--t;var i=r.t=this.t+e.t-t;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(t-this.t,0);i<e.t;++i)r[this.t+i-t]=this.am(t-i,e[i],r,0,0,this.t+i-t);r.clamp(),r.drShiftTo(1,r)}function Ue(e){this.r2=new i,this.q3=new i,i.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Fe(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=new i;return e.copyTo(t),this.reduce(t),t}function Ke(e){return e}function He(e){var t=this;for(e.drShiftTo(t.m.t-1,t.r2),e.t>t.m.t+1&&(e.t=t.m.t+1,e.clamp()),t.mu.multiplyUpperTo(t.r2,t.m.t+1,t.q3),t.m.multiplyLowerTo(t.q3,t.m.t+1,t.r2);e.compareTo(t.r2)<0;)e.dAddOffset(1,t.m.t+1);for(e.subTo(t.r2,e);e.compareTo(t.m)>=0;)e.subTo(t.m,e)}function Ve(e,t){e.squareTo(t),this.reduce(t)}function Ye(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Xe(e,t){var r,n,o=e.bitLength(),f=c(1);if(0>=o)return f;r=18>o?1:48>o?3:144>o?4:768>o?5:6,n=8>o?new I(t):t.isEven()?new Ue(t):new D(t);var a=new Array,s=3,u=r-1,h=(1<<r)-1;if(a[1]=n.convert(this),r>1){var d=new i;for(n.sqrTo(a[1],d);h>=s;)a[s]=new i,n.mulTo(d,a[s-2],a[s]),s+=2}var l,p,b=e.t-1,g=!0,y=new i;for(o=v(e[b])-1;b>=0;){for(o>=u?l=e[b]>>o-u&h:(l=(e[b]&(1<<o+1)-1)<<u-o,b>0&&(l|=e[b-1]>>this.DB+o-u)),s=r;0==(1&l);)l>>=1,--s;if((o-=s)<0&&(o+=this.DB,--b),g)a[l].copyTo(f),g=!1;else{for(;s>1;)n.sqrTo(f,y),n.sqrTo(y,f),s-=2;s>0?n.sqrTo(f,y):(p=f,f=y,y=p),n.mulTo(y,a[l],f)}for(;b>=0&&0==(e[b]&1<<o);)n.sqrTo(f,y),p=f,f=y,y=p,--o<0&&(o=this.DB-1,--b)}return n.revert(f)}function We(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var i=t;t=r,r=i}var n=t.getLowestSetBit(),o=r.getLowestSetBit();if(0>o)return t;for(o>n&&(o=n),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function Ge(e){if(0>=e)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var i=this.t-1;i>=0;--i)r=(t*r+this[i])%e;return r}function Je(e){var t=e.isEven();if(0===this.signum())throw new Error("division by zero");if(this.isEven()&&t||0==e.signum())return i.ZERO;for(var r=e.clone(),n=this.clone(),o=c(1),f=c(0),a=c(0),s=c(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(o.isEven()&&f.isEven()||(o.addTo(this,o),f.subTo(e,f)),o.rShiftTo(1,o)):f.isEven()||f.subTo(e,f),f.rShiftTo(1,f);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&s.isEven()||(a.addTo(this,a),s.subTo(e,s)),a.rShiftTo(1,a)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(a,o),f.subTo(s,f)):(n.subTo(r,n),t&&a.subTo(o,a),s.subTo(f,s))}return 0!=n.compareTo(i.ONE)?i.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s}function Ze(e){var t,r=this.abs();if(1==r.t&&r[0]<=at[at.length-1]){for(t=0;t<at.length;++t)if(r[0]==at[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<at.length;){for(var i=at[t],n=t+1;n<at.length&&st>i;)i*=at[n++];for(i=r.modInt(i);n>t;)if(i%at[t++]==0)return!1}return r.millerRabin(e)}function $e(e){var t=this.subtract(i.ONE),r=t.getLowestSetBit();if(0>=r)return!1;var n=t.shiftRight(r);e=e+1>>1,e>at.length&&(e=at.length);for(var o,f=new i(null),a=[],s=0;e>s;++s){for(;o=at[Math.floor(Math.random()*at.length)],-1!=a.indexOf(o););a.push(o),f.fromInt(o);var c=f.modPow(n,this);if(0!=c.compareTo(i.ONE)&&0!=c.compareTo(t)){for(var o=1;o++<r&&0!=c.compareTo(t);)if(c=c.modPowInt(2,this),0==c.compareTo(i.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0}var Qe=i.prototype;Qe.__bigi=e("../package.json").version,i.isBigInteger=function(e,t){return e&&e.__bigi&&(!t||e.__bigi===Qe.__bigi)};var et;i.prototype.am=n,et=26,i.prototype.DB=et,i.prototype.DM=(1<<et)-1;var tt=i.prototype.DV=1<<et,rt=52;i.prototype.FV=Math.pow(2,rt),i.prototype.F1=rt-et,i.prototype.F2=2*et-rt;var it,nt,ot="0123456789abcdefghijklmnopqrstuvwxyz",ft=new Array;for(it="0".charCodeAt(0),nt=0;9>=nt;++nt)ft[it++]=nt;for(it="a".charCodeAt(0),nt=10;36>nt;++nt)ft[it++]=nt;for(it="A".charCodeAt(0),nt=10;36>nt;++nt)ft[it++]=nt;I.prototype.convert=B,I.prototype.revert=C,I.prototype.reduce=j,I.prototype.mulTo=R,I.prototype.sqrTo=T,D.prototype.convert=O,D.prototype.revert=q,D.prototype.reduce=L,D.prototype.mulTo=N,D.prototype.sqrTo=z,Qe.copyTo=a,Qe.fromInt=s,Qe.fromString=u,Qe.clamp=h,Qe.dlShiftTo=m,Qe.drShiftTo=w,Qe.lShiftTo=_,Qe.rShiftTo=S,Qe.subTo=E,Qe.multiplyTo=M,Qe.squareTo=A,Qe.divRemTo=k,Qe.invDigit=P,Qe.isEven=U,Qe.exp=F,Qe.toString=d,Qe.negate=l,Qe.abs=p,Qe.compareTo=b,Qe.bitLength=g,Qe.byteLength=y,Qe.mod=x,Qe.modPowInt=K,Pe.prototype.convert=De,Pe.prototype.revert=De,Pe.prototype.mulTo=Oe,Pe.prototype.sqrTo=qe,Ue.prototype.convert=Fe,Ue.prototype.revert=Ke,Ue.prototype.reduce=He,Ue.prototype.mulTo=Ye,Ue.prototype.sqrTo=Ve;var at=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],st=(1<<26)/at[at.length-1];Qe.chunkSize=W,Qe.toRadix=J,Qe.fromRadix=Z,Qe.fromNumber=$,Qe.bitwiseTo=ie,Qe.changeBit=we,Qe.addTo=Me,Qe.dMultiply=Re,Qe.dAddOffset=Te,Qe.multiplyLowerTo=ze,Qe.multiplyUpperTo=Ne,Qe.modInt=Ge,Qe.millerRabin=$e,Qe.clone=H,Qe.intValue=V,Qe.byteValue=Y,Qe.shortValue=X,Qe.signum=G,Qe.toByteArray=Q,Qe.equals=ee,Qe.min=te,Qe.max=re,Qe.and=oe,Qe.or=ae,Qe.xor=ce,Qe.andNot=he,Qe.not=de,Qe.shiftLeft=le,Qe.shiftRight=pe,Qe.getLowestSetBit=ve,Qe.bitCount=ye,Qe.testBit=me,Qe.setBit=_e,Qe.clearBit=Se,Qe.flipBit=Ee,Qe.add=Ae,Qe.subtract=ke,Qe.multiply=xe,Qe.divide=Be,Qe.remainder=Ce,Qe.divideAndRemainder=je,Qe.modPow=Xe,Qe.modInverse=Je,Qe.pow=Le,Qe.gcd=We,Qe.isProbablePrime=Ze,Qe.square=Ie,i.ZERO=c(0),i.ONE=c(1),i.valueOf=c,t.exports=i},{"../package.json":26}],24:[function(e,t,r){(function(t){var r=e("assert"),i=e("./bigi");i.fromByteArrayUnsigned=function(e){return new i(128&e[0]?[0].concat(e):e)},i.prototype.toByteArrayUnsigned=function(){var e=this.toByteArray();return 0===e[0]?e.slice(1):e},i.fromDERInteger=function(e){return new i(e)},i.prototype.toDERInteger=i.prototype.toByteArray,i.fromBuffer=function(e){if(128&e[0]){var t=Array.prototype.slice.call(e);return new i([0].concat(t))}return new i(e)},i.fromHex=function(e){return""===e?i.ZERO:(r.equal(e,e.match(/^[A-Fa-f0-9]+/),"Invalid hex string"),r.equal(e.length%2,0,"