solvoid 1.0.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.
Files changed (151) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -0
  3. package/SECURITY.md +174 -0
  4. package/bin/solvoid-scan +2 -0
  5. package/dist/cli/privacy-scan.d.ts +11 -0
  6. package/dist/cli/privacy-scan.d.ts.map +1 -0
  7. package/dist/cli/privacy-scan.js +112 -0
  8. package/dist/cli/privacy-scan.js.map +1 -0
  9. package/dist/cli/solvoid-scan.d.ts +13 -0
  10. package/dist/cli/solvoid-scan.d.ts.map +1 -0
  11. package/dist/cli/solvoid-scan.js +174 -0
  12. package/dist/cli/solvoid-scan.js.map +1 -0
  13. package/dist/cli/test-forensics.d.ts +2 -0
  14. package/dist/cli/test-forensics.d.ts.map +1 -0
  15. package/dist/cli/test-forensics.js +90 -0
  16. package/dist/cli/test-forensics.js.map +1 -0
  17. package/dist/cli/test-scenarios.d.ts +2 -0
  18. package/dist/cli/test-scenarios.d.ts.map +1 -0
  19. package/dist/cli/test-scenarios.js +96 -0
  20. package/dist/cli/test-scenarios.js.map +1 -0
  21. package/dist/examples/enterprise-demo.js +65 -0
  22. package/dist/sdk/client.d.ts +77 -0
  23. package/dist/sdk/client.d.ts.map +1 -0
  24. package/dist/sdk/client.js +180 -0
  25. package/dist/sdk/client.js.map +1 -0
  26. package/dist/sdk/compliance/identity.d.ts +34 -0
  27. package/dist/sdk/compliance/identity.d.ts.map +1 -0
  28. package/dist/sdk/compliance/identity.js +55 -0
  29. package/dist/sdk/compliance/identity.js.map +1 -0
  30. package/dist/sdk/compliance/threat-model.d.ts +14 -0
  31. package/dist/sdk/compliance/threat-model.d.ts.map +1 -0
  32. package/dist/sdk/compliance/threat-model.js +101 -0
  33. package/dist/sdk/compliance/threat-model.js.map +1 -0
  34. package/dist/sdk/forensics/mev.js +50 -0
  35. package/dist/sdk/forensics/order-flow.d.ts +20 -0
  36. package/dist/sdk/forensics/order-flow.d.ts.map +1 -0
  37. package/dist/sdk/forensics/order-flow.js +104 -0
  38. package/dist/sdk/forensics/order-flow.js.map +1 -0
  39. package/dist/sdk/forensics/simulation.d.ts +14 -0
  40. package/dist/sdk/forensics/simulation.d.ts.map +1 -0
  41. package/dist/sdk/forensics/simulation.js +45 -0
  42. package/dist/sdk/forensics/simulation.js.map +1 -0
  43. package/dist/sdk/index.d.ts +10 -0
  44. package/dist/sdk/index.d.ts.map +1 -0
  45. package/dist/sdk/index.js +43 -0
  46. package/dist/sdk/index.js.map +1 -0
  47. package/dist/sdk/network/shadow-rpc.d.ts +18 -0
  48. package/dist/sdk/network/shadow-rpc.d.ts.map +1 -0
  49. package/dist/sdk/network/shadow-rpc.js +32 -0
  50. package/dist/sdk/network/shadow-rpc.js.map +1 -0
  51. package/dist/sdk/obfuscator.d.ts +36 -0
  52. package/dist/sdk/obfuscator.d.ts.map +1 -0
  53. package/dist/sdk/obfuscator.js +77 -0
  54. package/dist/sdk/obfuscator.js.map +1 -0
  55. package/dist/sdk/passport/manager.d.ts +36 -0
  56. package/dist/sdk/passport/manager.d.ts.map +1 -0
  57. package/dist/sdk/passport/manager.js +107 -0
  58. package/dist/sdk/passport/manager.js.map +1 -0
  59. package/dist/sdk/pipeline.d.ts +34 -0
  60. package/dist/sdk/pipeline.d.ts.map +1 -0
  61. package/dist/sdk/pipeline.js +81 -0
  62. package/dist/sdk/pipeline.js.map +1 -0
  63. package/dist/sdk/privacy/confidential-transfer.d.ts +81 -0
  64. package/dist/sdk/privacy/confidential-transfer.d.ts.map +1 -0
  65. package/dist/sdk/privacy/confidential-transfer.js +158 -0
  66. package/dist/sdk/privacy/confidential-transfer.js.map +1 -0
  67. package/dist/sdk/privacy/history.d.ts +11 -0
  68. package/dist/sdk/privacy/history.d.ts.map +1 -0
  69. package/dist/sdk/privacy/history.js +110 -0
  70. package/dist/sdk/privacy/history.js.map +1 -0
  71. package/dist/sdk/privacy/light-protocol.d.ts +42 -0
  72. package/dist/sdk/privacy/light-protocol.d.ts.map +1 -0
  73. package/dist/sdk/privacy/light-protocol.js +83 -0
  74. package/dist/sdk/privacy/light-protocol.js.map +1 -0
  75. package/dist/sdk/privacy/relayer.d.ts +12 -0
  76. package/dist/sdk/privacy/relayer.d.ts.map +1 -0
  77. package/dist/sdk/privacy/relayer.js +55 -0
  78. package/dist/sdk/privacy/relayer.js.map +1 -0
  79. package/dist/sdk/privacy/safe-obfuscator.d.ts +38 -0
  80. package/dist/sdk/privacy/safe-obfuscator.d.ts.map +1 -0
  81. package/dist/sdk/privacy/safe-obfuscator.js +101 -0
  82. package/dist/sdk/privacy/safe-obfuscator.js.map +1 -0
  83. package/dist/sdk/privacy/shield.d.ts +34 -0
  84. package/dist/sdk/privacy/shield.d.ts.map +1 -0
  85. package/dist/sdk/privacy/shield.js +174 -0
  86. package/dist/sdk/privacy/shield.js.map +1 -0
  87. package/dist/sdk/privacy/zk.js +43 -0
  88. package/dist/sdk/privacy-engine.d.ts +11 -0
  89. package/dist/sdk/privacy-engine.d.ts.map +1 -0
  90. package/dist/sdk/privacy-engine.js +165 -0
  91. package/dist/sdk/privacy-engine.js.map +1 -0
  92. package/dist/sdk/registry/idl-fetcher.d.ts +17 -0
  93. package/dist/sdk/registry/idl-fetcher.d.ts.map +1 -0
  94. package/dist/sdk/registry/idl-fetcher.js +98 -0
  95. package/dist/sdk/registry/idl-fetcher.js.map +1 -0
  96. package/dist/sdk/registry/programs.d.ts +18 -0
  97. package/dist/sdk/registry/programs.d.ts.map +1 -0
  98. package/dist/sdk/registry/programs.js +45 -0
  99. package/dist/sdk/registry/programs.js.map +1 -0
  100. package/dist/sdk/rescue/analyzer.d.ts +22 -0
  101. package/dist/sdk/rescue/analyzer.d.ts.map +1 -0
  102. package/dist/sdk/rescue/analyzer.js +46 -0
  103. package/dist/sdk/rescue/analyzer.js.map +1 -0
  104. package/dist/sdk/rescue/builder.d.ts +16 -0
  105. package/dist/sdk/rescue/builder.d.ts.map +1 -0
  106. package/dist/sdk/rescue/builder.js +33 -0
  107. package/dist/sdk/rescue/builder.js.map +1 -0
  108. package/dist/sdk/semantics/analyzer.d.ts +1 -0
  109. package/dist/sdk/semantics/analyzer.d.ts.map +1 -0
  110. package/dist/sdk/semantics/analyzer.js +2 -0
  111. package/dist/sdk/semantics/analyzer.js.map +1 -0
  112. package/dist/sdk/semantics/decoder.d.ts +7 -0
  113. package/dist/sdk/semantics/decoder.d.ts.map +1 -0
  114. package/dist/sdk/semantics/decoder.js +30 -0
  115. package/dist/sdk/semantics/decoder.js.map +1 -0
  116. package/dist/sdk/semantics/graph.d.ts +1 -0
  117. package/dist/sdk/semantics/graph.d.ts.map +1 -0
  118. package/dist/sdk/semantics/graph.js +2 -0
  119. package/dist/sdk/semantics/graph.js.map +1 -0
  120. package/dist/sdk/semantics/idl-registry.d.ts +7 -0
  121. package/dist/sdk/semantics/idl-registry.d.ts.map +1 -0
  122. package/dist/sdk/semantics/idl-registry.js +95 -0
  123. package/dist/sdk/semantics/idl-registry.js.map +1 -0
  124. package/dist/sdk/semantics/types.d.ts +44 -0
  125. package/dist/sdk/semantics/types.d.ts.map +1 -0
  126. package/dist/sdk/semantics/types.js +3 -0
  127. package/dist/sdk/semantics/types.js.map +1 -0
  128. package/dist/sdk/simulator.d.ts +15 -0
  129. package/dist/sdk/simulator.d.ts.map +1 -0
  130. package/dist/sdk/simulator.js +133 -0
  131. package/dist/sdk/simulator.js.map +1 -0
  132. package/dist/sdk/types.d.ts +53 -0
  133. package/dist/sdk/types.d.ts.map +1 -0
  134. package/dist/sdk/types.js +3 -0
  135. package/dist/sdk/types.js.map +1 -0
  136. package/dist/sdk/utils/config.d.ts +15 -0
  137. package/dist/sdk/utils/config.d.ts.map +1 -0
  138. package/dist/sdk/utils/config.js +40 -0
  139. package/dist/sdk/utils/config.js.map +1 -0
  140. package/dist/sdk/utils/logger.d.ts +3 -0
  141. package/dist/sdk/utils/logger.d.ts.map +1 -0
  142. package/dist/sdk/utils/logger.js +17 -0
  143. package/dist/sdk/utils/logger.js.map +1 -0
  144. package/dist/tests/unit/idl-registry.test.d.ts +2 -0
  145. package/dist/tests/unit/idl-registry.test.d.ts.map +1 -0
  146. package/dist/tests/unit/idl-registry.test.js +35 -0
  147. package/dist/tests/unit/idl-registry.test.js.map +1 -0
  148. package/dist/tools/exploit_demonstration.js +99 -0
  149. package/dist/tools/gen-tx.js +29 -0
  150. package/dist/tools/get-recent-tx.js +18 -0
  151. package/package.json +95 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Privacy-Zero Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # SOLVOID | THE DIGITAL FORTRESS FOR SOLANA
2
+
3
+ [VERSION: 1.2.4-STABLE] | [LICENSE: MIT] | [SECURITY: ENFORCED]
4
+
5
+ SolVoid is a high-performance Privacy Lifecycle Management (PLM) framework engineered for the Solana blockchain. It provides an enterprise-grade suite of forensic auditing tools and cryptographically enforced shielding protocols designed to neutralize identity leaks and maintain on-chain anonymity.
6
+
7
+ ---
8
+
9
+ ## [I] ARCHITECTURAL PILLARS
10
+
11
+ ### 1. IDENTITY FORENSICS (SOLVOID SCANNER)
12
+ The scanner utilizes a multi-layered detection engine to analyze account history. It evaluates transactions against known leakage patterns, including:
13
+ * **Direct Linkage**: Connections to KYC-verified exchange addresses.
14
+ * **Binary Metadata Leaks**: Public key exposure within instruction data payloads.
15
+ * **Account Relationships**: State-level footprints in third-party program accounts.
16
+ * **MEV Sensitivity**: Vulnerability to predatory sandwich attacks based on historical slippage tolerance.
17
+
18
+ ### 2. DISCRETE SHIELDING (SHADOW VAULT)
19
+ The core privacy layer is a non-custodial vault powered by Groth16 ZK-SNARKs.
20
+ * **State Tree**: A 20-level incremental Merkle tree supporting an anonymity set of 1,048,575 individual deposits.
21
+ * **Commitment Protocol**: Cryptographic binding of secret and nullifier values, ensuring assets are unlinkable once deposited.
22
+ * **Relayer Isolation**: Support for ephemeral relayers to decouple transaction fee payment from identity.
23
+
24
+ ### 3. SURGICAL RESCUE WORKFLOW
25
+ An automated pipeline that bridges auditing and defense. The Rescue workflow identifies tainted assets and executes an atomic migration into the Shadow Vault, effectively "cleansing" the history of the fund's current owner.
26
+
27
+ ---
28
+
29
+ ## [II] SYSTEM ARCHITECTURE
30
+
31
+ The following diagram illustrates the flow from initial identity compromise to cryptographic recovery.
32
+
33
+ ```mermaid
34
+ sequenceDiagram
35
+ participant U as User Identity
36
+ participant S as SolVoid Scanner
37
+ participant V as Shadow Vault (Program)
38
+ participant R as Relayer Network
39
+ participant D as Fresh Recipient
40
+
41
+ note over U, S: PHASE 1: FORENSIC AUDIT
42
+ U->>S: Request Privacy Passport
43
+ S-->>U: Identity Leak Detected (High Severity)
44
+
45
+ note over U, V: PHASE 2: SURGICAL SHIELDING
46
+ U->>V: Deposit (Commitment Hash)
47
+ V-->>V: Update Merkle State Tree
48
+
49
+ note over U, R: PHASE 3: ZK PROOF GENERATION
50
+ U->>U: Generate Local ZK-Proof (Groth16)
51
+ U->>R: Submit Proof + Nullifier Hash (SSH)
52
+
53
+ note over R, D: PHASE 4: ANONYMOUS RECOVERY
54
+ R->>V: Execute Withdrawal (Verify Proof)
55
+ V->>D: Distribute Assets (No Link to User)
56
+ ```
57
+
58
+ ---
59
+
60
+ ## [III] ENTERPRISE CLI REFERENCE
61
+
62
+ The `solvoid-scan` utility is the primary management interface.
63
+
64
+ ### CORE COMMANDS
65
+ | Command | Usage | Description |
66
+ | :--- | :--- | :--- |
67
+ | **PROTECT** | `protect <ADDRESS>` | Executes forensic analysis and generates a Privacy Passport. |
68
+ | **RESCUE** | `rescue <ADDRESS>` | Automated detection and shielding of all leaked assets. |
69
+ | **SHIELD** | `shield <AMOUNT>` | Manual cryptographic commitment of SOL into the Vault. |
70
+ | **WITHDRAW** | `withdraw <...>` | Executes a ZK-SNARK membership proof and withdrawal. |
71
+
72
+ ### SECURITY FLAGS
73
+ * `--shadow-rpc`: Routes all queries through encrypted relay hops to prevent IP logging.
74
+ * `--surgical`: Limits shielding operations strictly to assets with identified leakage history.
75
+ * `--relayer-auth`: Provides credentials for private enterprise relayer networks.
76
+
77
+ ---
78
+
79
+ ## [IV] INTEGRATION & SDK
80
+
81
+ SolVoid is designed for protocol developers to bake privacy into their own applications.
82
+
83
+ ```typescript
84
+ import { SolVoidClient } from 'solvoid';
85
+
86
+ // Enterprise Client Configuration
87
+ const client = new SolVoidClient({
88
+ rpcUrl: process.env.SOLANA_RPC_URL,
89
+ programId: process.env.SOLVOID_PROGRAM_ID,
90
+ relayerUrl: "https://relayer.internal.net",
91
+ stealthMode: true
92
+ }, walletSigner);
93
+
94
+ // Execute a privacy-preserving rescue operation
95
+ const rescueResult = await client.rescue(targetAccount);
96
+ if (rescueResult.status === 'SUCCESS') {
97
+ console.log(`[STATE] Assets Shielded. New Privacy Score: ${rescueResult.newScore}/100`);
98
+ }
99
+ ```
100
+
101
+ ---
102
+
103
+ ## [V] TECHNICAL DOCUMENTATION
104
+
105
+ For deep-dive technical specifications, refer to the following sub-directories:
106
+
107
+ * **[Technical Architecture](./documentation/architecture/OVERVIEW.md)**: Deep dive into the Merkle Tree and ZK Circuits.
108
+ * **[SDK Reference](./documentation/reference/SDK.md)**: Exhaustive documentation of classes and methods.
109
+ * **[Relayer API](./documentation/reference/API.md)**: Specifications for building/running a relayer node.
110
+ * **[Development Guide](./documentation/reference/DEVELOPMENT.md)**: Instructions for compiling circuits and testing.
111
+
112
+ ---
113
+
114
+ ## [VI] COMPLIANCE & SECURITY
115
+
116
+ * **Non-Custodial**: SolVoid never has access to user keys or unshielded secrets.
117
+ * **Verifiable**: All ZK circuits are open-source and deterministic.
118
+ * **Zero-Logging**: The CLI and official Relayers utilize ephemeral states with no persistent logging of user patterns.
119
+
120
+ **[!] DISCLAIMER**: SolVoid is an advanced security tool. On-chain privacy is a competitive game; ensure you understand the underlying mathematics before deploying to high-value production environments.
121
+
122
+ ---
123
+ [SYSTEM_STATUS: OPERATIONAL] | [ENCRYPTION_ENGINE: GROTH16]
package/SECURITY.md ADDED
@@ -0,0 +1,174 @@
1
+ # Security Documentation
2
+
3
+ ## Overview
4
+
5
+ SolVoid is a **leak detection scanner**, not a privacy solution. This document explains:
6
+ 1. What privacy guarantees the tool provides (none - it's a scanner)
7
+ 2. What privacy guarantees the integrated protocols provide
8
+ 3. Known limitations and attack vectors
9
+ 4. Proper usage for actual privacy
10
+
11
+ ## SolVoid Does NOT Provide Privacy
12
+
13
+ **This is critical to understand.**
14
+
15
+ SolVoid scans transactions to identify privacy leaks. It does not:
16
+ - Encrypt any data
17
+ - Hide any information on-chain
18
+ - Provide anonymity
19
+ - Protect against chain analysis
20
+
21
+ All Solana transactions are public and permanent. This tool helps you understand what you're exposing.
22
+
23
+ ## Integrated Protocol Privacy Guarantees
24
+
25
+ ### Token-2022 Confidential Transfers
26
+
27
+ **What it hides:**
28
+ - ✅ Token balances (after deposit to encrypted state)
29
+ - ✅ Transfer amounts between confidential accounts
30
+
31
+ **What it exposes:**
32
+ - ❌ Sender address (fully visible)
33
+ - ❌ Receiver address (fully visible)
34
+ - ❌ Transaction timing (block timestamp)
35
+ - ❌ Deposit/withdrawal amounts (at boundaries)
36
+ - ❌ Token mint being used
37
+ - ❌ Fee payer
38
+
39
+ **Threat Model:**
40
+ Token-2022 CT protects against casual observers seeing your balance and transfer amounts. It does NOT protect against:
41
+ - Identity correlation (addresses are visible)
42
+ - Timing analysis
43
+ - Amount inference from deposit/withdraw patterns
44
+
45
+ ### Light Protocol (ZK State Compression)
46
+
47
+ **What it hides:**
48
+ - ✅ Sender identity (within anonymity set)
49
+ - ✅ Receiver identity (within anonymity set)
50
+ - ✅ Transfer amounts
51
+
52
+ **What it exposes:**
53
+ - ❌ That a transaction occurred
54
+ - ❌ Approximate timing
55
+ - ❌ Programs being interacted with
56
+ - ❌ Network-level metadata (IP, RPC queries)
57
+
58
+ **Threat Model:**
59
+ Light Protocol provides cryptographic privacy through ZK proofs. Privacy strength depends on:
60
+ - Size of anonymity set
61
+ - Time between shield/unshield
62
+ - Behavioral patterns
63
+
64
+ ### Jito (MEV Protection)
65
+
66
+ **What it protects against:**
67
+ - ✅ Front-running
68
+ - ✅ Sandwich attacks
69
+ - ✅ Public mempool visibility
70
+
71
+ **What it does NOT protect:**
72
+ - ❌ On-chain transaction data (still visible after inclusion)
73
+ - ❌ Block explorer analysis
74
+ - ❌ Historical transaction tracing
75
+
76
+ ## Removed Features
77
+
78
+ ### Obfuscator / SafeObfuscator
79
+
80
+ These features were **removed** because they provided **no privacy** while creating a **false sense of security**.
81
+
82
+ **Why they were broken:**
83
+
84
+ 1. **Funding Trace Attack**
85
+ - User creates "SessionKey" (ephemeral keypair)
86
+ - User sends SOL to SessionKey to pay for fees
87
+ - This transfer is on-chain: `MainWallet → SessionKey`
88
+ - Any analyst can trace this in seconds
89
+ - Result: Zero privacy
90
+
91
+ 2. **No Cryptographic Privacy**
92
+ - Just key substitution, not encryption
93
+ - All transaction data fully visible
94
+ - No ZK proofs, no mixers, no privacy
95
+
96
+ 3. **Worse Than Nothing**
97
+ - Unusual patterns (unfunded ephemeral signers) draw attention
98
+ - Creates false confidence in users
99
+ - Users take more risks thinking they're protected
100
+
101
+ **What to use instead:**
102
+
103
+ | Use Case | Solution |
104
+ |----------|----------|
105
+ | Hide transaction from mempool | Jito private RPC |
106
+ | Hide transfer amounts | Token-2022 Confidential Transfers |
107
+ | Hide sender/receiver | Light Protocol |
108
+ | All of the above | Light Protocol + Jito |
109
+
110
+ ## Attack Vectors
111
+
112
+ ### Script Kiddie (Solscan User)
113
+ - **Tools**: Block explorer, basic clustering
114
+ - **Time to deanonymize**: 2-5 minutes
115
+ - **What breaks privacy**: Direct wallet address in transaction
116
+
117
+ ### Professional Chain Analyst (Chainalysis)
118
+ - **Tools**: Graph database, ML clustering, timing analysis
119
+ - **Time to deanonymize**: 30 seconds (automated)
120
+ - **What breaks privacy**:
121
+ - Funding traces
122
+ - Account reuse
123
+ - Timing patterns
124
+ - Amount patterns
125
+
126
+ ### MEV Bot Operator
127
+ - **Tools**: Mempool monitoring, transaction simulation
128
+ - **Time to exploit**: Real-time
129
+ - **What breaks privacy**: Public mempool submission
130
+
131
+ ### Hostile RPC Provider
132
+ - **Tools**: Request logging, IP correlation
133
+ - **Time to deanonymize**: Real-time
134
+ - **What breaks privacy**: Using their endpoint without VPN/Tor
135
+
136
+ ## Best Practices
137
+
138
+ ### For Casual Privacy
139
+ 1. Use a fresh wallet for each major activity
140
+ 2. Don't reuse addresses across contexts
141
+ 3. Wait random intervals between transactions
142
+ 4. Use Jito for any DEX activity
143
+
144
+ ### For Serious Privacy
145
+ 1. Use Light Protocol for all value transfers
146
+ 2. Fund new wallets through privacy-preserving channels
147
+ 3. Use your own RPC node or trusted private RPC
148
+ 4. Connect through Tor or VPN
149
+ 5. Don't create timing patterns
150
+
151
+ ### For Regulatory Compliance
152
+ 1. Document all privacy-impacting decisions
153
+ 2. Use privacy-manifest.json waivers
154
+ 3. Regular privacy audits with this scanner
155
+ 4. Staff training on privacy implications
156
+
157
+ ## Reporting Security Issues
158
+
159
+ If you find a security vulnerability:
160
+
161
+ 1. **DO NOT** open a public issue
162
+ 2. Email: security@privacyzero.dev
163
+ 3. Include: Description, reproduction steps, impact assessment
164
+ 4. We will respond within 48 hours
165
+
166
+ ## Audit Status
167
+
168
+ This codebase has NOT been audited by a third-party security firm.
169
+
170
+ It is provided as-is for educational and development purposes. Do not rely on it for production security without additional review.
171
+
172
+ ---
173
+
174
+ **Remember**: Privacy is not a product feature you can bolt on. It requires careful architecture from the start.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/cli/solvoid-scan.js');
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * SolVoid CLI
4
+ *
5
+ * Production privacy protocol toolkit for Solana.
6
+ */
7
+ export declare function validateInput(input: string): {
8
+ type: 'file' | 'signature';
9
+ path?: string;
10
+ };
11
+ //# sourceMappingURL=solvoid-scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-scan.d.ts","sourceRoot":"","sources":["../../cli/privacy-scan.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AA+FH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAkB1F"}
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Privacy-Zero CLI
5
+ *
6
+ * Production privacy protocol toolkit for Solana.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.validateInput = validateInput;
10
+ const web3_js_1 = require("@solana/web3.js");
11
+ const client_1 = require("../sdk/client");
12
+ async function main() {
13
+ const args = process.argv.slice(2);
14
+ const command = args[0];
15
+ if (!command || args.includes('--help')) {
16
+ console.log(`
17
+ Privacy-Zero CLI: Cryptographically Enforced Privacy
18
+
19
+ Commands:
20
+ protect <address> Scan address for leaks and prepare shielding
21
+ shield <amount> Execute a private deposit (shielding)
22
+ withdraw <secret> <nullifier> <recipient> Execute an unlinkable withdrawal
23
+
24
+ Flags:
25
+ --rpc <url> Solana RPC URL
26
+ --program <id> Privacy Program ID
27
+ --relayer <url> Relayer URL
28
+ `);
29
+ process.exit(0);
30
+ }
31
+ const rpcUrl = args.includes('--rpc') ? args[args.indexOf('--rpc') + 1] : 'https://api.mainnet-beta.solana.com';
32
+ const programId = args.includes('--program') ? args[args.indexOf('--program') + 1] : 'PriZero1111111111111111111111111111111111111';
33
+ const relayerUrl = args.includes('--relayer') ? args[args.indexOf('--relayer') + 1] : 'http://localhost:3000';
34
+ // In production, the wallet would be loaded from a secret key file or environment
35
+ const wallet = web3_js_1.Keypair.generate();
36
+ const client = new client_1.PrivacyZeroClient({ rpcUrl, programId, relayerUrl }, wallet);
37
+ try {
38
+ switch (command) {
39
+ case 'protect': {
40
+ const address = new web3_js_1.PublicKey(args[1]);
41
+ console.log(`\n🔍 Scanning address: ${address.toBase58()}...`);
42
+ const results = await client.protect(address);
43
+ results.forEach((res) => {
44
+ console.log(`\n---------------------------------------------------------`);
45
+ console.log(`Signature: ${res.signature}`);
46
+ const color = res.privacyScore < 50 ? '\x1b[31m' : res.privacyScore < 80 ? '\x1b[33m' : '\x1b[32m';
47
+ console.log(`Privacy Score: ${color}${res.privacyScore}/100\x1b[0m`);
48
+ if (res.leaks.length > 0) {
49
+ console.log(`Leaks Found: ${res.leaks.length}`);
50
+ res.leaks.forEach((leak) => {
51
+ const severityColor = leak.severity === 'CRITICAL' ? '\x1b[31m' : leak.severity === 'HIGH' ? '\x1b[31m' : '\x1b[33m';
52
+ console.log(` - [${severityColor}${leak.severity}\x1b[0m] ${leak.description}`);
53
+ });
54
+ }
55
+ else {
56
+ console.log(`✅ No leaks detected.`);
57
+ }
58
+ if (res.remediation) {
59
+ console.log(`Remediation Recommended: ${res.remediation.description}`);
60
+ }
61
+ });
62
+ break;
63
+ }
64
+ case 'shield': {
65
+ const amount = parseFloat(args[1]) * 1e9; // SOL to lamports
66
+ console.log(`Shielding ${args[1]} SOL...`);
67
+ const { txid, commitmentData } = await client.shield(amount);
68
+ console.log('Transaction:', txid);
69
+ console.log('--- SECRET DATA (SAVE THIS) ---');
70
+ console.log('Secret:', commitmentData.secret.toString('hex'));
71
+ console.log('Nullifier:', commitmentData.nullifier.toString('hex'));
72
+ break;
73
+ }
74
+ case 'withdraw': {
75
+ const secret = args[1];
76
+ const nullifier = args[2];
77
+ const recipient = new web3_js_1.PublicKey(args[3]);
78
+ console.log(`Withdrawing to ${recipient.toBase58()} via relayer...`);
79
+ const result = await client.withdraw(secret, nullifier, recipient, relayerUrl);
80
+ console.log('Result:', result);
81
+ break;
82
+ }
83
+ default:
84
+ console.error(`Unknown command: ${command}`);
85
+ process.exit(1);
86
+ }
87
+ }
88
+ catch (e) {
89
+ console.error('Error:', e.message);
90
+ process.exit(1);
91
+ }
92
+ }
93
+ function validateInput(input) {
94
+ if (!input || input.trim().length === 0) {
95
+ throw new Error('Input cannot be empty');
96
+ }
97
+ if (input.endsWith('.json')) {
98
+ if (require('fs').existsSync(input)) {
99
+ return { type: 'file', path: input };
100
+ }
101
+ throw new Error('File not found');
102
+ }
103
+ // Basic base58 check for signature
104
+ if (/^[1-9A-HJ-NP-Za-km-z]{32,88}$/.test(input)) {
105
+ return { type: 'signature' };
106
+ }
107
+ throw new Error('Invalid input format');
108
+ }
109
+ if (require.main === module) {
110
+ main();
111
+ }
112
+ //# sourceMappingURL=privacy-scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-scan.js","sourceRoot":"","sources":["../../cli/privacy-scan.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;;AA+FH,sCAkBC;AA/GD,6CAAqD;AACrD,0CAAkD;AAElD,KAAK,UAAU,IAAI;IACf,MAAM,IAA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+ /**
3
+ * SolVoid CLI
4
+ * Utility for shielding assets and auditing privacy leaks on Solana.
5
+ */
6
+ /**
7
+ * Basic input validation for signatures vs file paths.
8
+ */
9
+ export declare function validateInput(input: string): {
10
+ type: 'file' | 'signature';
11
+ path?: string;
12
+ };
13
+ //# sourceMappingURL=solvoid-scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solvoid-scan.d.ts","sourceRoot":"","sources":["../../cli/solvoid-scan.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAsIH;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAkB1F"}
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * SolVoid CLI
5
+ * Utility for shielding assets and auditing privacy leaks on Solana.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.validateInput = validateInput;
42
+ const web3_js_1 = require("@solana/web3.js");
43
+ const client_1 = require("../sdk/client");
44
+ const dotenv = __importStar(require("dotenv"));
45
+ dotenv.config();
46
+ async function main() {
47
+ const args = process.argv.slice(2);
48
+ const command = args[0];
49
+ if (!command || args.includes('--help')) {
50
+ console.log(`
51
+ SolVoid: The Digital Fortress for Solana
52
+
53
+ Commands:
54
+ protect <address> Scan address for leaks and view Privacy Passport
55
+ rescue <address> Atomic shielding of all leaked assets
56
+ shield <amount> Execute a private deposit (Surgical Shielding)
57
+ withdraw <secret> <nullifier> <recipient> Unlinkable ZK withdrawal
58
+
59
+ Flags:
60
+ --rpc <url> Solana RPC URL
61
+ --relayer <url> Relayer/Shadow RPC URL (or SHADOW_RELAYER_URL env)
62
+ --program <id> Override SolVoid Program ID
63
+ --surgical Optimize shielding for leaked assets only
64
+ --shadow-rpc Broadcast via encrypted relay hops
65
+ --mock Enable simulated/mock mode for testing
66
+ `);
67
+ process.exit(0);
68
+ }
69
+ const rpcUrl = args.includes('--rpc') ? args[args.indexOf('--rpc') + 1] : (process.env.RPC_URL || 'https://api.mainnet-beta.solana.com');
70
+ const programId = args.includes('--program') ? args[args.indexOf('--program') + 1] : (process.env.PROGRAM_ID || 'Fg6PaFpoGXkYsidMpSsu3SWJYEHp7rQU9YSTFNDQ4F5i');
71
+ const relayerUrl = args.includes('--relayer') ? args[args.indexOf('--relayer') + 1] : (process.env.SHADOW_RELAYER_URL || 'http://localhost:3000');
72
+ const mock = args.includes('--mock');
73
+ const wallet = web3_js_1.Keypair.generate();
74
+ const client = new client_1.SolVoidClient({ rpcUrl, programId, relayerUrl, mock }, wallet);
75
+ try {
76
+ switch (command) {
77
+ case 'protect': {
78
+ const address = new web3_js_1.PublicKey(args[1]);
79
+ console.log(`\nScanning ${address.toBase58()}...`);
80
+ const passport = await client.getPassport(address.toBase58());
81
+ const results = await client.protect(address);
82
+ console.log(`\n--- PRIVACY PASSPORT ---`);
83
+ const scoreColor = passport.overallScore < 50 ? '\x1b[31m' : passport.overallScore < 80 ? '\x1b[33m' : '\x1b[32m';
84
+ console.log(`Overall Score: ${scoreColor}${passport.overallScore}/100\x1b[0m`);
85
+ console.log(`Badges: ${passport.badges.map(b => b.icon + ' ' + b.name).join(', ') || 'None'}`);
86
+ results.forEach((res) => {
87
+ console.log(`\n---------------------------------------------------------`);
88
+ console.log(`Signature: ${res.signature}`);
89
+ if (res.leaks.length > 0) {
90
+ res.leaks.forEach((leak) => {
91
+ const sevColor = leak.severity === 'CRITICAL' ? '\x1b[31m' : '\x1b[33m';
92
+ console.log(` - [${sevColor}${leak.severity}\x1b[0m] ${leak.description}`);
93
+ });
94
+ }
95
+ });
96
+ break;
97
+ }
98
+ case 'rescue': {
99
+ const address = new web3_js_1.PublicKey(args[1]);
100
+ console.log(`\nExecuting rescue for: ${address.toBase58()}`);
101
+ const result = await client.rescue(address);
102
+ if (result.status === 'success') {
103
+ console.log(`\nRescue successful.`);
104
+ console.log(`Leaked assets shielded and mixed via relay.`);
105
+ console.log(`TX Signature: ${result.txid}`);
106
+ console.log(`Score improved: ${result.oldScore} -> ${result.newScore}`);
107
+ }
108
+ else {
109
+ console.log(`\n${result.message}`);
110
+ }
111
+ break;
112
+ }
113
+ case 'shield': {
114
+ const amount = parseFloat(args[1]) * 1e9;
115
+ console.log(`Shielding ${args[1]} SOL...`);
116
+ const { txid, commitmentData } = await client.shield(amount);
117
+ console.log('TX Signature:', txid);
118
+ console.log('--- SAVE THESE SECRETS ---');
119
+ console.log('Secret:', commitmentData.secret.toString('hex'));
120
+ console.log('Nullifier:', commitmentData.nullifier.toString('hex'));
121
+ break;
122
+ }
123
+ case 'withdraw': {
124
+ const secret = args[1];
125
+ const nullifier = args[2];
126
+ const recipient = new web3_js_1.PublicKey(args[3]);
127
+ let commitmentBuffers = [];
128
+ if (!mock) {
129
+ console.log(`Fetching commitments from: ${relayerUrl}...`);
130
+ const response = await fetch(`${relayerUrl}/commitments`);
131
+ const { commitments } = (await response.json());
132
+ commitmentBuffers = commitments.map((c) => Buffer.from(c, 'hex'));
133
+ }
134
+ else {
135
+ console.log(`[MOCK] Skipping commitment fetch...`);
136
+ }
137
+ console.log(`Generating ZK proof and submitting withdrawal...`);
138
+ const result = await client.withdraw(secret, nullifier, recipient, commitmentBuffers, './withdraw.wasm', './withdraw.zkey', wallet);
139
+ console.log('Result:', result);
140
+ break;
141
+ }
142
+ default:
143
+ console.error(`Unknown command: ${command}`);
144
+ process.exit(1);
145
+ }
146
+ }
147
+ catch (e) {
148
+ console.error('Error:', e.message);
149
+ process.exit(1);
150
+ }
151
+ }
152
+ /**
153
+ * Basic input validation for signatures vs file paths.
154
+ */
155
+ function validateInput(input) {
156
+ if (!input || input.trim().length === 0) {
157
+ throw new Error('Input cannot be empty');
158
+ }
159
+ if (input.endsWith('.json')) {
160
+ if (require('fs').existsSync(input)) {
161
+ return { type: 'file', path: input };
162
+ }
163
+ throw new Error('File not found');
164
+ }
165
+ // Base58 check for Solana signatures
166
+ if (/^[1-9A-HJ-NP-Za-km-z]{32,88}$/.test(input)) {
167
+ return { type: 'signature' };
168
+ }
169
+ throw new Error('Invalid format');
170
+ }
171
+ if (require.main === module) {
172
+ main();
173
+ }
174
+ //# sourceMappingURL=solvoid-scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solvoid-scan.js","sourceRoot":"","sources":["../../cli/solvoid-scan.ts"],"names":[],"mappings":";;AAEA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyIH,sCAkBC;AAzJD,6CAAqD;AACrD,0CAA8C;AAC9C,+CAAiC;AAE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