Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / components / encryptor / index.js
index b7f863f..7132015 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x561b44,_0x2c8366){var _0x3cd153=function(_0x10c3ec){while(--_0x10c3ec){_0x561b44['push'](_0x561b44['shift']());}};_0x3cd153(++_0x2c8366);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});};
\ No newline at end of file
+var _0xafb9=['encryptString','secret','utf8','base64','crypto','bluebird','../../config/environment','secrets','session','aes-256-ctr','aes192','encryptFile','createReadStream','createWriteStream','algorithm','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher'];(function(_0x3b2338,_0xeda656){var _0x1b6703=function(_0x4f90c5){while(--_0x4f90c5){_0x3b2338['push'](_0x3b2338['shift']());}};_0x1b6703(++_0xeda656);}(_0xafb9,0x68));var _0x9afb=function(_0x2eb288,_0x13d09b){_0x2eb288=_0x2eb288-0x0;var _0x2f3906=_0xafb9[_0x2eb288];return _0x2f3906;};'use strict';var crypto=require(_0x9afb('0x0'));var fs=require('fs');var BPromise=require(_0x9afb('0x1'));var config=require(_0x9afb('0x2'));const stringOptions={'secret':config[_0x9afb('0x3')][_0x9afb('0x4')],'algorithm':_0x9afb('0x5')};const fileOptions={'algorithm':_0x9afb('0x6')};function combineOptions(_0x44892f){var _0xdaf0c6={};for(var _0x4e983d in fileOptions){if(fileOptions['hasOwnProperty'](_0x4e983d)){_0xdaf0c6[_0x4e983d]=fileOptions[_0x4e983d];}}if(_0x44892f){for(var _0x91ffa0 in _0x44892f){if(_0x44892f['hasOwnProperty'](_0x91ffa0)){_0xdaf0c6[_0x91ffa0]=_0x44892f[_0x91ffa0];}}}return _0xdaf0c6;}exports[_0x9afb('0x7')]=function(_0x548b24,_0x556880,_0x4c0e9d,_0x1edf77){return new BPromise(function(_0x20b8c1,_0x51dc88){_0x1edf77=combineOptions(_0x1edf77);var _0x3ef362=new Buffer(_0x4c0e9d);var _0x3e0264=fs[_0x9afb('0x8')](_0x548b24);var _0x27fa71=fs[_0x9afb('0x9')](_0x556880);var _0x56f477=crypto['createCipher'](_0x1edf77[_0x9afb('0xa')],_0x3ef362);_0x3e0264['on'](_0x9afb('0xb'),function(_0x3e6a29){var _0x31b574=new Buffer(_0x56f477[_0x9afb('0xc')](_0x3e6a29),_0x9afb('0xd'));_0x27fa71[_0x9afb('0xe')](_0x31b574);});_0x3e0264['on'](_0x9afb('0xf'),function(){try{var _0x464462=new Buffer(_0x56f477[_0x9afb('0x10')]('binary'),_0x9afb('0xd'));_0x27fa71['write'](_0x464462);_0x27fa71['end']();_0x27fa71['on'](_0x9afb('0x11'),function(){return _0x20b8c1(_0x556880);});}catch(_0x3e40c1){fs[_0x9afb('0x12')](_0x556880);return _0x51dc88(_0x3e40c1);}});});};exports[_0x9afb('0x13')]=function(_0x46b16f,_0x39cdf1,_0xd111f1,_0x4d31e3){return new BPromise(function(_0x18505a,_0x2145c2){_0x4d31e3=combineOptions(_0x4d31e3);var _0x23b906=new Buffer(_0xd111f1);var _0x190cb8=fs[_0x9afb('0x8')](_0x46b16f);var _0x508433=fs[_0x9afb('0x9')](_0x39cdf1);var _0x50a7e4=crypto[_0x9afb('0x14')](_0x4d31e3[_0x9afb('0xa')],_0x23b906);_0x190cb8['on']('data',function(_0x4a1c74){var _0x3ac42f=new Buffer(_0x50a7e4[_0x9afb('0xc')](_0x4a1c74),_0x9afb('0xd'));_0x508433[_0x9afb('0xe')](_0x3ac42f);});_0x190cb8['on'](_0x9afb('0xf'),function(){try{var _0x57b4e2=new Buffer(_0x50a7e4[_0x9afb('0x10')]('binary'),'binary');_0x508433[_0x9afb('0xe')](_0x57b4e2);_0x508433[_0x9afb('0xf')]();_0x508433['on'](_0x9afb('0x11'),function(){return _0x18505a(_0x39cdf1);});}catch(_0x2d3938){fs['unlink'](_0x39cdf1);return _0x2145c2(_0x2d3938);}});});};exports[_0x9afb('0x15')]=function(_0x725a04,_0x49ba5f,_0x571bd9){var _0x5b5dab=_0x571bd9||stringOptions[_0x9afb('0xa')];var _0x4fbe61=_0x49ba5f||stringOptions[_0x9afb('0x16')];var _0x123510=crypto['createCipher'](_0x5b5dab,_0x4fbe61);var _0x324293=_0x123510[_0x9afb('0xc')](_0x725a04,_0x9afb('0x17'),_0x9afb('0x18'));_0x324293+=_0x123510['final'](_0x9afb('0x18'));return _0x324293;};exports['decryptString']=function(_0x29e092,_0x4ad975,_0x5692fa){var _0x1e6100=_0x5692fa||stringOptions[_0x9afb('0xa')];var _0x30af1b=_0x4ad975||stringOptions[_0x9afb('0x16')];var _0x119e04=crypto[_0x9afb('0x14')](_0x1e6100,_0x30af1b);var _0x46673d=_0x119e04['update'](_0x29e092,'base64',_0x9afb('0x17'));_0x46673d+=_0x119e04[_0x9afb('0x10')]('utf8');return _0x46673d;};
\ No newline at end of file