02a68f820442f542faae80e2739537aa52785ce8
[motion2.git] / server / utils / mask-sensitive-data.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x58f5d9,_0x553121){var _0x2c233f=function(_0x497700){while(--_0x497700){_0x58f5d9['push'](_0x58f5d9['shift']());}};_0x2c233f(++_0x553121);}(_0xda2d,0x102));var _0xdda2=function(_0xe72193,_0x4ad5d0){_0xe72193=_0xe72193-0x0;var _0x522965=_0xda2d[_0xe72193];return _0x522965;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData;