bdy 1.22.57-stage → 1.22.58-dev
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/distTs/package.json
CHANGED
|
@@ -48,6 +48,7 @@ const http1_1 = __importDefault(require("./server/http1"));
|
|
|
48
48
|
const log_1 = __importDefault(require("./http/log"));
|
|
49
49
|
const format_1 = __importDefault(require("../format"));
|
|
50
50
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
51
|
+
const node_zlib_1 = __importDefault(require("node:zlib"));
|
|
51
52
|
const texts_1 = require("../texts");
|
|
52
53
|
const dns_1 = __importDefault(require("./dns"));
|
|
53
54
|
const tunnel_1 = require("../types/tunnel");
|
|
@@ -862,9 +863,9 @@ class Tunnel extends events_1.default {
|
|
|
862
863
|
_httpEncryptState(url, verifier) {
|
|
863
864
|
try {
|
|
864
865
|
const cipher = node_crypto_1.default.createCipheriv(CIPHER_ALG, Buffer.from(this.cipherKey), Buffer.from(CIPHER_IV));
|
|
865
|
-
|
|
866
|
-
enc
|
|
867
|
-
return enc;
|
|
866
|
+
const compressed = node_zlib_1.default.deflateRawSync(JSON.stringify({ url, verifier }));
|
|
867
|
+
const enc = Buffer.concat([cipher.update(compressed), cipher.final()]);
|
|
868
|
+
return enc.toString('base64url');
|
|
868
869
|
}
|
|
869
870
|
catch {
|
|
870
871
|
// do nothing
|
|
@@ -877,9 +878,8 @@ class Tunnel extends events_1.default {
|
|
|
877
878
|
if (state) {
|
|
878
879
|
try {
|
|
879
880
|
const decipher = node_crypto_1.default.createDecipheriv(CIPHER_ALG, Buffer.from(this.cipherKey), Buffer.from(CIPHER_IV));
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
const json = JSON.parse(dec);
|
|
881
|
+
const dec = Buffer.concat([decipher.update(Buffer.from(state, 'base64url')), decipher.final()]);
|
|
882
|
+
const json = JSON.parse(node_zlib_1.default.inflateRawSync(dec).toString('utf8'));
|
|
883
883
|
if (json) {
|
|
884
884
|
if (json.url)
|
|
885
885
|
url = json.url;
|