{"version":3,"sources":["webpack:////workdir/node_modules/asn1.js/lib/asn1/decoders/der.js","webpack:////workdir/node_modules/agmp-utility/utility/mathtools.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/decoders/pem.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/api.js","webpack:////workdir/node_modules/agmp-utility/utility/request.js","webpack:////workdir/node_modules/agmp-utility/utility/datetime.js","webpack:////workdir/node_modules/agmp-utility/utility/validate.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/encoders/index.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/constants/index.js","webpack:////workdir/node_modules/asn1.js/lib/asn1.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/base/reporter.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/base/buffer.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/encoders/pem.js","webpack:////workdir/node_modules/agmp-utility/utility/requestLongTimeout.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/base/index.js","webpack:////workdir/node_modules/agmp-utility/index.js","webpack:////workdir/node_modules/agmp-utility/utility/encrypt.js","webpack:////workdir/node_modules/agmp-utility/imports.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/decoders/index.js","webpack:////workdir/node_modules/agmp-utility/utility/random.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/constants/der.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/encoders/der.js","webpack:////workdir/node_modules/asn1.js/lib/asn1/base/node.js","webpack:////workdir/node_modules/agmp-utility/utility/upload.js"],"names":["inherits","bignum","DecoderBuffer","Node","der","DERDecoder","entity","this","enc","name","tree","DERNode","_init","body","parent","call","derDecodeTag","buf","fail","tag","readUInt8","isError","cls","tagClass","primitive","oct","tagStr","derDecodeLen","len","num","error","i","j","module","exports","prototype","decode","data","options","isDecoderBuffer","_decode","_peekTag","buffer","any","isEmpty","state","save","decodedTag","restore","_decodeTag","skip","res","_skipUntilEnd","offset","_decodeList","decoder","result","possibleEnd","push","_decodeStr","unused","raw","length","str","String","fromCharCode","readUInt16BE","numstr","toString","_isNumstr","printstr","_isPrintstr","test","_decodeObjid","values","relative","identifiers","ident","subident","first","second","concat","slice","tmp","join","undefined","_decodeTime","year","mon","day","hour","min","sec","Date","UTC","_decodeNull","_decodeBool","_decodeInt","_use","obj","_getDecoder","isInteger","Math","floor","operation","a","b","op","o1","toInteger","o2","n1","n2","t1","times","t2","max","floatNum","ret","isNegative","strfi","dotPos","indexOf","substr","pow","intNum","parseInt","abs","toDecimalForReport","x","d","f","parseFloat","isNaN","p","round","toFixed","toDecimal","defaultNumber","addOperation","subtractOperation","multiplyOperation","divideOperation","Buffer","PEMDecoder","lines","split","label","toUpperCase","re","start","end","match","Error","base64","replace","input","from","encoders","decoders","api","Entity","define","_createNamed","Base","Generated","_initNamed","hasOwnProperty","_getEncoder","encode","reporter","axios","moment","path","method","header","contentType","log","Promise","resolve","reject","key","url","headers","json","timeout","starttime","Number","format","checkTime","spendTime","warn","Warning","then","response","catch","getToday","now","utc","startOf","endOf","getBefore7Days","before7","add","getBefore15Days","before15","getBefore30Days","before30","getBefore60Days","before60","getBefore90Days","before90","getAfter10Minutes","after10","getAfter30Days","date","startTime","endTime","daysInMonth","getTimestamp","isBetween","startDate","endDate","dateNow","local","whereBetween","dateStart","dateEnd","_","validBody","keyArray","has","forEach","Object","keys","some","bodyKey","validBodyAndValue","validStatus","status","maxNum","statusReg","reg","RegExp","validStatusFromArray","array","value","validCreateAgentID","account","validAgentAccount","validAgentPassword","password","validMemberAccount","validMemberPassword","validAgentID","agentId","validMemberID","memberId","validDateYYYYMMDD_hhmmss","validPageNum","pageNum","validTransactionType","type","validAmount","amount","validCurrencyID","currencyID","validGroupID","groupID","validBankID","bankID","validCode","code","validEmoji","validNumber","validEnAndNum","validTrueName","validExcSpecChar","validChinese","validEnglish","validDecimal","validLowerCase","validUpperCase","isNumberOrEnglish","isExternal","validUsername","valid_map","trim","validURL","validEmail","email","isString","isArray","arg","Array","validBankAccount","country","toLowerCase","banks","regex","validateBank","LocationID","BankAccount","LocationCodeMapping","1","2","3","4","5","6","validPhone","phone","phones","validateCellPhone","validPromoCode","PromoCode","pem","constants","_reverse","map","asn1","base","Reporter","_reporterState","errors","ReporterError","msg","rethrow","pathLen","enterKey","exitKey","index","leaveKey","enterObject","prev","leaveObject","err","inherited","elem","JSON","stringify","message","stack","partial","wrapResult","captureStackTrace","e","isBuffer","EncoderBuffer","item","isEncoderBuffer","byteLength","isCompatible","constructor","bytes","out","alloc","write","copy","DEREncoder","PEMEncoder","datetime","encrypt","random","request","requestLongTimeout","upload","validator","mathtools","randomstring","crypto","md5","createHash","update","digest","maskPassword","rotate_left","n","s","t4","cvt_hex","val","v","Utf8Encode","string","utftext","c","charCodeAt","blockstart","A","B","C","D","E","W","H0","H1","H2","H3","H4","msg_len","word_array","temp","encryptPassword","pwd","salt1","salt2","key2","pass1","pass2","createPassword","generate","encryptAES","iv","cipher","createCipheriv","crypted","final","decryptAES","decipher","createDecipheriv","decoded","algorithm","text","cipherText","decrypt","plaintext","bufferFromBase64","bufferFromBinary","encodeFieldPart","boundary","returnPart","encodeFilePart","filename","makePartBoundary","randomNumbers","uuid","fs","getRandomNumber","tmpStr","substring","getRandomString","_uuid","getRandomMemberAccount","possible","charAt","getRandomNickName","reverse","0","tagClassByName","tagByName","two","encodeTag","_encode","_encodeComposite","content","encodedTag","_createEncoderBuffer","lenOctets","_encodeStr","writeUInt16BE","_encodeObjid","id","splice","size","objid","_encodeTime","time","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","_encodeNull","_encodeInt","numArray","toArray","sign","unshift","_encodeBool","_skipDefault","dataBuffer","_baseState","defaultBuffer","_encodeValue","assert","tags","methods","overrided","children","args","reverseArgs","choice","optional","use","useDecoder","explicit","implicit","contains","_wrap","stateProps","clone","cstate","prop","apply","arguments","filter","child","equal","_useArgs","def","newKey","prevObj","present","prevKey","_decodeGeneric","_decodeChoice","track","_getUse","node","_encodeChoice","_encodePrimitive","genAuth","netstoragePath","actionHeaders","acs_auth_data","acs_auth_sign","keyName","cfg","sign_string","createHmac","acs_action","authData","escape","host","initialize","config","akamai"],"mappings":"gHAEA,MAAMA,EAAW,EAAQ,QAEnBC,EAAS,EAAQ,QACjBC,EAAgB,EAAQ,QAAkBA,cAC1CC,EAAO,EAAQ,QAGfC,EAAM,EAAQ,QAEpB,SAASC,EAAWC,GAClBC,KAAKC,IAAM,MACXD,KAAKE,KAAOH,EAAOG,KACnBF,KAAKD,OAASA,EAGdC,KAAKG,KAAO,IAAIC,EAChBJ,KAAKG,KAAKE,MAAMN,EAAOO,MAczB,SAASF,EAAQG,GACfX,EAAKY,KAAKR,KAAM,MAAOO,GA8OzB,SAASE,EAAaC,EAAKC,GACzB,IAAIC,EAAMF,EAAIG,UAAUF,GACxB,GAAID,EAAII,QAAQF,GACd,OAAOA,EAET,MAAMG,EAAMlB,EAAImB,SAASJ,GAAO,GAC1BK,EAA6B,KAAV,GAANL,GAGnB,GAAqB,MAAV,GAANA,GAAsB,CACzB,IAAIM,EAAMN,EACVA,EAAM,EACN,MAAwB,OAAV,IAANM,GAAsB,CAE5B,GADAA,EAAMR,EAAIG,UAAUF,GAChBD,EAAII,QAAQI,GACd,OAAOA,EAETN,IAAQ,EACRA,GAAa,IAANM,QAGTN,GAAO,GAET,MAAMO,EAAStB,EAAIe,IAAIA,GAEvB,MAAO,CACLG,IAAKA,EACLE,UAAWA,EACXL,IAAKA,EACLO,OAAQA,GAIZ,SAASC,EAAaV,EAAKO,EAAWN,GACpC,IAAIU,EAAMX,EAAIG,UAAUF,GACxB,GAAID,EAAII,QAAQO,GACd,OAAOA,EAGT,IAAKJ,GAAqB,MAARI,EAChB,OAAO,KAGT,GAAqB,KAAV,IAANA,GAEH,OAAOA,EAIT,MAAMC,EAAY,IAAND,EACZ,GAAIC,EAAM,EACR,OAAOZ,EAAIa,MAAM,6BAEnBF,EAAM,EACN,IAAK,IAAIG,EAAI,EAAGA,EAAIF,EAAKE,I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f,WAAYC,IACVR,EAAMA,GAAOQ,GAGfC,OAAQ,CAAChf,EAAQmI,IACRiM,EAAOpU,EAAQmI","file":"static/js/app-92cdd359.js","sourcesContent":["'use strict';\n\nconst inherits = require('inherits');\n\nconst bignum = require('bn.js');\nconst DecoderBuffer = require('../base/buffer').DecoderBuffer;\nconst Node = require('../base/node');\n\n// Import DER constants\nconst der = require('../constants/der');\n\nfunction DERDecoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n}\nmodule.exports = DERDecoder;\n\nDERDecoder.prototype.decode = function decode(data, options) {\n if (!DecoderBuffer.isDecoderBuffer(data)) {\n data = new DecoderBuffer(data, options);\n }\n\n return this.tree._decode(data, options);\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\ninherits(DERNode, Node);\n\nDERNode.prototype._peekTag = function peekTag(buffer, tag, any) {\n if (buffer.isEmpty())\n return false;\n\n const state = buffer.save();\n const decodedTag = derDecodeTag(buffer, 'Failed to peek tag: \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n\n buffer.restore(state);\n\n return decodedTag.tag === tag || decodedTag.tagStr === tag ||\n (decodedTag.tagStr + 'of') === tag || any;\n};\n\nDERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {\n const decodedTag = derDecodeTag(buffer,\n 'Failed to decode tag of \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n\n let len = derDecodeLen(buffer,\n decodedTag.primitive,\n 'Failed to get length of \"' + tag + '\"');\n\n // Failure\n if (buffer.isError(len))\n return len;\n\n if (!any &&\n decodedTag.tag !== tag &&\n decodedTag.tagStr !== tag &&\n decodedTag.tagStr + 'of' !== tag) {\n return buffer.error('Failed to match tag: \"' + tag + '\"');\n }\n\n if (decodedTag.primitive || len !== null)\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n\n // Indefinite length... find END tag\n const state = buffer.save();\n const res = this._skipUntilEnd(\n buffer,\n 'Failed to skip indefinite length body: \"' + this.tag + '\"');\n if (buffer.isError(res))\n return res;\n\n len = buffer.offset - state.offset;\n buffer.restore(state);\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n};\n\nDERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {\n for (;;) {\n const tag = derDecodeTag(buffer, fail);\n if (buffer.isError(tag))\n return tag;\n const len = derDecodeLen(buffer, tag.primitive, fail);\n if (buffer.isError(len))\n return len;\n\n let res;\n if (tag.primitive || len !== null)\n res = buffer.skip(len);\n else\n res = this._skipUntilEnd(buffer, fail);\n\n // Failure\n if (buffer.isError(res))\n return res;\n\n if (tag.tagStr === 'end')\n break;\n }\n};\n\nDERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,\n options) {\n const result = [];\n while (!buffer.isEmpty()) {\n const possibleEnd = this._peekTag(buffer, 'end');\n if (buffer.isError(possibleEnd))\n return possibleEnd;\n\n const res = decoder.decode(buffer, 'der', options);\n if (buffer.isError(res) && possibleEnd)\n break;\n result.push(res);\n }\n return result;\n};\n\nDERNode.prototype._decodeStr = function decodeStr(buffer, tag) {\n if (tag === 'bitstr') {\n const unused = buffer.readUInt8();\n if (buffer.isError(unused))\n return unused;\n return { unused: unused, data: buffer.raw() };\n } else if (tag === 'bmpstr') {\n const raw = buffer.raw();\n if (raw.length % 2 === 1)\n return buffer.error('Decoding of string type: bmpstr length mismatch');\n\n let str = '';\n for (let i = 0; i < raw.length / 2; i++) {\n str += String.fromCharCode(raw.readUInt16BE(i * 2));\n }\n return str;\n } else if (tag === 'numstr') {\n const numstr = buffer.raw().toString('ascii');\n if (!this._isNumstr(numstr)) {\n return buffer.error('Decoding of string type: ' +\n 'numstr unsupported characters');\n }\n return numstr;\n } else if (tag === 'octstr') {\n return buffer.raw();\n } else if (tag === 'objDesc') {\n return buffer.raw();\n } else if (tag === 'printstr') {\n const printstr = buffer.raw().toString('ascii');\n if (!this._isPrintstr(printstr)) {\n return buffer.error('Decoding of string type: ' +\n 'printstr unsupported characters');\n }\n return printstr;\n } else if (/str$/.test(tag)) {\n return buffer.raw().toString();\n } else {\n return buffer.error('Decoding of string type: ' + tag + ' unsupported');\n }\n};\n\nDERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {\n let result;\n const identifiers = [];\n let ident = 0;\n let subident = 0;\n while (!buffer.isEmpty()) {\n subident = buffer.readUInt8();\n ident <<= 7;\n ident |= subident & 0x7f;\n if ((subident & 0x80) === 0) {\n identifiers.push(ident);\n ident = 0;\n }\n }\n if (subident & 0x80)\n identifiers.push(ident);\n\n const first = (identifiers[0] / 40) | 0;\n const second = identifiers[0] % 40;\n\n if (relative)\n result = identifiers;\n else\n result = [first, second].concat(identifiers.slice(1));\n\n if (values) {\n let tmp = values[result.join(' ')];\n if (tmp === undefined)\n tmp = values[result.join('.')];\n if (tmp !== undefined)\n result = tmp;\n }\n\n return result;\n};\n\nDERNode.prototype._decodeTime = function decodeTime(buffer, tag) {\n const str = buffer.raw().toString();\n\n let year;\n let mon;\n let day;\n let hour;\n let min;\n let sec;\n if (tag === 'gentime') {\n year = str.slice(0, 4) | 0;\n mon = str.slice(4, 6) | 0;\n day = str.slice(6, 8) | 0;\n hour = str.slice(8, 10) | 0;\n min = str.slice(10, 12) | 0;\n sec = str.slice(12, 14) | 0;\n } else if (tag === 'utctime') {\n year = str.slice(0, 2) | 0;\n mon = str.slice(2, 4) | 0;\n day = str.slice(4, 6) | 0;\n hour = str.slice(6, 8) | 0;\n min = str.slice(8, 10) | 0;\n sec = str.slice(10, 12) | 0;\n if (year < 70)\n year = 2000 + year;\n else\n year = 1900 + year;\n } else {\n return buffer.error('Decoding ' + tag + ' time is not supported yet');\n }\n\n return Date.UTC(year, mon - 1, day, hour, min, sec, 0);\n};\n\nDERNode.prototype._decodeNull = function decodeNull() {\n return null;\n};\n\nDERNode.prototype._decodeBool = function decodeBool(buffer) {\n const res = buffer.readUInt8();\n if (buffer.isError(res))\n return res;\n else\n return res !== 0;\n};\n\nDERNode.prototype._decodeInt = function decodeInt(buffer, values) {\n // Bigint, return as it is (assume big endian)\n const raw = buffer.raw();\n let res = new bignum(raw);\n\n if (values)\n res = values[res.toString(10)] || res;\n\n return res;\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getDecoder('der').tree;\n};\n\n// Utility methods\n\nfunction derDecodeTag(buf, fail) {\n let tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n\n const cls = der.tagClass[tag >> 6];\n const primitive = (tag & 0x20) === 0;\n\n // Multi-octet tag - load\n if ((tag & 0x1f) === 0x1f) {\n let oct = tag;\n tag = 0;\n while ((oct & 0x80) === 0x80) {\n oct = buf.readUInt8(fail);\n if (buf.isError(oct))\n return oct;\n\n tag <<= 7;\n tag |= oct & 0x7f;\n }\n } else {\n tag &= 0x1f;\n }\n const tagStr = der.tag[tag];\n\n return {\n cls: cls,\n primitive: primitive,\n tag: tag,\n tagStr: tagStr\n };\n}\n\nfunction derDecodeLen(buf, primitive, fail) {\n let len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n\n // Indefinite form\n if (!primitive && len === 0x80)\n return null;\n\n // Definite form\n if ((len & 0x80) === 0) {\n // Short form\n return len;\n }\n\n // Long form\n const num = len & 0x7f;\n if (num > 4)\n return buf.error('length octect is too long');\n\n len = 0;\n for (let i = 0; i < num; i++) {\n len <<= 8;\n const j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n\n return len;\n}\n","'use strict';\n\nmodule.exports = {\n /**\n * 報表用,會有負數\n * 將 x 四捨五入,保留小數點後 d 位數\n * @param {int} x \n * @param {int} d \n */\n toDecimalForReport: function (x, d) {\n var f = parseFloat(x);\n if (isNaN(f)) {\n return;\n }\n var p = Math.pow(10, d);\n f = Math.round(x * p) / p;\n return f.toFixed(d);\n },\n /**\n * 輸出一般表格用,負數會回 0\n * 將 x 四捨五入,保留小數點後 d 位數,若小於 0 則回 0.00\n * @param {int} x \n * @param {int} d \n */\n toDecimal: function (x, d) {\n var defaultNumber = 0\n var f = parseFloat(x);\n if (isNaN(f)) {\n return defaultNumber.toFixed(d);\n }\n var p = Math.pow(10, d);\n f = Math.round(x * p) / p;\n return f < 0 ? defaultNumber.toFixed(d) : f.toFixed(d);\n },\n addOperation: function (a, b) {\n return operation(a, b, 'add')\n },\n subtractOperation: function (a, b) {\n return operation(a, b, 'subtract')\n },\n multiplyOperation: function (a, b) {\n return operation(a, b, 'multiply')\n },\n divideOperation: function (a, b) {\n return operation(a, b, 'divide')\n }\n}\n\n/*\n * 判斷obj是否為一個整數 整數取整後還是等於自己。利用這個特性來判斷是否是整數\n */\nfunction isInteger(obj) {\n // 或者使用 Number.isInteger()\n return Math.floor(obj) === obj\n}\n\n/*\n * 核心方法,實現加減乘除運算,確保不丟失精度\n * 思路:把小數放大為整數(乘),進行算術運算,再縮小為小數(除)\n * @param a {number} 运算数1\n * @param b {number} 运算数2\n */\nfunction operation(a, b, op) {\n var o1 = toInteger(a)\n var o2 = toInteger(b)\n var n1 = o1.num // 3.25+3.153\n var n2 = o2.num\n var t1 = o1.times\n var t2 = o2.times\n var max = t1 > t2 ? t1 : t2\n var result = null\n switch (op) {\n // 加減需要根據倍數關係來處理\n case 'add':\n if (t1 === t2) { // 兩個小數倍數相同\n result = n1 + n2\n } else if (t1 > t2) {\n // o1 小数位 大于 o2\n result = n1 + n2 * (t1 / t2)\n } else {\n // o1小数位小于 o2\n result = n1 * (t2 / t1) + n2\n }\n return result / max\n case 'subtract':\n if (t1 === t2) {\n result = n1 - n2\n } else if (t1 > t2) {\n result = n1 - n2 * (t1 / t2)\n } else {\n result = n1 * (t2 / t1) - n2\n }\n return result / max\n case 'multiply':\n // 3253153(1001000) 擴大100倍 ==>縮小100倍\n result = (n1 * n2) / (t1 * t2)\n return result\n case 'divide':\n // (3253153)(1000100) 縮小100倍 ==>擴大100倍\n result = (n1 / n2) * (t2 / t1)\n return result\n }\n}\n\n/*\n * 將一個浮點數轉成整數,返回整數和倍數。如 3.14 >> 314,倍數是 100\n * @param floatNum {number} 小数\n * @return {object}\n * {times:100, num: 314}\n */\nfunction toInteger(floatNum) {\n // 初始化數字與精度 times精度倍數 num轉化後的整數\n var ret = {\n times: 1,\n num: 0\n }\n // 是否是小数\n var isNegative = floatNum < 0\n if (isInteger(floatNum)) {\n // 是否是整数\n ret.num = floatNum\n // 是整数直接返回\n return ret\n }\n // 轉換為字符串\n var strfi = floatNum + ''\n var dotPos = strfi.indexOf('.')\n var len = strfi.substr(dotPos + 1).length // 拿到小數點之後的位數\n // 精度倍数\n var times = Math.pow(10, len)\n /* 為什麼加0.5? 前面講過乘法也會出現精度問題 假設傳入0.16344556此時倍數為100000000\n Math.abs(0.16344556) 100000000=0.1634455610000000=1634455.5999999999 少了0.0000000001\n 加上0.5 0.16344556*10000000+0.5=1634456.0999999999 parseInt之后乘法的精度问题得以矫正\n */\n var intNum = parseInt(Math.abs(floatNum) * times + 0.5, 10)\n ret.times = times\n if (isNegative) {\n intNum = -intNum\n }\n ret.num = intNum\n return ret\n}","'use strict';\n\nconst inherits = require('inherits');\nconst Buffer = require('safer-buffer').Buffer;\n\nconst DERDecoder = require('./der');\n\nfunction PEMDecoder(entity) {\n DERDecoder.call(this, entity);\n this.enc = 'pem';\n}\ninherits(PEMDecoder, DERDecoder);\nmodule.exports = PEMDecoder;\n\nPEMDecoder.prototype.decode = function decode(data, options) {\n const lines = data.toString().split(/[\\r\\n]+/g);\n\n const label = options.label.toUpperCase();\n\n const re = /^-----(BEGIN|END) ([^-]+)-----$/;\n let start = -1;\n let end = -1;\n for (let i = 0; i < lines.length; i++) {\n const match = lines[i].match(re);\n if (match === null)\n continue;\n\n if (match[2] !== label)\n continue;\n\n if (start === -1) {\n if (match[1] !== 'BEGIN')\n break;\n start = i;\n } else {\n if (match[1] !== 'END')\n break;\n end = i;\n break;\n }\n }\n if (start === -1 || end === -1)\n throw new Error('PEM section not found for: ' + label);\n\n const base64 = lines.slice(start + 1, end).join('');\n // Remove excessive symbols\n base64.replace(/[^a-z0-9+/=]+/gi, '');\n\n const input = Buffer.from(base64, 'base64');\n return DERDecoder.prototype.decode.call(this, input, options);\n};\n","'use strict';\n\nconst encoders = require('./encoders');\nconst decoders = require('./decoders');\nconst inherits = require('inherits');\n\nconst api = exports;\n\napi.define = function define(name, body) {\n return new Entity(name, body);\n};\n\nfunction Entity(name, body) {\n this.name = name;\n this.body = body;\n\n this.decoders = {};\n this.encoders = {};\n}\n\nEntity.prototype._createNamed = function createNamed(Base) {\n const name = this.name;\n\n function Generated(entity) {\n this._initNamed(entity, name);\n }\n inherits(Generated, Base);\n Generated.prototype._initNamed = function _initNamed(entity, name) {\n Base.call(this, entity, name);\n };\n\n return new Generated(this);\n};\n\nEntity.prototype._getDecoder = function _getDecoder(enc) {\n enc = enc || 'der';\n // Lazily create decoder\n if (!this.decoders.hasOwnProperty(enc))\n this.decoders[enc] = this._createNamed(decoders[enc]);\n return this.decoders[enc];\n};\n\nEntity.prototype.decode = function decode(data, enc, options) {\n return this._getDecoder(enc).decode(data, options);\n};\n\nEntity.prototype._getEncoder = function _getEncoder(enc) {\n enc = enc || 'der';\n // Lazily create encoder\n if (!this.encoders.hasOwnProperty(enc))\n this.encoders[enc] = this._createNamed(encoders[enc]);\n return this.encoders[enc];\n};\n\nEntity.prototype.encode = function encode(data, enc, /* internal */ reporter) {\n return this._getEncoder(enc).encode(data, reporter);\n};\n","'use strict'\n\nconst {\n axios,\n moment\n} = require('../imports')\n\nmodule.exports = function (path, data, method, header, contentType, log) {\n return new Promise(function (resolve, reject) {\n\n var options = {\n url: path,\n method: 'post',\n data: data,\n headers: {\n 'Content-Type': 'application/json',\n },\n json: true,\n timeout: 30000, //timeout: 10000,\n }\n\n if (method) {\n options.method = method\n }\n\n if (header) {\n var key\n\n for (key in header) {\n options.headers[key] = header[key]\n }\n }\n\n if (contentType) {\n options.headers['Content-Type'] = contentType\n }\n\n var starttime = Number(moment().format('x'))\n\n axios(options)\n .then(function (response) {\n var spendTime = (Number(moment().format('x')) - starttime) / 1000\n checkTime(log, spendTime)\n resolve({\n error: null,\n starttime: spendTime + 's',\n response: response,\n })\n })\n .catch(function (error) {\n var spendTime = (Number(moment().format('x')) - starttime) / 1000\n checkTime(log, spendTime)\n resolve({\n error: error,\n starttime: spendTime + 's',\n response: null,\n })\n })\n\n function checkTime(log, spendTime) {\n if (log) {\n if (spendTime >= 10 && spendTime < 30) {\n log.warn({\n Warning: `${options.method} ${path}, overtime : ${spendTime} s`\n })\n } else if (spendTime >= 30) {\n log.error({\n Error: `${options.method} ${path}, overtime : ${spendTime} s`\n })\n }\n }\n }\n })\n}","'use strict'\n\nconst { moment } = require('../imports')\n\nmodule.exports = {\n getToday: function () {\n var now = new moment.utc()\n return [now.startOf('day').format('YYYY-MM-DD HH:mm:ss'), now.endOf('day').format('YYYY-MM-DD HH:mm:ss')]\n },\n getBefore7Days: function () {\n var now = new moment.utc()\n var before7 = new moment.utc().add(-7, 'days')\n return [before7.startOf('day').format('YYYY-MM-DD HH:mm:ss'), now.endOf('day').format('YYYY-MM-DD HH:mm:ss')]\n },\n getBefore15Days: function () {\n var now = new moment.utc()\n var before15 = new moment.utc().add(-15, 'days')\n return [before15.startOf('day').format('YYYY-MM-DD HH:mm:ss'), now.endOf('day').format('YYYY-MM-DD HH:mm:ss')]\n },\n getBefore30Days: function () {\n var now = new moment.utc()\n var before30 = new moment.utc().add(-30, 'days')\n return [before30.startOf('day').format('YYYY-MM-DD HH:mm:ss'), now.endOf('day').format('YYYY-MM-DD HH:mm:ss')]\n },\n getBefore60Days: function () {\n var now = new moment.utc()\n var before60 = new moment.utc().add(-60, 'days')\n return [before60.startOf('day').format('YYYY-MM-DD HH:mm:ss'), now.endOf('day').format('YYYY-MM-DD HH:mm:ss')]\n },\n getBefore90Days: function () {\n var now = new moment.utc()\n var before90 = new moment.utc().add(-90, 'days')\n return [before90.startOf('day').format('YYYY-MM-DD HH:mm:ss'), now.endOf('day').format('YYYY-MM-DD HH:mm:ss')]\n },\n getAfter10Minutes: function () {\n var now = new moment.utc()\n var after10 = new moment.utc().add(10, 'minutes')\n return [now.format('YYYY-MM-DD HH:mm:ss'), after10.format('YYYY-MM-DD HH:mm:ss')]\n },\n /**\n * 取得當日後的一個月,日期請給當月 1 號\n * @param {String} date\n */\n getAfter30Days: function (date) {\n var startTime = new moment(date)\n var endTime = new moment(date).add(startTime.daysInMonth() - 1, 'days')\n return [startTime.startOf('day').format('YYYY-MM-DD HH:mm:ss'), endTime.endOf('day').format('YYYY-MM-DD HH:mm:ss')]\n },\n getTimestamp: function (date) {\n if (date) {\n return Number(moment().utc(date).format('x'))\n }\n return Number(moment().format('x'))\n },\n isBetween: function (startDate, endDate, date) {\n // UTC Now\n var dateNow = new moment.utc().format('YYYY-MM-DD HH:mm:ss')\n if (date) {\n dateNow = date\n }\n // UTC Now To Local\n var local = moment.utc(dateNow).local().format('YYYY-MM-DD HH:mm:ss')\n return moment(dateNow).isBetween(startDate, endDate)\n },\n whereBetween: function (startDate, endDate, dateStart, dateEnd) {\n return moment(dateStart).isBetween(startDate, endDate) && moment(dateEnd).isBetween(startDate, endDate)\n },\n}\n","'use strict';\n\nconst {\n _\n} = require('../imports');\n\nmodule.exports = {\n /**\n * 使用 keyArray 驗證 body 內指定的參數是否 '存在'\n * @param {String} str\n * @returns {Boolean}\n */\n validBody: function (body, keyArray) {\n var has = false;\n if (body) {\n _.forEach(keyArray, function (key) {\n return has = Object.keys(body).some(function (bodyKey) {\n return key === bodyKey\n })\n })\n return has\n }\n },\n\n /**\n * 使用 keyArray 驗證 body 內指定的參數是否 '存在' 且 '值不為 null, 空字串, undefined'\n * @param {String} str\n * @returns {Boolean}\n */\n validBodyAndValue: function (body, keyArray) {\n var has = false;\n if (body) {\n _.forEach(keyArray, function (key) {\n return has = Object.keys(body).some(function (bodyKey) {\n var data = body[bodyKey] + ''\n return key === bodyKey && (data !== 'null' && data !== '' && data !== 'undefined')\n })\n })\n }\n return has\n },\n /**\n * status 若不包含在 0 ~ maxNum 則返回 false\n * @param {integer} status 驗證參數\n * @param {integer} maxNum 驗證參數最大值\n * @returns {Boolean}\n */\n validStatus: function (status, maxNum) {\n var i = maxNum\n // console.log(status, maxNum)\n var statusReg = ''\n while (i > -1) {\n if (i != maxNum) {\n statusReg += '|'\n }\n statusReg += i\n i--\n }\n var reg = RegExp('^(?:' + statusReg + ')$')\n return reg.test(status)\n },\n /**\n * status 若不包含在'陣列'內則返回 false\n * @param {integer} status 驗證參數\n * @param {integer} array 驗證參數陣列\n * @returns {Boolean}\n */\n validStatusFromArray: function (status, array) {\n var statusReg = ''\n _(array).forEach(function (value) {\n if (statusReg != '') {\n statusReg += '|'\n }\n statusReg += value\n })\n var reg = RegExp('^(?:' + statusReg + ')$')\n return reg.test(status)\n },\n /**\n * 驗證參數內若有不包含'數字' 或 null' 或 'NULL' 的字元, 返回false\n * null 為新增第一層代理\n * @param {String} account\n * @returns {Boolean}\n */\n validCreateAgentID: function (account) {\n return /^(?:[0-9]{1,}|null|NULL)$/.test(account)\n },\n /**\n * 驗證參數是否符合只能包含'英數'且至少要有'1個數字'或'1個英文'且符合'6-18字元數'規則\n * @param {String} account\n * @returns {Boolean}\n */\n validAgentAccount: function (account) {\n return /^(?=.*\\d)(?=.*[a-zA-Z])([A-Za-z0-9]){6,18}$/.test(account)\n },\n /**\n * 驗證參數是否符合只能包含'英數'且至少要有'1個數字'或'1個英文'且符合'6-18字元數'規則\n * @param {String} account\n * @returns {Boolean}\n */\n validAgentPassword: function (password) {\n return /^(?=.*\\d)(?=.*[a-zA-Z])([A-Za-z0-9]){6,18}$/.test(password)\n },\n /**\n * 驗證參數是否符合只能包含'英數'且至少要有'1個數字'或'1個英文'且符合'6-12字元數'規則\n * @param {String} account\n * @returns {Boolean}\n */\n validMemberAccount: function (account) {\n return /^(?=.*\\d)(?=.*[a-zA-Z])([A-Za-z0-9]){6,12}$/.test(account)\n },\n /**\n * 驗證參數是否符合只能包含'英數'且至少要有'1個數字'或'1個英文'且符合'6-12字元數'規則\n * @param {String} account\n * @returns {Boolean}\n */\n validMemberPassword: function (password) {\n return /^(?=.*\\d)(?=.*[a-zA-Z])([A-Za-z0-9]){6,12}$/.test(password)\n },\n /**\n * 驗證參數內若有不包含'數字'的字元, 返回false\n * @param {String} agentId\n * @returns {Boolean}\n */\n validAgentID: function (agentId) {\n return /^[0-9]{1,}$/.test(agentId)\n },\n /**\n * 驗證參數內若有不包含'數字'的字元, 返回false\n * @param {String} memberId\n * @returns {Boolean}\n */\n validMemberID: function (memberId) {\n return /^[0-9]{1,}$/.test(memberId)\n },\n /**\n * 驗證參數是否符合'指定時間格式'\n * @param {String} str\n * @returns {Boolean}\n * @example 驗證時間格式 2020-04-10 01:01:01\n */\n validDateYYYYMMDD_hhmmss: function (str) {\n return /^(?:\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2})$/.test(str)\n },\n /**\n * 驗證參數是否'1~3位數的數字'\n * @param {String} pageNum\n * @returns {Boolean}\n */\n validPageNum: function (pageNum) {\n return /^\\d{1,3}$/.test(pageNum)\n },\n /**\n *\n * @param {String} type\n * @returns {Boolean}\n */\n validTransactionType: function (type) {\n return /^[A-Za-z]{1,30}$/.test(type)\n },\n /**\n *\n * @param {String} amount\n * @returns {Boolean}\n */\n validAmount: function (amount) {\n return /^[0-9]+(.[0-9]{1,2})?$/.test(amount)\n },\n /**\n *\n * @param {String} currencyID\n * @returns {Boolean}\n */\n validCurrencyID: function (currencyID) {\n return /^[0-9]{1,3}$/.test(currencyID)\n },\n /**\n *\n * @param {String} groupID\n * @returns {Boolean}\n */\n validGroupID: function (groupID) {\n return /^[0-9]{1,3}$/.test(groupID)\n },\n /**\n *\n * @param {String} bankID\n * @returns {Boolean}\n */\n validBankID: function (bankID) {\n return /^[0-9]{1,3}$/.test(bankID)\n },\n /**\n *\n * @param {String} code\n * @returns {Boolean}\n */\n validCode: function (code) {\n return /^[A-Za-z0-9]{3,3}$/.test(code)\n },\n /**\n * 若字串內含有 emoji 符號,則返回 true\n * @param {String} str\n */\n validEmoji: function (str) {\n return /(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\u0023-\\u0039]\\ufe0f?\\u20e3|\\u3299|\\u3297|\\u303d|\\u3030|\\u24c2|\\ud83c[\\udd70-\\udd71]|\\ud83c[\\udd7e-\\udd7f]|\\ud83c\\udd8e|\\ud83c[\\udd91-\\udd9a]|\\ud83c[\\udde6-\\uddff]|\\ud83c[\\ude01-\\ude02]|\\ud83c\\ude1a|\\ud83c\\ude2f|\\ud83c[\\ude32-\\ude3a]|\\ud83c[\\ude50-\\ude51]|\\u203c|\\u2049|[\\u25aa-\\u25ab]|\\u25b6|\\u25c0|[\\u25fb-\\u25fe]|\\u00a9|\\u00ae|\\u2122|\\u2139|\\ud83c\\udc04|[\\u2600-\\u26FF]|\\u2b05|\\u2b06|\\u2b07|\\u2b1b|\\u2b1c|\\u2b50|\\u2b55|\\u231a|\\u231b|\\u2328|\\u23cf|[\\u23e9-\\u23f3]|[\\u23f8-\\u23fa]|\\ud83c\\udccf|\\u2934|\\u2935|[\\u2190-\\u21ff])/g.test(str)\n },\n\n /**\n * 驗證參數內若有不包含'數字'的字元, 返回false, float可用\n * @param {String} str\n * @returns {Boolean}\n */\n validNumber: function (memberId) {\n return /^[0-9]+.?[0-9]*$/.test(memberId)\n },\n /**\n * 驗證參數內若有不包含'英文'及'數字'的字元, 返回false\n * @param {String} str\n * @returns {Boolean}\n */\n validEnAndNum: function (str) {\n return /^[a-zA-Z0-9]*$/g.test(str)\n },\n /**\n * 驗證參數內若有不包含'英文','中文'及'泰文'的字元, 返回false\n * @param {String} str\n * @returns {Boolean}\n */\n validTrueName: function (str) {\n return /^[a-zA-Z\\u4e00-\\u9fa5\\u0E00-\\u0E7F]*$/g.test(str)\n },\n /**\n * 驗證參數內若有不包含'英文','數字','中文'及'泰文'的字元, 返回false\n * @param {String} str\n * @returns {Boolean}\n */\n validExcSpecChar: function (str) {\n return /^[a-zA-Z0-9\\u4e00-\\u9fa5\\u0E00-\\u0E7F]*$/g.test(str)\n },\n /**\n * 驗證參數內若有不包含'中文'字元, 返回false\n * @param {String} str\n * @returns {Boolean}\n */\n validChinese: function (str) {\n return /^[\\u4e00-\\u9fa5]*$/g.test(str)\n },\n /**\n * 驗證參數內若有不包含'英文'字元, 返回false\n * @param {String} str\n * @returns {Boolean}\n */\n validEnglish: function (str) {\n return /^[a-zA-Z]+$/.test(str)\n },\n /**\n * 驗證參數內若如不符合'數字後帶有一個符號',符號後方最多'兩位數的數字'的字串, 返回false\n * @param {String} str\n * @returns {Boolean}\n * @example 13552G22 -> true , 12344#1332 -> false\n */\n validDecimal: function (str) {\n return /^[0-9]+.[0-9]{0,2}$/.test(str)\n },\n /**\n * 驗證參數內是否皆為'小寫'英文字串\n * @param {String} str\n * @returns {Boolean}\n */\n validLowerCase: function (str) {\n return /^[a-z]+$/.test(str)\n },\n /**\n * 驗證參數內是否皆為'大寫'英文字串\n * @param {String} str\n * @returns {Boolean}\n */\n validUpperCase: function (str) {\n return /^[A-Z]+$/.test(str)\n },\n /**\n * 驗證參數內是否為'英數'字串\n * @param {String} str\n * @returns {Boolean}\n */\n isNumberOrEnglish: function (str) {\n return /^[0-9A-z]+$/.test(str)\n },\n /**\n * 驗證參數內是否為指定篩選的'外部連結開頭'\n * @param {String} str\n * @returns {Boolean}\n */\n isExternal: function (path) {\n return /^(https?:|mailto:|tel:)/.test(path)\n },\n /**\n * 驗證參數內是否為指定'篩選的字串'\n * @param {String} str\n * @returns {Boolean}\n */\n validUsername: function (str) {\n const valid_map = ['admin', 'editor', 'topagent']\n return valid_map.indexOf(str.trim()) >= 0\n },\n /**\n * 驗證參數是否為一個'有效的URL'\n * @param {String} str\n * @returns {Boolean}\n */\n validURL: function (url) {\n const reg = /^(https?|ftp|http):\\/\\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+\\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\\/($|[a-zA-Z0-9.,?'\\\\+&%$#=~_-]+))*$/\n return reg.test(url)\n },\n /**\n * 驗證參數內是否為'合法email'\n * @param {String} str\n * @returns {Boolean}\n */\n validEmail: function (email) {\n const reg = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n return reg.test(email)\n },\n /**\n * 驗證參數內是否為'字串'\n * @param {String} str\n * @returns {Boolean}\n */\n isString: function (str) {\n if (typeof str === 'string' || str instanceof String) {\n return true\n }\n return false\n },\n /**\n * 驗證參數內是否為'陣列'\n * @param {String} str\n * @returns {Boolean}\n */\n isArray: function (arg) {\n if (typeof Array.isArray === 'undefined') {\n return Object.prototype.toString.call(arg) === '[object Array]'\n }\n return Array.isArray(arg)\n },\n /**\n * 驗證參數內是否為'合法銀行帳戶'\n * @param {String} account\n * @returns {Boolean}\n */\n validBankAccount: function (country, account) {\n country = country.toLowerCase()\n var banks = {\n 'th': /^[0-9]{10,12}$/,\n 'vi': /^[0-9]{6,18}$/,\n 'my': /^[0-9]{9}$|^[0-9]{11}$|^[0-9]{15,17}$|^(\\+?95|0)9[0-9]{7,9}$|^(\\+?66\\-?)0[689]\\d{8}$/,\n 'mr': /^[0-9]{10,16}$/,\n 'ko': /^[0-9]{10,12}$/,\n 'ph': /^[0-9]{10,19}$/,\n }\n if (banks[country]) {\n var regex = new RegExp(banks[country])\n return regex.test(account)\n } else {\n return false\n }\n },\n /**\n * 驗證參數內是否為'合法銀行帳戶 by LocationID 用'\n * @param {String} account\n * @returns {Boolean}\n */\n validateBank: function (LocationID, BankAccount) {\n\n let LocationCodeMapping = {\n 1: 'th',\n 2: 'vi',\n 3: 'my',\n 4: 'ko',\n 5: 'mr',\n 6: 'ph',\n }\n\n if (!LocationCodeMapping[LocationID]) {\n return false\n }\n\n let country = LocationCodeMapping[LocationID]\n\n return this.validBankAccount(country,BankAccount)\n },\n /**\n * 驗證參數內是否為'合法門號'\n * @param {String} str\n * @returns {Boolean}\n */\n validPhone: function (country, phone) {\n country = country.toLowerCase()\n var phones = {\n 'th': /^(\\+?66\\-?|0)[689]\\d{8}$/,\n 'en': /^(\\+?66\\-?|0)[689]\\d{8}$/,\n 'vi': /^(\\+?84|0)[1-9]{1}[0-9]{8}$/,\n 'my': /^(\\+?95|0)9[0-9]{7,9}$|^(\\+?66\\-?)0[689]\\d{8}$/,\n 'ko': /^(\\+?82|0)10[0-9]{8}$/,\n 'mr': /^(\\+?60|0)[1][0-9]{8,9}$/,\n 'ph': /^(09|\\+?639)\\d{9}$/,\n 'ar-DZ': /^(\\+?213|0)(5|6|7)\\d{8}$/,\n 'ar-SY': /^(!?(\\+?963)|0)?9\\d{8}$/,\n 'ar-SA': /^(!?(\\+?966)|0)?5\\d{8}$/,\n 'en-US': /^(\\+?1)?[2-9]\\d{2}[2-9](?!11)\\d{6}$/,\n 'cs-CZ': /^(\\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,\n 'de-DE': /^(\\+?49[ \\.\\-])?([\\(]{1}[0-9]{1,6}[\\)])?([0-9 \\.\\-\\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,\n 'da-DK': /^(\\+?45)?(\\d{8})$/,\n 'el-GR': /^(\\+?30)?(69\\d{8})$/,\n 'en-AU': /^(\\+?61|0)4\\d{8}$/,\n 'en-GB': /^(\\+?44|0)7\\d{9}$/,\n 'en-HK': /^(\\+?852\\-?)?[569]\\d{3}\\-?\\d{4}$/,\n 'en-IN': /^(\\+?91|0)?[789]\\d{9}$/,\n 'en-NZ': /^(\\+?64|0)2\\d{7,9}$/,\n 'en-ZA': /^(\\+?27|0)\\d{9}$/,\n 'en-ZM': /^(\\+?26)?09[567]\\d{7}$/,\n 'es-ES': /^(\\+?34)?(6\\d{1}|7[1234])\\d{7}$/,\n 'fi-FI': /^(\\+?358|0)\\s?(4(0|1|2|4|5)?|50)\\s?(\\d\\s?){4,8}\\d$/,\n 'fr-FR': /^(\\+?33|0)[67]\\d{8}$/,\n 'he-IL': /^(\\+972|0)([23489]|5[0248]|77)[1-9]\\d{6}/,\n 'hu-HU': /^(\\+?36)(20|30|70)\\d{7}$/,\n 'it-IT': /^(\\+?39)?\\s?3\\d{2} ?\\d{6,7}$/,\n 'ja-JP': /^(\\+?81|0)\\d{1,4}[ \\-]?\\d{1,4}[ \\-]?\\d{4}$/,\n 'ms-MY': /^(\\+?6?01){1}(([145]{1}(\\-|\\s)?\\d{7,8})|([236789]{1}(\\s|\\-)?\\d{7}))$/,\n 'nb-NO': /^(\\+?47)?[49]\\d{7}$/,\n 'nl-BE': /^(\\+?32|0)4?\\d{8}$/,\n 'nn-NO': /^(\\+?47)?[49]\\d{7}$/,\n 'pl-PL': /^(\\+?48)? ?[5-8]\\d ?\\d{3} ?\\d{2} ?\\d{2}$/,\n 'pt-BR': /^(\\+?55|0)\\-?[1-9]{2}\\-?[2-9]{1}\\d{3,4}\\-?\\d{4}$/,\n 'pt-PT': /^(\\+?351)?9[1236]\\d{7}$/,\n 'ru-RU': /^(\\+?7|8)?9\\d{9}$/,\n 'sr-RS': /^(\\+3816|06)[- \\d]{5,9}$/,\n 'tr-TR': /^(\\+?90|0)?5\\d{9}$/,\n 'vi-VN': /^(\\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,\n 'zh-CN': /^(\\+?0?86\\-?)?1[345789]\\d{9}$/,\n 'zh-TW': /^(\\+?886\\-?|0)?9\\d{8}$/\n }\n if (phones[country]) {\n var regex = new RegExp(phones[country])\n return regex.test(phone)\n } else {\n return false\n }\n },\n /**\n * 驗證參數內是否為'合法門號 by LocaitonID 使用'\n * @param {String} str\n * @returns {Boolean}\n */\n validateCellPhone: function (LocationID, phone) {\n\n let LocationCodeMapping = {\n 1: 'th',\n 2: 'vi',\n 3: 'my',\n 4: 'ko',\n 5: 'mr',\n 6: 'ph',\n }\n\n if (!LocationCodeMapping[LocationID]) {\n return false\n }\n\n let country = LocationCodeMapping[LocationID]\n\n return this.validPhone(country, phone)\n },\n /**\n *\n * @param {String} PromoCode\n * @returns {Boolean}\n */\n validPromoCode: function (PromoCode) {\n return /^([A-Z0-9]){6}$/.test(PromoCode)\n },\n\n\n}","'use strict';\n\nconst encoders = exports;\n\nencoders.der = require('./der');\nencoders.pem = require('./pem');\n","'use strict';\n\nconst constants = exports;\n\n// Helper\nconstants._reverse = function reverse(map) {\n const res = {};\n\n Object.keys(map).forEach(function(key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key)\n key = key | 0;\n\n const value = map[key];\n res[value] = key;\n });\n\n return res;\n};\n\nconstants.der = require('./der');\n","'use strict';\n\nconst asn1 = exports;\n\nasn1.bignum = require('bn.js');\n\nasn1.define = require('./asn1/api').define;\nasn1.base = require('./asn1/base');\nasn1.constants = require('./asn1/constants');\nasn1.decoders = require('./asn1/decoders');\nasn1.encoders = require('./asn1/encoders');\n","'use strict';\n\nconst inherits = require('inherits');\n\nfunction Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n}\nexports.Reporter = Reporter;\n\nReporter.prototype.isError = function isError(obj) {\n return obj instanceof ReporterError;\n};\n\nReporter.prototype.save = function save() {\n const state = this._reporterState;\n\n return { obj: state.obj, pathLen: state.path.length };\n};\n\nReporter.prototype.restore = function restore(data) {\n const state = this._reporterState;\n\n state.obj = data.obj;\n state.path = state.path.slice(0, data.pathLen);\n};\n\nReporter.prototype.enterKey = function enterKey(key) {\n return this._reporterState.path.push(key);\n};\n\nReporter.prototype.exitKey = function exitKey(index) {\n const state = this._reporterState;\n\n state.path = state.path.slice(0, index - 1);\n};\n\nReporter.prototype.leaveKey = function leaveKey(index, key, value) {\n const state = this._reporterState;\n\n this.exitKey(index);\n if (state.obj !== null)\n state.obj[key] = value;\n};\n\nReporter.prototype.path = function path() {\n return this._reporterState.path.join('/');\n};\n\nReporter.prototype.enterObject = function enterObject() {\n const state = this._reporterState;\n\n const prev = state.obj;\n state.obj = {};\n return prev;\n};\n\nReporter.prototype.leaveObject = function leaveObject(prev) {\n const state = this._reporterState;\n\n const now = state.obj;\n state.obj = prev;\n return now;\n};\n\nReporter.prototype.error = function error(msg) {\n let err;\n const state = this._reporterState;\n\n const inherited = msg instanceof ReporterError;\n if (inherited) {\n err = msg;\n } else {\n err = new ReporterError(state.path.map(function(elem) {\n return '[' + JSON.stringify(elem) + ']';\n }).join(''), msg.message || msg, msg.stack);\n }\n\n if (!state.options.partial)\n throw err;\n\n if (!inherited)\n state.errors.push(err);\n\n return err;\n};\n\nReporter.prototype.wrapResult = function wrapResult(result) {\n const state = this._reporterState;\n if (!state.options.partial)\n return result;\n\n return {\n result: this.isError(result) ? null : result,\n errors: state.errors\n };\n};\n\nfunction ReporterError(path, msg) {\n this.path = path;\n this.rethrow(msg);\n}\ninherits(ReporterError, Error);\n\nReporterError.prototype.rethrow = function rethrow(msg) {\n this.message = msg + ' at: ' + (this.path || '(shallow)');\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, ReporterError);\n\n if (!this.stack) {\n try {\n // IE only adds stack when thrown\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n }\n return this;\n};\n","'use strict';\n\nconst inherits = require('inherits');\nconst Reporter = require('../base/reporter').Reporter;\nconst Buffer = require('safer-buffer').Buffer;\n\nfunction DecoderBuffer(base, options) {\n Reporter.call(this, options);\n if (!Buffer.isBuffer(base)) {\n this.error('Input not Buffer');\n return;\n }\n\n this.base = base;\n this.offset = 0;\n this.length = base.length;\n}\ninherits(DecoderBuffer, Reporter);\nexports.DecoderBuffer = DecoderBuffer;\n\nDecoderBuffer.isDecoderBuffer = function isDecoderBuffer(data) {\n if (data instanceof DecoderBuffer) {\n return true;\n }\n\n // Or accept compatible API\n const isCompatible = typeof data === 'object' &&\n Buffer.isBuffer(data.base) &&\n data.constructor.name === 'DecoderBuffer' &&\n typeof data.offset === 'number' &&\n typeof data.length === 'number' &&\n typeof data.save === 'function' &&\n typeof data.restore === 'function' &&\n typeof data.isEmpty === 'function' &&\n typeof data.readUInt8 === 'function' &&\n typeof data.skip === 'function' &&\n typeof data.raw === 'function';\n\n return isCompatible;\n};\n\nDecoderBuffer.prototype.save = function save() {\n return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };\n};\n\nDecoderBuffer.prototype.restore = function restore(save) {\n // Return skipped data\n const res = new DecoderBuffer(this.base);\n res.offset = save.offset;\n res.length = this.offset;\n\n this.offset = save.offset;\n Reporter.prototype.restore.call(this, save.reporter);\n\n return res;\n};\n\nDecoderBuffer.prototype.isEmpty = function isEmpty() {\n return this.offset === this.length;\n};\n\nDecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {\n if (this.offset + 1 <= this.length)\n return this.base.readUInt8(this.offset++, true);\n else\n return this.error(fail || 'DecoderBuffer overrun');\n};\n\nDecoderBuffer.prototype.skip = function skip(bytes, fail) {\n if (!(this.offset + bytes <= this.length))\n return this.error(fail || 'DecoderBuffer overrun');\n\n const res = new DecoderBuffer(this.base);\n\n // Share reporter state\n res._reporterState = this._reporterState;\n\n res.offset = this.offset;\n res.length = this.offset + bytes;\n this.offset += bytes;\n return res;\n};\n\nDecoderBuffer.prototype.raw = function raw(save) {\n return this.base.slice(save ? save.offset : this.offset, this.length);\n};\n\nfunction EncoderBuffer(value, reporter) {\n if (Array.isArray(value)) {\n this.length = 0;\n this.value = value.map(function(item) {\n if (!EncoderBuffer.isEncoderBuffer(item))\n item = new EncoderBuffer(item, reporter);\n this.length += item.length;\n return item;\n }, this);\n } else if (typeof value === 'number') {\n if (!(0 <= value && value <= 0xff))\n return reporter.error('non-byte EncoderBuffer value');\n this.value = value;\n this.length = 1;\n } else if (typeof value === 'string') {\n this.value = value;\n this.length = Buffer.byteLength(value);\n } else if (Buffer.isBuffer(value)) {\n this.value = value;\n this.length = value.length;\n } else {\n return reporter.error('Unsupported type: ' + typeof value);\n }\n}\nexports.EncoderBuffer = EncoderBuffer;\n\nEncoderBuffer.isEncoderBuffer = function isEncoderBuffer(data) {\n if (data instanceof EncoderBuffer) {\n return true;\n }\n\n // Or accept compatible API\n const isCompatible = typeof data === 'object' &&\n data.constructor.name === 'EncoderBuffer' &&\n typeof data.length === 'number' &&\n typeof data.join === 'function';\n\n return isCompatible;\n};\n\nEncoderBuffer.prototype.join = function join(out, offset) {\n if (!out)\n out = Buffer.alloc(this.length);\n if (!offset)\n offset = 0;\n\n if (this.length === 0)\n return out;\n\n if (Array.isArray(this.value)) {\n this.value.forEach(function(item) {\n item.join(out, offset);\n offset += item.length;\n });\n } else {\n if (typeof this.value === 'number')\n out[offset] = this.value;\n else if (typeof this.value === 'string')\n out.write(this.value, offset);\n else if (Buffer.isBuffer(this.value))\n this.value.copy(out, offset);\n offset += this.length;\n }\n\n return out;\n};\n","'use strict';\n\nconst inherits = require('inherits');\n\nconst DEREncoder = require('./der');\n\nfunction PEMEncoder(entity) {\n DEREncoder.call(this, entity);\n this.enc = 'pem';\n}\ninherits(PEMEncoder, DEREncoder);\nmodule.exports = PEMEncoder;\n\nPEMEncoder.prototype.encode = function encode(data, options) {\n const buf = DEREncoder.prototype.encode.call(this, data);\n\n const p = buf.toString('base64');\n const out = [ '-----BEGIN ' + options.label + '-----' ];\n for (let i = 0; i < p.length; i += 64)\n out.push(p.slice(i, i + 64));\n out.push('-----END ' + options.label + '-----');\n return out.join('\\n');\n};\n","'use strict'\n\nconst {\n axios,\n moment\n} = require('../imports')\n\nmodule.exports = function (path, data, method, header, contentType, log) {\n return new Promise(function (resolve, reject) {\n\n var options = {\n url: path,\n method: 'post',\n data: data,\n headers: {\n 'Content-Type': 'application/json',\n },\n json: true,\n timeout: 60000, //timeout: 10000,\n }\n\n if (method) {\n options.method = method\n }\n\n if (header) {\n var key\n\n for (key in header) {\n options.headers[key] = header[key]\n }\n }\n\n if (contentType) {\n options.headers['Content-Type'] = contentType\n }\n\n var starttime = Number(moment().format('x'))\n\n axios(options)\n .then(function (response) {\n var spendTime = (Number(moment().format('x')) - starttime) / 1000\n checkTime(log, spendTime)\n resolve({\n error: null,\n starttime: spendTime + 's',\n response: response,\n })\n })\n .catch(function (error) {\n var spendTime = (Number(moment().format('x')) - starttime) / 1000\n checkTime(log, spendTime)\n resolve({\n error: error,\n starttime: spendTime + 's',\n response: null,\n })\n })\n\n function checkTime(log, spendTime) {\n if (log) {\n if (spendTime >= 10 && spendTime < 30) {\n log.warn({\n Warning: `${options.method} ${path}, overtime : ${spendTime} s`\n })\n } else if (spendTime >= 30) {\n log.error({\n Error: `${options.method} ${path}, overtime : ${spendTime} s`\n })\n }\n }\n }\n })\n}\n","'use strict';\n\nconst base = exports;\n\nbase.Reporter = require('./reporter').Reporter;\nbase.DecoderBuffer = require('./buffer').DecoderBuffer;\nbase.EncoderBuffer = require('./buffer').EncoderBuffer;\nbase.Node = require('./node');\n","'use strict';\n\nmodule.exports = {\n datetime: require('./utility/datetime'),\n encrypt: require('./utility/encrypt'),\n random: require('./utility/random'),\n request: require('./utility/request'),\n requestLongTimeout: require('./utility/requestLongTimeout'),\n upload: require('./utility/upload'),\n validator: require('./utility/validate'),\n mathtools: require('./utility/mathtools'),\n};\n","'use strict'\n\nconst { randomstring, crypto } = require('../imports')\n\nfunction md5(data, raw) {\n return crypto\n .createHash('md5')\n .update(data)\n .digest(raw ? 'raw' : 'hex')\n}\n\nfunction maskPassword(msg) {\n function rotate_left(n, s) {\n var t4 = (n << s) | (n >>> (32 - s))\n return t4\n }\n\n function lsb_hex(val) {\n var str = ''\n var i\n var vh\n var vl\n\n for ( i = 0 ; i <= 6 ; i += 2 ) {\n vh = (val >>> (i * 4 + 4)) & 0x0f\n vl = (val >>> (i * 4)) & 0x0f\n str += vh.toString(16) + vl.toString(16)\n }\n return str\n }\n\n function cvt_hex(val) {\n var str = ''\n var i\n var v\n\n for ( i = 7 ; i >= 0 ; i-- ) {\n v = (val >>> (i * 4)) & 0x0f\n str += v.toString(16)\n }\n return str\n }\n\n function Utf8Encode(string) {\n string = string.replace(/\\r\\n/g, '\\n')\n var utftext = ''\n\n for ( var n = 0 ; n < string.length ; n++ ) {\n var c = string.charCodeAt(n)\n\n if (c < 128) {\n utftext += String.fromCharCode(c)\n } else if (c > 127 && c < 2048) {\n utftext += String.fromCharCode((c >> 6) | 192)\n utftext += String.fromCharCode((c & 63) | 128)\n } else {\n utftext += String.fromCharCode((c >> 12) | 224)\n utftext += String.fromCharCode(((c >> 6) & 63) | 128)\n utftext += String.fromCharCode((c & 63) | 128)\n }\n }\n\n return utftext\n }\n\n var blockstart\n var i, j\n var W = new Array(80)\n var H0 = 0x67452301\n var H1 = 0xefcdab89\n var H2 = 0x98badcfe\n var H3 = 0x10325476\n var H4 = 0xc3d2e1f0\n var A, B, C, D, E\n var temp\n\n msg = Utf8Encode(msg)\n\n var msg_len = msg.length\n\n var word_array = new Array()\n for ( i = 0 ; i < msg_len - 3 ; i += 4 ) {\n j =\n (msg.charCodeAt(i) << 24) |\n (msg.charCodeAt(i + 1) << 16) |\n (msg.charCodeAt(i + 2) << 8) |\n msg.charCodeAt(i + 3)\n word_array.push(j)\n }\n\n switch (msg_len % 4) {\n case 0:\n i = 0x080000000\n break\n case 1:\n i = (msg.charCodeAt(msg_len - 1) << 24) | 0x0800000\n break\n\n case 2:\n i =\n (msg.charCodeAt(msg_len - 2) << 24) |\n (msg.charCodeAt(msg_len - 1) << 16) |\n 0x08000\n break\n\n case 3:\n i =\n (msg.charCodeAt(msg_len - 3) << 24) |\n (msg.charCodeAt(msg_len - 2) << 16) |\n (msg.charCodeAt(msg_len - 1) << 8) |\n 0x80\n break\n }\n\n word_array.push(i)\n\n while (word_array.length % 16 != 14) word_array.push(0)\n\n word_array.push(msg_len >>> 29)\n word_array.push((msg_len << 3) & 0x0ffffffff)\n\n for ( blockstart = 0 ; blockstart < word_array.length ; blockstart += 16 ) {\n for ( i = 0 ; i < 16 ; i++ ) W[i] = word_array[blockstart + i]\n for ( i = 16 ; i <= 79 ; i++ )\n W[i] = rotate_left(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1)\n\n A = H0\n B = H1\n C = H2\n D = H3\n E = H4\n\n for ( i = 0 ; i <= 19 ; i++ ) {\n temp =\n (rotate_left(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5a827999) &\n 0x0ffffffff\n E = D\n D = C\n C = rotate_left(B, 30)\n B = A\n A = temp\n }\n\n for ( i = 20 ; i <= 39 ; i++ ) {\n temp =\n (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ed9eba1) & 0x0ffffffff\n E = D\n D = C\n C = rotate_left(B, 30)\n B = A\n A = temp\n }\n\n for ( i = 40 ; i <= 59 ; i++ ) {\n temp =\n (rotate_left(A, 5) +\n ((B & C) | (B & D) | (C & D)) +\n E +\n W[i] +\n 0x8f1bbcdc) &\n 0x0ffffffff\n E = D\n D = C\n C = rotate_left(B, 30)\n B = A\n A = temp\n }\n\n for ( i = 60 ; i <= 79 ; i++ ) {\n temp =\n (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0xca62c1d6) & 0x0ffffffff\n E = D\n D = C\n C = rotate_left(B, 30)\n B = A\n A = temp\n }\n\n H0 = (H0 + A) & 0x0ffffffff\n H1 = (H1 + B) & 0x0ffffffff\n H2 = (H2 + C) & 0x0ffffffff\n H3 = (H3 + D) & 0x0ffffffff\n H4 = (H4 + E) & 0x0ffffffff\n }\n\n var temp =\n cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4)\n\n return temp.toLowerCase()\n}\n\nexports.encryptPassword = (pwd, salt1, salt2) => {\n pwd = maskPassword(pwd)\n var key = 'ASD&*!)_)><>21ASDasnk<>MNd67&2561A21SKJ'\n var key2 = 'p,as;asd&^&7!)I(!@)*,> {\n var result = {}\n result.salt1 = randomstring.generate(10)\n result.salt2 = randomstring.generate(12)\n result.encryptPassword = exports.encryptPassword(\n pwd,\n result.salt1,\n result.salt2\n )\n return result\n}\n\n/**\n * 加密方法\n * @param key 加密key\n * @param iv 向量\n * @param data 需要加密的資料\n * @returns string\n */\nexports.encryptAES = (key, iv, data) => {\n var cipher = crypto.createCipheriv('aes-128-cbc', key, iv)\n var crypted = cipher.update(data, 'utf8', 'binary')\n crypted += cipher.final('binary')\n crypted = Buffer.from(crypted, 'binary').toString('base64')\n return crypted\n}\n\n/**\n * 解密方法\n * @param key 解密的key\n * @param iv 向量\n * @param crypted 密文\n * @returns string\n */\nexports.decryptAES = (key, iv, crypted) => {\n crypted = Buffer.from(crypted, 'base64').toString('binary')\n var decipher = crypto.createDecipheriv('aes-128-cbc', key, iv)\n var decoded = decipher.update(crypted, 'binary', 'utf8')\n decoded += decipher.final('utf8')\n return decoded\n}\n\nexports.encrypt = (algorithm, key, iv, text) => {\n const cipher = crypto.createCipheriv(algorithm, key, iv)\n let cipherText = cipher.update(text, 'utf8', 'base64')\n cipherText += cipher.final('base64')\n return cipherText\n}\n\nexports.decrypt = (algorithm, key, iv, cipherText) => {\n let decipher = crypto.createDecipheriv(algorithm, key, iv)\n let plaintext = decipher.update(cipherText, 'base64')\n plaintext += decipher.final('utf8')\n return plaintext\n}\n\n// ====== BufferToBase64 ======\nexports.bufferFromBase64 = (value) => {\n return Buffer.from(value, 'base64')\n}\n// ====== BufferToBinary ======\nexports.bufferFromBinary = (value) => {\n return Buffer.from(value, 'binary')\n}\n// ====== 組formData Field =======\nexports.encodeFieldPart = (boundary, name, value) => {\n var returnPart = `--${boundary}\\r\\n`\n\n returnPart += `Content-Disposition: form-data; name=\"${name}\"\\r\\n\\r\\n`\n\n returnPart += value + '\\r\\n'\n\n return returnPart\n}\n// ====== 組formData File =======\nexports.encodeFilePart = (boundary, type, name, filename) => {\n var returnPart = `--${boundary}\\r\\n`\n\n returnPart += `Content-Disposition: form-data; name=\"${name}\"; filename=\"${filename}\"\\r\\n`\n\n returnPart += `Content-Type: ${type}\\r\\n\\r\\n`\n\n return returnPart\n}\n\nexports.makePartBoundary = () => {\n var randomNumbers = (Math.random() + '').split('.')[1]\n\n return '--------------------------' + randomNumbers\n}\n","'use strict';\n\nmodule.exports = {\n // 外部\n axios: require('axios'),\n moment: require('moment'),\n randomstring: require('randomstring'),\n uuid: require('uuid'),\n crypto: require('crypto'),\n fs: require('fs'),\n _: require('lodash')\n};","'use strict';\n\nconst decoders = exports;\n\ndecoders.der = require('./der');\ndecoders.pem = require('./pem');\n","'use strict';\n\nconst {\n moment,\n uuid\n} = require('../imports');\n\nmodule.exports = {\n getRandomNumber: function (num) {\n if (!num) {\n num = 10;\n }\n var tmpStr = moment().format('ssmmHHYYYYMMDD') + Math.random().toString().substring(2, num + 2)\n return tmpStr.substr(0, num);\n },\n getRandomString: function (num) {\n var _uuid = uuid().toString();\n return _uuid.replace(/-/g, '').substring(0, num);\n },\n getRandomMemberAccount: function (num) {\n var text = '';\n var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n for (var i = 0; i < 6; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n text += this.getRandomString(2);\n text += Math.random().toString().substring(2, num + 2);\n return text;\n },\n getRandomNickName: function (num) {\n var text = '';\n var possible = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n for (var i = 0; i < 6; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n text += this.getRandomString(2);\n text += Math.random().toString().substring(2, num + 2);\n return text;\n }\n};","'use strict';\n\n// Helper\nfunction reverse(map) {\n const res = {};\n\n Object.keys(map).forEach(function(key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key)\n key = key | 0;\n\n const value = map[key];\n res[value] = key;\n });\n\n return res;\n}\n\nexports.tagClass = {\n 0: 'universal',\n 1: 'application',\n 2: 'context',\n 3: 'private'\n};\nexports.tagClassByName = reverse(exports.tagClass);\n\nexports.tag = {\n 0x00: 'end',\n 0x01: 'bool',\n 0x02: 'int',\n 0x03: 'bitstr',\n 0x04: 'octstr',\n 0x05: 'null_',\n 0x06: 'objid',\n 0x07: 'objDesc',\n 0x08: 'external',\n 0x09: 'real',\n 0x0a: 'enum',\n 0x0b: 'embed',\n 0x0c: 'utf8str',\n 0x0d: 'relativeOid',\n 0x10: 'seq',\n 0x11: 'set',\n 0x12: 'numstr',\n 0x13: 'printstr',\n 0x14: 't61str',\n 0x15: 'videostr',\n 0x16: 'ia5str',\n 0x17: 'utctime',\n 0x18: 'gentime',\n 0x19: 'graphstr',\n 0x1a: 'iso646str',\n 0x1b: 'genstr',\n 0x1c: 'unistr',\n 0x1d: 'charstr',\n 0x1e: 'bmpstr'\n};\nexports.tagByName = reverse(exports.tag);\n","'use strict';\n\nconst inherits = require('inherits');\nconst Buffer = require('safer-buffer').Buffer;\nconst Node = require('../base/node');\n\n// Import DER constants\nconst der = require('../constants/der');\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n}\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\ninherits(DERNode, Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag,\n primitive,\n cls,\n content) {\n const encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n\n // Short form\n if (content.length < 0x80) {\n const header = Buffer.alloc(2);\n header[0] = encodedTag;\n header[1] = content.length;\n return this._createEncoderBuffer([ header, content ]);\n }\n\n // Long form\n // Count octets required to store length\n let lenOctets = 1;\n for (let i = content.length; i >= 0x100; i >>= 8)\n lenOctets++;\n\n const header = Buffer.alloc(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)\n header[i] = j & 0xff;\n\n return this._createEncoderBuffer([ header, content ]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'bitstr') {\n return this._createEncoderBuffer([ str.unused | 0, str.data ]);\n } else if (tag === 'bmpstr') {\n const buf = Buffer.alloc(str.length * 2);\n for (let i = 0; i < str.length; i++) {\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n }\n return this._createEncoderBuffer(buf);\n } else if (tag === 'numstr') {\n if (!this._isNumstr(str)) {\n return this.reporter.error('Encoding of string type: numstr supports ' +\n 'only digits and space');\n }\n return this._createEncoderBuffer(str);\n } else if (tag === 'printstr') {\n if (!this._isPrintstr(str)) {\n return this.reporter.error('Encoding of string type: printstr supports ' +\n 'only latin upper and lower case letters, ' +\n 'digits, space, apostrophe, left and rigth ' +\n 'parenthesis, plus sign, comma, hyphen, ' +\n 'dot, slash, colon, equal sign, ' +\n 'question mark');\n }\n return this._createEncoderBuffer(str);\n } else if (/str$/.test(tag)) {\n return this._createEncoderBuffer(str);\n } else if (tag === 'objDesc') {\n return this._createEncoderBuffer(str);\n } else {\n return this.reporter.error('Encoding of string type: ' + tag +\n ' unsupported');\n }\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values)\n return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id))\n return this.reporter.error('objid not found in values map');\n id = values[id].split(/[\\s.]+/g);\n for (let i = 0; i < id.length; i++)\n id[i] |= 0;\n } else if (Array.isArray(id)) {\n id = id.slice();\n for (let i = 0; i < id.length; i++)\n id[i] |= 0;\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' +\n 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n\n // Count number of octets\n let size = 0;\n for (let i = 0; i < id.length; i++) {\n let ident = id[i];\n for (size++; ident >= 0x80; ident >>= 7)\n size++;\n }\n\n const objid = Buffer.alloc(size);\n let offset = objid.length - 1;\n for (let i = id.length - 1; i >= 0; i--) {\n let ident = id[i];\n objid[offset--] = ident & 0x7f;\n while ((ident >>= 7) > 0)\n objid[offset--] = 0x80 | (ident & 0x7f);\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num < 10)\n return '0' + num;\n else\n return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n let str;\n const date = new Date(time);\n\n if (tag === 'gentime') {\n str = [\n two(date.getUTCFullYear()),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else if (tag === 'utctime') {\n str = [\n two(date.getUTCFullYear() % 100),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values)\n return this.reporter.error('String int or enum given, but no values map');\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' +\n JSON.stringify(num));\n }\n num = values[num];\n }\n\n // Bignum, assume big endian\n if (typeof num !== 'number' && !Buffer.isBuffer(num)) {\n const numArray = num.toArray();\n if (!num.sign && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n num = Buffer.from(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n let size = num.length;\n if (num.length === 0)\n size++;\n\n const out = Buffer.alloc(size);\n num.copy(out);\n if (num.length === 0)\n out[0] = 0;\n return this._createEncoderBuffer(out);\n }\n\n if (num < 0x80)\n return this._createEncoderBuffer(num);\n\n if (num < 0x100)\n return this._createEncoderBuffer([0, num]);\n\n let size = 1;\n for (let i = num; i >= 0x100; i >>= 8)\n size++;\n\n const out = new Array(size);\n for (let i = out.length - 1; i >= 0; i--) {\n out[i] = num & 0xff;\n num >>= 8;\n }\n if(out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(Buffer.from(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n const state = this._baseState;\n let i;\n if (state['default'] === null)\n return false;\n\n const data = dataBuffer.join();\n if (state.defaultBuffer === undefined)\n state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n\n if (data.length !== state.defaultBuffer.length)\n return false;\n\n for (i=0; i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return false;\n\n return true;\n};\n\n// Utility methods\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n let res;\n\n if (tag === 'seqof')\n tag = 'seq';\n else if (tag === 'setof')\n tag = 'set';\n\n if (der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag === 'number' && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error('Unknown tag: ' + tag);\n\n if (res >= 0x1f)\n return reporter.error('Multi-octet tag encoding unsupported');\n\n if (!primitive)\n res |= 0x20;\n\n res |= (der.tagClassByName[cls || 'universal'] << 6);\n\n return res;\n}\n","'use strict';\n\nconst Reporter = require('../base/reporter').Reporter;\nconst EncoderBuffer = require('../base/buffer').EncoderBuffer;\nconst DecoderBuffer = require('../base/buffer').DecoderBuffer;\nconst assert = require('minimalistic-assert');\n\n// Supported tags\nconst tags = [\n 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',\n 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',\n 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',\n 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'\n];\n\n// Public methods list\nconst methods = [\n 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',\n 'any', 'contains'\n].concat(tags);\n\n// Overrided methods list\nconst overrided = [\n '_peekTag', '_decodeTag', '_use',\n '_decodeStr', '_decodeObjid', '_decodeTime',\n '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',\n\n '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',\n '_encodeNull', '_encodeInt', '_encodeBool'\n];\n\nfunction Node(enc, parent, name) {\n const state = {};\n this._baseState = state;\n\n state.name = name;\n state.enc = enc;\n\n state.parent = parent || null;\n state.children = null;\n\n // State\n state.tag = null;\n state.args = null;\n state.reverseArgs = null;\n state.choice = null;\n state.optional = false;\n state.any = false;\n state.obj = false;\n state.use = null;\n state.useDecoder = null;\n state.key = null;\n state['default'] = null;\n state.explicit = null;\n state.implicit = null;\n state.contains = null;\n\n // Should create new instance on each method\n if (!state.parent) {\n state.children = [];\n this._wrap();\n }\n}\nmodule.exports = Node;\n\nconst stateProps = [\n 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',\n 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',\n 'implicit', 'contains'\n];\n\nNode.prototype.clone = function clone() {\n const state = this._baseState;\n const cstate = {};\n stateProps.forEach(function(prop) {\n cstate[prop] = state[prop];\n });\n const res = new this.constructor(cstate.parent);\n res._baseState = cstate;\n return res;\n};\n\nNode.prototype._wrap = function wrap() {\n const state = this._baseState;\n methods.forEach(function(method) {\n this[method] = function _wrappedMethod() {\n const clone = new this.constructor(this);\n state.children.push(clone);\n return clone[method].apply(clone, arguments);\n };\n }, this);\n};\n\nNode.prototype._init = function init(body) {\n const state = this._baseState;\n\n assert(state.parent === null);\n body.call(this);\n\n // Filter children\n state.children = state.children.filter(function(child) {\n return child._baseState.parent === this;\n }, this);\n assert.equal(state.children.length, 1, 'Root node can have only one child');\n};\n\nNode.prototype._useArgs = function useArgs(args) {\n const state = this._baseState;\n\n // Filter children and args\n const children = args.filter(function(arg) {\n return arg instanceof this.constructor;\n }, this);\n args = args.filter(function(arg) {\n return !(arg instanceof this.constructor);\n }, this);\n\n if (children.length !== 0) {\n assert(state.children === null);\n state.children = children;\n\n // Replace parent to maintain backward link\n children.forEach(function(child) {\n child._baseState.parent = this;\n }, this);\n }\n if (args.length !== 0) {\n assert(state.args === null);\n state.args = args;\n state.reverseArgs = args.map(function(arg) {\n if (typeof arg !== 'object' || arg.constructor !== Object)\n return arg;\n\n const res = {};\n Object.keys(arg).forEach(function(key) {\n if (key == (key | 0))\n key |= 0;\n const value = arg[key];\n res[value] = key;\n });\n return res;\n });\n }\n};\n\n//\n// Overrided methods\n//\n\noverrided.forEach(function(method) {\n Node.prototype[method] = function _overrided() {\n const state = this._baseState;\n throw new Error(method + ' not implemented for encoding: ' + state.enc);\n };\n});\n\n//\n// Public methods\n//\n\ntags.forEach(function(tag) {\n Node.prototype[tag] = function _tagMethod() {\n const state = this._baseState;\n const args = Array.prototype.slice.call(arguments);\n\n assert(state.tag === null);\n state.tag = tag;\n\n this._useArgs(args);\n\n return this;\n };\n});\n\nNode.prototype.use = function use(item) {\n assert(item);\n const state = this._baseState;\n\n assert(state.use === null);\n state.use = item;\n\n return this;\n};\n\nNode.prototype.optional = function optional() {\n const state = this._baseState;\n\n state.optional = true;\n\n return this;\n};\n\nNode.prototype.def = function def(val) {\n const state = this._baseState;\n\n assert(state['default'] === null);\n state['default'] = val;\n state.optional = true;\n\n return this;\n};\n\nNode.prototype.explicit = function explicit(num) {\n const state = this._baseState;\n\n assert(state.explicit === null && state.implicit === null);\n state.explicit = num;\n\n return this;\n};\n\nNode.prototype.implicit = function implicit(num) {\n const state = this._baseState;\n\n assert(state.explicit === null && state.implicit === null);\n state.implicit = num;\n\n return this;\n};\n\nNode.prototype.obj = function obj() {\n const state = this._baseState;\n const args = Array.prototype.slice.call(arguments);\n\n state.obj = true;\n\n if (args.length !== 0)\n this._useArgs(args);\n\n return this;\n};\n\nNode.prototype.key = function key(newKey) {\n const state = this._baseState;\n\n assert(state.key === null);\n state.key = newKey;\n\n return this;\n};\n\nNode.prototype.any = function any() {\n const state = this._baseState;\n\n state.any = true;\n\n return this;\n};\n\nNode.prototype.choice = function choice(obj) {\n const state = this._baseState;\n\n assert(state.choice === null);\n state.choice = obj;\n this._useArgs(Object.keys(obj).map(function(key) {\n return obj[key];\n }));\n\n return this;\n};\n\nNode.prototype.contains = function contains(item) {\n const state = this._baseState;\n\n assert(state.use === null);\n state.contains = item;\n\n return this;\n};\n\n//\n// Decoding\n//\n\nNode.prototype._decode = function decode(input, options) {\n const state = this._baseState;\n\n // Decode root node\n if (state.parent === null)\n return input.wrapResult(state.children[0]._decode(input, options));\n\n let result = state['default'];\n let present = true;\n\n let prevKey = null;\n if (state.key !== null)\n prevKey = input.enterKey(state.key);\n\n // Check if tag is there\n if (state.optional) {\n let tag = null;\n if (state.explicit !== null)\n tag = state.explicit;\n else if (state.implicit !== null)\n tag = state.implicit;\n else if (state.tag !== null)\n tag = state.tag;\n\n if (tag === null && !state.any) {\n // Trial and Error\n const save = input.save();\n try {\n if (state.choice === null)\n this._decodeGeneric(state.tag, input, options);\n else\n this._decodeChoice(input, options);\n present = true;\n } catch (e) {\n present = false;\n }\n input.restore(save);\n } else {\n present = this._peekTag(input, tag, state.any);\n\n if (input.isError(present))\n return present;\n }\n }\n\n // Push object on stack\n let prevObj;\n if (state.obj && present)\n prevObj = input.enterObject();\n\n if (present) {\n // Unwrap explicit values\n if (state.explicit !== null) {\n const explicit = this._decodeTag(input, state.explicit);\n if (input.isError(explicit))\n return explicit;\n input = explicit;\n }\n\n const start = input.offset;\n\n // Unwrap implicit and normal values\n if (state.use === null && state.choice === null) {\n let save;\n if (state.any)\n save = input.save();\n const body = this._decodeTag(\n input,\n state.implicit !== null ? state.implicit : state.tag,\n state.any\n );\n if (input.isError(body))\n return body;\n\n if (state.any)\n result = input.raw(save);\n else\n input = body;\n }\n\n if (options && options.track && state.tag !== null)\n options.track(input.path(), start, input.length, 'tagged');\n\n if (options && options.track && state.tag !== null)\n options.track(input.path(), input.offset, input.length, 'content');\n\n // Select proper method for tag\n if (state.any) {\n // no-op\n } else if (state.choice === null) {\n result = this._decodeGeneric(state.tag, input, options);\n } else {\n result = this._decodeChoice(input, options);\n }\n\n if (input.isError(result))\n return result;\n\n // Decode children\n if (!state.any && state.choice === null && state.children !== null) {\n state.children.forEach(function decodeChildren(child) {\n // NOTE: We are ignoring errors here, to let parser continue with other\n // parts of encoded data\n child._decode(input, options);\n });\n }\n\n // Decode contained/encoded by schema, only in bit or octet strings\n if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {\n const data = new DecoderBuffer(result);\n result = this._getUse(state.contains, input._reporterState.obj)\n ._decode(data, options);\n }\n }\n\n // Pop object\n if (state.obj && present)\n result = input.leaveObject(prevObj);\n\n // Set key\n if (state.key !== null && (result !== null || present === true))\n input.leaveKey(prevKey, state.key, result);\n else if (prevKey !== null)\n input.exitKey(prevKey);\n\n return result;\n};\n\nNode.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {\n const state = this._baseState;\n\n if (tag === 'seq' || tag === 'set')\n return null;\n if (tag === 'seqof' || tag === 'setof')\n return this._decodeList(input, tag, state.args[0], options);\n else if (/str$/.test(tag))\n return this._decodeStr(input, tag, options);\n else if (tag === 'objid' && state.args)\n return this._decodeObjid(input, state.args[0], state.args[1], options);\n else if (tag === 'objid')\n return this._decodeObjid(input, null, null, options);\n else if (tag === 'gentime' || tag === 'utctime')\n return this._decodeTime(input, tag, options);\n else if (tag === 'null_')\n return this._decodeNull(input, options);\n else if (tag === 'bool')\n return this._decodeBool(input, options);\n else if (tag === 'objDesc')\n return this._decodeStr(input, tag, options);\n else if (tag === 'int' || tag === 'enum')\n return this._decodeInt(input, state.args && state.args[0], options);\n\n if (state.use !== null) {\n return this._getUse(state.use, input._reporterState.obj)\n ._decode(input, options);\n } else {\n return input.error('unknown tag: ' + tag);\n }\n};\n\nNode.prototype._getUse = function _getUse(entity, obj) {\n\n const state = this._baseState;\n // Create altered use decoder if implicit is set\n state.useDecoder = this._use(entity, obj);\n assert(state.useDecoder._baseState.parent === null);\n state.useDecoder = state.useDecoder._baseState.children[0];\n if (state.implicit !== state.useDecoder._baseState.implicit) {\n state.useDecoder = state.useDecoder.clone();\n state.useDecoder._baseState.implicit = state.implicit;\n }\n return state.useDecoder;\n};\n\nNode.prototype._decodeChoice = function decodeChoice(input, options) {\n const state = this._baseState;\n let result = null;\n let match = false;\n\n Object.keys(state.choice).some(function(key) {\n const save = input.save();\n const node = state.choice[key];\n try {\n const value = node._decode(input, options);\n if (input.isError(value))\n return false;\n\n result = { type: key, value: value };\n match = true;\n } catch (e) {\n input.restore(save);\n return false;\n }\n return true;\n }, this);\n\n if (!match)\n return input.error('Choice not matched');\n\n return result;\n};\n\n//\n// Encoding\n//\n\nNode.prototype._createEncoderBuffer = function createEncoderBuffer(data) {\n return new EncoderBuffer(data, this.reporter);\n};\n\nNode.prototype._encode = function encode(data, reporter, parent) {\n const state = this._baseState;\n if (state['default'] !== null && state['default'] === data)\n return;\n\n const result = this._encodeValue(data, reporter, parent);\n if (result === undefined)\n return;\n\n if (this._skipDefault(result, reporter, parent))\n return;\n\n return result;\n};\n\nNode.prototype._encodeValue = function encode(data, reporter, parent) {\n const state = this._baseState;\n\n // Decode root node\n if (state.parent === null)\n return state.children[0]._encode(data, reporter || new Reporter());\n\n let result = null;\n\n // Set reporter to share it with a child class\n this.reporter = reporter;\n\n // Check if data is there\n if (state.optional && data === undefined) {\n if (state['default'] !== null)\n data = state['default'];\n else\n return;\n }\n\n // Encode children first\n let content = null;\n let primitive = false;\n if (state.any) {\n // Anything that was given is translated to buffer\n result = this._createEncoderBuffer(data);\n } else if (state.choice) {\n result = this._encodeChoice(data, reporter);\n } else if (state.contains) {\n content = this._getUse(state.contains, parent)._encode(data, reporter);\n primitive = true;\n } else if (state.children) {\n content = state.children.map(function(child) {\n if (child._baseState.tag === 'null_')\n return child._encode(null, reporter, data);\n\n if (child._baseState.key === null)\n return reporter.error('Child should have a key');\n const prevKey = reporter.enterKey(child._baseState.key);\n\n if (typeof data !== 'object')\n return reporter.error('Child expected, but input is not object');\n\n const res = child._encode(data[child._baseState.key], reporter, data);\n reporter.leaveKey(prevKey);\n\n return res;\n }, this).filter(function(child) {\n return child;\n });\n content = this._createEncoderBuffer(content);\n } else {\n if (state.tag === 'seqof' || state.tag === 'setof') {\n // TODO(indutny): this should be thrown on DSL level\n if (!(state.args && state.args.length === 1))\n return reporter.error('Too many args for : ' + state.tag);\n\n if (!Array.isArray(data))\n return reporter.error('seqof/setof, but data is not Array');\n\n const child = this.clone();\n child._baseState.implicit = null;\n content = this._createEncoderBuffer(data.map(function(item) {\n const state = this._baseState;\n\n return this._getUse(state.args[0], data)._encode(item, reporter);\n }, child));\n } else if (state.use !== null) {\n result = this._getUse(state.use, parent)._encode(data, reporter);\n } else {\n content = this._encodePrimitive(state.tag, data);\n primitive = true;\n }\n }\n\n // Encode data itself\n if (!state.any && state.choice === null) {\n const tag = state.implicit !== null ? state.implicit : state.tag;\n const cls = state.implicit === null ? 'universal' : 'context';\n\n if (tag === null) {\n if (state.use === null)\n reporter.error('Tag could be omitted only for .use()');\n } else {\n if (state.use === null)\n result = this._encodeComposite(tag, primitive, cls, content);\n }\n }\n\n // Wrap in explicit\n if (state.explicit !== null)\n result = this._encodeComposite(state.explicit, false, 'context', result);\n\n return result;\n};\n\nNode.prototype._encodeChoice = function encodeChoice(data, reporter) {\n const state = this._baseState;\n\n const node = state.choice[data.type];\n if (!node) {\n assert(\n false,\n data.type + ' not found in ' +\n JSON.stringify(Object.keys(state.choice)));\n }\n return node._encode(data.value, reporter);\n};\n\nNode.prototype._encodePrimitive = function encodePrimitive(tag, data) {\n const state = this._baseState;\n\n if (/str$/.test(tag))\n return this._encodeStr(data, tag);\n else if (tag === 'objid' && state.args)\n return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);\n else if (tag === 'objid')\n return this._encodeObjid(data, null, null);\n else if (tag === 'gentime' || tag === 'utctime')\n return this._encodeTime(data, tag);\n else if (tag === 'null_')\n return this._encodeNull();\n else if (tag === 'int' || tag === 'enum')\n return this._encodeInt(data, state.args && state.reverseArgs[0]);\n else if (tag === 'bool')\n return this._encodeBool(data);\n else if (tag === 'objDesc')\n return this._encodeStr(data, tag);\n else\n throw new Error('Unsupported tag: ' + tag);\n};\n\nNode.prototype._isNumstr = function isNumstr(str) {\n return /^[0-9 ]*$/.test(str);\n};\n\nNode.prototype._isPrintstr = function isPrintstr(str) {\n return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(str);\n};\n","\"use strict\";\n\nconst { crypto, axios } = require(\"../imports\");\n\nfunction genAuth(netstoragePath, actionHeaders) {\n let acs_auth_data = \"\";\n let acs_auth_sign = \"\";\n let keyName = cfg.keyName;\n\n try {\n acs_auth_data = `5, 0.0.0.0, 0.0.0.0, ${Math.floor(\n Date.now() / 1000\n )}, ${Math.floor(Math.random() * 100000)}, ${keyName}`;\n const sign_string = `${netstoragePath}\\nx-akamai-acs-action:${actionHeaders}\\n`;\n const message = acs_auth_data + sign_string;\n acs_auth_sign = crypto\n .createHmac(\"sha256\", cfg.key)\n .update(message)\n .digest(\"base64\");\n } catch (err) {\n throw new Error(`[Auth Error] ${err}`);\n }\n\n return { acs_auth_data: acs_auth_data, acs_auth_sign: acs_auth_sign };\n}\n\nfunction upload(buffer, path) {\n const acs_action = `version=1&action=upload`;\n const authData = genAuth(escape(path), acs_action);\n\n return axios({\n method: \"put\",\n url: cfg.host + path,\n data: buffer,\n headers: {\n \"X-Akamai-ACS-Action\": acs_action,\n \"X-Akamai-ACS-Auth-Data\": authData.acs_auth_data,\n \"X-Akamai-ACS-Auth-Sign\": authData.acs_auth_sign,\n \"Accept-Encoding\": \"identity\",\n \"User-Agent\": \"NetStorageKit-Node\"\n }\n });\n}\n\nlet cfg;\n\nmodule.exports = {\n initialize: config => {\n cfg = cfg || config;\n },\n\n akamai: (buffer, path) => {\n return upload(buffer, path);\n }\n};\n"],"sourceRoot":""}