@mtkruto/node 0.1.0 → 0.1.100
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/esm/0_deps.d.ts +1 -1
- package/esm/0_deps.js +1 -1
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.2.1 → tgcrypto@0.3.2}/mod.d.ts +2 -6
- package/esm/deps/deno.land/x/tgcrypto@0.3.2/mod.js +158 -0
- package/esm/deps/deno.land/x/tgcrypto@0.3.2/tgcrypto.js +308 -0
- package/esm/transport/0_obfuscation.js +1 -1
- package/esm/transport/0_transport.js +2 -2
- package/esm/utilities/0_crypto.d.ts +1 -2
- package/esm/utilities/0_crypto.js +3 -12
- package/package.json +1 -1
- package/script/0_deps.d.ts +1 -1
- package/script/0_deps.js +3 -4
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/deps/deno.land/x/{tgcrypto@0.2.1 → tgcrypto@0.3.2}/mod.d.ts +2 -6
- package/script/deps/deno.land/x/tgcrypto@0.3.2/mod.js +171 -0
- package/script/deps/deno.land/x/tgcrypto@0.3.2/tgcrypto.js +310 -0
- package/script/transport/0_obfuscation.js +1 -1
- package/script/transport/0_transport.js +2 -2
- package/script/utilities/0_crypto.d.ts +1 -2
- package/script/utilities/0_crypto.js +2 -11
- package/esm/deps/deno.land/x/tgcrypto@0.2.1/mod.js +0 -81
- package/esm/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +0 -991
- package/script/deps/deno.land/x/tgcrypto@0.2.1/mod.js +0 -95
- package/script/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +0 -993
- /package/esm/deps/deno.land/x/{tgcrypto@0.2.1 → tgcrypto@0.3.2}/tgcrypto.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.2.1 → tgcrypto@0.3.2}/tgcrypto.d.ts +0 -0
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.factorize = exports.cbc256Decrypt = exports.cbc256Encrypt = exports.ctr256Decrypt = exports.ctr256Encrypt = exports.ige256Decrypt = exports.ige256Encrypt = exports.init = void 0;
|
|
7
|
-
const tgcrypto_js_1 = __importDefault(require("./tgcrypto.js"));
|
|
8
|
-
// deno-lint-ignore no-explicit-any
|
|
9
|
-
function collectVector(vector) {
|
|
10
|
-
const p = new Uint8Array(vector.size());
|
|
11
|
-
for (let i = 0; i < vector.size(); i++) {
|
|
12
|
-
p[i] = vector.get(i);
|
|
13
|
-
}
|
|
14
|
-
vector.delete();
|
|
15
|
-
return p;
|
|
16
|
-
}
|
|
17
|
-
// deno-lint-ignore no-explicit-any
|
|
18
|
-
let module_;
|
|
19
|
-
const promise = (0, tgcrypto_js_1.default)().then((v) => module_ = v);
|
|
20
|
-
async function init() {
|
|
21
|
-
await promise;
|
|
22
|
-
}
|
|
23
|
-
exports.init = init;
|
|
24
|
-
/**
|
|
25
|
-
* Performs IGE-256 encryption.
|
|
26
|
-
*
|
|
27
|
-
* @param data The unencrypted data, larger than a byte, divisible by 16
|
|
28
|
-
* @param key 32-byte encryption key
|
|
29
|
-
* @param iv 32-byte initialization vector
|
|
30
|
-
*/
|
|
31
|
-
function ige256Encrypt(data, key, iv) {
|
|
32
|
-
return collectVector(module_.ige256Encrypt(data, key, iv));
|
|
33
|
-
}
|
|
34
|
-
exports.ige256Encrypt = ige256Encrypt;
|
|
35
|
-
/**
|
|
36
|
-
* Performs IGE-256 decryption.
|
|
37
|
-
*
|
|
38
|
-
* @param data The encrypted data, larger than a byte, divisible by 16
|
|
39
|
-
* @param key 32-byte encryption key
|
|
40
|
-
* @param iv 32-byte initialization vector
|
|
41
|
-
*/
|
|
42
|
-
function ige256Decrypt(data, key, iv) {
|
|
43
|
-
return collectVector(module_.ige256Decrypt(data, key, iv));
|
|
44
|
-
}
|
|
45
|
-
exports.ige256Decrypt = ige256Decrypt;
|
|
46
|
-
/**
|
|
47
|
-
* Performs CTR-256 encryption.
|
|
48
|
-
*
|
|
49
|
-
* @param data The data, larger than a byte
|
|
50
|
-
* @param key 32-byte encryption key
|
|
51
|
-
* @param iv 16-byte initialization vector
|
|
52
|
-
* @param state 1-byte state
|
|
53
|
-
*/
|
|
54
|
-
function ctr256Encrypt(data, key, iv, state) {
|
|
55
|
-
const r = module_.ctr256Encrypt(data, data, key, iv, state);
|
|
56
|
-
return r.map(collectVector);
|
|
57
|
-
}
|
|
58
|
-
exports.ctr256Encrypt = ctr256Encrypt;
|
|
59
|
-
/**
|
|
60
|
-
* Alias of `ctr256Encrypt`
|
|
61
|
-
*/
|
|
62
|
-
function ctr256Decrypt(data, key, iv, state) {
|
|
63
|
-
const r = module_.ctr256Decrypt(data, data, key, iv, state);
|
|
64
|
-
return r.map(collectVector);
|
|
65
|
-
}
|
|
66
|
-
exports.ctr256Decrypt = ctr256Decrypt;
|
|
67
|
-
/**
|
|
68
|
-
* Performs CBC-256 encryption.
|
|
69
|
-
*
|
|
70
|
-
* @param data The unencrypted data, larger than a byte, divisible by 16
|
|
71
|
-
* @param key 32-byte encryption key
|
|
72
|
-
* @param iv 16-byte initialization vector
|
|
73
|
-
*/
|
|
74
|
-
function cbc256Encrypt(data, key, iv) {
|
|
75
|
-
module_.cbc256Encrypt(data, data, key, iv);
|
|
76
|
-
return data;
|
|
77
|
-
}
|
|
78
|
-
exports.cbc256Encrypt = cbc256Encrypt;
|
|
79
|
-
/**
|
|
80
|
-
* Performs CBC-256 decryption.
|
|
81
|
-
*
|
|
82
|
-
* @param data The encrypted data, larger than a byte, divisible by 16
|
|
83
|
-
* @param key 32-byte encryption key
|
|
84
|
-
* @param iv 16-byte initialization vector
|
|
85
|
-
*/
|
|
86
|
-
function cbc256Decrypt(data, key, iv) {
|
|
87
|
-
module_.cbc256Decrypt(data, data, key, iv);
|
|
88
|
-
return data;
|
|
89
|
-
}
|
|
90
|
-
exports.cbc256Decrypt = cbc256Decrypt;
|
|
91
|
-
function factorize(pq) {
|
|
92
|
-
const vector = module_.factorize(pq);
|
|
93
|
-
return [vector.get(0), vector.get(1)];
|
|
94
|
-
}
|
|
95
|
-
exports.factorize = factorize;
|