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.
@@ -0,0 +1,10 @@
1
+ import {
2
+ CardCollection
3
+ } from "./chunk-RZENJZGX.js";
4
+ import "./chunk-J3IDWMDN.js";
5
+ import "./chunk-GGQCF7ZK.js";
6
+ import "./chunk-ASW6AOA7.js";
7
+ import "./chunk-PNKVD2UK.js";
8
+ export {
9
+ CardCollection
10
+ };
@@ -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
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ MCard
3
+ } from "./chunk-GGQCF7ZK.js";
4
+ import "./chunk-ASW6AOA7.js";
5
+ import "./chunk-PNKVD2UK.js";
6
+ export {
7
+ MCard
8
+ };