lemonldap-ng-handler 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/LICENSE +622 -284
- package/lib/handlerDevOps.d.ts +22 -0
- package/lib/handlerDevOpsST.d.ts +10 -0
- package/lib/handlerMain.d.ts +30 -0
- package/lib/handlerServiceToken.d.ts +8 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +2 -322
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +726 -0
- package/lib/index.mjs.map +1 -0
- package/lib/init.d.ts +30 -0
- package/lib/tsv.d.ts +59 -0
- package/package.json +20 -47
- package/lib/conf.js +0 -340
- package/lib/handlerDevOps.js +0 -167
- package/lib/handlerDevOpsST.js +0 -23
- package/lib/handlerOAuth2.js +0 -55
- package/lib/handlerServiceToken.js +0 -59
- package/lib/safelib.js +0 -174
package/lib/handlerDevOps.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
/*
|
|
3
|
-
* LemonLDAP::NG DevOps handler
|
|
4
|
-
* (see https://lemonldap-ng.org/documentation/2.0/devopshandler)
|
|
5
|
-
*
|
|
6
|
-
* See README.md for license and copyright
|
|
7
|
-
*/
|
|
8
|
-
var Handler, HandlerDevOps;
|
|
9
|
-
|
|
10
|
-
Handler = require('./').class;
|
|
11
|
-
|
|
12
|
-
HandlerDevOps = class HandlerDevOps extends Handler {
|
|
13
|
-
constructor(args) {
|
|
14
|
-
super(args);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Override grant() to get application rules.json before checking access
|
|
18
|
-
grant(req, uri, session) {
|
|
19
|
-
var base, base1, d, lvOpts, self, up, vhost;
|
|
20
|
-
vhost = this.resolveAlias(req);
|
|
21
|
-
// Calculates rules.json URL
|
|
22
|
-
self = this;
|
|
23
|
-
(base1 = this.conf.tsv).lastVhostUpdate || (base1.lastVhostUpdate = {});
|
|
24
|
-
// Initialize devops conf if needed (each 10mn)
|
|
25
|
-
if (!(this.conf.tsv.defaultCondition[vhost] && (Date.now() / 1000 - this.conf.tsv.lastVhostUpdate[vhost] < 600))) {
|
|
26
|
-
// TODO: FALSE !!!
|
|
27
|
-
base = req.cgiParams && req.cgiParams['RULES_URL'] ? req.cgiParams['RULES_URL'] : `${this.conf.tsv.loopBackUrl || 'http://127.0.0.1'}/rules.json`;
|
|
28
|
-
if (!base.match(/^(https?):\/\/([^\/:]+)(?::(\d+))?(.*)$/)) {
|
|
29
|
-
this.logger.error(`Bad loopBackUrl ${base}`);
|
|
30
|
-
}
|
|
31
|
-
lvOpts = {
|
|
32
|
-
prot: RegExp.$1,
|
|
33
|
-
host: RegExp.$2,
|
|
34
|
-
path: RegExp.$4,
|
|
35
|
-
port: RegExp.$3 || (RegExp.$1 === 'https' ? 443 : 80)
|
|
36
|
-
};
|
|
37
|
-
if (!(req.cgiParams && req.cgiParams['RULES_URL'])) {
|
|
38
|
-
lvOpts.lb = true;
|
|
39
|
-
}
|
|
40
|
-
up = super.grant;
|
|
41
|
-
d = new Promise(function(resolve, reject) {
|
|
42
|
-
return self.loadVhostConfig(req, vhost, lvOpts).then(function() {
|
|
43
|
-
return up.call(self, req, uri, session).then(function() {
|
|
44
|
-
return resolve(true);
|
|
45
|
-
}).catch(function(e) {
|
|
46
|
-
return reject(e);
|
|
47
|
-
});
|
|
48
|
-
}).catch(function(e) {
|
|
49
|
-
self.logger.error('E', e);
|
|
50
|
-
return up.call(self, req, uri, session).then(function() {
|
|
51
|
-
return resolve(true);
|
|
52
|
-
}).catch(function(e) {
|
|
53
|
-
return reject(e);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
return d;
|
|
58
|
-
} else {
|
|
59
|
-
return super.grant(req, uri, session);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
loadVhostConfig(req, vhost, lvOpts) {
|
|
64
|
-
var d, self;
|
|
65
|
-
self = this;
|
|
66
|
-
d = new Promise(function(resolve, reject) {
|
|
67
|
-
var http, opts;
|
|
68
|
-
if (!lvOpts.lb) {
|
|
69
|
-
// Verify URL
|
|
70
|
-
// Build request
|
|
71
|
-
vhost = lvOpts.host;
|
|
72
|
-
}
|
|
73
|
-
opts = {
|
|
74
|
-
host: lvOpts.host,
|
|
75
|
-
path: lvOpts.path,
|
|
76
|
-
port: lvOpts.port,
|
|
77
|
-
headers: {
|
|
78
|
-
Host: vhost
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
// and launch it
|
|
82
|
-
self.logger.debug(`Trying to get ${lvOpts.prot}://${vhost}:${lvOpts.port}${lvOpts.path}`);
|
|
83
|
-
http = require(lvOpts.prot);
|
|
84
|
-
req = http.request(opts, function(resp) {
|
|
85
|
-
var str;
|
|
86
|
-
str = '';
|
|
87
|
-
resp.on('data', function(chunk) {
|
|
88
|
-
return str += chunk;
|
|
89
|
-
});
|
|
90
|
-
return resp.on('end', function() {
|
|
91
|
-
var cond, err, h, json, prot, ref, ref1, rule, rules, sub, url, v, val;
|
|
92
|
-
if (str) {
|
|
93
|
-
rules = '';
|
|
94
|
-
try {
|
|
95
|
-
json = JSON.parse(str);
|
|
96
|
-
// Blank old rules
|
|
97
|
-
self.conf.tsv.locationCondition[vhost] = [];
|
|
98
|
-
self.conf.tsv.locationProtection[vhost] = [];
|
|
99
|
-
self.conf.tsv.locationRegexp[vhost] = [];
|
|
100
|
-
self.conf.tsv.locationCount = 0;
|
|
101
|
-
self.conf.tsv.headerList[vhost] = [];
|
|
102
|
-
// Parse rules
|
|
103
|
-
self.conf.safe[vhost] = self.conf.newSafe();
|
|
104
|
-
ref = json.rules;
|
|
105
|
-
for (url in ref) {
|
|
106
|
-
rule = ref[url];
|
|
107
|
-
rule = new String(rule).valueOf();
|
|
108
|
-
self.logger.debug(`Compile ${rule}`);
|
|
109
|
-
[cond, prot] = self.conf.conditionSub(rule, self.conf.safe[vhost]);
|
|
110
|
-
if (url === 'default') {
|
|
111
|
-
self.conf.tsv.defaultCondition[vhost] = cond;
|
|
112
|
-
self.conf.tsv.defaultProtection[vhost] = prot;
|
|
113
|
-
} else {
|
|
114
|
-
self.conf.tsv.locationCondition[vhost].push(cond);
|
|
115
|
-
self.conf.tsv.locationProtection[vhost].push(prot);
|
|
116
|
-
self.conf.tsv.locationRegexp[vhost].push(new RegExp(url.replace(/\(\?#.*?\)/, '')));
|
|
117
|
-
self.conf.tsv.locationCount[vhost]++;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (!self.conf.tsv.defaultCondition[vhost]) {
|
|
121
|
-
self.conf.tsv.defaultCondition[vhost] = function() {
|
|
122
|
-
return 1;
|
|
123
|
-
};
|
|
124
|
-
self.conf.tsv.defaultProtection = false;
|
|
125
|
-
}
|
|
126
|
-
// Parse headers
|
|
127
|
-
sub = '';
|
|
128
|
-
ref1 = json.headers;
|
|
129
|
-
for (h in ref1) {
|
|
130
|
-
v = ref1[h];
|
|
131
|
-
self.conf.tsv.headerList[vhost].push(h);
|
|
132
|
-
val = self.conf.substitute(v);
|
|
133
|
-
sub += `'${h}': ${val},`;
|
|
134
|
-
}
|
|
135
|
-
sub = sub.replace(/,$/, '');
|
|
136
|
-
self.conf.vm.runInContext(`fg = function(session) {return {${sub}};}`, self.conf.safe[vhost]);
|
|
137
|
-
self.conf.tsv.forgeHeaders[vhost] = self.conf.safe[vhost].fg;
|
|
138
|
-
self.conf.tsv.lastVhostUpdate[vhost] = Date.now() / 1000;
|
|
139
|
-
return resolve();
|
|
140
|
-
} catch (error) {
|
|
141
|
-
err = error;
|
|
142
|
-
self.logger.error(`JSON parsing error: ${err}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
self.logger.info("No rules found, apply default rule");
|
|
146
|
-
self.conf.tsv.defaultCondition[vhost] = function() {
|
|
147
|
-
return 1;
|
|
148
|
-
};
|
|
149
|
-
self.conf.tsv.defaultProtection = false;
|
|
150
|
-
self.conf.tsv.lastVhostUpdate[vhost] = Date.now() / 1000;
|
|
151
|
-
return resolve();
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
req.on('error', function(e) {
|
|
155
|
-
self.logger.error(`Unable to load rules.json: ${e.message}`);
|
|
156
|
-
return reject();
|
|
157
|
-
});
|
|
158
|
-
return req.end();
|
|
159
|
-
});
|
|
160
|
-
return d;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
module.exports = HandlerDevOps;
|
|
166
|
-
|
|
167
|
-
}).call(this);
|
package/lib/handlerDevOpsST.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
/*
|
|
3
|
-
* LemonLDAP::NG handler-service-token for Node.js/express
|
|
4
|
-
* (see https://lemonldap-ng.org/documentation/2.0/servertoserver)
|
|
5
|
-
*
|
|
6
|
-
* See README.md for license and copyright
|
|
7
|
-
*/
|
|
8
|
-
var HandlerDevOps, HandlerDevOpsST, HandlerServiceToken;
|
|
9
|
-
|
|
10
|
-
HandlerServiceToken = require('./handlerServiceToken');
|
|
11
|
-
|
|
12
|
-
HandlerDevOps = require('./handlerDevOps');
|
|
13
|
-
|
|
14
|
-
HandlerDevOpsST = class HandlerDevOpsST extends HandlerDevOps {
|
|
15
|
-
fetchId(req) {
|
|
16
|
-
return HandlerServiceToken.prototype.fetchId.call(this, req);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
module.exports = HandlerDevOpsST;
|
|
22
|
-
|
|
23
|
-
}).call(this);
|
package/lib/handlerOAuth2.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
/*
|
|
3
|
-
* LemonLDAP::NG handler-oauth2 for Node.js/express
|
|
4
|
-
* (see https://lemonldap-ng.org/documentation/2.0/servertoserver)
|
|
5
|
-
*
|
|
6
|
-
* See README.md for license and copyright
|
|
7
|
-
*/
|
|
8
|
-
var Handler, HandlerOAuth2;
|
|
9
|
-
|
|
10
|
-
Handler = require('./').class;
|
|
11
|
-
|
|
12
|
-
HandlerOAuth2 = class HandlerOAuth2 extends Handler {
|
|
13
|
-
constructor(args) {
|
|
14
|
-
var self;
|
|
15
|
-
self = super(args);
|
|
16
|
-
self;
|
|
17
|
-
self;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
fetchId(req) {
|
|
21
|
-
var access_token, authorization;
|
|
22
|
-
authorization = req.cgiParams['HTTP_AUTHORIZATION'];
|
|
23
|
-
if ((authorization != null) && authorization.match(/^Bearer (.+)$/i)) {
|
|
24
|
-
access_token = authorization.replace(/^Bearer (.+)$/i, "$1");
|
|
25
|
-
this.logger.debug(`Found OAuth2 access token ${access_token}`);
|
|
26
|
-
return access_token;
|
|
27
|
-
}
|
|
28
|
-
return super.fetchId(req);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
retrieveSession(access_token) {
|
|
32
|
-
var d, self;
|
|
33
|
-
self = this;
|
|
34
|
-
return d = new Promise(function(resolve, reject) {
|
|
35
|
-
var oidcSession;
|
|
36
|
-
return oidcSession = self.conf.oidcStorageModule.get(id).then(function(session) { // kind OIDCI
|
|
37
|
-
if (session.user_session_id) {
|
|
38
|
-
return super.retrieveSession(session.user_session_id).then(function(s) {
|
|
39
|
-
return resolve(s);
|
|
40
|
-
}).catch(function(e) {
|
|
41
|
-
return reject(false);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}).catch(function(e) {
|
|
45
|
-
self.userLogger.info(`OAuth2 token not found in store: ${e}`);
|
|
46
|
-
return reject(false);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
module.exports = HandlerOAuth2;
|
|
54
|
-
|
|
55
|
-
}).call(this);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
/*
|
|
3
|
-
* LemonLDAP::NG handler-service-token for Node.js/express
|
|
4
|
-
* (see https://lemonldap-ng.org/documentation/2.0/servertoserver)
|
|
5
|
-
*
|
|
6
|
-
* See README.md for license and copyright
|
|
7
|
-
*/
|
|
8
|
-
var Handler, HandlerServiceToken;
|
|
9
|
-
|
|
10
|
-
Handler = require('./').class;
|
|
11
|
-
|
|
12
|
-
HandlerServiceToken = class HandlerServiceToken extends Handler {
|
|
13
|
-
constructor(args) {
|
|
14
|
-
super(args);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Override fetchId() to use token if present instead of cookie
|
|
18
|
-
fetchId(req) {
|
|
19
|
-
var s, t, time, token, vh;
|
|
20
|
-
token = '';
|
|
21
|
-
if (req.cgiParams) {
|
|
22
|
-
token = req.cgiParams['HTTP_X_LLNG_TOKEN'];
|
|
23
|
-
} else {
|
|
24
|
-
token = req.header['x-llng-token'];
|
|
25
|
-
}
|
|
26
|
-
if (token) {
|
|
27
|
-
// Decrypt token
|
|
28
|
-
s = this.conf.tsv.cipher.decrypt(token);
|
|
29
|
-
// Token format:
|
|
30
|
-
// time:_session_id:vhost1:vhost2,...
|
|
31
|
-
t = s.split(':');
|
|
32
|
-
// At least one vhost
|
|
33
|
-
if (!t[2]) {
|
|
34
|
-
this.userLogger.error('Bad service token');
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
// Is token in good interval ?
|
|
38
|
-
time = Date.now() / 1000;
|
|
39
|
-
if (!(t[0] <= time && t[0] > time - 30)) {
|
|
40
|
-
this.userLogger.warn('Expired service token');
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
// Is vhost listed in token ?
|
|
44
|
-
vh = this.resolveAlias(req);
|
|
45
|
-
if (!(t.indexOf(vh) > 1)) {
|
|
46
|
-
this.userLogger.error(`${vh} not authorizated in token (${s})`);
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
// Retun _session_id
|
|
50
|
-
return t[1];
|
|
51
|
-
}
|
|
52
|
-
return super.fetchId(req);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
module.exports = HandlerServiceToken;
|
|
58
|
-
|
|
59
|
-
}).call(this);
|
package/lib/safelib.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
/*
|
|
3
|
-
*
|
|
4
|
-
* Extended functions
|
|
5
|
-
* (see https://lemonldap-ng.org/documentation/latest/extendedfunctions)
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
var ExtdFunc, Iconv;
|
|
9
|
-
|
|
10
|
-
Iconv = null;
|
|
11
|
-
|
|
12
|
-
ExtdFunc = (function() {
|
|
13
|
-
var cipher, date, encrypt, unicode2iso;
|
|
14
|
-
|
|
15
|
-
class ExtdFunc {
|
|
16
|
-
constructor(c) {
|
|
17
|
-
var e;
|
|
18
|
-
cipher = c;
|
|
19
|
-
try {
|
|
20
|
-
Iconv = require('iconv').Iconv;
|
|
21
|
-
} catch (error) {
|
|
22
|
-
e = error;
|
|
23
|
-
console.log("iconv module not available");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
hostname(req) {
|
|
28
|
-
return req.headers.host;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
remote_ip(req) {
|
|
32
|
-
if (req.ip != null) {
|
|
33
|
-
return req.ip;
|
|
34
|
-
} else {
|
|
35
|
-
return req.cgiParams.REMOTE_ADDR;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
basic(login, pwd) {
|
|
40
|
-
return "Basic " + unicode2iso(`${login}:${pwd}`).toString('base64');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
groupMatch(groups, attr, value) {
|
|
44
|
-
var group, i, len, match, re, ref, s, v;
|
|
45
|
-
match = 0;
|
|
46
|
-
re = new RegExp(value);
|
|
47
|
-
for (group in groups) {
|
|
48
|
-
v = groups[group];
|
|
49
|
-
if (v[attr] != null) {
|
|
50
|
-
if (typeof v[attr] === 'object') {
|
|
51
|
-
ref = v[attr];
|
|
52
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
|
53
|
-
s = ref[i];
|
|
54
|
-
if (s.match(re)) {
|
|
55
|
-
match++;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
if (v[attr].match(re)) {
|
|
60
|
-
match++;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return match;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
isInNet6(ip, net) {
|
|
69
|
-
var bits, test;
|
|
70
|
-
test = require('ipaddr.js');
|
|
71
|
-
ip = test.parse(ip);
|
|
72
|
-
net = net.replace(/^(.*)\/(.*)/, "$1");
|
|
73
|
-
bits = RegExp.$2;
|
|
74
|
-
net = test.parse(net);
|
|
75
|
-
return ip.match(net, bits);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
checkLogonHours(logonHours, syntax = 'hexadecimal', timeCorrection, defaultAccess = 0) {
|
|
79
|
-
var d, div, hourPos, pos, v1, v2;
|
|
80
|
-
timeCorrection = parseInt(timeCorrection);
|
|
81
|
-
d = new Date();
|
|
82
|
-
hourPos = d.getDay() * 24 + d.getHours() + timeCorrection;
|
|
83
|
-
div = syntax === 'octetstring' ? 3 : 4;
|
|
84
|
-
pos = Math.trunc(hourPos / div);
|
|
85
|
-
v1 = Math.pow(2, hourPos % div);
|
|
86
|
-
v2 = logonHours.substr(pos, 1);
|
|
87
|
-
if (v2.match(/\d/)) {
|
|
88
|
-
v2 = parseInt(v2); // Cast as int
|
|
89
|
-
} else {
|
|
90
|
-
v2 = v2.charCodeAt(0);
|
|
91
|
-
v2 = v2 > 70 ? v2 - 87 : v2 - 55;
|
|
92
|
-
}
|
|
93
|
-
return v1 & v2;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
checkDate(start = 0, end, defaultAccess = 0) {
|
|
97
|
-
var d;
|
|
98
|
-
start = start + '';
|
|
99
|
-
start = start.substring(0, 14);
|
|
100
|
-
end = end + '';
|
|
101
|
-
end = end.substring(0, 14);
|
|
102
|
-
if (!(start || end)) {
|
|
103
|
-
return defaultAccess;
|
|
104
|
-
}
|
|
105
|
-
end || (end = 999999999999999);
|
|
106
|
-
d = date();
|
|
107
|
-
if (d >= start && d <= end) {
|
|
108
|
-
return true;
|
|
109
|
-
} else {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
unicode2iso(s) {
|
|
115
|
-
return unicode2iso(s);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
iso2unicode(s) {
|
|
119
|
-
var iconv;
|
|
120
|
-
iconv = new Iconv('ISO-8859-1', 'UTF-8');
|
|
121
|
-
return iconv.convert(s);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
encrypt(s) {
|
|
125
|
-
return encrypt(s);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
token() {
|
|
129
|
-
var args, time;
|
|
130
|
-
time = Math.trunc(Date.now() / 1000); // Perl time
|
|
131
|
-
args = Array.from(arguments);
|
|
132
|
-
return encrypt(`${time}:${args.join(':')}`);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
encode_base64(s) {
|
|
136
|
-
var r;
|
|
137
|
-
return r = new Buffer.from(s).toString('base64');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
cipher = null;
|
|
143
|
-
|
|
144
|
-
ExtdFunc.prototype.date = date;
|
|
145
|
-
|
|
146
|
-
unicode2iso = function(s) {
|
|
147
|
-
var iconv;
|
|
148
|
-
iconv = new Iconv('UTF-8', 'ISO-8859-1');
|
|
149
|
-
return iconv.convert(s);
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
date = function() {
|
|
153
|
-
var a, d, i, len, s, x;
|
|
154
|
-
d = new Date();
|
|
155
|
-
s = '';
|
|
156
|
-
a = [d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()];
|
|
157
|
-
for (i = 0, len = a.length; i < len; i++) {
|
|
158
|
-
x = a[i];
|
|
159
|
-
s += x < 10 ? `0${x}` : `${x}`;
|
|
160
|
-
}
|
|
161
|
-
return s;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
encrypt = function(s) {
|
|
165
|
-
return cipher.encrypt(s);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
return ExtdFunc;
|
|
169
|
-
|
|
170
|
-
}).call(this);
|
|
171
|
-
|
|
172
|
-
module.exports = ExtdFunc;
|
|
173
|
-
|
|
174
|
-
}).call(this);
|