shogun-core 5.2.0 → 5.2.1
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/browser/defaultVendors-node_modules_hpke_chacha20poly1305_esm_mod_js.shogun-core.js +1220 -0
- package/dist/browser/defaultVendors-node_modules_hpke_chacha20poly1305_esm_mod_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_hpke_hybridkem-x-wing_esm_mod_js.shogun-core.js +844 -0
- package/dist/browser/defaultVendors-node_modules_hpke_hybridkem-x-wing_esm_mod_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_mlkem_esm_mod_js.shogun-core.js +2335 -0
- package/dist/browser/defaultVendors-node_modules_mlkem_esm_mod_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_ciphers_chacha_js.shogun-core.js +999 -0
- package/dist/browser/defaultVendors-node_modules_noble_ciphers_chacha_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js +1651 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_edwards_js-node_modules_noble_curves_es-a82056.shogun-core.js +825 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_edwards_js-node_modules_noble_curves_es-a82056.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed25519_js.shogun-core.js +508 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed25519_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js +747 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js +1608 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_post-quantum_ml-dsa_js.shogun-core.js +2117 -0
- package/dist/browser/defaultVendors-node_modules_noble_post-quantum_ml-dsa_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_openpgp_dist_openpgp_min_mjs.shogun-core.js +86 -0
- package/dist/browser/defaultVendors-node_modules_openpgp_dist_openpgp_min_mjs.shogun-core.js.map +1 -0
- package/dist/browser/node_modules_hpke_ml-kem_esm_mod_js.shogun-core.js +539 -0
- package/dist/browser/node_modules_hpke_ml-kem_esm_mod_js.shogun-core.js.map +1 -0
- package/dist/browser/shogun-core.js +160386 -0
- package/dist/browser/shogun-core.js.map +1 -0
- package/dist/config/simplified-config.js +236 -0
- package/dist/core.js +329 -0
- package/dist/crypto/asymmetric.js +99 -0
- package/dist/crypto/double-ratchet.js +370 -0
- package/dist/crypto/file-encryption.js +213 -0
- package/dist/crypto/hashing.js +87 -0
- package/dist/crypto/index.js +34 -0
- package/dist/crypto/mls-codec.js +202 -0
- package/dist/crypto/mls.js +550 -0
- package/dist/crypto/pgp.js +390 -0
- package/dist/crypto/random-generation.js +341 -0
- package/dist/crypto/sframe.js +350 -0
- package/dist/crypto/signal-protocol.js +376 -0
- package/dist/crypto/symmetric.js +91 -0
- package/dist/crypto/types.js +2 -0
- package/dist/crypto/utils.js +140 -0
- package/dist/examples/auth-test.js +253 -0
- package/dist/examples/crypto-identity-example.js +151 -0
- package/dist/examples/crypto-working-test.js +83 -0
- package/dist/examples/double-ratchet-test.js +155 -0
- package/dist/examples/mls-advanced-example.js +294 -0
- package/dist/examples/mls-sframe-test.js +304 -0
- package/dist/examples/pgp-example.js +200 -0
- package/dist/examples/quick-auth-test.js +61 -0
- package/dist/examples/random-generation-test.js +151 -0
- package/dist/examples/signal-protocol-test.js +38 -0
- package/dist/examples/simple-api-test.js +114 -0
- package/dist/examples/simple-crypto-identity-example.js +84 -0
- package/dist/examples/timeout-test.js +227 -0
- package/dist/examples/zkproof-credentials-example.js +212 -0
- package/dist/examples/zkproof-example.js +201 -0
- package/dist/gundb/api.js +435 -0
- package/dist/gundb/crypto.js +283 -0
- package/dist/gundb/db.js +1946 -0
- package/dist/gundb/derive.js +232 -0
- package/dist/gundb/errors.js +76 -0
- package/dist/gundb/index.js +22 -0
- package/dist/gundb/rxjs.js +447 -0
- package/dist/gundb/types.js +5 -0
- package/dist/index.js +58 -0
- package/dist/interfaces/common.js +2 -0
- package/dist/interfaces/events.js +40 -0
- package/dist/interfaces/plugin.js +2 -0
- package/dist/interfaces/shogun.js +37 -0
- package/dist/managers/AuthManager.js +226 -0
- package/dist/managers/CoreInitializer.js +228 -0
- package/dist/managers/CryptoIdentityManager.js +366 -0
- package/dist/managers/EventManager.js +70 -0
- package/dist/managers/PluginManager.js +299 -0
- package/dist/plugins/base.js +50 -0
- package/dist/plugins/index.js +32 -0
- package/dist/plugins/nostr/index.js +20 -0
- package/dist/plugins/nostr/nostrConnector.js +419 -0
- package/dist/plugins/nostr/nostrConnectorPlugin.js +453 -0
- package/dist/plugins/nostr/nostrSigner.js +319 -0
- package/dist/plugins/nostr/types.js +2 -0
- package/dist/plugins/smartwallet/index.js +18 -0
- package/dist/plugins/smartwallet/smartWalletPlugin.js +511 -0
- package/dist/plugins/smartwallet/types.js +2 -0
- package/dist/plugins/web3/index.js +20 -0
- package/dist/plugins/web3/types.js +2 -0
- package/dist/plugins/web3/web3Connector.js +533 -0
- package/dist/plugins/web3/web3ConnectorPlugin.js +455 -0
- package/dist/plugins/web3/web3Signer.js +314 -0
- package/dist/plugins/webauthn/index.js +19 -0
- package/dist/plugins/webauthn/types.js +14 -0
- package/dist/plugins/webauthn/webauthn.js +496 -0
- package/dist/plugins/webauthn/webauthnPlugin.js +489 -0
- package/dist/plugins/webauthn/webauthnSigner.js +310 -0
- package/dist/plugins/zkproof/index.js +53 -0
- package/dist/plugins/zkproof/types.js +2 -0
- package/dist/plugins/zkproof/zkCredentials.js +213 -0
- package/dist/plugins/zkproof/zkProofConnector.js +198 -0
- package/dist/plugins/zkproof/zkProofPlugin.js +272 -0
- package/dist/storage/storage.js +145 -0
- package/dist/types/config/simplified-config.d.ts +114 -0
- package/dist/types/core.d.ts +305 -0
- package/dist/types/crypto/asymmetric.d.ts +6 -0
- package/dist/types/crypto/double-ratchet.d.ts +22 -0
- package/dist/types/crypto/file-encryption.d.ts +19 -0
- package/dist/types/crypto/hashing.d.ts +9 -0
- package/dist/types/crypto/index.d.ts +13 -0
- package/dist/types/crypto/mls-codec.d.ts +39 -0
- package/dist/types/crypto/mls.d.ts +130 -0
- package/dist/types/crypto/pgp.d.ts +95 -0
- package/dist/types/crypto/random-generation.d.ts +35 -0
- package/dist/types/crypto/sframe.d.ts +102 -0
- package/dist/types/crypto/signal-protocol.d.ts +26 -0
- package/dist/types/crypto/symmetric.d.ts +9 -0
- package/dist/types/crypto/types.d.ts +144 -0
- package/dist/types/crypto/utils.d.ts +22 -0
- package/dist/types/examples/auth-test.d.ts +8 -0
- package/dist/types/examples/crypto-identity-example.d.ts +5 -0
- package/dist/types/examples/crypto-working-test.d.ts +1 -0
- package/dist/types/examples/double-ratchet-test.d.ts +1 -0
- package/dist/types/examples/mls-advanced-example.d.ts +53 -0
- package/dist/types/examples/mls-sframe-test.d.ts +1 -0
- package/dist/types/examples/pgp-example.d.ts +75 -0
- package/dist/types/examples/quick-auth-test.d.ts +8 -0
- package/dist/types/examples/random-generation-test.d.ts +1 -0
- package/dist/types/examples/signal-protocol-test.d.ts +1 -0
- package/dist/types/examples/simple-api-test.d.ts +10 -0
- package/dist/types/examples/simple-crypto-identity-example.d.ts +6 -0
- package/dist/types/examples/timeout-test.d.ts +8 -0
- package/dist/types/examples/zkproof-credentials-example.d.ts +12 -0
- package/dist/types/examples/zkproof-example.d.ts +11 -0
- package/dist/types/gundb/api.d.ts +185 -0
- package/dist/types/gundb/crypto.d.ts +95 -0
- package/dist/types/gundb/db.d.ts +397 -0
- package/dist/types/gundb/derive.d.ts +21 -0
- package/dist/types/gundb/errors.d.ts +42 -0
- package/dist/types/gundb/index.d.ts +3 -0
- package/dist/types/gundb/rxjs.d.ts +110 -0
- package/dist/types/gundb/types.d.ts +255 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/interfaces/common.d.ts +85 -0
- package/dist/types/interfaces/events.d.ts +131 -0
- package/dist/types/interfaces/plugin.d.ts +162 -0
- package/dist/types/interfaces/shogun.d.ts +208 -0
- package/dist/types/managers/AuthManager.d.ts +72 -0
- package/dist/types/managers/CoreInitializer.d.ts +40 -0
- package/dist/types/managers/CryptoIdentityManager.d.ts +102 -0
- package/dist/types/managers/EventManager.d.ts +49 -0
- package/dist/types/managers/PluginManager.d.ts +145 -0
- package/dist/types/plugins/base.d.ts +35 -0
- package/dist/types/plugins/index.d.ts +18 -0
- package/dist/types/plugins/nostr/index.d.ts +4 -0
- package/dist/types/plugins/nostr/nostrConnector.d.ts +119 -0
- package/dist/types/plugins/nostr/nostrConnectorPlugin.d.ts +163 -0
- package/dist/types/plugins/nostr/nostrSigner.d.ts +105 -0
- package/dist/types/plugins/nostr/types.d.ts +122 -0
- package/dist/types/plugins/smartwallet/index.d.ts +2 -0
- package/dist/types/plugins/smartwallet/smartWalletPlugin.d.ts +67 -0
- package/dist/types/plugins/smartwallet/types.d.ts +80 -0
- package/dist/types/plugins/web3/index.d.ts +4 -0
- package/dist/types/plugins/web3/types.d.ts +107 -0
- package/dist/types/plugins/web3/web3Connector.d.ts +129 -0
- package/dist/types/plugins/web3/web3ConnectorPlugin.d.ts +160 -0
- package/dist/types/plugins/web3/web3Signer.d.ts +114 -0
- package/dist/types/plugins/webauthn/index.d.ts +3 -0
- package/dist/types/plugins/webauthn/types.d.ts +183 -0
- package/dist/types/plugins/webauthn/webauthn.d.ts +129 -0
- package/dist/types/plugins/webauthn/webauthnPlugin.d.ts +179 -0
- package/dist/types/plugins/webauthn/webauthnSigner.d.ts +91 -0
- package/dist/types/plugins/zkproof/index.d.ts +48 -0
- package/dist/types/plugins/zkproof/types.d.ts +123 -0
- package/dist/types/plugins/zkproof/zkCredentials.d.ts +112 -0
- package/dist/types/plugins/zkproof/zkProofConnector.d.ts +46 -0
- package/dist/types/plugins/zkproof/zkProofPlugin.d.ts +76 -0
- package/dist/types/storage/storage.d.ts +51 -0
- package/dist/types/utils/errorHandler.d.ts +119 -0
- package/dist/types/utils/eventEmitter.d.ts +39 -0
- package/dist/types/utils/seedPhrase.d.ts +50 -0
- package/dist/types/utils/validation.d.ts +27 -0
- package/dist/utils/errorHandler.js +246 -0
- package/dist/utils/eventEmitter.js +79 -0
- package/dist/utils/seedPhrase.js +97 -0
- package/dist/utils/validation.js +81 -0
- package/package.json +10 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Crypto module exports for shogun-core
|
|
18
|
+
__exportStar(require("./symmetric"), exports);
|
|
19
|
+
__exportStar(require("./asymmetric"), exports);
|
|
20
|
+
__exportStar(require("./hashing"), exports);
|
|
21
|
+
__exportStar(require("./file-encryption"), exports);
|
|
22
|
+
__exportStar(require("./signal-protocol"), exports);
|
|
23
|
+
__exportStar(require("./double-ratchet"), exports);
|
|
24
|
+
__exportStar(require("./random-generation"), exports);
|
|
25
|
+
// RFC-compliant MLS and SFrame implementations
|
|
26
|
+
__exportStar(require("./mls"), exports);
|
|
27
|
+
__exportStar(require("./mls-codec"), exports);
|
|
28
|
+
__exportStar(require("./sframe"), exports);
|
|
29
|
+
// PGP/OpenPGP implementation
|
|
30
|
+
__exportStar(require("./pgp"), exports);
|
|
31
|
+
__exportStar(require("./types"), exports);
|
|
32
|
+
__exportStar(require("./utils"), exports);
|
|
33
|
+
// Main crypto provider (only for React apps)
|
|
34
|
+
// export { CryptoProvider, useCrypto } from './provider';
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MLS Message encoding/decoding utilities
|
|
4
|
+
*
|
|
5
|
+
* Since ts-mls doesn't export encode/decode functions from the main package,
|
|
6
|
+
* we'll use JSON serialization with Uint8Array and BigInt conversion for transmission.
|
|
7
|
+
* This works for KeyPackage, Welcome, Commit, and other MLS messages.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.encodeKeyPackage = encodeKeyPackage;
|
|
11
|
+
exports.decodeKeyPackage = decodeKeyPackage;
|
|
12
|
+
exports.encodeWelcome = encodeWelcome;
|
|
13
|
+
exports.decodeWelcome = decodeWelcome;
|
|
14
|
+
exports.encodeCommit = encodeCommit;
|
|
15
|
+
exports.decodeCommit = decodeCommit;
|
|
16
|
+
exports.encodeRatchetTree = encodeRatchetTree;
|
|
17
|
+
exports.decodeRatchetTree = decodeRatchetTree;
|
|
18
|
+
/**
|
|
19
|
+
* Convert Uint8Array and BigInt to regular array/string recursively
|
|
20
|
+
*/
|
|
21
|
+
function uint8ArrayToArray(obj) {
|
|
22
|
+
// Handle null explicitly (important for MLS ratchet trees)
|
|
23
|
+
if (obj === null) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
if (obj instanceof Uint8Array) {
|
|
27
|
+
return { __type: "Uint8Array", data: Array.from(obj) };
|
|
28
|
+
}
|
|
29
|
+
if (typeof obj === "bigint") {
|
|
30
|
+
return { __type: "BigInt", value: obj.toString() };
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(obj)) {
|
|
33
|
+
return obj.map(uint8ArrayToArray);
|
|
34
|
+
}
|
|
35
|
+
if (typeof obj === "object") {
|
|
36
|
+
const result = {};
|
|
37
|
+
for (const key in obj) {
|
|
38
|
+
if (obj.hasOwnProperty(key)) {
|
|
39
|
+
result[key] = uint8ArrayToArray(obj[key]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
return obj;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Convert regular arrays back to Uint8Array and strings back to BigInt recursively
|
|
48
|
+
*/
|
|
49
|
+
function arrayToUint8Array(obj) {
|
|
50
|
+
// Handle null: Convert to undefined for MLS compatibility
|
|
51
|
+
// ts-mls expects RatchetTree = (Node | undefined)[], not (Node | null)[]
|
|
52
|
+
if (obj === null) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
// Check for marked Uint8Array
|
|
56
|
+
if (typeof obj === "object" && obj.__type === "Uint8Array") {
|
|
57
|
+
return new Uint8Array(obj.data);
|
|
58
|
+
}
|
|
59
|
+
// Check for marked BigInt
|
|
60
|
+
if (typeof obj === "object" && obj.__type === "BigInt") {
|
|
61
|
+
return BigInt(obj.value);
|
|
62
|
+
}
|
|
63
|
+
if (Array.isArray(obj)) {
|
|
64
|
+
return obj.map(arrayToUint8Array);
|
|
65
|
+
}
|
|
66
|
+
if (typeof obj === "object") {
|
|
67
|
+
// Check if this is an array-like object with sequential numeric keys
|
|
68
|
+
const keys = Object.keys(obj);
|
|
69
|
+
const isArrayLike = keys.length > 0 && keys.every((key, index) => key === String(index));
|
|
70
|
+
if (isArrayLike) {
|
|
71
|
+
// Convert object with numeric keys back to array
|
|
72
|
+
console.log("🔧 [mlsCodec] Converting array-like object to array, length:", keys.length);
|
|
73
|
+
return keys.map((key) => arrayToUint8Array(obj[key]));
|
|
74
|
+
}
|
|
75
|
+
const result = {};
|
|
76
|
+
for (const key in obj) {
|
|
77
|
+
if (obj.hasOwnProperty(key)) {
|
|
78
|
+
result[key] = arrayToUint8Array(obj[key]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
return obj;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Encode a KeyPackage to JSON string for transmission
|
|
87
|
+
*/
|
|
88
|
+
function encodeKeyPackage(keyPackage) {
|
|
89
|
+
// Convert Uint8Arrays to regular arrays so they can be JSON serialized
|
|
90
|
+
const serializable = uint8ArrayToArray(keyPackage);
|
|
91
|
+
return JSON.stringify(serializable);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Decode JSON string back to a KeyPackage object
|
|
95
|
+
*/
|
|
96
|
+
function decodeKeyPackage(encoded) {
|
|
97
|
+
const parsed = JSON.parse(encoded);
|
|
98
|
+
// Convert arrays back to Uint8Arrays
|
|
99
|
+
return arrayToUint8Array(parsed);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Encode a Welcome message to JSON string for transmission
|
|
103
|
+
*/
|
|
104
|
+
function encodeWelcome(welcome) {
|
|
105
|
+
const serializable = uint8ArrayToArray(welcome);
|
|
106
|
+
return JSON.stringify(serializable);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Decode JSON string back to a Welcome object
|
|
110
|
+
*/
|
|
111
|
+
function decodeWelcome(encoded) {
|
|
112
|
+
const parsed = JSON.parse(encoded);
|
|
113
|
+
return arrayToUint8Array(parsed);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Encode a Commit message to JSON string for transmission
|
|
117
|
+
*/
|
|
118
|
+
function encodeCommit(commit) {
|
|
119
|
+
const serializable = uint8ArrayToArray(commit);
|
|
120
|
+
return JSON.stringify(serializable);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Decode JSON string back to a Commit object
|
|
124
|
+
*/
|
|
125
|
+
function decodeCommit(encoded) {
|
|
126
|
+
const parsed = JSON.parse(encoded);
|
|
127
|
+
return arrayToUint8Array(parsed);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Encode a RatchetTree to JSON string for transmission
|
|
131
|
+
*/
|
|
132
|
+
function encodeRatchetTree(ratchetTree) {
|
|
133
|
+
const serializable = uint8ArrayToArray(ratchetTree);
|
|
134
|
+
return JSON.stringify(serializable);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Decode JSON string back to a RatchetTree
|
|
138
|
+
*/
|
|
139
|
+
function decodeRatchetTree(encoded) {
|
|
140
|
+
const parsed = JSON.parse(encoded);
|
|
141
|
+
console.log("========================================");
|
|
142
|
+
console.log("🔍 [mlsCodec] AFTER JSON.PARSE:");
|
|
143
|
+
console.log(" Type:", typeof parsed);
|
|
144
|
+
console.log(" Is Array:", Array.isArray(parsed));
|
|
145
|
+
console.log(" Length:", Array.isArray(parsed) ? parsed.length : "not an array");
|
|
146
|
+
console.log(" Element 0:", parsed[0] === null
|
|
147
|
+
? "NULL"
|
|
148
|
+
: parsed[0] === undefined
|
|
149
|
+
? "UNDEFINED"
|
|
150
|
+
: typeof parsed[0]);
|
|
151
|
+
if (parsed[0] && typeof parsed[0] === "object") {
|
|
152
|
+
console.log(" - Keys:", Object.keys(parsed[0]).slice(0, 10));
|
|
153
|
+
console.log(" - Has nodeType:", "nodeType" in parsed[0]);
|
|
154
|
+
}
|
|
155
|
+
console.log(" Element 1:", parsed[1] === null
|
|
156
|
+
? "NULL"
|
|
157
|
+
: parsed[1] === undefined
|
|
158
|
+
? "UNDEFINED"
|
|
159
|
+
: typeof parsed[1]);
|
|
160
|
+
console.log(" Element 2:", parsed[2] === null
|
|
161
|
+
? "NULL"
|
|
162
|
+
: parsed[2] === undefined
|
|
163
|
+
? "UNDEFINED"
|
|
164
|
+
: typeof parsed[2]);
|
|
165
|
+
if (parsed[2] && typeof parsed[2] === "object") {
|
|
166
|
+
console.log(" - Keys:", Object.keys(parsed[2]).slice(0, 10));
|
|
167
|
+
console.log(" - Has nodeType:", "nodeType" in parsed[2]);
|
|
168
|
+
}
|
|
169
|
+
const result = arrayToUint8Array(parsed);
|
|
170
|
+
console.log("----------------------------------------");
|
|
171
|
+
console.log("🔍 [mlsCodec] AFTER ARRAY_TO_UINT8ARRAY:");
|
|
172
|
+
console.log(" Type:", typeof result);
|
|
173
|
+
console.log(" Is Array:", Array.isArray(result));
|
|
174
|
+
console.log(" Length:", Array.isArray(result) ? result.length : "not an array");
|
|
175
|
+
console.log(" Element 0:", result[0] === null
|
|
176
|
+
? "NULL"
|
|
177
|
+
: result[0] === undefined
|
|
178
|
+
? "UNDEFINED"
|
|
179
|
+
: typeof result[0]);
|
|
180
|
+
if (result[0] && typeof result[0] === "object") {
|
|
181
|
+
console.log(" - Keys:", Object.keys(result[0]).slice(0, 10));
|
|
182
|
+
console.log(" - Has nodeType:", "nodeType" in result[0]);
|
|
183
|
+
console.log(" - nodeType value:", result[0].nodeType);
|
|
184
|
+
}
|
|
185
|
+
console.log(" Element 1:", result[1] === null
|
|
186
|
+
? "NULL"
|
|
187
|
+
: result[1] === undefined
|
|
188
|
+
? "UNDEFINED"
|
|
189
|
+
: typeof result[1]);
|
|
190
|
+
console.log(" Element 2:", result[2] === null
|
|
191
|
+
? "NULL"
|
|
192
|
+
: result[2] === undefined
|
|
193
|
+
? "UNDEFINED"
|
|
194
|
+
: typeof result[2]);
|
|
195
|
+
if (result[2] && typeof result[2] === "object") {
|
|
196
|
+
console.log(" - Keys:", Object.keys(result[2]).slice(0, 10));
|
|
197
|
+
console.log(" - Has nodeType:", "nodeType" in result[2]);
|
|
198
|
+
console.log(" - nodeType value:", result[2].nodeType);
|
|
199
|
+
}
|
|
200
|
+
console.log("========================================");
|
|
201
|
+
return result;
|
|
202
|
+
}
|