securequ 1.0.13 → 1.0.14
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.d.ts +22 -22
- package/client/index.js +169 -147
- package/client/index.js.map +1 -1
- package/client/index.mjs +169 -147
- package/client/index.mjs.map +1 -1
- package/client/types.d.ts +16 -14
- package/include/lib/base64.js +47 -47
- package/include/lib/base64.js.map +1 -1
- package/include/lib/base64.mjs +46 -46
- package/include/lib/base64.mjs.map +1 -1
- package/include/lib/cache.js +72 -72
- package/include/lib/cache.js.map +1 -1
- package/include/lib/cache.mjs +71 -71
- package/include/lib/cache.mjs.map +1 -1
- package/include/lib/crypto.js +69 -69
- package/include/lib/crypto.js.map +1 -1
- package/include/lib/crypto.mjs +68 -68
- package/include/lib/crypto.mjs.map +1 -1
- package/include/lib/pako.js +28 -28
- package/include/lib/pako.js.map +1 -1
- package/include/lib/pako.mjs +28 -28
- package/include/lib/pako.mjs.map +1 -1
- package/include/lib/reverser.js +25 -25
- package/include/lib/reverser.js.map +1 -1
- package/include/lib/reverser.mjs +24 -24
- package/include/lib/reverser.mjs.map +1 -1
- package/include/lib/urlpath.js +10 -10
- package/include/lib/urlpath.js.map +1 -1
- package/include/lib/urlpath.mjs +9 -9
- package/include/lib/urlpath.mjs.map +1 -1
- package/include/responseValue.js +10 -10
- package/include/responseValue.js.map +1 -1
- package/include/responseValue.mjs +9 -9
- package/include/responseValue.mjs.map +1 -1
- package/include/signeture.js +20 -20
- package/include/signeture.js.map +1 -1
- package/include/signeture.mjs +19 -19
- package/include/signeture.mjs.map +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +2 -2
- package/server/index.d.ts +14 -14
- package/server/index.js +115 -116
- package/server/index.js.map +1 -1
- package/server/index.mjs +115 -116
- package/server/index.mjs.map +1 -1
- package/server/types.d.ts +25 -25
package/include/lib/crypto.mjs
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import nacl from'tweetnacl';import base64 from'./base64.mjs';import pako from'./pako.mjs';/**
|
|
2
|
-
* Encrypts data using TweetNaCl, compresses it with Pako (Gzip), and encodes it in Base64.
|
|
3
|
-
* @param data - The plaintext data to encrypt.
|
|
4
|
-
* @param secret - The secret key as a string.
|
|
5
|
-
* @returns A Base64 encoded string (nonce + compressed ciphertext).
|
|
6
|
-
*/
|
|
7
|
-
function encrypt(data, secret) {
|
|
8
|
-
data = typeof data === "object" ? JSON.stringify(data) : data;
|
|
9
|
-
secret = hash(secret).substring(0, 32);
|
|
10
|
-
const key = new TextEncoder().encode(secret);
|
|
11
|
-
const nonce = nacl.randomBytes(nacl.secretbox.nonceLength);
|
|
12
|
-
const compressed = pako.compress(data, true); // Ensure it returns Uint8Array
|
|
13
|
-
const encrypted = nacl.secretbox(compressed, nonce, key);
|
|
14
|
-
return base64.encode(new Uint8Array([...nonce, ...encrypted]));
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Decrypts a Base64-encoded NaCl-encrypted data, decompresses it with Pako (Gzip).
|
|
18
|
-
* @param data - The Base64 encoded string (nonce + compressed ciphertext).
|
|
19
|
-
* @param secret - The secret key as a string.
|
|
20
|
-
* @returns The decrypted plaintext string.
|
|
21
|
-
*/
|
|
22
|
-
function decrypt(data, secret) {
|
|
23
|
-
try {
|
|
24
|
-
secret = hash(secret).substring(0, 32);
|
|
25
|
-
const key = new TextEncoder().encode(secret);
|
|
26
|
-
const encryptedBytes = base64.decode(data);
|
|
27
|
-
const nonce = encryptedBytes.slice(0, nacl.secretbox.nonceLength);
|
|
28
|
-
const ciphertext = encryptedBytes.slice(nacl.secretbox.nonceLength);
|
|
29
|
-
const decrypted = nacl.secretbox.open(ciphertext, nonce, key);
|
|
30
|
-
if (!decrypted)
|
|
31
|
-
throw new Error("Decryption failed!");
|
|
32
|
-
const decompressed = pako.decompress(decrypted); // Decompress as string
|
|
33
|
-
try {
|
|
34
|
-
return JSON.parse(decompressed);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
return decompressed;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
throw new Error("Invalid encrypted data.");
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Hashes a string using NaCl's hash function.
|
|
46
|
-
* @param data - The input string to hash.
|
|
47
|
-
* @returns The hash of the input string.
|
|
48
|
-
*/
|
|
49
|
-
let hashed = new Map();
|
|
50
|
-
function hash(data) {
|
|
51
|
-
if (hashed.has(data))
|
|
52
|
-
return hashed.get(data);
|
|
53
|
-
const inputBytes = new TextEncoder().encode(data);
|
|
54
|
-
const hashedData = nacl.hash(inputBytes);
|
|
55
|
-
const d = Array.from(hashedData)
|
|
56
|
-
.map(byte => byte.toString(16).padStart(2, '0'))
|
|
57
|
-
.join('');
|
|
58
|
-
hashed.set(data, d);
|
|
59
|
-
return d;
|
|
60
|
-
}
|
|
61
|
-
const makeSecret = (secret) => {
|
|
62
|
-
return hash(secret).substring(0, 32);
|
|
63
|
-
};
|
|
64
|
-
const crypto = {
|
|
65
|
-
encrypt,
|
|
66
|
-
decrypt,
|
|
67
|
-
hash,
|
|
68
|
-
makeSecret
|
|
1
|
+
import nacl from'tweetnacl';import base64 from'./base64.mjs';import pako from'./pako.mjs';/**
|
|
2
|
+
* Encrypts data using TweetNaCl, compresses it with Pako (Gzip), and encodes it in Base64.
|
|
3
|
+
* @param data - The plaintext data to encrypt.
|
|
4
|
+
* @param secret - The secret key as a string.
|
|
5
|
+
* @returns A Base64 encoded string (nonce + compressed ciphertext).
|
|
6
|
+
*/
|
|
7
|
+
function encrypt(data, secret) {
|
|
8
|
+
data = typeof data === "object" ? JSON.stringify(data) : data;
|
|
9
|
+
secret = hash(secret).substring(0, 32);
|
|
10
|
+
const key = new TextEncoder().encode(secret);
|
|
11
|
+
const nonce = nacl.randomBytes(nacl.secretbox.nonceLength);
|
|
12
|
+
const compressed = pako.compress(data, true); // Ensure it returns Uint8Array
|
|
13
|
+
const encrypted = nacl.secretbox(compressed, nonce, key);
|
|
14
|
+
return base64.encode(new Uint8Array([...nonce, ...encrypted]));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Decrypts a Base64-encoded NaCl-encrypted data, decompresses it with Pako (Gzip).
|
|
18
|
+
* @param data - The Base64 encoded string (nonce + compressed ciphertext).
|
|
19
|
+
* @param secret - The secret key as a string.
|
|
20
|
+
* @returns The decrypted plaintext string.
|
|
21
|
+
*/
|
|
22
|
+
function decrypt(data, secret) {
|
|
23
|
+
try {
|
|
24
|
+
secret = hash(secret).substring(0, 32);
|
|
25
|
+
const key = new TextEncoder().encode(secret);
|
|
26
|
+
const encryptedBytes = base64.decode(data);
|
|
27
|
+
const nonce = encryptedBytes.slice(0, nacl.secretbox.nonceLength);
|
|
28
|
+
const ciphertext = encryptedBytes.slice(nacl.secretbox.nonceLength);
|
|
29
|
+
const decrypted = nacl.secretbox.open(ciphertext, nonce, key);
|
|
30
|
+
if (!decrypted)
|
|
31
|
+
throw new Error("Decryption failed!");
|
|
32
|
+
const decompressed = pako.decompress(decrypted); // Decompress as string
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse(decompressed);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return decompressed;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
throw new Error("Invalid encrypted data.");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Hashes a string using NaCl's hash function.
|
|
46
|
+
* @param data - The input string to hash.
|
|
47
|
+
* @returns The hash of the input string.
|
|
48
|
+
*/
|
|
49
|
+
let hashed = new Map();
|
|
50
|
+
function hash(data) {
|
|
51
|
+
if (hashed.has(data))
|
|
52
|
+
return hashed.get(data);
|
|
53
|
+
const inputBytes = new TextEncoder().encode(data);
|
|
54
|
+
const hashedData = nacl.hash(inputBytes);
|
|
55
|
+
const d = Array.from(hashedData)
|
|
56
|
+
.map(byte => byte.toString(16).padStart(2, '0'))
|
|
57
|
+
.join('');
|
|
58
|
+
hashed.set(data, d);
|
|
59
|
+
return d;
|
|
60
|
+
}
|
|
61
|
+
const makeSecret = (secret) => {
|
|
62
|
+
return hash(secret).substring(0, 32);
|
|
63
|
+
};
|
|
64
|
+
const crypto = {
|
|
65
|
+
encrypt,
|
|
66
|
+
decrypt,
|
|
67
|
+
hash,
|
|
68
|
+
makeSecret
|
|
69
69
|
};export{crypto as default};//# sourceMappingURL=crypto.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.mjs","sources":["../../../src/include/lib/crypto.ts"],"sourcesContent":["import nacl from \"tweetnacl\";\
|
|
1
|
+
{"version":3,"file":"crypto.mjs","sources":["../../../src/include/lib/crypto.ts"],"sourcesContent":["import nacl from \"tweetnacl\";\nimport base64 from \"./base64\";\nimport pako from \"./pako\";\n\n/**\n * Encrypts data using TweetNaCl, compresses it with Pako (Gzip), and encodes it in Base64.\n * @param data - The plaintext data to encrypt.\n * @param secret - The secret key as a string.\n * @returns A Base64 encoded string (nonce + compressed ciphertext).\n */\nfunction encrypt(data: string | object, secret: string): string {\n data = typeof data === \"object\" ? JSON.stringify(data) : data\n secret = hash(secret).substring(0, 32)\n const key = new TextEncoder().encode(secret);\n const nonce = nacl.randomBytes(nacl.secretbox.nonceLength);\n const compressed = pako.compress(data, true) as Uint8Array // Ensure it returns Uint8Array\n const encrypted = nacl.secretbox(compressed, nonce, key);\n return base64.encode(new Uint8Array([...nonce, ...encrypted]));\n}\n\n/**\n * Decrypts a Base64-encoded NaCl-encrypted data, decompresses it with Pako (Gzip).\n * @param data - The Base64 encoded string (nonce + compressed ciphertext).\n * @param secret - The secret key as a string.\n * @returns The decrypted plaintext string.\n */\nfunction decrypt(data: string, secret: string): string {\n try {\n secret = hash(secret).substring(0, 32)\n const key = new TextEncoder().encode(secret);\n const encryptedBytes = base64.decode(data);\n const nonce = encryptedBytes.slice(0, nacl.secretbox.nonceLength);\n const ciphertext = encryptedBytes.slice(nacl.secretbox.nonceLength);\n const decrypted = nacl.secretbox.open(ciphertext, nonce, key);\n if (!decrypted) throw new Error(\"Decryption failed!\");\n const decompressed = pako.decompress(decrypted); // Decompress as string\n try {\n return JSON.parse(decompressed);\n } catch (error) {\n return decompressed;\n }\n } catch (error) {\n throw new Error(\"Invalid encrypted data.\");\n }\n}\n\n/**\n * Hashes a string using NaCl's hash function.\n * @param data - The input string to hash.\n * @returns The hash of the input string.\n */\nlet hashed = new Map<string, string>();\nfunction hash(data: string): string {\n if (hashed.has(data)) return hashed.get(data) as string\n const inputBytes = new TextEncoder().encode(data);\n const hashedData = nacl.hash(inputBytes);\n const d = Array.from(hashedData)\n .map(byte => byte.toString(16).padStart(2, '0'))\n .join('');\n hashed.set(data, d)\n return d\n}\n\nconst makeSecret = (secret: string) => {\n return hash(secret).substring(0, 32);\n}\n\nconst crypto = {\n encrypt,\n decrypt,\n hash,\n makeSecret\n};\n\nexport default crypto;\n"],"names":[],"mappings":"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"}
|
package/include/lib/pako.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
* Compresses a string message using Pako (Gzip).
|
|
3
|
-
* @param message - The plaintext string message to compress.
|
|
4
|
-
* @returns A Base64 encoded string of the compressed data.
|
|
5
|
-
*/
|
|
6
|
-
function compress(data, returnUnit8) {
|
|
7
|
-
const encoded = new TextEncoder().encode(data);
|
|
8
|
-
const compressed = pako$1.gzip(encoded);
|
|
9
|
-
if (returnUnit8)
|
|
10
|
-
return compressed;
|
|
11
|
-
return base64.
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Decompresses a Base64 encoded compressed message using Pako (Gzip).
|
|
15
|
-
* @param data - The Base64 encoded compressed data.
|
|
16
|
-
* @returns The decompressed plaintext string.
|
|
17
|
-
*/
|
|
18
|
-
function decompress(data) {
|
|
19
|
-
if (typeof data === 'string') {
|
|
20
|
-
data = base64.
|
|
21
|
-
}
|
|
22
|
-
const decompressed = pako$1.ungzip(data);
|
|
23
|
-
return new TextDecoder().decode(decompressed);
|
|
24
|
-
}
|
|
25
|
-
var pako = {
|
|
26
|
-
compress,
|
|
27
|
-
decompress
|
|
28
|
-
};
|
|
1
|
+
'use strict';var pako$1=require('pako'),base64=require('./base64.js');/**
|
|
2
|
+
* Compresses a string message using Pako (Gzip).
|
|
3
|
+
* @param message - The plaintext string message to compress.
|
|
4
|
+
* @returns A Base64 encoded string of the compressed data.
|
|
5
|
+
*/
|
|
6
|
+
function compress(data, returnUnit8) {
|
|
7
|
+
const encoded = new TextEncoder().encode(data);
|
|
8
|
+
const compressed = pako$1.gzip(encoded);
|
|
9
|
+
if (returnUnit8)
|
|
10
|
+
return compressed;
|
|
11
|
+
return base64.encode(compressed);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Decompresses a Base64 encoded compressed message using Pako (Gzip).
|
|
15
|
+
* @param data - The Base64 encoded compressed data.
|
|
16
|
+
* @returns The decompressed plaintext string.
|
|
17
|
+
*/
|
|
18
|
+
function decompress(data) {
|
|
19
|
+
if (typeof data === 'string') {
|
|
20
|
+
data = base64.decode(data);
|
|
21
|
+
}
|
|
22
|
+
const decompressed = pako$1.ungzip(data);
|
|
23
|
+
return new TextDecoder().decode(decompressed);
|
|
24
|
+
}
|
|
25
|
+
var pako = {
|
|
26
|
+
compress,
|
|
27
|
+
decompress
|
|
28
|
+
};module.exports=pako;//# sourceMappingURL=pako.js.map
|
package/include/lib/pako.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pako.js","sources":["../../../src/include/lib/pako.ts"],"sourcesContent":["import pako from \"pako\";\
|
|
1
|
+
{"version":3,"file":"pako.js","sources":["../../../src/include/lib/pako.ts"],"sourcesContent":["import pako from \"pako\";\nimport base64 from \"./base64\";\n\n/**\n * Compresses a string message using Pako (Gzip).\n * @param message - The plaintext string message to compress.\n * @returns A Base64 encoded string of the compressed data.\n */\nfunction compress(data: string, returnUnit8?: boolean): string | Uint8Array {\n const encoded = new TextEncoder().encode(data);\n const compressed = pako.gzip(encoded);\n if (returnUnit8) return compressed;\n return base64.encode(compressed);\n}\n\n/**\n * Decompresses a Base64 encoded compressed message using Pako (Gzip).\n * @param data - The Base64 encoded compressed data.\n * @returns The decompressed plaintext string.\n */\nfunction decompress(data: string | Uint8Array): string {\n if (typeof data === 'string') {\n data = base64.decode(data);\n }\n const decompressed = pako.ungzip(data);\n return new TextDecoder().decode(decompressed);\n}\n\nexport default {\n compress,\n decompress\n}"],"names":["pako"],"mappings":"sEAGA;;;;AAIG;AACH,SAAS,QAAQ,CAAC,IAAY,EAAE,WAAqB,EAAA;IAClD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9C,MAAM,UAAU,GAAGA,MAAI,CAAC,IAAI,CAAC,OAAO,CAAC;AACrC,IAAA,IAAI,WAAW;AAAE,QAAA,OAAO,UAAU;AAClC,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;AACnC;AAEA;;;;AAIG;AACH,SAAS,UAAU,CAAC,IAAyB,EAAA;AAC1C,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC3B,QAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAC5B,IAAA;IACD,MAAM,YAAY,GAAGA,MAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IACtC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;AAChD;AAEA,WAAe;IACZ,QAAQ;IACR;CACF"}
|
package/include/lib/pako.mjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import pako$1 from'pako';import base64 from'./base64.mjs';/**
|
|
2
|
-
* Compresses a string message using Pako (Gzip).
|
|
3
|
-
* @param message - The plaintext string message to compress.
|
|
4
|
-
* @returns A Base64 encoded string of the compressed data.
|
|
5
|
-
*/
|
|
6
|
-
function compress(data, returnUnit8) {
|
|
7
|
-
const encoded = new TextEncoder().encode(data);
|
|
8
|
-
const compressed = pako$1.gzip(encoded);
|
|
9
|
-
if (returnUnit8)
|
|
10
|
-
return compressed;
|
|
11
|
-
return base64.encode(compressed);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Decompresses a Base64 encoded compressed message using Pako (Gzip).
|
|
15
|
-
* @param data - The Base64 encoded compressed data.
|
|
16
|
-
* @returns The decompressed plaintext string.
|
|
17
|
-
*/
|
|
18
|
-
function decompress(data) {
|
|
19
|
-
if (typeof data === 'string') {
|
|
20
|
-
data = base64.decode(data);
|
|
21
|
-
}
|
|
22
|
-
const decompressed = pako$1.ungzip(data);
|
|
23
|
-
return new TextDecoder().decode(decompressed);
|
|
24
|
-
}
|
|
25
|
-
var pako = {
|
|
26
|
-
compress,
|
|
27
|
-
decompress
|
|
28
|
-
};export{
|
|
1
|
+
import pako$1 from'pako';import base64 from'./base64.mjs';/**
|
|
2
|
+
* Compresses a string message using Pako (Gzip).
|
|
3
|
+
* @param message - The plaintext string message to compress.
|
|
4
|
+
* @returns A Base64 encoded string of the compressed data.
|
|
5
|
+
*/
|
|
6
|
+
function compress(data, returnUnit8) {
|
|
7
|
+
const encoded = new TextEncoder().encode(data);
|
|
8
|
+
const compressed = pako$1.gzip(encoded);
|
|
9
|
+
if (returnUnit8)
|
|
10
|
+
return compressed;
|
|
11
|
+
return base64.encode(compressed);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Decompresses a Base64 encoded compressed message using Pako (Gzip).
|
|
15
|
+
* @param data - The Base64 encoded compressed data.
|
|
16
|
+
* @returns The decompressed plaintext string.
|
|
17
|
+
*/
|
|
18
|
+
function decompress(data) {
|
|
19
|
+
if (typeof data === 'string') {
|
|
20
|
+
data = base64.decode(data);
|
|
21
|
+
}
|
|
22
|
+
const decompressed = pako$1.ungzip(data);
|
|
23
|
+
return new TextDecoder().decode(decompressed);
|
|
24
|
+
}
|
|
25
|
+
var pako = {
|
|
26
|
+
compress,
|
|
27
|
+
decompress
|
|
28
|
+
};export{pako as default};//# sourceMappingURL=pako.mjs.map
|
package/include/lib/pako.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pako.mjs","sources":["../../../src/include/lib/pako.ts"],"sourcesContent":["import pako from \"pako\";\
|
|
1
|
+
{"version":3,"file":"pako.mjs","sources":["../../../src/include/lib/pako.ts"],"sourcesContent":["import pako from \"pako\";\nimport base64 from \"./base64\";\n\n/**\n * Compresses a string message using Pako (Gzip).\n * @param message - The plaintext string message to compress.\n * @returns A Base64 encoded string of the compressed data.\n */\nfunction compress(data: string, returnUnit8?: boolean): string | Uint8Array {\n const encoded = new TextEncoder().encode(data);\n const compressed = pako.gzip(encoded);\n if (returnUnit8) return compressed;\n return base64.encode(compressed);\n}\n\n/**\n * Decompresses a Base64 encoded compressed message using Pako (Gzip).\n * @param data - The Base64 encoded compressed data.\n * @returns The decompressed plaintext string.\n */\nfunction decompress(data: string | Uint8Array): string {\n if (typeof data === 'string') {\n data = base64.decode(data);\n }\n const decompressed = pako.ungzip(data);\n return new TextDecoder().decode(decompressed);\n}\n\nexport default {\n compress,\n decompress\n}"],"names":["pako"],"mappings":"0DAGA;;;;AAIG;AACH,SAAS,QAAQ,CAAC,IAAY,EAAE,WAAqB,EAAA;IAClD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9C,MAAM,UAAU,GAAGA,MAAI,CAAC,IAAI,CAAC,OAAO,CAAC;AACrC,IAAA,IAAI,WAAW;AAAE,QAAA,OAAO,UAAU;AAClC,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;AACnC;AAEA;;;;AAIG;AACH,SAAS,UAAU,CAAC,IAAyB,EAAA;AAC1C,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC3B,QAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAC5B,IAAA;IACD,MAAM,YAAY,GAAGA,MAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IACtC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;AAChD;AAEA,WAAe;IACZ,QAAQ;IACR;CACF"}
|
package/include/lib/reverser.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
3
|
-
for (let i = 0; i < alphabet.length; i++) {
|
|
4
|
-
substitutionPattern[alphabet[i]] = alphabet[(i + 1) % alphabet.length];
|
|
5
|
-
substitutionPattern[alphabet[i].toLowerCase()] = alphabet[(i + 1) % alphabet.length].toLowerCase();
|
|
6
|
-
}
|
|
7
|
-
let speacialCharters = '?.,!@#$%^&*()_+-=[]{}|;:<>/';
|
|
8
|
-
for (let i = 0; i < speacialCharters.length; i++) {
|
|
9
|
-
substitutionPattern[speacialCharters[i]] = speacialCharters[i];
|
|
10
|
-
}
|
|
11
|
-
const encrypt = (text) => text.split('').map((char) => substitutionPattern[char] || char).join('');
|
|
12
|
-
const decrypt = (text) => {
|
|
13
|
-
return text.split('').map((char) => {
|
|
14
|
-
for (let key in substitutionPattern) {
|
|
15
|
-
if (substitutionPattern[key] === char) {
|
|
16
|
-
return key;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return char;
|
|
20
|
-
}).join('');
|
|
21
|
-
};
|
|
22
|
-
var reverser = {
|
|
23
|
-
encrypt,
|
|
24
|
-
decrypt
|
|
25
|
-
};exports
|
|
1
|
+
'use strict';const substitutionPattern = {};
|
|
2
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
3
|
+
for (let i = 0; i < alphabet.length; i++) {
|
|
4
|
+
substitutionPattern[alphabet[i]] = alphabet[(i + 1) % alphabet.length];
|
|
5
|
+
substitutionPattern[alphabet[i].toLowerCase()] = alphabet[(i + 1) % alphabet.length].toLowerCase();
|
|
6
|
+
}
|
|
7
|
+
let speacialCharters = '?.,!@#$%^&*()_+-=[]{}|;:<>/';
|
|
8
|
+
for (let i = 0; i < speacialCharters.length; i++) {
|
|
9
|
+
substitutionPattern[speacialCharters[i]] = speacialCharters[i];
|
|
10
|
+
}
|
|
11
|
+
const encrypt = (text) => text.split('').map((char) => substitutionPattern[char] || char).join('');
|
|
12
|
+
const decrypt = (text) => {
|
|
13
|
+
return text.split('').map((char) => {
|
|
14
|
+
for (let key in substitutionPattern) {
|
|
15
|
+
if (substitutionPattern[key] === char) {
|
|
16
|
+
return key;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return char;
|
|
20
|
+
}).join('');
|
|
21
|
+
};
|
|
22
|
+
var reverser = {
|
|
23
|
+
encrypt,
|
|
24
|
+
decrypt
|
|
25
|
+
};module.exports=reverser;//# sourceMappingURL=reverser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reverser.js","sources":["../../../src/include/lib/reverser.ts"],"sourcesContent":["const substitutionPattern: any = {};\
|
|
1
|
+
{"version":3,"file":"reverser.js","sources":["../../../src/include/lib/reverser.ts"],"sourcesContent":["const substitutionPattern: any = {};\nconst alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nfor (let i = 0; i < alphabet.length; i++) {\n substitutionPattern[alphabet[i]] = alphabet[(i + 1) % alphabet.length];\n substitutionPattern[alphabet[i].toLowerCase()] = alphabet[(i + 1) % alphabet.length].toLowerCase();\n}\n\nlet speacialCharters = '?.,!@#$%^&*()_+-=[]{}|;:<>/';\nfor (let i = 0; i < speacialCharters.length; i++) {\n substitutionPattern[speacialCharters[i]] = speacialCharters[i];\n}\n\nconst encrypt = (text: string) => text.split('').map((char) => substitutionPattern[char] || char).join('')\nconst decrypt = (text: string) => {\n return text.split('').map((char) => {\n for (let key in substitutionPattern) {\n if (substitutionPattern[key] === char) {\n return key;\n }\n }\n return char;\n }).join('');\n}\n\nexport default {\n encrypt,\n decrypt\n}"],"names":[],"mappings":"aAAA,MAAM,mBAAmB,GAAQ,EAAE;AACnC,MAAM,QAAQ,GAAG,4BAA4B;AAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACvC,IAAA,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC;IACtE,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE;AACpG;AAED,IAAI,gBAAgB,GAAG,6BAA6B;AACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IAC/C,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;AAChE;AAED,MAAM,OAAO,GAAG,CAAC,IAAY,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1G,MAAM,OAAO,GAAG,CAAC,IAAY,KAAI;AAC9B,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAI;AAChC,QAAA,KAAK,IAAI,GAAG,IAAI,mBAAmB,EAAE;AAClC,YAAA,IAAI,mBAAmB,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;AACpC,gBAAA,OAAO,GAAG;AACZ,YAAA;AACH,QAAA;AACD,QAAA,OAAO,IAAI;AACd,IAAA,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AACd,CAAC;AAED,eAAe;IACZ,OAAO;IACP;CACF"}
|
package/include/lib/reverser.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const substitutionPattern = {};
|
|
2
|
-
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
3
|
-
for (let i = 0; i < alphabet.length; i++) {
|
|
4
|
-
substitutionPattern[alphabet[i]] = alphabet[(i + 1) % alphabet.length];
|
|
5
|
-
substitutionPattern[alphabet[i].toLowerCase()] = alphabet[(i + 1) % alphabet.length].toLowerCase();
|
|
6
|
-
}
|
|
7
|
-
let speacialCharters = '?.,!@#$%^&*()_+-=[]{}|;:<>/';
|
|
8
|
-
for (let i = 0; i < speacialCharters.length; i++) {
|
|
9
|
-
substitutionPattern[speacialCharters[i]] = speacialCharters[i];
|
|
10
|
-
}
|
|
11
|
-
const encrypt = (text) => text.split('').map((char) => substitutionPattern[char] || char).join('');
|
|
12
|
-
const decrypt = (text) => {
|
|
13
|
-
return text.split('').map((char) => {
|
|
14
|
-
for (let key in substitutionPattern) {
|
|
15
|
-
if (substitutionPattern[key] === char) {
|
|
16
|
-
return key;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return char;
|
|
20
|
-
}).join('');
|
|
21
|
-
};
|
|
22
|
-
var reverser = {
|
|
23
|
-
encrypt,
|
|
24
|
-
decrypt
|
|
1
|
+
const substitutionPattern = {};
|
|
2
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
3
|
+
for (let i = 0; i < alphabet.length; i++) {
|
|
4
|
+
substitutionPattern[alphabet[i]] = alphabet[(i + 1) % alphabet.length];
|
|
5
|
+
substitutionPattern[alphabet[i].toLowerCase()] = alphabet[(i + 1) % alphabet.length].toLowerCase();
|
|
6
|
+
}
|
|
7
|
+
let speacialCharters = '?.,!@#$%^&*()_+-=[]{}|;:<>/';
|
|
8
|
+
for (let i = 0; i < speacialCharters.length; i++) {
|
|
9
|
+
substitutionPattern[speacialCharters[i]] = speacialCharters[i];
|
|
10
|
+
}
|
|
11
|
+
const encrypt = (text) => text.split('').map((char) => substitutionPattern[char] || char).join('');
|
|
12
|
+
const decrypt = (text) => {
|
|
13
|
+
return text.split('').map((char) => {
|
|
14
|
+
for (let key in substitutionPattern) {
|
|
15
|
+
if (substitutionPattern[key] === char) {
|
|
16
|
+
return key;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return char;
|
|
20
|
+
}).join('');
|
|
21
|
+
};
|
|
22
|
+
var reverser = {
|
|
23
|
+
encrypt,
|
|
24
|
+
decrypt
|
|
25
25
|
};export{reverser as default};//# sourceMappingURL=reverser.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reverser.mjs","sources":["../../../src/include/lib/reverser.ts"],"sourcesContent":["const substitutionPattern: any = {};\
|
|
1
|
+
{"version":3,"file":"reverser.mjs","sources":["../../../src/include/lib/reverser.ts"],"sourcesContent":["const substitutionPattern: any = {};\nconst alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nfor (let i = 0; i < alphabet.length; i++) {\n substitutionPattern[alphabet[i]] = alphabet[(i + 1) % alphabet.length];\n substitutionPattern[alphabet[i].toLowerCase()] = alphabet[(i + 1) % alphabet.length].toLowerCase();\n}\n\nlet speacialCharters = '?.,!@#$%^&*()_+-=[]{}|;:<>/';\nfor (let i = 0; i < speacialCharters.length; i++) {\n substitutionPattern[speacialCharters[i]] = speacialCharters[i];\n}\n\nconst encrypt = (text: string) => text.split('').map((char) => substitutionPattern[char] || char).join('')\nconst decrypt = (text: string) => {\n return text.split('').map((char) => {\n for (let key in substitutionPattern) {\n if (substitutionPattern[key] === char) {\n return key;\n }\n }\n return char;\n }).join('');\n}\n\nexport default {\n encrypt,\n decrypt\n}"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAQ,EAAE;AACnC,MAAM,QAAQ,GAAG,4BAA4B;AAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACvC,IAAA,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC;IACtE,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE;AACpG;AAED,IAAI,gBAAgB,GAAG,6BAA6B;AACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IAC/C,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;AAChE;AAED,MAAM,OAAO,GAAG,CAAC,IAAY,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1G,MAAM,OAAO,GAAG,CAAC,IAAY,KAAI;AAC9B,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAI;AAChC,QAAA,KAAK,IAAI,GAAG,IAAI,mBAAmB,EAAE;AAClC,YAAA,IAAI,mBAAmB,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;AACpC,gBAAA,OAAO,GAAG;AACZ,YAAA;AACH,QAAA;AACD,QAAA,OAAO,IAAI;AACd,IAAA,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AACd,CAAC;AAED,eAAe;IACZ,OAAO;IACP;CACF"}
|
package/include/lib/urlpath.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
return encodeURIComponent(reverser.
|
|
3
|
-
}
|
|
4
|
-
function decrypt(encryptedString) {
|
|
5
|
-
return reverser.
|
|
6
|
-
}
|
|
7
|
-
var urlpath = {
|
|
8
|
-
encrypt,
|
|
9
|
-
decrypt
|
|
10
|
-
};exports
|
|
1
|
+
'use strict';var reverser=require('./reverser.js');function encrypt(input) {
|
|
2
|
+
return encodeURIComponent(reverser.encrypt(input.toLowerCase()));
|
|
3
|
+
}
|
|
4
|
+
function decrypt(encryptedString) {
|
|
5
|
+
return reverser.decrypt(decodeURIComponent(encryptedString));
|
|
6
|
+
}
|
|
7
|
+
var urlpath = {
|
|
8
|
+
encrypt,
|
|
9
|
+
decrypt
|
|
10
|
+
};module.exports=urlpath;//# sourceMappingURL=urlpath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlpath.js","sources":["../../../src/include/lib/urlpath.ts"],"sourcesContent":["import reverser from \"./reverser\"\
|
|
1
|
+
{"version":3,"file":"urlpath.js","sources":["../../../src/include/lib/urlpath.ts"],"sourcesContent":["import reverser from \"./reverser\"\n\nfunction encrypt(input: string): string {\n return encodeURIComponent(reverser.encrypt(input.toLowerCase()))\n}\n\nfunction decrypt(encryptedString: string): string {\n return reverser.decrypt(decodeURIComponent(encryptedString))\n}\n\nexport default {\n encrypt,\n decrypt\n}"],"names":[],"mappings":"mDAEA,SAAS,OAAO,CAAC,KAAa,EAAA;AAC3B,IAAA,OAAO,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;AACnE;AAEA,SAAS,OAAO,CAAC,eAAuB,EAAA;IACrC,OAAO,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAC/D;AAEA,cAAe;IACZ,OAAO;IACP;CACF"}
|
package/include/lib/urlpath.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import reverser from'./reverser.mjs';function encrypt(input) {
|
|
2
|
-
return encodeURIComponent(reverser.encrypt(input.toLowerCase()));
|
|
3
|
-
}
|
|
4
|
-
function decrypt(encryptedString) {
|
|
5
|
-
return reverser.decrypt(decodeURIComponent(encryptedString));
|
|
6
|
-
}
|
|
7
|
-
var urlpath = {
|
|
8
|
-
encrypt,
|
|
9
|
-
decrypt
|
|
1
|
+
import reverser from'./reverser.mjs';function encrypt(input) {
|
|
2
|
+
return encodeURIComponent(reverser.encrypt(input.toLowerCase()));
|
|
3
|
+
}
|
|
4
|
+
function decrypt(encryptedString) {
|
|
5
|
+
return reverser.decrypt(decodeURIComponent(encryptedString));
|
|
6
|
+
}
|
|
7
|
+
var urlpath = {
|
|
8
|
+
encrypt,
|
|
9
|
+
decrypt
|
|
10
10
|
};export{urlpath as default};//# sourceMappingURL=urlpath.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlpath.mjs","sources":["../../../src/include/lib/urlpath.ts"],"sourcesContent":["import reverser from \"./reverser\"\
|
|
1
|
+
{"version":3,"file":"urlpath.mjs","sources":["../../../src/include/lib/urlpath.ts"],"sourcesContent":["import reverser from \"./reverser\"\n\nfunction encrypt(input: string): string {\n return encodeURIComponent(reverser.encrypt(input.toLowerCase()))\n}\n\nfunction decrypt(encryptedString: string): string {\n return reverser.decrypt(decodeURIComponent(encryptedString))\n}\n\nexport default {\n encrypt,\n decrypt\n}"],"names":[],"mappings":"qCAEA,SAAS,OAAO,CAAC,KAAa,EAAA;AAC3B,IAAA,OAAO,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;AACnE;AAEA,SAAS,OAAO,CAAC,eAAuB,EAAA;IACrC,OAAO,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAC/D;AAEA,cAAe;IACZ,OAAO;IACP;CACF"}
|
package/include/responseValue.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
return crypto.
|
|
3
|
-
};
|
|
4
|
-
const decrypt = (value, signerure) => {
|
|
5
|
-
return crypto.
|
|
6
|
-
};
|
|
7
|
-
var responseValue = {
|
|
8
|
-
encrypt,
|
|
9
|
-
decrypt
|
|
10
|
-
};exports
|
|
1
|
+
'use strict';var crypto=require('./lib/crypto.js');const encrypt = (data, signerure) => {
|
|
2
|
+
return crypto.encrypt(data, crypto.makeSecret(signerure));
|
|
3
|
+
};
|
|
4
|
+
const decrypt = (value, signerure) => {
|
|
5
|
+
return crypto.decrypt(value, crypto.makeSecret(signerure));
|
|
6
|
+
};
|
|
7
|
+
var responseValue = {
|
|
8
|
+
encrypt,
|
|
9
|
+
decrypt
|
|
10
|
+
};module.exports=responseValue;//# sourceMappingURL=responseValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseValue.js","sources":["../../src/include/responseValue.ts"],"sourcesContent":["import crypto from \"./lib/crypto\";\
|
|
1
|
+
{"version":3,"file":"responseValue.js","sources":["../../src/include/responseValue.ts"],"sourcesContent":["import crypto from \"./lib/crypto\";\n\nconst encrypt = (data: any, signerure: string): string => {\n return crypto.encrypt(data, crypto.makeSecret(signerure))\n}\n\nconst decrypt = (value: string, signerure: string) => {\n return crypto.decrypt(value, crypto.makeSecret(signerure))\n}\n\nexport default {\n encrypt,\n decrypt\n}"],"names":[],"mappings":"mDAEA,MAAM,OAAO,GAAG,CAAC,IAAS,EAAE,SAAiB,KAAY;AACtD,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,SAAiB,KAAI;AAClD,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC7D,CAAC;AAED,oBAAe;IACZ,OAAO;IACP;CACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import crypto from'./lib/crypto.mjs';const encrypt = (data, signerure) => {
|
|
2
|
-
return crypto.encrypt(data, crypto.makeSecret(signerure));
|
|
3
|
-
};
|
|
4
|
-
const decrypt = (value, signerure) => {
|
|
5
|
-
return crypto.decrypt(value, crypto.makeSecret(signerure));
|
|
6
|
-
};
|
|
7
|
-
var responseValue = {
|
|
8
|
-
encrypt,
|
|
9
|
-
decrypt
|
|
1
|
+
import crypto from'./lib/crypto.mjs';const encrypt = (data, signerure) => {
|
|
2
|
+
return crypto.encrypt(data, crypto.makeSecret(signerure));
|
|
3
|
+
};
|
|
4
|
+
const decrypt = (value, signerure) => {
|
|
5
|
+
return crypto.decrypt(value, crypto.makeSecret(signerure));
|
|
6
|
+
};
|
|
7
|
+
var responseValue = {
|
|
8
|
+
encrypt,
|
|
9
|
+
decrypt
|
|
10
10
|
};export{responseValue as default};//# sourceMappingURL=responseValue.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseValue.mjs","sources":["../../src/include/responseValue.ts"],"sourcesContent":["import crypto from \"./lib/crypto\";\
|
|
1
|
+
{"version":3,"file":"responseValue.mjs","sources":["../../src/include/responseValue.ts"],"sourcesContent":["import crypto from \"./lib/crypto\";\n\nconst encrypt = (data: any, signerure: string): string => {\n return crypto.encrypt(data, crypto.makeSecret(signerure))\n}\n\nconst decrypt = (value: string, signerure: string) => {\n return crypto.decrypt(value, crypto.makeSecret(signerure))\n}\n\nexport default {\n encrypt,\n decrypt\n}"],"names":[],"mappings":"qCAEA,MAAM,OAAO,GAAG,CAAC,IAAS,EAAE,SAAiB,KAAY;AACtD,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,SAAiB,KAAI;AAClD,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC7D,CAAC;AAED,oBAAe;IACZ,OAAO;IACP;CACF"}
|
package/include/signeture.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const signeture = crypto.
|
|
3
|
-
const signetureHash = crypto.
|
|
4
|
-
const secretEncript = crypto.
|
|
5
|
-
return `${signeture}.${secretEncript}`;
|
|
6
|
-
};
|
|
7
|
-
const verify = (signerure) => {
|
|
8
|
-
const [signeture, secretEncript] = signerure.split(".");
|
|
9
|
-
const signetureHash = crypto.
|
|
10
|
-
const secret = crypto.
|
|
11
|
-
const secretVal = crypto.
|
|
12
|
-
if (secretVal !== secret)
|
|
13
|
-
throw new Error("Invalid Signeture");
|
|
14
|
-
return secretVal;
|
|
15
|
-
};
|
|
16
|
-
var signeture = {
|
|
17
|
-
make,
|
|
18
|
-
verify,
|
|
19
|
-
key: "x-signeture"
|
|
20
|
-
};exports
|
|
1
|
+
'use strict';var crypto=require('./lib/crypto.js');const make = (val, secret) => {
|
|
2
|
+
const signeture = crypto.encrypt(val, secret);
|
|
3
|
+
const signetureHash = crypto.hash(signeture);
|
|
4
|
+
const secretEncript = crypto.encrypt(secret, signetureHash);
|
|
5
|
+
return `${signeture}.${secretEncript}`;
|
|
6
|
+
};
|
|
7
|
+
const verify = (signerure) => {
|
|
8
|
+
const [signeture, secretEncript] = signerure.split(".");
|
|
9
|
+
const signetureHash = crypto.hash(signeture);
|
|
10
|
+
const secret = crypto.decrypt(secretEncript, signetureHash);
|
|
11
|
+
const secretVal = crypto.decrypt(signeture, secret);
|
|
12
|
+
if (secretVal !== secret)
|
|
13
|
+
throw new Error("Invalid Signeture");
|
|
14
|
+
return secretVal;
|
|
15
|
+
};
|
|
16
|
+
var signeture = {
|
|
17
|
+
make,
|
|
18
|
+
verify,
|
|
19
|
+
key: "x-signeture"
|
|
20
|
+
};module.exports=signeture;//# sourceMappingURL=signeture.js.map
|
package/include/signeture.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signeture.js","sources":["../../src/include/signeture.ts"],"sourcesContent":["import crypto from \"./lib/crypto\";\
|
|
1
|
+
{"version":3,"file":"signeture.js","sources":["../../src/include/signeture.ts"],"sourcesContent":["import crypto from \"./lib/crypto\";\n\nconst make = (val: string, secret: string) => {\n const signeture = crypto.encrypt(val, secret);\n const signetureHash = crypto.hash(signeture)\n const secretEncript = crypto.encrypt(secret, signetureHash);\n return `${signeture}.${secretEncript}`;\n}\n\nconst verify = (signerure: string) => {\n const [signeture, secretEncript] = signerure.split(\".\");\n const signetureHash = crypto.hash(signeture);\n const secret = crypto.decrypt(secretEncript, signetureHash);\n const secretVal = crypto.decrypt(signeture, secret);\n if (secretVal !== secret) throw new Error(\"Invalid Signeture\");\n return secretVal;\n}\n\nexport default {\n make,\n verify,\n key: \"x-signeture\"\n}"],"names":[],"mappings":"mDAEA,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,MAAc,KAAI;IAC1C,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC;IAC7C,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;IAC5C,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC;AAC3D,IAAA,OAAO,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,aAAa,EAAE;AACzC,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,SAAiB,KAAI;AAClC,IAAA,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC;IACvD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;IAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC;IAC3D,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;IACnD,IAAI,SAAS,KAAK,MAAM;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AAC9D,IAAA,OAAO,SAAS;AACnB,CAAC;AAED,gBAAe;IACZ,IAAI;IACJ,MAAM;AACN,IAAA,GAAG,EAAE;CACP"}
|