chunktech 0.1.0
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/README.md +250 -0
- package/dist/assembler.d.ts +58 -0
- package/dist/assembler.d.ts.map +1 -0
- package/dist/assembler.js +158 -0
- package/dist/assembler.js.map +1 -0
- package/dist/chunker.d.ts +65 -0
- package/dist/chunker.d.ts.map +1 -0
- package/dist/chunker.js +220 -0
- package/dist/chunker.js.map +1 -0
- package/dist/crypto.d.ts +38 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +242 -0
- package/dist/crypto.js.map +1 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +180 -0
- package/dist/index.js.map +1 -0
- package/dist/sender.d.ts +30 -0
- package/dist/sender.d.ts.map +1 -0
- package/dist/sender.js +79 -0
- package/dist/sender.js.map +1 -0
- package/dist/tracker.d.ts +63 -0
- package/dist/tracker.d.ts.map +1 -0
- package/dist/tracker.js +199 -0
- package/dist/tracker.js.map +1 -0
- package/dist/types.d.ts +138 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
package/dist/chunker.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChunkTech - File Chunking
|
|
3
|
+
* Split files into chunks for on-chain storage
|
|
4
|
+
*/
|
|
5
|
+
import { MAX_CHUNK_SIZE, CHUNK_PREFIX, CHUNK_ENCRYPTED_PREFIX } from './types.js';
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Chunking
|
|
8
|
+
// ============================================================================
|
|
9
|
+
/**
|
|
10
|
+
* Generate a random chunk set ID
|
|
11
|
+
*/
|
|
12
|
+
export function generateChunkId() {
|
|
13
|
+
const bytes = new Uint8Array(16);
|
|
14
|
+
crypto.getRandomValues(bytes);
|
|
15
|
+
return Array.from(bytes)
|
|
16
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
17
|
+
.join('');
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Split data into chunks
|
|
21
|
+
*/
|
|
22
|
+
export function chunkData(data, chunkId) {
|
|
23
|
+
const id = chunkId || generateChunkId();
|
|
24
|
+
const totalChunks = Math.ceil(data.length / MAX_CHUNK_SIZE);
|
|
25
|
+
const chunks = [];
|
|
26
|
+
for (let i = 0; i < totalChunks; i++) {
|
|
27
|
+
const start = i * MAX_CHUNK_SIZE;
|
|
28
|
+
const end = Math.min(start + MAX_CHUNK_SIZE, data.length);
|
|
29
|
+
const chunkData = data.slice(start, end);
|
|
30
|
+
chunks.push({
|
|
31
|
+
id,
|
|
32
|
+
part: i + 1,
|
|
33
|
+
total: totalChunks,
|
|
34
|
+
data: chunkData,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return { id, total: totalChunks, chunks };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Encode chunk to calldata string
|
|
41
|
+
*/
|
|
42
|
+
export function encodeChunk(chunk, encrypted = false) {
|
|
43
|
+
const prefix = encrypted ? CHUNK_ENCRYPTED_PREFIX : CHUNK_PREFIX;
|
|
44
|
+
const metadata = {
|
|
45
|
+
id: chunk.id,
|
|
46
|
+
part: chunk.part,
|
|
47
|
+
total: chunk.total,
|
|
48
|
+
};
|
|
49
|
+
// Format: prefix + base64(JSON({metadata, data: base64(data)}))
|
|
50
|
+
const payload = {
|
|
51
|
+
...metadata,
|
|
52
|
+
data: uint8ArrayToBase64(chunk.data),
|
|
53
|
+
};
|
|
54
|
+
return prefix + btoa(JSON.stringify(payload));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Decode calldata string to chunk
|
|
58
|
+
*/
|
|
59
|
+
export function decodeChunk(calldata) {
|
|
60
|
+
const isEncrypted = calldata.startsWith(CHUNK_ENCRYPTED_PREFIX);
|
|
61
|
+
const isPlain = calldata.startsWith(CHUNK_PREFIX);
|
|
62
|
+
if (!isEncrypted && !isPlain) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const prefix = isEncrypted ? CHUNK_ENCRYPTED_PREFIX : CHUNK_PREFIX;
|
|
67
|
+
const base64 = calldata.slice(prefix.length);
|
|
68
|
+
const payload = JSON.parse(atob(base64));
|
|
69
|
+
return {
|
|
70
|
+
id: payload.id,
|
|
71
|
+
part: payload.part,
|
|
72
|
+
total: payload.total,
|
|
73
|
+
data: base64ToUint8Array(payload.data),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if calldata is a chunk
|
|
82
|
+
*/
|
|
83
|
+
export function isChunk(calldata) {
|
|
84
|
+
return (calldata.startsWith(CHUNK_PREFIX) ||
|
|
85
|
+
calldata.startsWith(CHUNK_ENCRYPTED_PREFIX));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Check if calldata is an encrypted chunk
|
|
89
|
+
*/
|
|
90
|
+
export function isEncryptedChunk(calldata) {
|
|
91
|
+
return calldata.startsWith(CHUNK_ENCRYPTED_PREFIX);
|
|
92
|
+
}
|
|
93
|
+
// ============================================================================
|
|
94
|
+
// Reassembly
|
|
95
|
+
// ============================================================================
|
|
96
|
+
/**
|
|
97
|
+
* Reassemble chunks back into original data
|
|
98
|
+
*/
|
|
99
|
+
export function reassembleChunks(chunks) {
|
|
100
|
+
if (chunks.length === 0)
|
|
101
|
+
return null;
|
|
102
|
+
// Verify all chunks have same ID
|
|
103
|
+
const id = chunks[0].id;
|
|
104
|
+
if (!chunks.every((c) => c.id === id)) {
|
|
105
|
+
throw new Error('Chunks have mismatched IDs');
|
|
106
|
+
}
|
|
107
|
+
// Verify we have all parts
|
|
108
|
+
const total = chunks[0].total;
|
|
109
|
+
if (chunks.length !== total) {
|
|
110
|
+
return null; // Incomplete
|
|
111
|
+
}
|
|
112
|
+
// Sort by part number
|
|
113
|
+
const sorted = [...chunks].sort((a, b) => a.part - b.part);
|
|
114
|
+
// Verify sequential parts
|
|
115
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
116
|
+
if (sorted[i].part !== i + 1) {
|
|
117
|
+
throw new Error(`Missing chunk part ${i + 1}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Calculate total size
|
|
121
|
+
const totalSize = sorted.reduce((sum, c) => sum + c.data.length, 0);
|
|
122
|
+
// Concatenate data
|
|
123
|
+
const result = new Uint8Array(totalSize);
|
|
124
|
+
let offset = 0;
|
|
125
|
+
for (const chunk of sorted) {
|
|
126
|
+
result.set(chunk.data, offset);
|
|
127
|
+
offset += chunk.data.length;
|
|
128
|
+
}
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
// ============================================================================
|
|
132
|
+
// Chunk Tracker (streaming reassembly)
|
|
133
|
+
// ============================================================================
|
|
134
|
+
export class ChunkTracker {
|
|
135
|
+
chunks = new Map();
|
|
136
|
+
/**
|
|
137
|
+
* Add a chunk, returns assembled data if complete
|
|
138
|
+
*/
|
|
139
|
+
add(chunk) {
|
|
140
|
+
const existing = this.chunks.get(chunk.id) || [];
|
|
141
|
+
// Avoid duplicates
|
|
142
|
+
if (existing.some((c) => c.part === chunk.part)) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
existing.push(chunk);
|
|
146
|
+
this.chunks.set(chunk.id, existing);
|
|
147
|
+
// Check if complete
|
|
148
|
+
if (existing.length === chunk.total) {
|
|
149
|
+
const result = reassembleChunks(existing);
|
|
150
|
+
if (result !== null) {
|
|
151
|
+
this.chunks.delete(chunk.id); // Clean up
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get incomplete chunk sets
|
|
159
|
+
*/
|
|
160
|
+
getIncomplete() {
|
|
161
|
+
const result = [];
|
|
162
|
+
for (const [id, chunks] of this.chunks) {
|
|
163
|
+
result.push({
|
|
164
|
+
id,
|
|
165
|
+
have: chunks.length,
|
|
166
|
+
need: chunks[0].total,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get chunks for a specific ID
|
|
173
|
+
*/
|
|
174
|
+
getChunks(id) {
|
|
175
|
+
return this.chunks.get(id) || [];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Clear all tracked chunks
|
|
179
|
+
*/
|
|
180
|
+
clear() {
|
|
181
|
+
this.chunks.clear();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// ============================================================================
|
|
185
|
+
// Estimation
|
|
186
|
+
// ============================================================================
|
|
187
|
+
/**
|
|
188
|
+
* Estimate number of chunks needed for data
|
|
189
|
+
*/
|
|
190
|
+
export function estimateChunks(dataSize) {
|
|
191
|
+
return Math.ceil(dataSize / MAX_CHUNK_SIZE);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Estimate total calldata size (rough approximation)
|
|
195
|
+
*/
|
|
196
|
+
export function estimateCalldataSize(dataSize) {
|
|
197
|
+
const numChunks = estimateChunks(dataSize);
|
|
198
|
+
// Base64 expansion ~1.37x + ~100 bytes metadata per chunk
|
|
199
|
+
const perChunkOverhead = 100;
|
|
200
|
+
return Math.ceil(dataSize * 1.37 + numChunks * perChunkOverhead);
|
|
201
|
+
}
|
|
202
|
+
// ============================================================================
|
|
203
|
+
// Utilities
|
|
204
|
+
// ============================================================================
|
|
205
|
+
function uint8ArrayToBase64(bytes) {
|
|
206
|
+
let binary = '';
|
|
207
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
208
|
+
binary += String.fromCharCode(bytes[i]);
|
|
209
|
+
}
|
|
210
|
+
return btoa(binary);
|
|
211
|
+
}
|
|
212
|
+
function base64ToUint8Array(base64) {
|
|
213
|
+
const binary = atob(base64);
|
|
214
|
+
const bytes = new Uint8Array(binary.length);
|
|
215
|
+
for (let i = 0; i < binary.length; i++) {
|
|
216
|
+
bytes[i] = binary.charCodeAt(i);
|
|
217
|
+
}
|
|
218
|
+
return bytes;
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=chunker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunker.js","sourceRoot":"","sources":["../src/chunker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAElF,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAgB,EAAE,OAAgB;IAC1D,MAAM,EAAE,GAAG,OAAO,IAAI,eAAe,EAAE,CAAC;IACxC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,CAAC,GAAG,cAAc,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,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AAC,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/crypto.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChunkTech - Optional Encryption (X3DH + AES-256-GCM)
|
|
3
|
+
*
|
|
4
|
+
* Uses Web Crypto API for browser compatibility.
|
|
5
|
+
* Requires @noble/curves and @noble/hashes as optional dependencies.
|
|
6
|
+
*/
|
|
7
|
+
import type { KeyPair, KeyBundle, EncryptionKeys, Recipient, EncryptedPayload } from './types.js';
|
|
8
|
+
export declare function toHex(bytes: Uint8Array): string;
|
|
9
|
+
export declare function fromHex(hex: string): Uint8Array;
|
|
10
|
+
export declare function bundleToHex(bundle: KeyBundle): {
|
|
11
|
+
identityKey: string;
|
|
12
|
+
signedPreKey: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function bundleFromHex(hex: {
|
|
15
|
+
identityKey: string;
|
|
16
|
+
signedPreKey: string;
|
|
17
|
+
}): KeyBundle;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a new X25519 key pair
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateKeyPair(): Promise<KeyPair>;
|
|
22
|
+
/**
|
|
23
|
+
* Generate full encryption keys (identity + signedPreKey)
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateEncryptionKeys(): Promise<EncryptionKeys>;
|
|
26
|
+
/**
|
|
27
|
+
* Derive encryption keys from a wallet signature
|
|
28
|
+
*/
|
|
29
|
+
export declare function deriveKeysFromSignature(signature: string): Promise<EncryptionKeys>;
|
|
30
|
+
/**
|
|
31
|
+
* Encrypt data for multiple recipients
|
|
32
|
+
*/
|
|
33
|
+
export declare function encryptForRecipients(senderKeys: EncryptionKeys, recipients: Recipient[], plaintext: Uint8Array): Promise<EncryptedPayload>;
|
|
34
|
+
/**
|
|
35
|
+
* Decrypt data for a specific recipient
|
|
36
|
+
*/
|
|
37
|
+
export declare function decryptForRecipient(recipientId: string, recipientKeys: EncryptionKeys, encrypted: EncryptedPayload): Promise<Uint8Array>;
|
|
38
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,SAAS,EACT,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAiCpB,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAI/C;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAM/C;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAK5F;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAK3F;AAMD;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAQxD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,cAAc,CAAC,CAYtE;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA+BxF;AAwHD;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,SAAS,EAAE,EACvB,SAAS,EAAE,UAAU,GACpB,OAAO,CAAC,gBAAgB,CAAC,CAsC3B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,cAAc,EAC7B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAkCrB"}
|
package/dist/crypto.js
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChunkTech - Optional Encryption (X3DH + AES-256-GCM)
|
|
3
|
+
*
|
|
4
|
+
* Uses Web Crypto API for browser compatibility.
|
|
5
|
+
* Requires @noble/curves and @noble/hashes as optional dependencies.
|
|
6
|
+
*/
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Dynamic Imports (optional dependencies)
|
|
9
|
+
// ============================================================================
|
|
10
|
+
let x25519;
|
|
11
|
+
let hkdf;
|
|
12
|
+
let sha256;
|
|
13
|
+
async function loadCryptoDeps() {
|
|
14
|
+
if (x25519)
|
|
15
|
+
return; // Already loaded
|
|
16
|
+
try {
|
|
17
|
+
const curves = await import('@noble/curves/ed25519');
|
|
18
|
+
const hashes = await import('@noble/hashes/hkdf');
|
|
19
|
+
const sha = await import('@noble/hashes/sha256');
|
|
20
|
+
x25519 = curves.x25519;
|
|
21
|
+
hkdf = hashes.hkdf;
|
|
22
|
+
sha256 = sha.sha256;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw new Error('Encryption requires @noble/curves and @noble/hashes. ' +
|
|
26
|
+
'Install them with: npm install @noble/curves @noble/hashes');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// Utilities
|
|
31
|
+
// ============================================================================
|
|
32
|
+
export function toHex(bytes) {
|
|
33
|
+
return Array.from(bytes)
|
|
34
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
35
|
+
.join('');
|
|
36
|
+
}
|
|
37
|
+
export function fromHex(hex) {
|
|
38
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
39
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
40
|
+
bytes[i / 2] = parseInt(hex.substr(i, 2), 16);
|
|
41
|
+
}
|
|
42
|
+
return bytes;
|
|
43
|
+
}
|
|
44
|
+
export function bundleToHex(bundle) {
|
|
45
|
+
return {
|
|
46
|
+
identityKey: toHex(bundle.identityKey),
|
|
47
|
+
signedPreKey: toHex(bundle.signedPreKey),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function bundleFromHex(hex) {
|
|
51
|
+
return {
|
|
52
|
+
identityKey: fromHex(hex.identityKey),
|
|
53
|
+
signedPreKey: fromHex(hex.signedPreKey),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// Key Generation
|
|
58
|
+
// ============================================================================
|
|
59
|
+
/**
|
|
60
|
+
* Generate a new X25519 key pair
|
|
61
|
+
*/
|
|
62
|
+
export async function generateKeyPair() {
|
|
63
|
+
await loadCryptoDeps();
|
|
64
|
+
const privateKey = new Uint8Array(32);
|
|
65
|
+
crypto.getRandomValues(privateKey);
|
|
66
|
+
const publicKey = x25519.getPublicKey(privateKey);
|
|
67
|
+
return { privateKey, publicKey };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Generate full encryption keys (identity + signedPreKey)
|
|
71
|
+
*/
|
|
72
|
+
export async function generateEncryptionKeys() {
|
|
73
|
+
const identity = await generateKeyPair();
|
|
74
|
+
const signedPreKey = await generateKeyPair();
|
|
75
|
+
return {
|
|
76
|
+
identity,
|
|
77
|
+
signedPreKey,
|
|
78
|
+
bundle: {
|
|
79
|
+
identityKey: identity.publicKey,
|
|
80
|
+
signedPreKey: signedPreKey.publicKey,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Derive encryption keys from a wallet signature
|
|
86
|
+
*/
|
|
87
|
+
export async function deriveKeysFromSignature(signature) {
|
|
88
|
+
await loadCryptoDeps();
|
|
89
|
+
const sigBytes = new TextEncoder().encode(signature);
|
|
90
|
+
const seed = sha256(sigBytes);
|
|
91
|
+
const identitySalt = new TextEncoder().encode('chunk-identity');
|
|
92
|
+
const signedPreKeySalt = new TextEncoder().encode('chunk-signed-prekey');
|
|
93
|
+
const info = new TextEncoder().encode('chunktech-v1');
|
|
94
|
+
const identityPrivate = hkdf(sha256, seed, identitySalt, info, 32);
|
|
95
|
+
const signedPreKeyPrivate = hkdf(sha256, seed, signedPreKeySalt, info, 32);
|
|
96
|
+
const identity = {
|
|
97
|
+
privateKey: identityPrivate,
|
|
98
|
+
publicKey: x25519.getPublicKey(identityPrivate),
|
|
99
|
+
};
|
|
100
|
+
const signedPreKey = {
|
|
101
|
+
privateKey: signedPreKeyPrivate,
|
|
102
|
+
publicKey: x25519.getPublicKey(signedPreKeyPrivate),
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
identity,
|
|
106
|
+
signedPreKey,
|
|
107
|
+
bundle: {
|
|
108
|
+
identityKey: identity.publicKey,
|
|
109
|
+
signedPreKey: signedPreKey.publicKey,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// Crypto Primitives (Web Crypto API)
|
|
115
|
+
// ============================================================================
|
|
116
|
+
function dh(privateKey, publicKey) {
|
|
117
|
+
return x25519.getSharedSecret(privateKey, publicKey);
|
|
118
|
+
}
|
|
119
|
+
function deriveKey(ikm, salt, info, length = 32) {
|
|
120
|
+
const saltBytes = typeof salt === 'string' ? new TextEncoder().encode(salt) : salt;
|
|
121
|
+
const infoBytes = new TextEncoder().encode(info);
|
|
122
|
+
return hkdf(sha256, ikm, saltBytes, infoBytes, length);
|
|
123
|
+
}
|
|
124
|
+
async function encrypt(key, plaintext) {
|
|
125
|
+
const iv = new Uint8Array(12);
|
|
126
|
+
crypto.getRandomValues(iv);
|
|
127
|
+
const cryptoKey = await crypto.subtle.importKey('raw', key, { name: 'AES-GCM' }, false, ['encrypt']);
|
|
128
|
+
const encrypted = await crypto.subtle.encrypt({ name: 'AES-GCM', iv, tagLength: 128 }, cryptoKey, plaintext);
|
|
129
|
+
// Web Crypto appends auth tag to ciphertext
|
|
130
|
+
const encryptedBytes = new Uint8Array(encrypted);
|
|
131
|
+
const ciphertext = encryptedBytes.slice(0, -16);
|
|
132
|
+
const authTag = encryptedBytes.slice(-16);
|
|
133
|
+
return { iv, ciphertext, authTag };
|
|
134
|
+
}
|
|
135
|
+
async function decrypt(key, iv, ciphertext, authTag) {
|
|
136
|
+
const cryptoKey = await crypto.subtle.importKey('raw', key, { name: 'AES-GCM' }, false, ['decrypt']);
|
|
137
|
+
// Web Crypto expects auth tag appended to ciphertext
|
|
138
|
+
const combined = new Uint8Array(ciphertext.length + authTag.length);
|
|
139
|
+
combined.set(ciphertext, 0);
|
|
140
|
+
combined.set(authTag, ciphertext.length);
|
|
141
|
+
const decrypted = await crypto.subtle.decrypt({ name: 'AES-GCM', iv, tagLength: 128 }, cryptoKey, combined);
|
|
142
|
+
return new Uint8Array(decrypted);
|
|
143
|
+
}
|
|
144
|
+
// ============================================================================
|
|
145
|
+
// X3DH Key Exchange
|
|
146
|
+
// ============================================================================
|
|
147
|
+
function x3dhSender(senderIdentity, recipientBundle) {
|
|
148
|
+
const ephemeralPrivate = new Uint8Array(32);
|
|
149
|
+
crypto.getRandomValues(ephemeralPrivate);
|
|
150
|
+
const ephemeralPublic = x25519.getPublicKey(ephemeralPrivate);
|
|
151
|
+
const dh1 = dh(senderIdentity.privateKey, recipientBundle.signedPreKey);
|
|
152
|
+
const dh2 = dh(ephemeralPrivate, recipientBundle.identityKey);
|
|
153
|
+
const dh3 = dh(ephemeralPrivate, recipientBundle.signedPreKey);
|
|
154
|
+
const dhConcat = new Uint8Array(96);
|
|
155
|
+
dhConcat.set(dh1, 0);
|
|
156
|
+
dhConcat.set(dh2, 32);
|
|
157
|
+
dhConcat.set(dh3, 64);
|
|
158
|
+
const sharedSecret = deriveKey(dhConcat, new Uint8Array(32), 'ChunkTechProtocol', 32);
|
|
159
|
+
return { sharedSecret, ephemeralPublicKey: ephemeralPublic };
|
|
160
|
+
}
|
|
161
|
+
function x3dhRecipient(recipientIdentity, recipientSignedPreKey, senderIdentityKey, ephemeralKey) {
|
|
162
|
+
const dh1 = dh(recipientSignedPreKey.privateKey, senderIdentityKey);
|
|
163
|
+
const dh2 = dh(recipientIdentity.privateKey, ephemeralKey);
|
|
164
|
+
const dh3 = dh(recipientSignedPreKey.privateKey, ephemeralKey);
|
|
165
|
+
const dhConcat = new Uint8Array(96);
|
|
166
|
+
dhConcat.set(dh1, 0);
|
|
167
|
+
dhConcat.set(dh2, 32);
|
|
168
|
+
dhConcat.set(dh3, 64);
|
|
169
|
+
return deriveKey(dhConcat, new Uint8Array(32), 'ChunkTechProtocol', 32);
|
|
170
|
+
}
|
|
171
|
+
// ============================================================================
|
|
172
|
+
// Multi-Recipient Encryption
|
|
173
|
+
// ============================================================================
|
|
174
|
+
/**
|
|
175
|
+
* Encrypt data for multiple recipients
|
|
176
|
+
*/
|
|
177
|
+
export async function encryptForRecipients(senderKeys, recipients, plaintext) {
|
|
178
|
+
await loadCryptoDeps();
|
|
179
|
+
const symmetricKey = new Uint8Array(32);
|
|
180
|
+
crypto.getRandomValues(symmetricKey);
|
|
181
|
+
const { iv, ciphertext, authTag } = await encrypt(symmetricKey, plaintext);
|
|
182
|
+
// Always include sender so they can decrypt their own data
|
|
183
|
+
const allRecipients = [
|
|
184
|
+
{ id: 'sender', bundle: senderKeys.bundle },
|
|
185
|
+
...recipients,
|
|
186
|
+
];
|
|
187
|
+
const keys = [];
|
|
188
|
+
for (const r of allRecipients) {
|
|
189
|
+
const { sharedSecret, ephemeralPublicKey } = x3dhSender(senderKeys.identity, r.bundle);
|
|
190
|
+
const wrapped = await encrypt(sharedSecret, symmetricKey);
|
|
191
|
+
keys.push({
|
|
192
|
+
recipientId: r.id,
|
|
193
|
+
recipientIdentityKey: toHex(r.bundle.identityKey),
|
|
194
|
+
ephemeralKey: toHex(ephemeralPublicKey),
|
|
195
|
+
wrappedKey: toHex(wrapped.ciphertext),
|
|
196
|
+
iv: toHex(wrapped.iv),
|
|
197
|
+
authTag: toHex(wrapped.authTag),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
version: 1,
|
|
202
|
+
senderIdentityKey: toHex(senderKeys.identity.publicKey),
|
|
203
|
+
iv: toHex(iv),
|
|
204
|
+
ciphertext: uint8ArrayToBase64(ciphertext),
|
|
205
|
+
authTag: toHex(authTag),
|
|
206
|
+
keys,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Decrypt data for a specific recipient
|
|
211
|
+
*/
|
|
212
|
+
export async function decryptForRecipient(recipientId, recipientKeys, encrypted) {
|
|
213
|
+
await loadCryptoDeps();
|
|
214
|
+
// Find key entry by ID or identity key match
|
|
215
|
+
const keyEntry = encrypted.keys.find((k) => k.recipientId === recipientId ||
|
|
216
|
+
k.recipientIdentityKey === toHex(recipientKeys.identity.publicKey));
|
|
217
|
+
if (!keyEntry) {
|
|
218
|
+
throw new Error(`No key found for recipient: ${recipientId}`);
|
|
219
|
+
}
|
|
220
|
+
const sharedSecret = x3dhRecipient(recipientKeys.identity, recipientKeys.signedPreKey, fromHex(encrypted.senderIdentityKey), fromHex(keyEntry.ephemeralKey));
|
|
221
|
+
const symmetricKey = await decrypt(sharedSecret, fromHex(keyEntry.iv), fromHex(keyEntry.wrappedKey), fromHex(keyEntry.authTag));
|
|
222
|
+
return decrypt(symmetricKey, fromHex(encrypted.iv), base64ToUint8Array(encrypted.ciphertext), fromHex(encrypted.authTag));
|
|
223
|
+
}
|
|
224
|
+
// ============================================================================
|
|
225
|
+
// Utilities
|
|
226
|
+
// ============================================================================
|
|
227
|
+
function uint8ArrayToBase64(bytes) {
|
|
228
|
+
let binary = '';
|
|
229
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
230
|
+
binary += String.fromCharCode(bytes[i]);
|
|
231
|
+
}
|
|
232
|
+
return btoa(binary);
|
|
233
|
+
}
|
|
234
|
+
function base64ToUint8Array(base64) {
|
|
235
|
+
const binary = atob(base64);
|
|
236
|
+
const bytes = new Uint8Array(binary.length);
|
|
237
|
+
for (let i = 0; i < binary.length; i++) {
|
|
238
|
+
bytes[i] = binary.charCodeAt(i);
|
|
239
|
+
}
|
|
240
|
+
return bytes;
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,+EAA+E;AAC/E,0CAA0C;AAC1C,+EAA+E;AAE/E,IAAI,MAAW,CAAC;AAChB,IAAI,IAAS,CAAC;AACd,IAAI,MAAW,CAAC;AAEhB,KAAK,UAAU,cAAc;IAC3B,IAAI,MAAM;QAAE,OAAO,CAAC,iBAAiB;IAErC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QAEjD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACvB,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACnB,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,uDAAuD;YACvD,4DAA4D,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,MAAM,KA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S,CAAC,OAAO,CAAC,CAC3B,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,SAAS,kBAAkB,CAAC,KAAiB;IAC3C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAc;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChunkTech - On-chain file storage via chunked transactions
|
|
3
|
+
*
|
|
4
|
+
* Store and retrieve files on EVM chains (Ethereum, Base, Arbitrum)
|
|
5
|
+
* using transaction calldata.
|
|
6
|
+
*/
|
|
7
|
+
import type { PublicClient, Hash, Chain } from 'viem';
|
|
8
|
+
import type { ChunkTechConfig, UploadOptions, UploadResult, DownloadOptions, DownloadResult } from './types.js';
|
|
9
|
+
import { TransactionMonitor } from './tracker.js';
|
|
10
|
+
import { StreamingAssembler } from './assembler.js';
|
|
11
|
+
export declare class ChunkTech {
|
|
12
|
+
private walletClient;
|
|
13
|
+
private publicClient;
|
|
14
|
+
private chain;
|
|
15
|
+
constructor(config: ChunkTechConfig);
|
|
16
|
+
private detectChain;
|
|
17
|
+
/**
|
|
18
|
+
* Upload data to chain
|
|
19
|
+
*/
|
|
20
|
+
upload(data: Uint8Array | ArrayBuffer | string, options?: UploadOptions): Promise<UploadResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Download data from chain
|
|
23
|
+
*/
|
|
24
|
+
download(txHashes: Hash[], options?: DownloadOptions): Promise<DownloadResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Get a streaming assembler for progressive downloads
|
|
27
|
+
*/
|
|
28
|
+
getStreamingAssembler(options?: DownloadOptions): StreamingAssembler;
|
|
29
|
+
/**
|
|
30
|
+
* Get a transaction monitor for tracking uploads
|
|
31
|
+
*/
|
|
32
|
+
getTransactionMonitor(options?: {
|
|
33
|
+
pollInterval?: number;
|
|
34
|
+
confirmations?: number;
|
|
35
|
+
}): TransactionMonitor;
|
|
36
|
+
/**
|
|
37
|
+
* Estimate chunks needed for data
|
|
38
|
+
*/
|
|
39
|
+
estimateChunks(dataSize: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Get the current chain
|
|
42
|
+
*/
|
|
43
|
+
getChain(): Chain;
|
|
44
|
+
/**
|
|
45
|
+
* Get the public client
|
|
46
|
+
*/
|
|
47
|
+
getPublicClient(): PublicClient;
|
|
48
|
+
}
|
|
49
|
+
export { ChunkTech as default };
|
|
50
|
+
export type { ChunkTechConfig, UploadOptions, UploadResult, DownloadOptions, DownloadResult, TxStatus, EncryptionKeys, Recipient, Chunk, ChunkedData, ChunkMetadata, } from './types.js';
|
|
51
|
+
export { chunkData, encodeChunk, decodeChunk, reassembleChunks, isChunk, isEncryptedChunk, generateChunkId, estimateChunks, estimateCalldataSize, ChunkTracker, } from './chunker.js';
|
|
52
|
+
export { sendChunk, sendChunks, sendChunksParallel } from './sender.js';
|
|
53
|
+
export type { SendResult, SendOptions } from './sender.js';
|
|
54
|
+
export { waitForTransaction, waitForTransactions, checkTransactionStatus, TransactionMonitor, } from './tracker.js';
|
|
55
|
+
export type { TrackerOptions } from './types.js';
|
|
56
|
+
export { fetchTransaction, fetchChunk, fetchChunks, fetchChunksParallel, assembleFromHashes, StreamingAssembler, } from './assembler.js';
|
|
57
|
+
export type { FetchResult } from './assembler.js';
|
|
58
|
+
export { generateKeyPair, generateEncryptionKeys, deriveKeysFromSignature, encryptForRecipients, decryptForRecipient, toHex, fromHex, bundleToHex, bundleFromHex, } from './crypto.js';
|
|
59
|
+
export { MAX_CHUNK_SIZE, CHUNK_PREFIX, CHUNK_ENCRYPTED_PREFIX, SUPPORTED_CHAINS } from './types.js';
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAgB,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAGpE,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,cAAc,EAIf,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAuB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAsB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAoBxE,qBAAa,SAAS;IACpB,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,KAAK,CAAQ;gBAET,MAAM,EAAE,eAAe;IAYnC,OAAO,CAAC,WAAW;IAQnB;;OAEG;IACG,MAAM,CACV,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,MAAM,EACvC,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC;IA6CxB;;OAEG;IACG,QAAQ,CACZ,QAAQ,EAAE,IAAI,EAAE,EAChB,OAAO,GAAE,eAAoB,GA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