mcard-js 2.1.47 → 2.1.48
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/dist/CardCollection-TYC67XOH.js +10 -0
- package/dist/EventProducer-VFDOM5W2.js +47 -0
- package/dist/IndexedDBEngine-5CEFZDOG.js +12 -0
- package/dist/LambdaRuntime-DMEBYJIN.js +19 -0
- package/dist/Loader-OBPDJNFH.js +12 -0
- package/dist/MCard-RHTWJPHJ.js +8 -0
- package/dist/NetworkRuntime-KBQURQ6A.js +1598 -0
- package/dist/chunk-AAO4GDBI.js +2360 -0
- package/dist/chunk-ASW6AOA7.js +140 -0
- package/dist/chunk-BJJZWPIF.js +112 -0
- package/dist/chunk-GGQCF7ZK.js +170 -0
- package/dist/chunk-HWBEGVEN.js +364 -0
- package/dist/chunk-ISY5LYLF.js +217 -0
- package/dist/chunk-OAHWTOEB.js +275 -0
- package/dist/chunk-RZENJZGX.js +299 -0
- package/dist/index.browser.cjs +21 -19
- package/dist/index.browser.d.cts +14 -15
- package/dist/index.browser.d.ts +14 -15
- package/dist/index.browser.js +5 -5
- package/dist/index.cjs +26 -21
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +18 -15
- package/dist/storage/SqliteNodeEngine.cjs +21 -19
- package/dist/storage/SqliteNodeEngine.js +3 -3
- package/dist/storage/SqliteWasmEngine.cjs +21 -19
- package/dist/storage/SqliteWasmEngine.js +3 -3
- package/package.json +3 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ALGORITHM_HIERARCHY,
|
|
3
|
+
EVENT_CONSTANTS
|
|
4
|
+
} from "./chunk-KEC7YFG3.js";
|
|
5
|
+
import {
|
|
6
|
+
GTime,
|
|
7
|
+
HashValidator
|
|
8
|
+
} from "./chunk-ASW6AOA7.js";
|
|
9
|
+
import "./chunk-PNKVD2UK.js";
|
|
10
|
+
|
|
11
|
+
// src/model/EventProducer.ts
|
|
12
|
+
async function generateCollisionEvent(card) {
|
|
13
|
+
const currentHashFunction = GTime.getHashAlgorithm(card.g_time);
|
|
14
|
+
const nextAlgo = nextHashFunction(currentHashFunction);
|
|
15
|
+
const upgradedHash = await HashValidator.computeHash(card.content, nextAlgo);
|
|
16
|
+
const event = {
|
|
17
|
+
[EVENT_CONSTANTS.TYPE]: EVENT_CONSTANTS.COLLISION_EVENT_TYPE,
|
|
18
|
+
[EVENT_CONSTANTS.HASH]: card.hash,
|
|
19
|
+
[EVENT_CONSTANTS.FIRST_G_TIME]: card.g_time,
|
|
20
|
+
[EVENT_CONSTANTS.COLLISION_TIME]: card.g_time,
|
|
21
|
+
// Using original card's time as per Python logic reference
|
|
22
|
+
[EVENT_CONSTANTS.CONTENT_SIZE]: card.content.length,
|
|
23
|
+
[EVENT_CONSTANTS.UPGRADED_FUNCTION]: nextAlgo,
|
|
24
|
+
[EVENT_CONSTANTS.UPGRADED_HASH]: upgradedHash
|
|
25
|
+
};
|
|
26
|
+
return JSON.stringify(event);
|
|
27
|
+
}
|
|
28
|
+
function generateDuplicationEvent(card) {
|
|
29
|
+
const event = {
|
|
30
|
+
[EVENT_CONSTANTS.TYPE]: EVENT_CONSTANTS.DUPLICATE_EVENT_TYPE,
|
|
31
|
+
[EVENT_CONSTANTS.HASH]: card.hash,
|
|
32
|
+
[EVENT_CONSTANTS.DUPLICATE_TIME]: card.g_time
|
|
33
|
+
};
|
|
34
|
+
return JSON.stringify(event);
|
|
35
|
+
}
|
|
36
|
+
function nextHashFunction(current) {
|
|
37
|
+
const currentLower = current.toLowerCase();
|
|
38
|
+
const entry = ALGORITHM_HIERARCHY[currentLower];
|
|
39
|
+
if (entry && entry.next) {
|
|
40
|
+
return entry.next;
|
|
41
|
+
}
|
|
42
|
+
return "sha256";
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
generateCollisionEvent,
|
|
46
|
+
generateDuplicationEvent
|
|
47
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IndexedDBEngine
|
|
3
|
+
} from "./chunk-OAHWTOEB.js";
|
|
4
|
+
import "./chunk-3EIBJPNF.js";
|
|
5
|
+
import "./chunk-ADV52544.js";
|
|
6
|
+
import "./chunk-J3IDWMDN.js";
|
|
7
|
+
import "./chunk-GGQCF7ZK.js";
|
|
8
|
+
import "./chunk-ASW6AOA7.js";
|
|
9
|
+
import "./chunk-PNKVD2UK.js";
|
|
10
|
+
export {
|
|
11
|
+
IndexedDBEngine
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LambdaRuntime,
|
|
3
|
+
parseLambdaExpression
|
|
4
|
+
} from "./chunk-AAO4GDBI.js";
|
|
5
|
+
import "./chunk-MPMRBT5R.js";
|
|
6
|
+
import "./chunk-2KADE3SE.js";
|
|
7
|
+
import "./chunk-ISY5LYLF.js";
|
|
8
|
+
import "./chunk-FPW33LMV.js";
|
|
9
|
+
import "./chunk-3EIBJPNF.js";
|
|
10
|
+
import "./chunk-ADV52544.js";
|
|
11
|
+
import "./chunk-RZENJZGX.js";
|
|
12
|
+
import "./chunk-J3IDWMDN.js";
|
|
13
|
+
import "./chunk-GGQCF7ZK.js";
|
|
14
|
+
import "./chunk-ASW6AOA7.js";
|
|
15
|
+
import "./chunk-PNKVD2UK.js";
|
|
16
|
+
export {
|
|
17
|
+
LambdaRuntime,
|
|
18
|
+
parseLambdaExpression
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadFileToCollection,
|
|
3
|
+
processAndStoreFile
|
|
4
|
+
} from "./chunk-HWBEGVEN.js";
|
|
5
|
+
import "./chunk-J3IDWMDN.js";
|
|
6
|
+
import "./chunk-GGQCF7ZK.js";
|
|
7
|
+
import "./chunk-ASW6AOA7.js";
|
|
8
|
+
import "./chunk-PNKVD2UK.js";
|
|
9
|
+
export {
|
|
10
|
+
loadFileToCollection,
|
|
11
|
+
processAndStoreFile
|
|
12
|
+
};
|