securequ 1.0.9 → 1.0.11
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/client/index.js +107 -173
- package/client/index.js.map +1 -1
- package/client/index.mjs +107 -173
- package/client/index.mjs.map +1 -1
- package/include/lib/base64.js +12 -12
- package/include/lib/base64.js.map +1 -1
- package/include/lib/base64.mjs +12 -12
- package/include/lib/base64.mjs.map +1 -1
- package/include/lib/cache.js +20 -22
- package/include/lib/cache.js.map +1 -1
- package/include/lib/cache.mjs +20 -22
- package/include/lib/cache.mjs.map +1 -1
- package/include/lib/crypto.js +23 -23
- package/include/lib/crypto.js.map +1 -1
- package/include/lib/crypto.mjs +23 -23
- package/include/lib/crypto.mjs.map +1 -1
- package/include/lib/pako.js +5 -5
- package/include/lib/pako.js.map +1 -1
- package/include/lib/pako.mjs +5 -5
- package/include/lib/pako.mjs.map +1 -1
- package/include/lib/reverser.js +11 -11
- package/include/lib/reverser.js.map +1 -1
- package/include/lib/reverser.mjs +11 -11
- package/include/lib/reverser.mjs.map +1 -1
- package/include/lib/urlpath.js +2 -2
- package/include/lib/urlpath.js.map +1 -1
- package/include/lib/urlpath.mjs +2 -2
- package/include/lib/urlpath.mjs.map +1 -1
- package/include/responseValue.js +4 -4
- package/include/responseValue.js.map +1 -1
- package/include/responseValue.mjs +4 -4
- package/include/responseValue.mjs.map +1 -1
- package/include/signeture.js +12 -12
- package/include/signeture.js.map +1 -1
- package/include/signeture.mjs +12 -12
- package/include/signeture.mjs.map +1 -1
- package/package.json +14 -4
- package/server/index.js +105 -176
- package/server/index.js.map +1 -1
- package/server/index.mjs +105 -176
- package/server/index.mjs.map +1 -1
package/client/index.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var
|
|
2
|
-
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var crypto=require('../include/lib/crypto.js'),signeture=require('../include/signeture.js'),urlpath=require('../include/lib/urlpath.js'),xanFetch=require('xanfetch'),responseValue=require('../include/responseValue.js'),cache=require('../include/lib/cache.js');class SecurequClient {
|
|
2
|
+
constructor(config) {
|
|
3
3
|
this.token = '';
|
|
4
4
|
this.tokenLoading = false;
|
|
5
5
|
this.Cache = new cache({ ttl: 1000 * 60 * 60, limit: 100 });
|
|
6
6
|
this.reqkey = '';
|
|
7
7
|
this.PATH_CACHE = new cache({ ttl: 1000 * 60 * 60, limit: 100 });
|
|
8
|
-
this.config =
|
|
9
|
-
|
|
8
|
+
this.config = Object.assign({}, config);
|
|
9
|
+
const secret = crypto.makeSecret(config.secret);
|
|
10
10
|
this.config.secret = secret;
|
|
11
11
|
this.secret_length = secret.length - (Math.floor(Math.random() * 11) + 5);
|
|
12
12
|
this.secret = crypto.makeSecret(secret.substring(0, this.secret_length));
|
|
13
13
|
this.signerure = signeture.make(this.secret, this.secret);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
setCache(path, method, response) {
|
|
16
|
+
const cacheKey = `${method}:${path}`;
|
|
17
17
|
if (this.config.cache === true) {
|
|
18
18
|
this.Cache.set(cacheKey, response);
|
|
19
19
|
}
|
|
20
20
|
else if (this.config.cache) {
|
|
21
21
|
this.config.cache.set(cacheKey, response);
|
|
22
22
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
}
|
|
24
|
+
getCache(path, method) {
|
|
25
|
+
const cacheKey = `${method}:${path}`;
|
|
26
26
|
if (this.config.cache === true) {
|
|
27
27
|
return this.Cache.get(cacheKey);
|
|
28
28
|
}
|
|
29
29
|
else if (this.config.cache) {
|
|
30
30
|
return this.config.cache.get(cacheKey);
|
|
31
31
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
}
|
|
33
|
+
path(path) {
|
|
34
|
+
let pathKey = path;
|
|
35
|
+
let has = this.PATH_CACHE.get(pathKey);
|
|
36
36
|
if (!has) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
path =
|
|
37
|
+
const { search, pathname } = new URL(path, window.location.origin);
|
|
38
|
+
const params = new URLSearchParams(search);
|
|
39
|
+
const paramsObject = Object.fromEntries(params.entries());
|
|
40
|
+
let split = pathname.split("/").map((s) => urlpath.encrypt(s)).filter((s) => s.length > 0);
|
|
41
|
+
path = `${this.config.path}/${split.join("/")}`;
|
|
42
42
|
if (Object.keys(paramsObject).length) {
|
|
43
|
-
for (
|
|
43
|
+
for (let key in paramsObject) {
|
|
44
44
|
paramsObject[urlpath.encrypt(key)] = paramsObject[key];
|
|
45
45
|
delete paramsObject[key];
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
path +=
|
|
47
|
+
const string = JSON.stringify(paramsObject);
|
|
48
|
+
const text = encodeURIComponent(crypto.encrypt(string, this.token));
|
|
49
|
+
path += `?${this.reqkey}=${text}`;
|
|
50
50
|
}
|
|
51
51
|
this.PATH_CACHE.set(pathKey, path);
|
|
52
52
|
}
|
|
@@ -54,160 +54,94 @@
|
|
|
54
54
|
path = has;
|
|
55
55
|
}
|
|
56
56
|
return path;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
switch (_d.label) {
|
|
64
|
-
case 0:
|
|
65
|
-
this.tokenLoading = true;
|
|
66
|
-
return [4 /*yield*/, xanFetch(this.path("/handshake"), {
|
|
67
|
-
method: "GET",
|
|
68
|
-
headers: tslib_es6.__assign(tslib_es6.__assign({}, this.config.headers), (_c = {}, _c[signeture.key] = this.signerure, _c)),
|
|
69
|
-
})];
|
|
70
|
-
case 1:
|
|
71
|
-
res = _d.sent();
|
|
72
|
-
_b = (_a = responseValue).decrypt;
|
|
73
|
-
return [4 /*yield*/, res.text()];
|
|
74
|
-
case 2:
|
|
75
|
-
value = _b.apply(_a, [_d.sent(), this.signerure]);
|
|
76
|
-
token = crypto.decrypt(value, this.secret);
|
|
77
|
-
this.token = token;
|
|
78
|
-
this.reqkey = token.substring(0, token.length / 2);
|
|
79
|
-
this.tokenLoading = false;
|
|
80
|
-
return [2 /*return*/];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
57
|
+
}
|
|
58
|
+
async handshake() {
|
|
59
|
+
this.tokenLoading = true;
|
|
60
|
+
const res = await xanFetch(this.path(`/handshake`), {
|
|
61
|
+
method: "GET",
|
|
62
|
+
headers: Object.assign(Object.assign({}, this.config.headers), { [signeture.key]: this.signerure }),
|
|
83
63
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
}, 100);
|
|
104
|
-
})];
|
|
105
|
-
case 1:
|
|
106
|
-
_b.sent();
|
|
107
|
-
_b.label = 2;
|
|
108
|
-
case 2:
|
|
109
|
-
if (!!this.token) return [3 /*break*/, 4];
|
|
110
|
-
return [4 /*yield*/, this.handshake()];
|
|
111
|
-
case 3:
|
|
112
|
-
_b.sent();
|
|
113
|
-
_b.label = 4;
|
|
114
|
-
case 4:
|
|
115
|
-
info = tslib_es6.__assign(tslib_es6.__assign({ method: "GET" }, init), { headers: tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign({}, this.config.headers), init === null || init === void 0 ? void 0 : init.headers), (_a = {}, _a[signeture.key] = this.signerure, _a)) });
|
|
116
|
-
cache_res = this.getCache(path, info.method);
|
|
117
|
-
if (cache_res) {
|
|
118
|
-
return [2 /*return*/, cache_res.clone()];
|
|
119
|
-
}
|
|
120
|
-
if (info.body) {
|
|
121
|
-
if (!this.token)
|
|
122
|
-
throw new Error("Token not loaded");
|
|
123
|
-
body = new FormData();
|
|
124
|
-
_data = {};
|
|
125
|
-
hasFile = false;
|
|
126
|
-
for (key in info.body) {
|
|
127
|
-
ukey = urlpath.encrypt(key);
|
|
128
|
-
if (info.body[key] instanceof File) {
|
|
129
|
-
body.append(ukey, info.body[key]);
|
|
130
|
-
hasFile = true;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
_data[ukey] = info.body[key];
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
body.append(this.reqkey, crypto.encrypt(_data, this.token));
|
|
137
|
-
if (!hasFile) {
|
|
138
|
-
info.body = new URLSearchParams(body);
|
|
139
|
-
if (!info.headers['Content-Type']) {
|
|
140
|
-
info.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
if (info.method === "GET") {
|
|
145
|
-
info.method = "POST";
|
|
146
|
-
}
|
|
147
|
-
info.body = body;
|
|
148
|
-
if (!info.headers['Content-Type']) {
|
|
149
|
-
info.headers['Content-Type'] = 'multipart/form-data';
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return [4 /*yield*/, xanFetch(this.path(path), info)];
|
|
154
|
-
case 5:
|
|
155
|
-
response = _b.sent();
|
|
156
|
-
res = response.clone();
|
|
157
|
-
return [4 /*yield*/, response.text()];
|
|
158
|
-
case 6:
|
|
159
|
-
text = _b.sent();
|
|
160
|
-
value = responseValue.decrypt(text, this.signerure);
|
|
161
|
-
res.text = function () { return tslib_es6.__awaiter(_this, void 0, void 0, function () { return tslib_es6.__generator(this, function (_a) {
|
|
162
|
-
return [2 /*return*/, value];
|
|
163
|
-
}); }); };
|
|
164
|
-
if (this.config.cache === true && res.ok) {
|
|
165
|
-
this.setCache(path, info.method, res.clone());
|
|
166
|
-
}
|
|
167
|
-
return [2 /*return*/, res];
|
|
168
|
-
}
|
|
64
|
+
const value = responseValue.decrypt(await res.text(), this.signerure);
|
|
65
|
+
const token = crypto.decrypt(value, this.secret);
|
|
66
|
+
this.token = token;
|
|
67
|
+
this.reqkey = token.substring(0, token.length / 2);
|
|
68
|
+
this.tokenLoading = false;
|
|
69
|
+
}
|
|
70
|
+
async send(path, init) {
|
|
71
|
+
if (path === '/handshake') {
|
|
72
|
+
throw new Error("Path is not allowed");
|
|
73
|
+
}
|
|
74
|
+
if (this.tokenLoading) {
|
|
75
|
+
await new Promise((resolve) => {
|
|
76
|
+
const interval = setInterval(() => {
|
|
77
|
+
if (!this.tokenLoading) {
|
|
78
|
+
clearInterval(interval);
|
|
79
|
+
resolve(null);
|
|
80
|
+
}
|
|
81
|
+
}, 100);
|
|
169
82
|
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
83
|
+
}
|
|
84
|
+
if (!this.token) {
|
|
85
|
+
await this.handshake();
|
|
86
|
+
}
|
|
87
|
+
const info = Object.assign(Object.assign({ method: "GET" }, init), { headers: Object.assign(Object.assign(Object.assign({}, this.config.headers), init === null || init === void 0 ? void 0 : init.headers), { [signeture.key]: this.signerure }) });
|
|
88
|
+
const cache_res = this.getCache(path, info.method);
|
|
89
|
+
if (cache_res) {
|
|
90
|
+
return cache_res.clone();
|
|
91
|
+
}
|
|
92
|
+
if (info.body) {
|
|
93
|
+
if (!this.token)
|
|
94
|
+
throw new Error("Token not loaded");
|
|
95
|
+
const body = new FormData();
|
|
96
|
+
let _data = {};
|
|
97
|
+
let hasFile = false;
|
|
98
|
+
for (let key in info.body) {
|
|
99
|
+
let ukey = urlpath.encrypt(key);
|
|
100
|
+
if (info.body[key] instanceof File) {
|
|
101
|
+
body.append(ukey, info.body[key]);
|
|
102
|
+
hasFile = true;
|
|
178
103
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
};
|
|
182
|
-
SecurequClient.prototype.post = function (path, body, init) {
|
|
183
|
-
return tslib_es6.__awaiter(this, void 0, void 0, function () {
|
|
184
|
-
return tslib_es6.__generator(this, function (_a) {
|
|
185
|
-
switch (_a.label) {
|
|
186
|
-
case 0: return [4 /*yield*/, this.send(path, tslib_es6.__assign(tslib_es6.__assign({}, init), { method: "POST", body: body }))];
|
|
187
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
104
|
+
else {
|
|
105
|
+
_data[ukey] = info.body[key];
|
|
188
106
|
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
switch (_a.label) {
|
|
196
|
-
case 0: return [4 /*yield*/, this.send(path, tslib_es6.__assign(tslib_es6.__assign({}, init), { method: "PUT", body: body }))];
|
|
197
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
107
|
+
}
|
|
108
|
+
body.append(this.reqkey, crypto.encrypt(_data, this.token));
|
|
109
|
+
if (!hasFile) {
|
|
110
|
+
info.body = new URLSearchParams(body);
|
|
111
|
+
if (!info.headers['Content-Type']) {
|
|
112
|
+
info.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
198
113
|
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
return tslib_es6.__awaiter(this, void 0, void 0, function () {
|
|
204
|
-
return tslib_es6.__generator(this, function (_a) {
|
|
205
|
-
switch (_a.label) {
|
|
206
|
-
case 0: return [4 /*yield*/, this.send(path, tslib_es6.__assign(tslib_es6.__assign({}, init), { method: "DELETE" }))];
|
|
207
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
if (info.method === "GET") {
|
|
117
|
+
info.method = "POST";
|
|
208
118
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
119
|
+
info.body = body;
|
|
120
|
+
if (!info.headers['Content-Type']) {
|
|
121
|
+
info.headers['Content-Type'] = 'multipart/form-data';
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const response = await xanFetch(this.path(path), info);
|
|
126
|
+
const res = response.clone();
|
|
127
|
+
const text = await response.text();
|
|
128
|
+
const value = responseValue.decrypt(text, this.signerure);
|
|
129
|
+
res.text = async () => value;
|
|
130
|
+
if (this.config.cache === true && res.ok) {
|
|
131
|
+
this.setCache(path, info.method, res.clone());
|
|
132
|
+
}
|
|
133
|
+
return res;
|
|
134
|
+
}
|
|
135
|
+
async get(path, init) {
|
|
136
|
+
return await this.send(path, init);
|
|
137
|
+
}
|
|
138
|
+
async post(path, body, init) {
|
|
139
|
+
return await this.send(path, Object.assign(Object.assign({}, init), { method: "POST", body: body }));
|
|
140
|
+
}
|
|
141
|
+
async put(path, body, init) {
|
|
142
|
+
return await this.send(path, Object.assign(Object.assign({}, init), { method: "PUT", body: body }));
|
|
143
|
+
}
|
|
144
|
+
async delete(path, init) {
|
|
145
|
+
return await this.send(path, Object.assign(Object.assign({}, init), { method: "DELETE" }));
|
|
146
|
+
}
|
|
147
|
+
}exports.SecurequClient=SecurequClient;exports.default=SecurequClient;//# sourceMappingURL=index.js.map
|
package/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/client/index.ts"],"sourcesContent":["import crypto from \"../include/lib/crypto\";\nimport signeture from \"../include/signeture\";\nimport urlpath from \"../include/lib/urlpath\";\nimport { HttpRequestInit, RequestBody, SecurequClientConfig } from \"./types\";\nimport xanFetch from 'xanfetch'\nimport responseValue from \"../include/responseValue\";\nimport SecurequCache from \"../include/lib/cache\";\n\nexport class SecurequClient {\n private config: SecurequClientConfig;\n private token: string = '';\n private tokenLoading: boolean = false;\n private Cache = new SecurequCache<Response>({ ttl: 1000 * 60 * 60, limit: 100 });\n\n private secret: string;\n private secret_length: number;\n private signerure: string;\n private reqkey: string = '';\n\n constructor(config: SecurequClientConfig) {\n this.config = { ...config }\n const secret = crypto.makeSecret(config.secret)\n this.config.secret = secret;\n this.secret_length = secret.length - (Math.floor(Math.random() * 11) + 5);\n this.secret = crypto.makeSecret(secret.substring(0, this.secret_length))\n this.signerure = signeture.make(this.secret, this.secret);\n }\n\n private setCache(path: string, method: string, response: any) {\n const cacheKey = `${method}:${path}`;\n if (this.config.cache === true) {\n this.Cache.set(cacheKey, response);\n } else if (this.config.cache) {\n this.config.cache.set(cacheKey, response);\n }\n }\n\n private getCache(path: string, method: string,) {\n const cacheKey = `${method}:${path}`;\n if (this.config.cache === true) {\n return this.Cache.get(cacheKey);\n } else if (this.config.cache) {\n return this.config.cache.get(cacheKey);\n }\n }\n\n private PATH_CACHE = new SecurequCache<string>({ ttl: 1000 * 60 * 60, limit: 100 });\n private path(path: string) {\n let pathKey = path\n let has = this.PATH_CACHE.get(pathKey)\n if (!has) {\n const { search, pathname } = new URL(path, window.location.origin);\n const params = new URLSearchParams(search);\n const paramsObject = Object.fromEntries(params.entries());\n let split = pathname.split(\"/\").map((s) => urlpath.encrypt(s)).filter((s) => s.length > 0);\n path = `${this.config.path}/${split.join(\"/\")}`;\n if (Object.keys(paramsObject).length) {\n for (let key in paramsObject) {\n paramsObject[urlpath.encrypt(key)] = paramsObject[key]\n delete paramsObject[key]\n }\n const string = JSON.stringify(paramsObject)\n const text = encodeURIComponent(crypto.encrypt(string, this.token));\n path += `?${this.reqkey}=${text}`;\n }\n this.PATH_CACHE.set(pathKey, path);\n } else {\n path = has\n }\n return path\n }\n\n private async handshake() {\n this.tokenLoading = true;\n const res = await xanFetch(this.path(`/handshake`), {\n method: \"GET\",\n headers: {\n ...this.config.headers,\n [signeture.key]: this.signerure\n },\n })\n\n const value: any = responseValue.decrypt(await res.text(), this.signerure)\n const token = crypto.decrypt(value, this.secret)\n this.token = token;\n this.reqkey = token.substring(0, token.length / 2);\n this.tokenLoading = false;\n }\n\n async send(path: string, init?: HttpRequestInit): Promise<Response> {\n if (path === '/handshake') {\n throw new Error(\"Path is not allowed\")\n }\n if (this.tokenLoading) {\n await new Promise((resolve) => {\n const interval = setInterval(() => {\n if (!this.tokenLoading) {\n clearInterval(interval);\n resolve(null);\n }\n }, 100);\n })\n }\n\n if (!this.token) {\n await this.handshake();\n }\n\n const info: any = {\n method: \"GET\",\n ...init,\n headers: {\n ...this.config.headers,\n ...init?.headers,\n [signeture.key]: this.signerure\n },\n }\n\n const cache_res = this.getCache(path, info.method);\n if (cache_res) {\n return cache_res.clone();\n }\n\n if (info.body) {\n if (!this.token) throw new Error(\"Token not loaded\")\n const body = new FormData();\n let _data: any = {}\n let hasFile = false;\n for (let key in info.body) {\n let ukey = urlpath.encrypt(key);\n if (info.body[key] instanceof File) {\n body.append(ukey, info.body[key]);\n hasFile = true;\n } else {\n _data[ukey] = info.body[key];\n }\n }\n\n body.append(this.reqkey, crypto.encrypt(_data, this.token));\n\n if (!hasFile) {\n info.body = new URLSearchParams(body as any);\n if (!info.headers['Content-Type']) {\n info.headers['Content-Type'] = 'application/x-www-form-urlencoded';\n }\n } else {\n if (info.method === \"GET\") {\n info.method = \"POST\"\n }\n info.body = body\n if (!info.headers['Content-Type']) {\n info.headers['Content-Type'] = 'multipart/form-data';\n }\n }\n }\n\n const response = await xanFetch(this.path(path), info);\n const res = response.clone();\n const text = await response.text();\n const value: any = responseValue.decrypt(text, this.signerure)\n res.text = async () => value;\n if (this.config.cache === true && res.ok) {\n this.setCache(path, info.method, res.clone());\n }\n return res\n }\n\n async get(path: string, init?: HttpRequestInit) {\n return await this.send(path, init);\n }\n\n async post(path: string, body: RequestBody, init?: HttpRequestInit) {\n return await this.send(path, {\n ...init,\n method: \"POST\",\n body: body\n });\n }\n\n async put(path: string, body: RequestBody, init?: HttpRequestInit) {\n return await this.send(path, {\n ...init,\n method: \"PUT\",\n body: body\n });\n }\n\n async delete(path: string, init?: HttpRequestInit) {\n return await this.send(path, {\n ...init,\n method: \"DELETE\",\n });\n }\n}\n"],"names":["SecurequCache","__assign","__awaiter","__generator"],"mappings":"kYAQA,IAAA,cAAA,kBAAA,YAAA;AAWG,I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E,MAAM,EACd,IAAI,EAAE,IAAI,IACX,CAAA;AAJF,oBAAA,KAAA,CAAA,EAAA,OAAA,CAAA,CAAA,aAAO,SAIL,CAAC;;;;AACL,KAAA;AAEK,IAAA,cAAA,CAAA,SAAA,CAAA,GAAG,GAAT,UAAU,IAAY,EAAE,IAAiB,EAAE,IAAsB,EAAA;;;;AACvD,oBAAA,KAAA,CAAA,EAAA,OAAA,CAAA,CAAA,YAAM,IAAI,CAAC,IAAI,CAAC,IAAI,4CACrB,IAAI,CAAA,EAAA,EACP,MAAM,EAAE,KAAK,EACb,IAAI,EAAE,IAAI,IACX,CAAA;AAJF,oBAAA,KAAA,CAAA,EAAA,OAAA,CAAA,CAAA,aAAO,SAIL,CAAC;;;;AACL,KAAA;AAEK,IAAA,cAAA,CAAA,SAAA,CAAA,MAAM,GAAZ,UAAa,IAAY,EAAE,IAAsB,EAAA;;;;AACvC,oBAAA,KAAA,CAAA,EAAA,OAAA,CAAA,CAAA,YAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAAF,kBAAA,CAAAA,kBAAA,CAAA,EAAA,EACrB,IAAI,CAAA,EAAA,EACP,MAAM,EAAE,QAAQ,EAAA,CAAA,CACjB,CAAA;AAHF,oBAAA,KAAA,CAAA,EAAA,OAAA,CAAA,CAAA,aAAO,SAGL,CAAC;;;;AACL,KAAA;IACJ,OAAC,cAAA;AAAD,CAAC,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/client/index.ts"],"sourcesContent":["import crypto from \"../include/lib/crypto\";\nimport signeture from \"../include/signeture\";\nimport urlpath from \"../include/lib/urlpath\";\nimport { HttpRequestInit, RequestBody, SecurequClientConfig } from \"./types\";\nimport xanFetch from 'xanfetch'\nimport responseValue from \"../include/responseValue\";\nimport SecurequCache from \"../include/lib/cache\";\n\nexport class SecurequClient {\n private config: SecurequClientConfig;\n private token: string = '';\n private tokenLoading: boolean = false;\n private Cache = new SecurequCache<Response>({ ttl: 1000 * 60 * 60, limit: 100 });\n\n private secret: string;\n private secret_length: number;\n private signerure: string;\n private reqkey: string = '';\n\n constructor(config: SecurequClientConfig) {\n this.config = { ...config }\n const secret = crypto.makeSecret(config.secret)\n this.config.secret = secret;\n this.secret_length = secret.length - (Math.floor(Math.random() * 11) + 5);\n this.secret = crypto.makeSecret(secret.substring(0, this.secret_length))\n this.signerure = signeture.make(this.secret, this.secret);\n }\n\n private setCache(path: string, method: string, response: any) {\n const cacheKey = `${method}:${path}`;\n if (this.config.cache === true) {\n this.Cache.set(cacheKey, response);\n } else if (this.config.cache) {\n this.config.cache.set(cacheKey, response);\n }\n }\n\n private getCache(path: string, method: string,) {\n const cacheKey = `${method}:${path}`;\n if (this.config.cache === true) {\n return this.Cache.get(cacheKey);\n } else if (this.config.cache) {\n return this.config.cache.get(cacheKey);\n }\n }\n\n private PATH_CACHE = new SecurequCache<string>({ ttl: 1000 * 60 * 60, limit: 100 });\n private path(path: string) {\n let pathKey = path\n let has = this.PATH_CACHE.get(pathKey)\n if (!has) {\n const { search, pathname } = new URL(path, window.location.origin);\n const params = new URLSearchParams(search);\n const paramsObject = Object.fromEntries(params.entries());\n let split = pathname.split(\"/\").map((s) => urlpath.encrypt(s)).filter((s) => s.length > 0);\n path = `${this.config.path}/${split.join(\"/\")}`;\n if (Object.keys(paramsObject).length) {\n for (let key in paramsObject) {\n paramsObject[urlpath.encrypt(key)] = paramsObject[key]\n delete paramsObject[key]\n }\n const string = JSON.stringify(paramsObject)\n const text = encodeURIComponent(crypto.encrypt(string, this.token));\n path += `?${this.reqkey}=${text}`;\n }\n this.PATH_CACHE.set(pathKey, path);\n } else {\n path = has\n }\n return path\n }\n\n private async handshake() {\n this.tokenLoading = true;\n const res = await xanFetch(this.path(`/handshake`), {\n method: \"GET\",\n headers: {\n ...this.config.headers,\n [signeture.key]: this.signerure\n },\n })\n\n const value: any = responseValue.decrypt(await res.text(), this.signerure)\n const token = crypto.decrypt(value, this.secret)\n this.token = token;\n this.reqkey = token.substring(0, token.length / 2);\n this.tokenLoading = false;\n }\n\n async send(path: string, init?: HttpRequestInit): Promise<Response> {\n if (path === '/handshake') {\n throw new Error(\"Path is not allowed\")\n }\n if (this.tokenLoading) {\n await new Promise((resolve) => {\n const interval = setInterval(() => {\n if (!this.tokenLoading) {\n clearInterval(interval);\n resolve(null);\n }\n }, 100);\n })\n }\n\n if (!this.token) {\n await this.handshake();\n }\n\n const info: any = {\n method: \"GET\",\n ...init,\n headers: {\n ...this.config.headers,\n ...init?.headers,\n [signeture.key]: this.signerure\n },\n }\n\n const cache_res = this.getCache(path, info.method);\n if (cache_res) {\n return cache_res.clone();\n }\n\n if (info.body) {\n if (!this.token) throw new Error(\"Token not loaded\")\n const body = new FormData();\n let _data: any = {}\n let hasFile = false;\n for (let key in info.body) {\n let ukey = urlpath.encrypt(key);\n if (info.body[key] instanceof File) {\n body.append(ukey, info.body[key]);\n hasFile = true;\n } else {\n _data[ukey] = info.body[key];\n }\n }\n\n body.append(this.reqkey, crypto.encrypt(_data, this.token));\n\n if (!hasFile) {\n info.body = new URLSearchParams(body as any);\n if (!info.headers['Content-Type']) {\n info.headers['Content-Type'] = 'application/x-www-form-urlencoded';\n }\n } else {\n if (info.method === \"GET\") {\n info.method = \"POST\"\n }\n info.body = body\n if (!info.headers['Content-Type']) {\n info.headers['Content-Type'] = 'multipart/form-data';\n }\n }\n }\n\n const response = await xanFetch(this.path(path), info);\n const res = response.clone();\n const text = await response.text();\n const value: any = responseValue.decrypt(text, this.signerure)\n res.text = async () => value;\n if (this.config.cache === true && res.ok) {\n this.setCache(path, info.method, res.clone());\n }\n return res\n }\n\n async get(path: string, init?: HttpRequestInit) {\n return await this.send(path, init);\n }\n\n async post(path: string, body: RequestBody, init?: HttpRequestInit) {\n return await this.send(path, {\n ...init,\n method: \"POST\",\n body: body\n });\n }\n\n async put(path: string, body: RequestBody, init?: HttpRequestInit) {\n return await this.send(path, {\n ...init,\n method: \"PUT\",\n body: body\n });\n }\n\n async delete(path: string, init?: HttpRequest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