erosolar-cli 2.1.239 → 2.1.240
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,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cryptographic Integrity Verification System
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Legal evidence preservation and integrity verification for
|
|
5
|
+
* pro se litigation against technology companies (Apple, Google, Meta, etc.)
|
|
6
|
+
*
|
|
7
|
+
* Capabilities:
|
|
8
|
+
* - Cryptographic hash chains for tamper-evident logging
|
|
9
|
+
* - Digital signatures with timestamping
|
|
10
|
+
* - Evidence collection from tech company products/APIs
|
|
11
|
+
* - Chain of custody documentation
|
|
12
|
+
* - Legal exhibit generation with integrity proofs
|
|
13
|
+
* - RFC 3161 compliant timestamping
|
|
14
|
+
*
|
|
15
|
+
* Use Cases:
|
|
16
|
+
* - Fraud documentation
|
|
17
|
+
* - Terms of service violations
|
|
18
|
+
* - Privacy breaches
|
|
19
|
+
* - Data manipulation evidence
|
|
20
|
+
* - Corporate misconduct records
|
|
21
|
+
*/
|
|
22
|
+
export interface IntegrityRecord {
|
|
23
|
+
id: string;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
previousHash: string;
|
|
26
|
+
contentHash: string;
|
|
27
|
+
merkleRoot: string;
|
|
28
|
+
signature?: string;
|
|
29
|
+
metadata: RecordMetadata;
|
|
30
|
+
content: EvidenceContent;
|
|
31
|
+
}
|
|
32
|
+
export interface RecordMetadata {
|
|
33
|
+
collector: string;
|
|
34
|
+
target: TargetEntity;
|
|
35
|
+
evidenceType: EvidenceType;
|
|
36
|
+
legalBasis: string;
|
|
37
|
+
jurisdiction: string;
|
|
38
|
+
caseReference?: string;
|
|
39
|
+
witnesses?: string[];
|
|
40
|
+
notes?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface TargetEntity {
|
|
43
|
+
name: string;
|
|
44
|
+
type: 'corporation' | 'product' | 'service' | 'api' | 'system' | 'individual';
|
|
45
|
+
identifiers: Record<string, string>;
|
|
46
|
+
parent?: string;
|
|
47
|
+
}
|
|
48
|
+
export type EvidenceType = 'communication' | 'transaction' | 'terms_violation' | 'privacy_breach' | 'data_manipulation' | 'api_response' | 'screenshot' | 'document' | 'metadata' | 'network_traffic' | 'audit_log' | 'configuration' | 'binary_artifact' | 'fraud_indicator';
|
|
49
|
+
export interface EvidenceContent {
|
|
50
|
+
type: string;
|
|
51
|
+
encoding: 'utf8' | 'base64' | 'hex';
|
|
52
|
+
data: string;
|
|
53
|
+
originalSize: number;
|
|
54
|
+
mimeType?: string;
|
|
55
|
+
sourceUrl?: string;
|
|
56
|
+
captureMethod: string;
|
|
57
|
+
}
|
|
58
|
+
export interface HashChain {
|
|
59
|
+
id: string;
|
|
60
|
+
created: string;
|
|
61
|
+
lastModified: string;
|
|
62
|
+
algorithm: 'sha256' | 'sha384' | 'sha512' | 'sha3-256' | 'sha3-512';
|
|
63
|
+
records: IntegrityRecord[];
|
|
64
|
+
merkleTree: MerkleTree;
|
|
65
|
+
chainIntegrity: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface MerkleTree {
|
|
68
|
+
root: string;
|
|
69
|
+
levels: string[][];
|
|
70
|
+
leafCount: number;
|
|
71
|
+
}
|
|
72
|
+
export interface TimestampToken {
|
|
73
|
+
timestamp: string;
|
|
74
|
+
nonce: string;
|
|
75
|
+
hash: string;
|
|
76
|
+
algorithm: string;
|
|
77
|
+
tsa?: string;
|
|
78
|
+
signature?: string;
|
|
79
|
+
certificate?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface LegalExhibit {
|
|
82
|
+
exhibitNumber: string;
|
|
83
|
+
title: string;
|
|
84
|
+
description: string;
|
|
85
|
+
chainId: string;
|
|
86
|
+
recordIds: string[];
|
|
87
|
+
integrityProof: IntegrityProof;
|
|
88
|
+
chainOfCustody: CustodyEntry[];
|
|
89
|
+
generated: string;
|
|
90
|
+
format: 'pdf' | 'json' | 'html';
|
|
91
|
+
}
|
|
92
|
+
export interface IntegrityProof {
|
|
93
|
+
rootHash: string;
|
|
94
|
+
algorithm: string;
|
|
95
|
+
merkleProofs: MerkleProof[];
|
|
96
|
+
timestamps: TimestampToken[];
|
|
97
|
+
signatures: SignatureRecord[];
|
|
98
|
+
}
|
|
99
|
+
export interface MerkleProof {
|
|
100
|
+
recordId: string;
|
|
101
|
+
leafHash: string;
|
|
102
|
+
siblings: Array<{
|
|
103
|
+
position: 'left' | 'right';
|
|
104
|
+
hash: string;
|
|
105
|
+
}>;
|
|
106
|
+
rootHash: string;
|
|
107
|
+
}
|
|
108
|
+
export interface SignatureRecord {
|
|
109
|
+
signer: string;
|
|
110
|
+
timestamp: string;
|
|
111
|
+
algorithm: string;
|
|
112
|
+
signature: string;
|
|
113
|
+
publicKey?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface CustodyEntry {
|
|
116
|
+
timestamp: string;
|
|
117
|
+
action: 'created' | 'accessed' | 'transferred' | 'verified' | 'exported';
|
|
118
|
+
actor: string;
|
|
119
|
+
description: string;
|
|
120
|
+
hash: string;
|
|
121
|
+
}
|
|
122
|
+
export interface TechCompanyTarget {
|
|
123
|
+
company: string;
|
|
124
|
+
products: ProductTarget[];
|
|
125
|
+
corporateInfo: CorporateInfo;
|
|
126
|
+
}
|
|
127
|
+
export interface ProductTarget {
|
|
128
|
+
name: string;
|
|
129
|
+
type: string;
|
|
130
|
+
endpoints?: string[];
|
|
131
|
+
dataTypes: string[];
|
|
132
|
+
}
|
|
133
|
+
export interface CorporateInfo {
|
|
134
|
+
legalName: string;
|
|
135
|
+
headquarters: string;
|
|
136
|
+
registeredAgent?: string;
|
|
137
|
+
secFilings?: string;
|
|
138
|
+
incorporationState?: string;
|
|
139
|
+
}
|
|
140
|
+
export declare const TECH_COMPANY_TARGETS: Record<string, TechCompanyTarget>;
|
|
141
|
+
export declare class IntegrityVerificationEngine {
|
|
142
|
+
private chains;
|
|
143
|
+
private storageDir;
|
|
144
|
+
private algorithm;
|
|
145
|
+
private privateKey?;
|
|
146
|
+
private publicKey?;
|
|
147
|
+
constructor(options: {
|
|
148
|
+
storageDir: string;
|
|
149
|
+
algorithm?: 'sha256' | 'sha384' | 'sha512' | 'sha3-256' | 'sha3-512';
|
|
150
|
+
keyPair?: {
|
|
151
|
+
privateKey: string;
|
|
152
|
+
publicKey: string;
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
createChain(id?: string): Promise<HashChain>;
|
|
156
|
+
addRecord(chainId: string, content: EvidenceContent, metadata: RecordMetadata): Promise<IntegrityRecord>;
|
|
157
|
+
private hash;
|
|
158
|
+
private signData;
|
|
159
|
+
verifySignature(data: string, signature: string, publicKey?: string): boolean;
|
|
160
|
+
private rebuildMerkleTree;
|
|
161
|
+
verifyChainIntegrity(chainId: string): {
|
|
162
|
+
valid: boolean;
|
|
163
|
+
errors: string[];
|
|
164
|
+
verifiedRecords: number;
|
|
165
|
+
};
|
|
166
|
+
generateMerkleProof(chainId: string, recordId: string): MerkleProof | null;
|
|
167
|
+
verifyMerkleProof(proof: MerkleProof): boolean;
|
|
168
|
+
createTimestamp(hash: string): TimestampToken;
|
|
169
|
+
collectEvidence(params: {
|
|
170
|
+
chainId: string;
|
|
171
|
+
target: TargetEntity;
|
|
172
|
+
evidenceType: EvidenceType;
|
|
173
|
+
content: string | Buffer;
|
|
174
|
+
mimeType?: string;
|
|
175
|
+
sourceUrl?: string;
|
|
176
|
+
captureMethod: string;
|
|
177
|
+
legalBasis: string;
|
|
178
|
+
jurisdiction: string;
|
|
179
|
+
caseReference?: string;
|
|
180
|
+
collector: string;
|
|
181
|
+
notes?: string;
|
|
182
|
+
}): Promise<IntegrityRecord>;
|
|
183
|
+
generateExhibit(params: {
|
|
184
|
+
chainId: string;
|
|
185
|
+
recordIds?: string[];
|
|
186
|
+
exhibitNumber: string;
|
|
187
|
+
title: string;
|
|
188
|
+
description: string;
|
|
189
|
+
format?: 'pdf' | 'json' | 'html';
|
|
190
|
+
}): Promise<LegalExhibit>;
|
|
191
|
+
persistChain(chain: HashChain): Promise<void>;
|
|
192
|
+
loadChain(chainId: string): Promise<HashChain | null>;
|
|
193
|
+
exportChainBundle(chainId: string): Promise<{
|
|
194
|
+
chain: HashChain;
|
|
195
|
+
exhibits: LegalExhibit[];
|
|
196
|
+
verification: {
|
|
197
|
+
valid: boolean;
|
|
198
|
+
errors: string[];
|
|
199
|
+
};
|
|
200
|
+
}>;
|
|
201
|
+
static generateKeyPair(): {
|
|
202
|
+
privateKey: string;
|
|
203
|
+
publicKey: string;
|
|
204
|
+
};
|
|
205
|
+
getPublicKey(): string | null;
|
|
206
|
+
}
|
|
207
|
+
export declare function hashFile(filePath: string, algorithm?: string): string;
|
|
208
|
+
export declare function hashString(data: string, algorithm?: string): string;
|
|
209
|
+
export declare function hashBuffer(buffer: Buffer, algorithm?: string): string;
|
|
210
|
+
export declare function verifyFileHash(filePath: string, expectedHash: string, algorithm?: string): boolean;
|
|
211
|
+
export declare function generateNonce(bytes?: number): string;
|
|
212
|
+
export interface FraudIndicator {
|
|
213
|
+
type: string;
|
|
214
|
+
description: string;
|
|
215
|
+
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
216
|
+
evidenceRefs: string[];
|
|
217
|
+
legalCitation?: string;
|
|
218
|
+
}
|
|
219
|
+
export declare function documentFraudIndicator(params: {
|
|
220
|
+
type: string;
|
|
221
|
+
description: string;
|
|
222
|
+
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
223
|
+
evidenceRefs: string[];
|
|
224
|
+
legalCitation?: string;
|
|
225
|
+
}): FraudIndicator;
|
|
226
|
+
export declare const FRAUD_TYPES: {
|
|
227
|
+
DATA_MANIPULATION: string;
|
|
228
|
+
PRIVACY_VIOLATION: string;
|
|
229
|
+
TERMS_VIOLATION: string;
|
|
230
|
+
MISREPRESENTATION: string;
|
|
231
|
+
ANTICOMPETITIVE: string;
|
|
232
|
+
SECURITY_NEGLIGENCE: string;
|
|
233
|
+
BILLING_FRAUD: string;
|
|
234
|
+
CONSENT_VIOLATION: string;
|
|
235
|
+
DISCRIMINATION: string;
|
|
236
|
+
CENSORSHIP: string;
|
|
237
|
+
};
|
|
238
|
+
export declare const LEGAL_CITATIONS: {
|
|
239
|
+
FTC_ACT_SECTION_5: string;
|
|
240
|
+
CCPA: string;
|
|
241
|
+
GDPR: string;
|
|
242
|
+
COMPUTER_FRAUD: string;
|
|
243
|
+
WIRE_FRAUD: string;
|
|
244
|
+
ECPA: string;
|
|
245
|
+
STORED_COMM_ACT: string;
|
|
246
|
+
LANHAM_ACT: string;
|
|
247
|
+
SHERMAN_ACT: string;
|
|
248
|
+
CLAYTON_ACT: string;
|
|
249
|
+
};
|
|
250
|
+
//# sourceMappingURL=integrityVerification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrityVerification.d.ts","sourceRoot":"","sources":["../../src/core/integrityVerification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAaH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;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AC;IACjD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IACjD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,cAAc,CAEjB;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;CAWvB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;CAW3B,CAAC"}
|
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cryptographic Integrity Verification System
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Legal evidence preservation and integrity verification for
|
|
5
|
+
* pro se litigation against technology companies (Apple, Google, Meta, etc.)
|
|
6
|
+
*
|
|
7
|
+
* Capabilities:
|
|
8
|
+
* - Cryptographic hash chains for tamper-evident logging
|
|
9
|
+
* - Digital signatures with timestamping
|
|
10
|
+
* - Evidence collection from tech company products/APIs
|
|
11
|
+
* - Chain of custody documentation
|
|
12
|
+
* - Legal exhibit generation with integrity proofs
|
|
13
|
+
* - RFC 3161 compliant timestamping
|
|
14
|
+
*
|
|
15
|
+
* Use Cases:
|
|
16
|
+
* - Fraud documentation
|
|
17
|
+
* - Terms of service violations
|
|
18
|
+
* - Privacy breaches
|
|
19
|
+
* - Data manipulation evidence
|
|
20
|
+
* - Corporate misconduct records
|
|
21
|
+
*/
|
|
22
|
+
import * as crypto from 'node:crypto';
|
|
23
|
+
import * as fs from 'node:fs/promises';
|
|
24
|
+
import * as fsSync from 'node:fs';
|
|
25
|
+
import * as path from 'node:path';
|
|
26
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
27
|
+
// TECH COMPANY REGISTRY
|
|
28
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
29
|
+
export const TECH_COMPANY_TARGETS = {
|
|
30
|
+
apple: {
|
|
31
|
+
company: 'Apple Inc.',
|
|
32
|
+
products: [
|
|
33
|
+
{ name: 'iOS', type: 'operating_system', dataTypes: ['telemetry', 'location', 'usage', 'health'] },
|
|
34
|
+
{ name: 'macOS', type: 'operating_system', dataTypes: ['telemetry', 'usage', 'diagnostics'] },
|
|
35
|
+
{ name: 'iCloud', type: 'cloud_service', dataTypes: ['documents', 'photos', 'backups', 'keychain'] },
|
|
36
|
+
{ name: 'App Store', type: 'marketplace', dataTypes: ['purchases', 'reviews', 'developer_data'] },
|
|
37
|
+
{ name: 'Apple Pay', type: 'payment', dataTypes: ['transactions', 'merchant_data'] },
|
|
38
|
+
{ name: 'Siri', type: 'ai_assistant', dataTypes: ['voice_recordings', 'queries', 'responses'] },
|
|
39
|
+
{ name: 'Apple Music', type: 'streaming', dataTypes: ['listening_history', 'preferences'] },
|
|
40
|
+
{ name: 'Apple Maps', type: 'mapping', dataTypes: ['location_history', 'searches', 'routes'] },
|
|
41
|
+
{ name: 'Safari', type: 'browser', dataTypes: ['browsing_history', 'bookmarks', 'passwords'] },
|
|
42
|
+
{ name: 'Health', type: 'health_data', dataTypes: ['medical_records', 'fitness', 'vitals'] },
|
|
43
|
+
],
|
|
44
|
+
corporateInfo: {
|
|
45
|
+
legalName: 'Apple Inc.',
|
|
46
|
+
headquarters: 'One Apple Park Way, Cupertino, CA 95014',
|
|
47
|
+
registeredAgent: 'CT Corporation System',
|
|
48
|
+
secFilings: 'CIK 0000320193',
|
|
49
|
+
incorporationState: 'California',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
google: {
|
|
53
|
+
company: 'Google LLC / Alphabet Inc.',
|
|
54
|
+
products: [
|
|
55
|
+
{ name: 'Search', type: 'search_engine', dataTypes: ['queries', 'clicks', 'personalization'] },
|
|
56
|
+
{ name: 'Gmail', type: 'email', dataTypes: ['emails', 'contacts', 'attachments'] },
|
|
57
|
+
{ name: 'Google Drive', type: 'cloud_storage', dataTypes: ['documents', 'sharing', 'activity'] },
|
|
58
|
+
{ name: 'YouTube', type: 'video_platform', dataTypes: ['watch_history', 'comments', 'uploads'] },
|
|
59
|
+
{ name: 'Google Maps', type: 'mapping', dataTypes: ['location_history', 'reviews', 'timeline'] },
|
|
60
|
+
{ name: 'Android', type: 'operating_system', dataTypes: ['telemetry', 'apps', 'location', 'contacts'] },
|
|
61
|
+
{ name: 'Chrome', type: 'browser', dataTypes: ['browsing_history', 'passwords', 'autofill'] },
|
|
62
|
+
{ name: 'Google Ads', type: 'advertising', dataTypes: ['ad_targeting', 'conversions', 'audiences'] },
|
|
63
|
+
{ name: 'Google Assistant', type: 'ai_assistant', dataTypes: ['voice_recordings', 'commands'] },
|
|
64
|
+
{ name: 'Google Photos', type: 'photo_storage', dataTypes: ['photos', 'face_recognition', 'location'] },
|
|
65
|
+
{ name: 'Google Pay', type: 'payment', dataTypes: ['transactions', 'cards', 'rewards'] },
|
|
66
|
+
{ name: 'Fitbit', type: 'wearable', dataTypes: ['health_data', 'activity', 'sleep'] },
|
|
67
|
+
{ name: 'Nest', type: 'smart_home', dataTypes: ['camera_footage', 'audio', 'presence'] },
|
|
68
|
+
],
|
|
69
|
+
corporateInfo: {
|
|
70
|
+
legalName: 'Google LLC (subsidiary of Alphabet Inc.)',
|
|
71
|
+
headquarters: '1600 Amphitheatre Parkway, Mountain View, CA 94043',
|
|
72
|
+
registeredAgent: 'Corporation Service Company',
|
|
73
|
+
secFilings: 'CIK 0001652044 (Alphabet)',
|
|
74
|
+
incorporationState: 'Delaware (Alphabet), California (Google LLC)',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
meta: {
|
|
78
|
+
company: 'Meta Platforms, Inc.',
|
|
79
|
+
products: [
|
|
80
|
+
{ name: 'Facebook', type: 'social_network', dataTypes: ['posts', 'messages', 'friends', 'activity'] },
|
|
81
|
+
{ name: 'Instagram', type: 'social_network', dataTypes: ['posts', 'stories', 'messages', 'followers'] },
|
|
82
|
+
{ name: 'WhatsApp', type: 'messaging', dataTypes: ['messages', 'calls', 'status', 'contacts'] },
|
|
83
|
+
{ name: 'Messenger', type: 'messaging', dataTypes: ['messages', 'calls', 'payments'] },
|
|
84
|
+
{ name: 'Meta Quest', type: 'vr_platform', dataTypes: ['usage', 'movements', 'social_vr'] },
|
|
85
|
+
{ name: 'Meta Ads', type: 'advertising', dataTypes: ['targeting', 'conversions', 'pixel_data'] },
|
|
86
|
+
{ name: 'Threads', type: 'social_network', dataTypes: ['posts', 'followers', 'engagement'] },
|
|
87
|
+
],
|
|
88
|
+
corporateInfo: {
|
|
89
|
+
legalName: 'Meta Platforms, Inc.',
|
|
90
|
+
headquarters: '1 Hacker Way, Menlo Park, CA 94025',
|
|
91
|
+
registeredAgent: 'Corporation Service Company',
|
|
92
|
+
secFilings: 'CIK 0001326801',
|
|
93
|
+
incorporationState: 'Delaware',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
microsoft: {
|
|
97
|
+
company: 'Microsoft Corporation',
|
|
98
|
+
products: [
|
|
99
|
+
{ name: 'Windows', type: 'operating_system', dataTypes: ['telemetry', 'diagnostics', 'activity'] },
|
|
100
|
+
{ name: 'Office 365', type: 'productivity', dataTypes: ['documents', 'emails', 'calendar'] },
|
|
101
|
+
{ name: 'Azure', type: 'cloud_platform', dataTypes: ['resources', 'logs', 'configurations'] },
|
|
102
|
+
{ name: 'LinkedIn', type: 'social_network', dataTypes: ['profile', 'connections', 'activity'] },
|
|
103
|
+
{ name: 'GitHub', type: 'code_hosting', dataTypes: ['repositories', 'activity', 'contributions'] },
|
|
104
|
+
{ name: 'Xbox', type: 'gaming', dataTypes: ['gameplay', 'achievements', 'social'] },
|
|
105
|
+
{ name: 'Bing', type: 'search_engine', dataTypes: ['queries', 'clicks', 'chat_history'] },
|
|
106
|
+
{ name: 'Teams', type: 'collaboration', dataTypes: ['messages', 'calls', 'meetings'] },
|
|
107
|
+
{ name: 'OneDrive', type: 'cloud_storage', dataTypes: ['files', 'sharing', 'activity'] },
|
|
108
|
+
{ name: 'Outlook', type: 'email', dataTypes: ['emails', 'calendar', 'contacts'] },
|
|
109
|
+
{ name: 'Edge', type: 'browser', dataTypes: ['browsing_history', 'passwords', 'collections'] },
|
|
110
|
+
{ name: 'Copilot', type: 'ai_assistant', dataTypes: ['prompts', 'responses', 'context'] },
|
|
111
|
+
],
|
|
112
|
+
corporateInfo: {
|
|
113
|
+
legalName: 'Microsoft Corporation',
|
|
114
|
+
headquarters: 'One Microsoft Way, Redmond, WA 98052',
|
|
115
|
+
registeredAgent: 'Corporation Service Company',
|
|
116
|
+
secFilings: 'CIK 0000789019',
|
|
117
|
+
incorporationState: 'Washington',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
amazon: {
|
|
121
|
+
company: 'Amazon.com, Inc.',
|
|
122
|
+
products: [
|
|
123
|
+
{ name: 'Amazon.com', type: 'ecommerce', dataTypes: ['orders', 'browsing', 'reviews', 'wishlist'] },
|
|
124
|
+
{ name: 'AWS', type: 'cloud_platform', dataTypes: ['resources', 'logs', 'billing'] },
|
|
125
|
+
{ name: 'Prime Video', type: 'streaming', dataTypes: ['watch_history', 'preferences'] },
|
|
126
|
+
{ name: 'Alexa', type: 'ai_assistant', dataTypes: ['voice_recordings', 'commands', 'routines'] },
|
|
127
|
+
{ name: 'Ring', type: 'smart_home', dataTypes: ['video', 'events', 'sharing'] },
|
|
128
|
+
{ name: 'Kindle', type: 'ereader', dataTypes: ['books', 'highlights', 'reading_progress'] },
|
|
129
|
+
{ name: 'Twitch', type: 'streaming', dataTypes: ['watch_history', 'chat', 'subscriptions'] },
|
|
130
|
+
{ name: 'Amazon Music', type: 'streaming', dataTypes: ['listening_history', 'playlists'] },
|
|
131
|
+
{ name: 'Whole Foods', type: 'retail', dataTypes: ['purchases', 'prime_benefits'] },
|
|
132
|
+
],
|
|
133
|
+
corporateInfo: {
|
|
134
|
+
legalName: 'Amazon.com, Inc.',
|
|
135
|
+
headquarters: '410 Terry Avenue North, Seattle, WA 98109',
|
|
136
|
+
registeredAgent: 'Corporation Service Company',
|
|
137
|
+
secFilings: 'CIK 0001018724',
|
|
138
|
+
incorporationState: 'Delaware',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
143
|
+
// INTEGRITY VERIFICATION ENGINE
|
|
144
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
145
|
+
export class IntegrityVerificationEngine {
|
|
146
|
+
chains = new Map();
|
|
147
|
+
storageDir;
|
|
148
|
+
algorithm;
|
|
149
|
+
privateKey;
|
|
150
|
+
publicKey;
|
|
151
|
+
constructor(options) {
|
|
152
|
+
this.storageDir = options.storageDir;
|
|
153
|
+
this.algorithm = options.algorithm || 'sha256';
|
|
154
|
+
if (options.keyPair) {
|
|
155
|
+
this.privateKey = crypto.createPrivateKey(options.keyPair.privateKey);
|
|
156
|
+
this.publicKey = crypto.createPublicKey(options.keyPair.publicKey);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
160
|
+
// Hash Chain Management
|
|
161
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
162
|
+
async createChain(id) {
|
|
163
|
+
const chainId = id || crypto.randomUUID();
|
|
164
|
+
const now = new Date().toISOString();
|
|
165
|
+
const chain = {
|
|
166
|
+
id: chainId,
|
|
167
|
+
created: now,
|
|
168
|
+
lastModified: now,
|
|
169
|
+
algorithm: this.algorithm,
|
|
170
|
+
records: [],
|
|
171
|
+
merkleTree: { root: '', levels: [], leafCount: 0 },
|
|
172
|
+
chainIntegrity: true,
|
|
173
|
+
};
|
|
174
|
+
this.chains.set(chainId, chain);
|
|
175
|
+
await this.persistChain(chain);
|
|
176
|
+
return chain;
|
|
177
|
+
}
|
|
178
|
+
async addRecord(chainId, content, metadata) {
|
|
179
|
+
const chain = this.chains.get(chainId);
|
|
180
|
+
if (!chain) {
|
|
181
|
+
throw new Error(`Chain not found: ${chainId}`);
|
|
182
|
+
}
|
|
183
|
+
const recordId = crypto.randomUUID();
|
|
184
|
+
const timestamp = new Date().toISOString();
|
|
185
|
+
const lastRecord = chain.records[chain.records.length - 1];
|
|
186
|
+
const previousHash = lastRecord
|
|
187
|
+
? lastRecord.contentHash
|
|
188
|
+
: this.hash('GENESIS');
|
|
189
|
+
const contentHash = this.hash(JSON.stringify(content));
|
|
190
|
+
const record = {
|
|
191
|
+
id: recordId,
|
|
192
|
+
timestamp,
|
|
193
|
+
previousHash,
|
|
194
|
+
contentHash,
|
|
195
|
+
merkleRoot: '', // Updated after merkle tree rebuild
|
|
196
|
+
metadata,
|
|
197
|
+
content,
|
|
198
|
+
};
|
|
199
|
+
// Sign the record if we have a private key
|
|
200
|
+
if (this.privateKey) {
|
|
201
|
+
record.signature = this.signData(JSON.stringify({
|
|
202
|
+
id: record.id,
|
|
203
|
+
timestamp: record.timestamp,
|
|
204
|
+
previousHash: record.previousHash,
|
|
205
|
+
contentHash: record.contentHash,
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
chain.records.push(record);
|
|
209
|
+
chain.lastModified = timestamp;
|
|
210
|
+
// Rebuild merkle tree
|
|
211
|
+
this.rebuildMerkleTree(chain);
|
|
212
|
+
// Update merkle root in record
|
|
213
|
+
record.merkleRoot = chain.merkleTree.root;
|
|
214
|
+
await this.persistChain(chain);
|
|
215
|
+
return record;
|
|
216
|
+
}
|
|
217
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
218
|
+
// Cryptographic Operations
|
|
219
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
220
|
+
hash(data) {
|
|
221
|
+
return crypto.createHash(this.algorithm).update(data).digest('hex');
|
|
222
|
+
}
|
|
223
|
+
signData(data) {
|
|
224
|
+
if (!this.privateKey) {
|
|
225
|
+
throw new Error('No private key configured for signing');
|
|
226
|
+
}
|
|
227
|
+
const sign = crypto.createSign('SHA256');
|
|
228
|
+
sign.update(data);
|
|
229
|
+
return sign.sign(this.privateKey, 'hex');
|
|
230
|
+
}
|
|
231
|
+
verifySignature(data, signature, publicKey) {
|
|
232
|
+
const key = publicKey
|
|
233
|
+
? crypto.createPublicKey(publicKey)
|
|
234
|
+
: this.publicKey;
|
|
235
|
+
if (!key) {
|
|
236
|
+
throw new Error('No public key available for verification');
|
|
237
|
+
}
|
|
238
|
+
const verify = crypto.createVerify('SHA256');
|
|
239
|
+
verify.update(data);
|
|
240
|
+
return verify.verify(key, signature, 'hex');
|
|
241
|
+
}
|
|
242
|
+
rebuildMerkleTree(chain) {
|
|
243
|
+
if (chain.records.length === 0) {
|
|
244
|
+
chain.merkleTree = { root: '', levels: [], leafCount: 0 };
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
// Leaf level - hash of each record
|
|
248
|
+
const leaves = chain.records.map(r => this.hash(r.contentHash));
|
|
249
|
+
const levels = [leaves];
|
|
250
|
+
// Build tree bottom-up
|
|
251
|
+
let currentLevel = leaves;
|
|
252
|
+
while (currentLevel.length > 1) {
|
|
253
|
+
const nextLevel = [];
|
|
254
|
+
for (let i = 0; i < currentLevel.length; i += 2) {
|
|
255
|
+
const left = currentLevel[i];
|
|
256
|
+
const right = currentLevel[i + 1];
|
|
257
|
+
if (right !== undefined) {
|
|
258
|
+
nextLevel.push(this.hash(left + right));
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
// Odd number of nodes - promote the last one
|
|
262
|
+
nextLevel.push(left);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
levels.push(nextLevel);
|
|
266
|
+
currentLevel = nextLevel;
|
|
267
|
+
}
|
|
268
|
+
chain.merkleTree = {
|
|
269
|
+
root: currentLevel[0] ?? '',
|
|
270
|
+
levels,
|
|
271
|
+
leafCount: leaves.length,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
275
|
+
// Verification Operations
|
|
276
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
277
|
+
verifyChainIntegrity(chainId) {
|
|
278
|
+
const chain = this.chains.get(chainId);
|
|
279
|
+
if (!chain) {
|
|
280
|
+
return { valid: false, errors: ['Chain not found'], verifiedRecords: 0 };
|
|
281
|
+
}
|
|
282
|
+
const errors = [];
|
|
283
|
+
let verifiedRecords = 0;
|
|
284
|
+
for (let i = 0; i < chain.records.length; i++) {
|
|
285
|
+
const record = chain.records[i];
|
|
286
|
+
// Verify content hash
|
|
287
|
+
const computedHash = this.hash(JSON.stringify(record.content));
|
|
288
|
+
if (computedHash !== record.contentHash) {
|
|
289
|
+
errors.push(`Record ${record.id}: Content hash mismatch`);
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
// Verify chain linkage
|
|
293
|
+
if (i === 0) {
|
|
294
|
+
if (record.previousHash !== this.hash('GENESIS')) {
|
|
295
|
+
errors.push(`Record ${record.id}: Invalid genesis link`);
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
const prevRecord = chain.records[i - 1];
|
|
301
|
+
if (record.previousHash !== prevRecord.contentHash) {
|
|
302
|
+
errors.push(`Record ${record.id}: Chain link broken`);
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// Verify signature if present
|
|
307
|
+
if (record.signature && this.publicKey) {
|
|
308
|
+
const signedData = JSON.stringify({
|
|
309
|
+
id: record.id,
|
|
310
|
+
timestamp: record.timestamp,
|
|
311
|
+
previousHash: record.previousHash,
|
|
312
|
+
contentHash: record.contentHash,
|
|
313
|
+
});
|
|
314
|
+
if (!this.verifySignature(signedData, record.signature)) {
|
|
315
|
+
errors.push(`Record ${record.id}: Invalid signature`);
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
verifiedRecords++;
|
|
320
|
+
}
|
|
321
|
+
// Verify merkle tree
|
|
322
|
+
this.rebuildMerkleTree(chain);
|
|
323
|
+
const lastRecord = chain.records[chain.records.length - 1];
|
|
324
|
+
if (lastRecord && lastRecord.merkleRoot !== chain.merkleTree.root) {
|
|
325
|
+
errors.push('Merkle tree root mismatch');
|
|
326
|
+
}
|
|
327
|
+
chain.chainIntegrity = errors.length === 0;
|
|
328
|
+
return {
|
|
329
|
+
valid: errors.length === 0,
|
|
330
|
+
errors,
|
|
331
|
+
verifiedRecords,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
generateMerkleProof(chainId, recordId) {
|
|
335
|
+
const chain = this.chains.get(chainId);
|
|
336
|
+
if (!chain)
|
|
337
|
+
return null;
|
|
338
|
+
const recordIndex = chain.records.findIndex(r => r.id === recordId);
|
|
339
|
+
if (recordIndex === -1)
|
|
340
|
+
return null;
|
|
341
|
+
const record = chain.records[recordIndex];
|
|
342
|
+
const leafHash = this.hash(record.contentHash);
|
|
343
|
+
const siblings = [];
|
|
344
|
+
let index = recordIndex;
|
|
345
|
+
for (let level = 0; level < chain.merkleTree.levels.length - 1; level++) {
|
|
346
|
+
const levelNodes = chain.merkleTree.levels[level];
|
|
347
|
+
const isLeft = index % 2 === 0;
|
|
348
|
+
const siblingIndex = isLeft ? index + 1 : index - 1;
|
|
349
|
+
const siblingHash = levelNodes[siblingIndex];
|
|
350
|
+
if (siblingHash !== undefined) {
|
|
351
|
+
siblings.push({
|
|
352
|
+
position: isLeft ? 'right' : 'left',
|
|
353
|
+
hash: siblingHash,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
index = Math.floor(index / 2);
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
recordId,
|
|
360
|
+
leafHash,
|
|
361
|
+
siblings,
|
|
362
|
+
rootHash: chain.merkleTree.root,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
verifyMerkleProof(proof) {
|
|
366
|
+
let currentHash = proof.leafHash;
|
|
367
|
+
for (const sibling of proof.siblings) {
|
|
368
|
+
if (sibling.position === 'left') {
|
|
369
|
+
currentHash = this.hash(sibling.hash + currentHash);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
currentHash = this.hash(currentHash + sibling.hash);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return currentHash === proof.rootHash;
|
|
376
|
+
}
|
|
377
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
378
|
+
// Timestamping
|
|
379
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
380
|
+
createTimestamp(hash) {
|
|
381
|
+
const nonce = crypto.randomBytes(16).toString('hex');
|
|
382
|
+
const timestamp = new Date().toISOString();
|
|
383
|
+
const token = {
|
|
384
|
+
timestamp,
|
|
385
|
+
nonce,
|
|
386
|
+
hash,
|
|
387
|
+
algorithm: this.algorithm,
|
|
388
|
+
};
|
|
389
|
+
// Self-sign if we have a key
|
|
390
|
+
if (this.privateKey) {
|
|
391
|
+
token.signature = this.signData(JSON.stringify({
|
|
392
|
+
timestamp: token.timestamp,
|
|
393
|
+
nonce: token.nonce,
|
|
394
|
+
hash: token.hash,
|
|
395
|
+
algorithm: token.algorithm,
|
|
396
|
+
}));
|
|
397
|
+
}
|
|
398
|
+
return token;
|
|
399
|
+
}
|
|
400
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
401
|
+
// Evidence Collection
|
|
402
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
403
|
+
async collectEvidence(params) {
|
|
404
|
+
const isBuffer = Buffer.isBuffer(params.content);
|
|
405
|
+
const data = isBuffer
|
|
406
|
+
? params.content.toString('base64')
|
|
407
|
+
: params.content;
|
|
408
|
+
const encoding = isBuffer ? 'base64' : 'utf8';
|
|
409
|
+
const originalSize = isBuffer
|
|
410
|
+
? params.content.length
|
|
411
|
+
: Buffer.byteLength(params.content);
|
|
412
|
+
const evidenceContent = {
|
|
413
|
+
type: params.evidenceType,
|
|
414
|
+
encoding,
|
|
415
|
+
data,
|
|
416
|
+
originalSize,
|
|
417
|
+
mimeType: params.mimeType,
|
|
418
|
+
sourceUrl: params.sourceUrl,
|
|
419
|
+
captureMethod: params.captureMethod,
|
|
420
|
+
};
|
|
421
|
+
const metadata = {
|
|
422
|
+
collector: params.collector,
|
|
423
|
+
target: params.target,
|
|
424
|
+
evidenceType: params.evidenceType,
|
|
425
|
+
legalBasis: params.legalBasis,
|
|
426
|
+
jurisdiction: params.jurisdiction,
|
|
427
|
+
caseReference: params.caseReference,
|
|
428
|
+
notes: params.notes,
|
|
429
|
+
};
|
|
430
|
+
return this.addRecord(params.chainId, evidenceContent, metadata);
|
|
431
|
+
}
|
|
432
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
433
|
+
// Legal Exhibit Generation
|
|
434
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
435
|
+
async generateExhibit(params) {
|
|
436
|
+
const chain = this.chains.get(params.chainId);
|
|
437
|
+
if (!chain) {
|
|
438
|
+
throw new Error(`Chain not found: ${params.chainId}`);
|
|
439
|
+
}
|
|
440
|
+
const recordIds = params.recordIds || chain.records.map(r => r.id);
|
|
441
|
+
const records = chain.records.filter(r => recordIds.includes(r.id));
|
|
442
|
+
// Generate merkle proofs for each record
|
|
443
|
+
const merkleProofs = [];
|
|
444
|
+
for (const record of records) {
|
|
445
|
+
const proof = this.generateMerkleProof(params.chainId, record.id);
|
|
446
|
+
if (proof) {
|
|
447
|
+
merkleProofs.push(proof);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
// Create timestamps for the exhibit
|
|
451
|
+
const timestamps = [
|
|
452
|
+
this.createTimestamp(chain.merkleTree.root),
|
|
453
|
+
];
|
|
454
|
+
// Collect signatures
|
|
455
|
+
const signatures = records
|
|
456
|
+
.filter(r => r.signature)
|
|
457
|
+
.map(r => ({
|
|
458
|
+
signer: r.metadata.collector,
|
|
459
|
+
timestamp: r.timestamp,
|
|
460
|
+
algorithm: 'SHA256withRSA',
|
|
461
|
+
signature: r.signature,
|
|
462
|
+
}));
|
|
463
|
+
const integrityProof = {
|
|
464
|
+
rootHash: chain.merkleTree.root,
|
|
465
|
+
algorithm: this.algorithm,
|
|
466
|
+
merkleProofs,
|
|
467
|
+
timestamps,
|
|
468
|
+
signatures,
|
|
469
|
+
};
|
|
470
|
+
// Generate chain of custody
|
|
471
|
+
const chainOfCustody = [
|
|
472
|
+
{
|
|
473
|
+
timestamp: chain.created,
|
|
474
|
+
action: 'created',
|
|
475
|
+
actor: 'system',
|
|
476
|
+
description: 'Evidence chain created',
|
|
477
|
+
hash: this.hash('GENESIS'),
|
|
478
|
+
},
|
|
479
|
+
...records.map(r => ({
|
|
480
|
+
timestamp: r.timestamp,
|
|
481
|
+
action: 'created',
|
|
482
|
+
actor: r.metadata.collector,
|
|
483
|
+
description: `Evidence collected: ${r.metadata.evidenceType}`,
|
|
484
|
+
hash: r.contentHash,
|
|
485
|
+
})),
|
|
486
|
+
{
|
|
487
|
+
timestamp: new Date().toISOString(),
|
|
488
|
+
action: 'exported',
|
|
489
|
+
actor: 'system',
|
|
490
|
+
description: `Legal exhibit ${params.exhibitNumber} generated`,
|
|
491
|
+
hash: chain.merkleTree.root,
|
|
492
|
+
},
|
|
493
|
+
];
|
|
494
|
+
const exhibit = {
|
|
495
|
+
exhibitNumber: params.exhibitNumber,
|
|
496
|
+
title: params.title,
|
|
497
|
+
description: params.description,
|
|
498
|
+
chainId: params.chainId,
|
|
499
|
+
recordIds,
|
|
500
|
+
integrityProof,
|
|
501
|
+
chainOfCustody,
|
|
502
|
+
generated: new Date().toISOString(),
|
|
503
|
+
format: params.format || 'json',
|
|
504
|
+
};
|
|
505
|
+
return exhibit;
|
|
506
|
+
}
|
|
507
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
508
|
+
// Export and Persistence
|
|
509
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
510
|
+
async persistChain(chain) {
|
|
511
|
+
const chainDir = path.join(this.storageDir, 'chains', chain.id);
|
|
512
|
+
await fs.mkdir(chainDir, { recursive: true });
|
|
513
|
+
// Write chain metadata
|
|
514
|
+
await fs.writeFile(path.join(chainDir, 'chain.json'), JSON.stringify(chain, null, 2));
|
|
515
|
+
// Write individual records
|
|
516
|
+
const recordsDir = path.join(chainDir, 'records');
|
|
517
|
+
await fs.mkdir(recordsDir, { recursive: true });
|
|
518
|
+
for (const record of chain.records) {
|
|
519
|
+
await fs.writeFile(path.join(recordsDir, `${record.id}.json`), JSON.stringify(record, null, 2));
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
async loadChain(chainId) {
|
|
523
|
+
try {
|
|
524
|
+
const chainPath = path.join(this.storageDir, 'chains', chainId, 'chain.json');
|
|
525
|
+
const data = await fs.readFile(chainPath, 'utf8');
|
|
526
|
+
const chain = JSON.parse(data);
|
|
527
|
+
this.chains.set(chainId, chain);
|
|
528
|
+
return chain;
|
|
529
|
+
}
|
|
530
|
+
catch {
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
async exportChainBundle(chainId) {
|
|
535
|
+
const chain = this.chains.get(chainId);
|
|
536
|
+
if (!chain) {
|
|
537
|
+
throw new Error(`Chain not found: ${chainId}`);
|
|
538
|
+
}
|
|
539
|
+
const verification = this.verifyChainIntegrity(chainId);
|
|
540
|
+
return {
|
|
541
|
+
chain,
|
|
542
|
+
exhibits: [],
|
|
543
|
+
verification,
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
547
|
+
// Key Management
|
|
548
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
549
|
+
static generateKeyPair() {
|
|
550
|
+
const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', {
|
|
551
|
+
modulusLength: 4096,
|
|
552
|
+
publicKeyEncoding: {
|
|
553
|
+
type: 'spki',
|
|
554
|
+
format: 'pem',
|
|
555
|
+
},
|
|
556
|
+
privateKeyEncoding: {
|
|
557
|
+
type: 'pkcs8',
|
|
558
|
+
format: 'pem',
|
|
559
|
+
},
|
|
560
|
+
});
|
|
561
|
+
return { privateKey, publicKey };
|
|
562
|
+
}
|
|
563
|
+
getPublicKey() {
|
|
564
|
+
if (!this.publicKey)
|
|
565
|
+
return null;
|
|
566
|
+
return this.publicKey.export({ type: 'spki', format: 'pem' });
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
570
|
+
// CONVENIENCE FUNCTIONS
|
|
571
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
572
|
+
export function hashFile(filePath, algorithm = 'sha256') {
|
|
573
|
+
const content = fsSync.readFileSync(filePath);
|
|
574
|
+
return crypto.createHash(algorithm).update(content).digest('hex');
|
|
575
|
+
}
|
|
576
|
+
export function hashString(data, algorithm = 'sha256') {
|
|
577
|
+
return crypto.createHash(algorithm).update(data).digest('hex');
|
|
578
|
+
}
|
|
579
|
+
export function hashBuffer(buffer, algorithm = 'sha256') {
|
|
580
|
+
return crypto.createHash(algorithm).update(buffer).digest('hex');
|
|
581
|
+
}
|
|
582
|
+
export function verifyFileHash(filePath, expectedHash, algorithm = 'sha256') {
|
|
583
|
+
const actualHash = hashFile(filePath, algorithm);
|
|
584
|
+
return actualHash === expectedHash;
|
|
585
|
+
}
|
|
586
|
+
export function generateNonce(bytes = 32) {
|
|
587
|
+
return crypto.randomBytes(bytes).toString('hex');
|
|
588
|
+
}
|
|
589
|
+
export function documentFraudIndicator(params) {
|
|
590
|
+
return params;
|
|
591
|
+
}
|
|
592
|
+
export const FRAUD_TYPES = {
|
|
593
|
+
DATA_MANIPULATION: 'Unauthorized modification of user data',
|
|
594
|
+
PRIVACY_VIOLATION: 'Collection/use of data beyond stated purposes',
|
|
595
|
+
TERMS_VIOLATION: 'Breach of terms of service by provider',
|
|
596
|
+
MISREPRESENTATION: 'False or misleading statements to users',
|
|
597
|
+
ANTICOMPETITIVE: 'Anti-competitive practices harming consumers',
|
|
598
|
+
SECURITY_NEGLIGENCE: 'Failure to protect user data',
|
|
599
|
+
BILLING_FRAUD: 'Unauthorized charges or billing manipulation',
|
|
600
|
+
CONSENT_VIOLATION: 'Action taken without proper consent',
|
|
601
|
+
DISCRIMINATION: 'Algorithmic or policy-based discrimination',
|
|
602
|
+
CENSORSHIP: 'Improper content moderation or suppression',
|
|
603
|
+
};
|
|
604
|
+
export const LEGAL_CITATIONS = {
|
|
605
|
+
FTC_ACT_SECTION_5: '15 U.S.C. § 45 - Unfair or Deceptive Acts or Practices',
|
|
606
|
+
CCPA: 'Cal. Civ. Code § 1798.100 et seq. - California Consumer Privacy Act',
|
|
607
|
+
GDPR: 'Regulation (EU) 2016/679 - General Data Protection Regulation',
|
|
608
|
+
COMPUTER_FRAUD: '18 U.S.C. § 1030 - Computer Fraud and Abuse Act',
|
|
609
|
+
WIRE_FRAUD: '18 U.S.C. § 1343 - Wire Fraud',
|
|
610
|
+
ECPA: '18 U.S.C. § 2510 et seq. - Electronic Communications Privacy Act',
|
|
611
|
+
STORED_COMM_ACT: '18 U.S.C. § 2701 et seq. - Stored Communications Act',
|
|
612
|
+
LANHAM_ACT: '15 U.S.C. § 1125 - False Advertising',
|
|
613
|
+
SHERMAN_ACT: '15 U.S.C. § 1-2 - Antitrust',
|
|
614
|
+
CLAYTON_ACT: '15 U.S.C. § 12-27 - Antitrust Enforcement',
|
|
615
|
+
};
|
|
616
|
+
//# sourceMappingURL=integrityVerification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrityVerification.js","sourceRoot":"","sources":["../../src/core/integrityVerification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAyJlC,kFAAkF;AAClF,wBAAwB;AAC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U,aAAa,CAAC,QAAgB,EAAE;IAC9C,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AAcD,MAAM,UAAU,sBAAsB,CAAC,MAMtC;IACC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,iBAAiB,EAAE,wCAAwC;IAC3D,iBAAiB,EAAE,+CAA+C;IAClE,eAAe,EAAE,wCAAwC;IACzD,iBAAiB,EAAE,yCAAyC;IAC5D,eAAe,EAAE,8CAA8C;IAC/D,mBAAmB,EAAE,8BAA8B;IACnD,aAAa,EAAE,8CAA8C;IAC7D,iBAAiB,EAAE,qCAAqC;IACxD,cAAc,EAAE,4CAA4C;IAC5D,UAAU,EAAE,4CAA4C;CACzD,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,iBAAiB,EAAE,wDAAwD;IAC3E,IAAI,EAAE,qEAAqE;IAC3E,IAAI,EAAE,+DAA+D;IACrE,cAAc,EAAE,iDAAiD;IACjE,UAAU,EAAE,+BAA+B;IAC3C,IAAI,EAAE,kEAAkE;IACxE,eAAe,EAAE,sDAAsD;IACvE,UAAU,EAAE,sCAAsC;IAClD,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,2CAA2C;CACzD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "erosolar-cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.240",
|
|
4
4
|
"description": "Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning",
|
|
5
5
|
"main": "dist/bin/erosolar.js",
|
|
6
6
|
"type": "module",
|