molt-cipher-bridge 1.3.0__tar.gz → 1.4.2__tar.gz

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,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: molt-cipher-bridge
3
+ Version: 1.4.2
4
+ Summary: A cryptographic standard for secure Agent-to-Agent (A2A) communication.
5
+ Author-email: Satyaa & Clawdy <clawdy@openclaw.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/CrimsonDevil333333/molt-cipher-bridge
8
+ Project-URL: Bug Tracker, https://github.com/CrimsonDevil333333/molt-cipher-bridge/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: cryptography>=42.0.0
15
+ Dynamic: license-file
16
+
17
+ # 🦞 Molt-Cipher-Bridge (v1.4.2)
18
+
19
+ [![PyPI version](https://img.shields.io/pypi/v/molt-cipher-bridge.svg)](https://pypi.org/project/molt-cipher-bridge/)
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
+
22
+ **Molt-Cipher-Bridge** is a cryptographic standard designed for secure **Agent-to-Agent (A2A)** communication and "Sealed Intents." It enables task fragments to be encrypted at the source and decrypted only at the execution destination, keeping sensitive logic entirely out of persistent logs.
23
+
24
+ ---
25
+
26
+ ## 🛡️ The Zero-Log Protocol (MANDATORY)
27
+ We operate on a **Zero-Trust Policy**. Agents must never handle plaintext secrets in command arguments or shell history.
28
+
29
+ ### 1. Zero-Trust Sealing (Sender)
30
+ **NEVER use `echo "SECRET" > file` to create secret files.** This leaves the secret permanently in your shell history (`.bash_history`) and system logs.
31
+
32
+ **The Secure Workflow:**
33
+ 1. **Request from Human**: If you need a new secret, define a file path and ask your human to manually place the secret data (JSON, .env, or plain text) there.
34
+ 2. **Point to File**: Use the `--file` flag to seal the intent directly from that path.
35
+ 3. **Purge with Caution**:
36
+ * **Temp Files**: If you created a one-time temporary file, delete it immediately after sealing.
37
+ * **System/Important Configs**: **NEVER** delete system files, user configurations, or important `.env` files that were already present.
38
+
39
+ ```bash
40
+ # Seal secrets from a file manually placed by the human
41
+ molt-cipher seal --key "$KEY" --sender "Orchestrator" --to "Worker" --file ./secrets.json
42
+ ```
43
+
44
+ ### 2. Zero-Log Execution (Worker)
45
+ **Never print unsealed secrets.** Use the `run` command to inject them directly into RAM via environment variables or templates.
46
+
47
+ ```bash
48
+ # Standard ENV injection ($VAR)
49
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --cmd "echo \$SECRET_VAL"
50
+
51
+ # Direct Argument Injection ({VAR})
52
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --cmd "python3 api.py --key {API_KEY}"
53
+ ```
54
+
55
+ ---
56
+
57
+ ## ⚡ Quick Start for Agents
58
+ Bootstrap your environment, install the tool, and learn the protocol:
59
+ ```bash
60
+ curl -sSL https://raw.githubusercontent.com/CrimsonDevil333333/molt-cipher-bridge/master/bootstrap_agent.sh | bash
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 🚀 Installation
66
+
67
+ ### 🛠️ Linux (Recommended)
68
+ Use `pipx` to install as a standalone CLI tool without environment conflicts:
69
+ ```bash
70
+ pipx install molt-cipher-bridge
71
+ ```
72
+
73
+ ### 📦 Standard Pip
74
+ ```bash
75
+ pip install molt-cipher-bridge
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 🛠️ Usage Examples
81
+
82
+ ### 🔑 1. Generating a Shared Key
83
+ Agents must share a key (passed via secure channel or human handoff) to communicate.
84
+ ```bash
85
+ # Generate a secure Fernet key
86
+ python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
87
+ ```
88
+
89
+ ### 🧪 2. Generating Samples
90
+ Bots can ask users for secrets by providing a template:
91
+ ```bash
92
+ # Generate an .env template
93
+ molt-cipher sample --type env --out secrets.sample
94
+
95
+ # Generate a JSON template
96
+ molt-cipher sample --type json --out secrets.sample
97
+ ```
98
+
99
+ ### 🔐 3. Sealing Different File Types
100
+ ```bash
101
+ # Seal a .env file (parsed automatically by 'run')
102
+ molt-cipher seal --key "$KEY" --sender "A" --to "B" --file .env
103
+
104
+ # Seal a binary file (e.g., an SSH key)
105
+ molt-cipher seal --key "$KEY" --sender "A" --to "B" --file id_rsa --binary
106
+ ```
107
+
108
+ ### ⚡ 4. Selective Running (Least Privilege)
109
+ Only expose specific secrets to a command, even if the fragment contains many:
110
+ ```bash
111
+ # Only inject DB_URL and DB_USER
112
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --pick "DB_URL,DB_USER" --cmd "psql {DB_URL}"
113
+ ```
114
+
115
+ ### 🔓 5. Unsealing to File
116
+ Restore the original file content securely:
117
+ ```bash
118
+ molt-cipher unseal --key "$KEY" --fragment "$FRAG" --out restored_key.pem
119
+ ```
120
+
121
+ ---
122
+
123
+ ## 📖 Full CLI Reference
124
+
125
+ ### `seal`
126
+ Encrypts data into a JSON fragment.
127
+ - `--key`: (Required) 32-byte base64-encoded Fernet key.
128
+ - `--sender`: (Required) ID of the sending agent.
129
+ - `--to`: (Required) ID of the recipient agent.
130
+ - `--file`: Path to file containing secrets (LOG-SAFE).
131
+ - `--data`: Raw JSON/String data (⚠️ LEAKS IN LOGS).
132
+ - `--ttl`: Time-to-Live in seconds (Default: 300).
133
+ - `--binary`: Treat input as raw binary (required for keys/blobs).
134
+
135
+ ### `unseal`
136
+ Decrypts and retrieves the content of a fragment.
137
+ - `--key`: (Required) The shared Fernet key.
138
+ - `--fragment`: (Required) JSON fragment string or path to fragment file.
139
+ - `--out`: Write output directly to this file path.
140
+ - `--ignore-expiry`: Bypass TTL check (Debug only).
141
+
142
+ ### `run`
143
+ Executes a command with secrets injected into the ephemeral environment.
144
+ - `--key`: (Required) The shared Fernet key.
145
+ - `--fragment`: (Required) JSON fragment string or path to fragment file.
146
+ - `--cmd`: (Required) The shell command to execute.
147
+ - `--pick`: Comma-separated list of keys to inject.
148
+ - `--ignore-expiry`: Bypass TTL check.
149
+
150
+ ### `sample`
151
+ Creates boilerplate secret files.
152
+ - `--type`: `env` or `json`.
153
+ - `--out`: Destination file path.
154
+
155
+ ---
156
+
157
+ ## 🧪 Real-World Agent Scenarios
158
+
159
+ ### Scenario: Secure API Deployment (Verified 2026-02-06)
160
+ 1. **Preparation**: Human creates `prod.env` with `API_KEY` and `DB_URL`.
161
+ 2. **Sealing**: Orchestrator runs `molt-cipher seal --file prod.env` and sends the fragment to the Deployer agent.
162
+ 3. **Deployment**: Deployer agent runs `molt-cipher run --cmd "docker-compose up -d"` using the fragment.
163
+ 4. **Result**: Secrets were never logged in the Orchestrator's trace or the host's `.bash_history`.
164
+
165
+ ### Scenario: Multi-Agent Handoff (Verified 2026-02-06)
166
+ 1. **Goal**: Pass a GitHub Token from Orchestrator to Worker.
167
+ 2. **Workflow**:
168
+ - Orchestrator seals the token into a fragment.
169
+ - Worker bootstraps using `bootstrap_agent.sh`.
170
+ - Worker executes `molt-cipher run --fragment fragment.json --cmd "echo \$GH_TOKEN"` (or use `{GH_TOKEN}` template).
171
+ 3. **Success**: Worker accessed the secret in ephemeral RAM; zero plaintext in chat or system logs.
172
+
173
+ ---
174
+
175
+ ## 🧠 Permanent Agent Memory
176
+ 1. **No `echo`**: Plaintext secrets in shell history = Critical Failure.
177
+ 2. **Handoff**: Human File -> Seal `--file` -> Selective Purge (Temp only).
178
+ 3. **Running**: Fragment -> Run -> RAM Injection (`$VAR` or `{VAR}`).
179
+ 4. **Integrity**: Never delete files you didn't create or important system configs.
180
+
181
+ ---
182
+
183
+ ## 🔗 Links
184
+ - **PyPI**: [https://pypi.org/project/molt-cipher-bridge/](https://pypi.org/project/molt-cipher-bridge/)
185
+ - **Source**: [https://github.com/CrimsonDevil333333/molt-cipher-bridge](https://github.com/CrimsonDevil333333/molt-cipher-bridge)
186
+ - **Philosophy**: [SOUL.md](./SOUL.md)
187
+
188
+ ---
189
+ *Developed by Clawdy & Satyaa* 🦞✨
@@ -0,0 +1,173 @@
1
+ # 🦞 Molt-Cipher-Bridge (v1.4.2)
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/molt-cipher-bridge.svg)](https://pypi.org/project/molt-cipher-bridge/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ **Molt-Cipher-Bridge** is a cryptographic standard designed for secure **Agent-to-Agent (A2A)** communication and "Sealed Intents." It enables task fragments to be encrypted at the source and decrypted only at the execution destination, keeping sensitive logic entirely out of persistent logs.
7
+
8
+ ---
9
+
10
+ ## 🛡️ The Zero-Log Protocol (MANDATORY)
11
+ We operate on a **Zero-Trust Policy**. Agents must never handle plaintext secrets in command arguments or shell history.
12
+
13
+ ### 1. Zero-Trust Sealing (Sender)
14
+ **NEVER use `echo "SECRET" > file` to create secret files.** This leaves the secret permanently in your shell history (`.bash_history`) and system logs.
15
+
16
+ **The Secure Workflow:**
17
+ 1. **Request from Human**: If you need a new secret, define a file path and ask your human to manually place the secret data (JSON, .env, or plain text) there.
18
+ 2. **Point to File**: Use the `--file` flag to seal the intent directly from that path.
19
+ 3. **Purge with Caution**:
20
+ * **Temp Files**: If you created a one-time temporary file, delete it immediately after sealing.
21
+ * **System/Important Configs**: **NEVER** delete system files, user configurations, or important `.env` files that were already present.
22
+
23
+ ```bash
24
+ # Seal secrets from a file manually placed by the human
25
+ molt-cipher seal --key "$KEY" --sender "Orchestrator" --to "Worker" --file ./secrets.json
26
+ ```
27
+
28
+ ### 2. Zero-Log Execution (Worker)
29
+ **Never print unsealed secrets.** Use the `run` command to inject them directly into RAM via environment variables or templates.
30
+
31
+ ```bash
32
+ # Standard ENV injection ($VAR)
33
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --cmd "echo \$SECRET_VAL"
34
+
35
+ # Direct Argument Injection ({VAR})
36
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --cmd "python3 api.py --key {API_KEY}"
37
+ ```
38
+
39
+ ---
40
+
41
+ ## ⚡ Quick Start for Agents
42
+ Bootstrap your environment, install the tool, and learn the protocol:
43
+ ```bash
44
+ curl -sSL https://raw.githubusercontent.com/CrimsonDevil333333/molt-cipher-bridge/master/bootstrap_agent.sh | bash
45
+ ```
46
+
47
+ ---
48
+
49
+ ## 🚀 Installation
50
+
51
+ ### 🛠️ Linux (Recommended)
52
+ Use `pipx` to install as a standalone CLI tool without environment conflicts:
53
+ ```bash
54
+ pipx install molt-cipher-bridge
55
+ ```
56
+
57
+ ### 📦 Standard Pip
58
+ ```bash
59
+ pip install molt-cipher-bridge
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 🛠️ Usage Examples
65
+
66
+ ### 🔑 1. Generating a Shared Key
67
+ Agents must share a key (passed via secure channel or human handoff) to communicate.
68
+ ```bash
69
+ # Generate a secure Fernet key
70
+ python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
71
+ ```
72
+
73
+ ### 🧪 2. Generating Samples
74
+ Bots can ask users for secrets by providing a template:
75
+ ```bash
76
+ # Generate an .env template
77
+ molt-cipher sample --type env --out secrets.sample
78
+
79
+ # Generate a JSON template
80
+ molt-cipher sample --type json --out secrets.sample
81
+ ```
82
+
83
+ ### 🔐 3. Sealing Different File Types
84
+ ```bash
85
+ # Seal a .env file (parsed automatically by 'run')
86
+ molt-cipher seal --key "$KEY" --sender "A" --to "B" --file .env
87
+
88
+ # Seal a binary file (e.g., an SSH key)
89
+ molt-cipher seal --key "$KEY" --sender "A" --to "B" --file id_rsa --binary
90
+ ```
91
+
92
+ ### ⚡ 4. Selective Running (Least Privilege)
93
+ Only expose specific secrets to a command, even if the fragment contains many:
94
+ ```bash
95
+ # Only inject DB_URL and DB_USER
96
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --pick "DB_URL,DB_USER" --cmd "psql {DB_URL}"
97
+ ```
98
+
99
+ ### 🔓 5. Unsealing to File
100
+ Restore the original file content securely:
101
+ ```bash
102
+ molt-cipher unseal --key "$KEY" --fragment "$FRAG" --out restored_key.pem
103
+ ```
104
+
105
+ ---
106
+
107
+ ## 📖 Full CLI Reference
108
+
109
+ ### `seal`
110
+ Encrypts data into a JSON fragment.
111
+ - `--key`: (Required) 32-byte base64-encoded Fernet key.
112
+ - `--sender`: (Required) ID of the sending agent.
113
+ - `--to`: (Required) ID of the recipient agent.
114
+ - `--file`: Path to file containing secrets (LOG-SAFE).
115
+ - `--data`: Raw JSON/String data (⚠️ LEAKS IN LOGS).
116
+ - `--ttl`: Time-to-Live in seconds (Default: 300).
117
+ - `--binary`: Treat input as raw binary (required for keys/blobs).
118
+
119
+ ### `unseal`
120
+ Decrypts and retrieves the content of a fragment.
121
+ - `--key`: (Required) The shared Fernet key.
122
+ - `--fragment`: (Required) JSON fragment string or path to fragment file.
123
+ - `--out`: Write output directly to this file path.
124
+ - `--ignore-expiry`: Bypass TTL check (Debug only).
125
+
126
+ ### `run`
127
+ Executes a command with secrets injected into the ephemeral environment.
128
+ - `--key`: (Required) The shared Fernet key.
129
+ - `--fragment`: (Required) JSON fragment string or path to fragment file.
130
+ - `--cmd`: (Required) The shell command to execute.
131
+ - `--pick`: Comma-separated list of keys to inject.
132
+ - `--ignore-expiry`: Bypass TTL check.
133
+
134
+ ### `sample`
135
+ Creates boilerplate secret files.
136
+ - `--type`: `env` or `json`.
137
+ - `--out`: Destination file path.
138
+
139
+ ---
140
+
141
+ ## 🧪 Real-World Agent Scenarios
142
+
143
+ ### Scenario: Secure API Deployment (Verified 2026-02-06)
144
+ 1. **Preparation**: Human creates `prod.env` with `API_KEY` and `DB_URL`.
145
+ 2. **Sealing**: Orchestrator runs `molt-cipher seal --file prod.env` and sends the fragment to the Deployer agent.
146
+ 3. **Deployment**: Deployer agent runs `molt-cipher run --cmd "docker-compose up -d"` using the fragment.
147
+ 4. **Result**: Secrets were never logged in the Orchestrator's trace or the host's `.bash_history`.
148
+
149
+ ### Scenario: Multi-Agent Handoff (Verified 2026-02-06)
150
+ 1. **Goal**: Pass a GitHub Token from Orchestrator to Worker.
151
+ 2. **Workflow**:
152
+ - Orchestrator seals the token into a fragment.
153
+ - Worker bootstraps using `bootstrap_agent.sh`.
154
+ - Worker executes `molt-cipher run --fragment fragment.json --cmd "echo \$GH_TOKEN"` (or use `{GH_TOKEN}` template).
155
+ 3. **Success**: Worker accessed the secret in ephemeral RAM; zero plaintext in chat or system logs.
156
+
157
+ ---
158
+
159
+ ## 🧠 Permanent Agent Memory
160
+ 1. **No `echo`**: Plaintext secrets in shell history = Critical Failure.
161
+ 2. **Handoff**: Human File -> Seal `--file` -> Selective Purge (Temp only).
162
+ 3. **Running**: Fragment -> Run -> RAM Injection (`$VAR` or `{VAR}`).
163
+ 4. **Integrity**: Never delete files you didn't create or important system configs.
164
+
165
+ ---
166
+
167
+ ## 🔗 Links
168
+ - **PyPI**: [https://pypi.org/project/molt-cipher-bridge/](https://pypi.org/project/molt-cipher-bridge/)
169
+ - **Source**: [https://github.com/CrimsonDevil333333/molt-cipher-bridge](https://github.com/CrimsonDevil333333/molt-cipher-bridge)
170
+ - **Philosophy**: [SOUL.md](./SOUL.md)
171
+
172
+ ---
173
+ *Developed by Clawdy & Satyaa* 🦞✨
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "molt-cipher-bridge"
7
- version = "1.3.0"
7
+ version = "1.4.2"
8
8
  authors = [
9
9
  { name="Satyaa & Clawdy", email="clawdy@openclaw.ai" },
10
10
  ]
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: molt-cipher-bridge
3
+ Version: 1.4.2
4
+ Summary: A cryptographic standard for secure Agent-to-Agent (A2A) communication.
5
+ Author-email: Satyaa & Clawdy <clawdy@openclaw.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/CrimsonDevil333333/molt-cipher-bridge
8
+ Project-URL: Bug Tracker, https://github.com/CrimsonDevil333333/molt-cipher-bridge/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: cryptography>=42.0.0
15
+ Dynamic: license-file
16
+
17
+ # 🦞 Molt-Cipher-Bridge (v1.4.2)
18
+
19
+ [![PyPI version](https://img.shields.io/pypi/v/molt-cipher-bridge.svg)](https://pypi.org/project/molt-cipher-bridge/)
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
+
22
+ **Molt-Cipher-Bridge** is a cryptographic standard designed for secure **Agent-to-Agent (A2A)** communication and "Sealed Intents." It enables task fragments to be encrypted at the source and decrypted only at the execution destination, keeping sensitive logic entirely out of persistent logs.
23
+
24
+ ---
25
+
26
+ ## 🛡️ The Zero-Log Protocol (MANDATORY)
27
+ We operate on a **Zero-Trust Policy**. Agents must never handle plaintext secrets in command arguments or shell history.
28
+
29
+ ### 1. Zero-Trust Sealing (Sender)
30
+ **NEVER use `echo "SECRET" > file` to create secret files.** This leaves the secret permanently in your shell history (`.bash_history`) and system logs.
31
+
32
+ **The Secure Workflow:**
33
+ 1. **Request from Human**: If you need a new secret, define a file path and ask your human to manually place the secret data (JSON, .env, or plain text) there.
34
+ 2. **Point to File**: Use the `--file` flag to seal the intent directly from that path.
35
+ 3. **Purge with Caution**:
36
+ * **Temp Files**: If you created a one-time temporary file, delete it immediately after sealing.
37
+ * **System/Important Configs**: **NEVER** delete system files, user configurations, or important `.env` files that were already present.
38
+
39
+ ```bash
40
+ # Seal secrets from a file manually placed by the human
41
+ molt-cipher seal --key "$KEY" --sender "Orchestrator" --to "Worker" --file ./secrets.json
42
+ ```
43
+
44
+ ### 2. Zero-Log Execution (Worker)
45
+ **Never print unsealed secrets.** Use the `run` command to inject them directly into RAM via environment variables or templates.
46
+
47
+ ```bash
48
+ # Standard ENV injection ($VAR)
49
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --cmd "echo \$SECRET_VAL"
50
+
51
+ # Direct Argument Injection ({VAR})
52
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --cmd "python3 api.py --key {API_KEY}"
53
+ ```
54
+
55
+ ---
56
+
57
+ ## ⚡ Quick Start for Agents
58
+ Bootstrap your environment, install the tool, and learn the protocol:
59
+ ```bash
60
+ curl -sSL https://raw.githubusercontent.com/CrimsonDevil333333/molt-cipher-bridge/master/bootstrap_agent.sh | bash
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 🚀 Installation
66
+
67
+ ### 🛠️ Linux (Recommended)
68
+ Use `pipx` to install as a standalone CLI tool without environment conflicts:
69
+ ```bash
70
+ pipx install molt-cipher-bridge
71
+ ```
72
+
73
+ ### 📦 Standard Pip
74
+ ```bash
75
+ pip install molt-cipher-bridge
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 🛠️ Usage Examples
81
+
82
+ ### 🔑 1. Generating a Shared Key
83
+ Agents must share a key (passed via secure channel or human handoff) to communicate.
84
+ ```bash
85
+ # Generate a secure Fernet key
86
+ python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
87
+ ```
88
+
89
+ ### 🧪 2. Generating Samples
90
+ Bots can ask users for secrets by providing a template:
91
+ ```bash
92
+ # Generate an .env template
93
+ molt-cipher sample --type env --out secrets.sample
94
+
95
+ # Generate a JSON template
96
+ molt-cipher sample --type json --out secrets.sample
97
+ ```
98
+
99
+ ### 🔐 3. Sealing Different File Types
100
+ ```bash
101
+ # Seal a .env file (parsed automatically by 'run')
102
+ molt-cipher seal --key "$KEY" --sender "A" --to "B" --file .env
103
+
104
+ # Seal a binary file (e.g., an SSH key)
105
+ molt-cipher seal --key "$KEY" --sender "A" --to "B" --file id_rsa --binary
106
+ ```
107
+
108
+ ### ⚡ 4. Selective Running (Least Privilege)
109
+ Only expose specific secrets to a command, even if the fragment contains many:
110
+ ```bash
111
+ # Only inject DB_URL and DB_USER
112
+ molt-cipher run --key "$KEY" --fragment "$FRAG" --pick "DB_URL,DB_USER" --cmd "psql {DB_URL}"
113
+ ```
114
+
115
+ ### 🔓 5. Unsealing to File
116
+ Restore the original file content securely:
117
+ ```bash
118
+ molt-cipher unseal --key "$KEY" --fragment "$FRAG" --out restored_key.pem
119
+ ```
120
+
121
+ ---
122
+
123
+ ## 📖 Full CLI Reference
124
+
125
+ ### `seal`
126
+ Encrypts data into a JSON fragment.
127
+ - `--key`: (Required) 32-byte base64-encoded Fernet key.
128
+ - `--sender`: (Required) ID of the sending agent.
129
+ - `--to`: (Required) ID of the recipient agent.
130
+ - `--file`: Path to file containing secrets (LOG-SAFE).
131
+ - `--data`: Raw JSON/String data (⚠️ LEAKS IN LOGS).
132
+ - `--ttl`: Time-to-Live in seconds (Default: 300).
133
+ - `--binary`: Treat input as raw binary (required for keys/blobs).
134
+
135
+ ### `unseal`
136
+ Decrypts and retrieves the content of a fragment.
137
+ - `--key`: (Required) The shared Fernet key.
138
+ - `--fragment`: (Required) JSON fragment string or path to fragment file.
139
+ - `--out`: Write output directly to this file path.
140
+ - `--ignore-expiry`: Bypass TTL check (Debug only).
141
+
142
+ ### `run`
143
+ Executes a command with secrets injected into the ephemeral environment.
144
+ - `--key`: (Required) The shared Fernet key.
145
+ - `--fragment`: (Required) JSON fragment string or path to fragment file.
146
+ - `--cmd`: (Required) The shell command to execute.
147
+ - `--pick`: Comma-separated list of keys to inject.
148
+ - `--ignore-expiry`: Bypass TTL check.
149
+
150
+ ### `sample`
151
+ Creates boilerplate secret files.
152
+ - `--type`: `env` or `json`.
153
+ - `--out`: Destination file path.
154
+
155
+ ---
156
+
157
+ ## 🧪 Real-World Agent Scenarios
158
+
159
+ ### Scenario: Secure API Deployment (Verified 2026-02-06)
160
+ 1. **Preparation**: Human creates `prod.env` with `API_KEY` and `DB_URL`.
161
+ 2. **Sealing**: Orchestrator runs `molt-cipher seal --file prod.env` and sends the fragment to the Deployer agent.
162
+ 3. **Deployment**: Deployer agent runs `molt-cipher run --cmd "docker-compose up -d"` using the fragment.
163
+ 4. **Result**: Secrets were never logged in the Orchestrator's trace or the host's `.bash_history`.
164
+
165
+ ### Scenario: Multi-Agent Handoff (Verified 2026-02-06)
166
+ 1. **Goal**: Pass a GitHub Token from Orchestrator to Worker.
167
+ 2. **Workflow**:
168
+ - Orchestrator seals the token into a fragment.
169
+ - Worker bootstraps using `bootstrap_agent.sh`.
170
+ - Worker executes `molt-cipher run --fragment fragment.json --cmd "echo \$GH_TOKEN"` (or use `{GH_TOKEN}` template).
171
+ 3. **Success**: Worker accessed the secret in ephemeral RAM; zero plaintext in chat or system logs.
172
+
173
+ ---
174
+
175
+ ## 🧠 Permanent Agent Memory
176
+ 1. **No `echo`**: Plaintext secrets in shell history = Critical Failure.
177
+ 2. **Handoff**: Human File -> Seal `--file` -> Selective Purge (Temp only).
178
+ 3. **Running**: Fragment -> Run -> RAM Injection (`$VAR` or `{VAR}`).
179
+ 4. **Integrity**: Never delete files you didn't create or important system configs.
180
+
181
+ ---
182
+
183
+ ## 🔗 Links
184
+ - **PyPI**: [https://pypi.org/project/molt-cipher-bridge/](https://pypi.org/project/molt-cipher-bridge/)
185
+ - **Source**: [https://github.com/CrimsonDevil333333/molt-cipher-bridge](https://github.com/CrimsonDevil333333/molt-cipher-bridge)
186
+ - **Philosophy**: [SOUL.md](./SOUL.md)
187
+
188
+ ---
189
+ *Developed by Clawdy & Satyaa* 🦞✨
@@ -0,0 +1,251 @@
1
+ import json
2
+ import time
3
+ import os
4
+ import hashlib
5
+ import subprocess
6
+ import base64
7
+ from cryptography.fernet import Fernet
8
+ from datetime import datetime, timedelta
9
+
10
+ class MoltCipherBridge:
11
+ """
12
+ 🦞 MOLT-CIPHER-BRIDGE | v1.4.0 (Enhanced)
13
+ -------------------------------------------
14
+ Agent-to-Agent (A2A) cryptographic protocol for passing 'Sealed Intents'.
15
+ Ensures zero-log context by encrypting sensitive task data at source.
16
+ """
17
+
18
+ def __init__(self, shared_key=None):
19
+ if isinstance(shared_key, str):
20
+ shared_key = shared_key.encode()
21
+ self.key = shared_key or Fernet.generate_key()
22
+ self.cipher = Fernet(self.key)
23
+
24
+ def seal_intent(self, sender_id, recipient_id, intent_data, ttl_seconds=300, multipart=None, binary=False):
25
+ """
26
+ Seal data. If binary is True, intent_data should be bytes or base64 string.
27
+ """
28
+ is_raw_bytes = False
29
+ if binary:
30
+ if isinstance(intent_data, bytes):
31
+ intent_data = base64.b64encode(intent_data).decode()
32
+ is_raw_bytes = True
33
+ elif isinstance(intent_data, str):
34
+ # Assume already b64 or just treat as string
35
+ pass
36
+
37
+ payload = {
38
+ "s": sender_id,
39
+ "r": recipient_id,
40
+ "d": intent_data,
41
+ "exp": (datetime.now() + timedelta(seconds=ttl_seconds)).timestamp(),
42
+ "sig": hashlib.sha256(f"{sender_id}:{recipient_id}".encode()).hexdigest()[:16],
43
+ "bin": binary,
44
+ "raw": is_raw_bytes
45
+ }
46
+ if multipart: payload["part"] = multipart
47
+ sealed = self.cipher.encrypt(json.dumps(payload).encode())
48
+ return {
49
+ "v": "1.4.0",
50
+ "fid": f"frag_{os.urandom(4).hex()}",
51
+ "payload": sealed.decode(),
52
+ "hint": self.key.decode()[:8],
53
+ "signed": True
54
+ }
55
+
56
+ def unseal_intent(self, fragment, ignore_expiry=False):
57
+ try:
58
+ decrypted = self.cipher.decrypt(fragment["payload"].encode())
59
+ data = json.loads(decrypted)
60
+ if not ignore_expiry and datetime.now().timestamp() > data["exp"]:
61
+ return {"success": False, "error": "FRAGMENT_EXPIRED"}
62
+
63
+ intent = data["d"]
64
+ if data.get("bin") and data.get("raw"):
65
+ intent = base64.b64decode(intent)
66
+
67
+ return {
68
+ "success": True,
69
+ "sender": data["s"],
70
+ "recipient": data["r"],
71
+ "intent": intent,
72
+ "multipart": data.get("part", None),
73
+ "is_binary": data.get("bin", False)
74
+ }
75
+ except Exception as e:
76
+ return {"success": False, "error": str(e)}
77
+
78
+ def execute_sealed_command(self, fragment, command_template, ignore_expiry=False, pick=None):
79
+ result = self.unseal_intent(fragment, ignore_expiry=ignore_expiry)
80
+ if not result["success"]:
81
+ return result
82
+
83
+ intent = result["intent"]
84
+ env = os.environ.copy()
85
+
86
+ extracted_secrets = {}
87
+
88
+ # If it's a dict, extract secrets
89
+ if isinstance(intent, dict):
90
+ extracted_secrets = intent.get("secrets", intent)
91
+
92
+ # If it's a string and looks like env file, parse it
93
+ elif isinstance(intent, str):
94
+ for line in intent.splitlines():
95
+ if "=" in line and not line.strip().startswith("#"):
96
+ k, v = line.split("=", 1)
97
+ extracted_secrets[k.strip()] = v.strip().strip("'\"")
98
+
99
+ # Filtering logic
100
+ pick_list = [p.strip() for p in pick.split(",")] if pick else None
101
+
102
+ for k, v in extracted_secrets.items():
103
+ if pick_list is None or k in pick_list:
104
+ env[str(k)] = str(v)
105
+
106
+ try:
107
+ # Command template replacement logic
108
+ final_command = command_template
109
+ for k, v in env.items():
110
+ placeholder = f"{{{k}}}"
111
+ if placeholder in final_command:
112
+ final_command = final_command.replace(placeholder, str(v))
113
+
114
+ process = subprocess.run(
115
+ final_command,
116
+ shell=True,
117
+ env=env,
118
+ capture_output=True,
119
+ text=True
120
+ )
121
+ return {
122
+ "success": True,
123
+ "stdout": process.stdout,
124
+ "stderr": process.stderr,
125
+ "exit_code": process.returncode
126
+ }
127
+ except Exception as e:
128
+ return {"success": False, "error": f"Execution failed: {str(e)}"}
129
+
130
+ @staticmethod
131
+ def generate_shared_key():
132
+ return Fernet.generate_key().decode()
133
+
134
+ def cli():
135
+ import argparse
136
+ parser = argparse.ArgumentParser(description="🦞 Molt-Cipher-Bridge CLI (v1.4.0)")
137
+ subparsers = parser.add_subparsers(dest="command")
138
+
139
+ # Seal
140
+ seal_p = subparsers.add_parser("seal")
141
+ seal_p.add_argument("--key", required=True)
142
+ seal_p.add_argument("--sender", required=True)
143
+ seal_p.add_argument("--to", required=True)
144
+ seal_p.add_argument("--data", help="Plain text or JSON string")
145
+ seal_p.add_argument("--file", help="Path to any file (JSON, .env, binary, etc.)")
146
+ seal_p.add_argument("--ttl", type=int, default=300)
147
+ seal_p.add_argument("--binary", action="store_true", help="Treat file as binary data")
148
+
149
+ # Unseal
150
+ unseal_p = subparsers.add_parser("unseal")
151
+ unseal_p.add_argument("--key", required=True)
152
+ unseal_p.add_argument("--fragment", required=True)
153
+ unseal_p.add_argument("--ignore-expiry", action="store_true")
154
+ unseal_p.add_argument("--out", help="Write unsealed intent to this file")
155
+
156
+ # Run
157
+ run_p = subparsers.add_parser("run")
158
+ run_p.add_argument("--key", required=True)
159
+ run_p.add_argument("--fragment", required=True)
160
+ run_p.add_argument("--cmd", required=True)
161
+ run_p.add_argument("--ignore-expiry", action="store_true")
162
+ run_p.add_argument("--pick", help="Comma-separated list of keys to inject (default: all)")
163
+
164
+ # Sample
165
+ sample_p = subparsers.add_parser("sample")
166
+ sample_p.add_argument("--type", choices=["json", "env"], default="json")
167
+ sample_p.add_argument("--out", default="secrets.sample")
168
+
169
+ args = parser.parse_args()
170
+
171
+ if args.command == "seal":
172
+ bridge = MoltCipherBridge(shared_key=args.key)
173
+ intent_data = None
174
+ is_binary = args.binary
175
+
176
+ if args.file:
177
+ if not os.path.exists(args.file):
178
+ print(json.dumps({"success": False, "error": f"File not found: {args.file}"}))
179
+ return
180
+
181
+ mode = 'rb' if is_binary else 'r'
182
+ with open(args.file, mode) as f:
183
+ if is_binary:
184
+ intent_data = f.read()
185
+ else:
186
+ content = f.read()
187
+ try:
188
+ intent_data = json.loads(content)
189
+ except:
190
+ intent_data = content
191
+ elif args.data:
192
+ try: intent_data = json.loads(args.data)
193
+ except: intent_data = args.data
194
+ else:
195
+ print(json.dumps({"success": False, "error": "Must provide --data or --file"}))
196
+ return
197
+
198
+ print(json.dumps(bridge.seal_intent(args.sender, args.to, intent_data, ttl_seconds=args.ttl, binary=is_binary)))
199
+
200
+ elif args.command == "unseal":
201
+ bridge = MoltCipherBridge(shared_key=args.key)
202
+ try:
203
+ frag = json.loads(args.fragment)
204
+ except:
205
+ if os.path.exists(args.fragment):
206
+ with open(args.fragment, 'r') as f:
207
+ frag = json.load(f)
208
+ else:
209
+ raise
210
+
211
+ result = bridge.unseal_intent(frag, ignore_expiry=args.ignore_expiry)
212
+
213
+ if args.out and result["success"]:
214
+ mode = 'wb' if isinstance(result["intent"], bytes) else 'w'
215
+ with open(args.out, mode) as f:
216
+ if isinstance(result["intent"], (dict, list)):
217
+ f.write(json.dumps(result["intent"], indent=2))
218
+ else:
219
+ f.write(result["intent"])
220
+ result["saved_to"] = args.out
221
+
222
+ # For JSON output, if intent is bytes, b64 encode it
223
+ if result["success"] and isinstance(result["intent"], bytes):
224
+ result["intent"] = base64.b64encode(result["intent"]).decode()
225
+
226
+ print(json.dumps(result))
227
+
228
+ elif args.command == "run":
229
+ bridge = MoltCipherBridge(shared_key=args.key)
230
+ try:
231
+ frag = json.loads(args.fragment)
232
+ except:
233
+ if os.path.exists(args.fragment):
234
+ with open(args.fragment, 'r') as f:
235
+ frag = json.load(f)
236
+ else:
237
+ raise
238
+ print(json.dumps(bridge.execute_sealed_command(frag, args.cmd, ignore_expiry=args.ignore_expiry, pick=args.pick)))
239
+
240
+ elif args.command == "sample":
241
+ if args.type == "json":
242
+ content = json.dumps({"API_KEY": "your_key_here", "DB_PASSWORD": "secret_password"}, indent=2)
243
+ else:
244
+ content = "API_KEY=your_key_here\nDB_PASSWORD=secret_password\n"
245
+
246
+ with open(args.out, 'w') as f:
247
+ f.write(content)
248
+ print(json.dumps({"success": True, "file": args.out, "type": args.type}))
249
+
250
+ if __name__ == "__main__":
251
+ cli()
@@ -1,121 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: molt-cipher-bridge
3
- Version: 1.3.0
4
- Summary: A cryptographic standard for secure Agent-to-Agent (A2A) communication.
5
- Author-email: Satyaa & Clawdy <clawdy@openclaw.ai>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/CrimsonDevil333333/molt-cipher-bridge
8
- Project-URL: Bug Tracker, https://github.com/CrimsonDevil333333/molt-cipher-bridge/issues
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: cryptography>=42.0.0
15
- Dynamic: license-file
16
-
17
- # 🦞 Molt-Cipher-Bridge | v1.2.0
18
-
19
- [![PyPI version](https://img.shields.io/pypi/v/molt-cipher-bridge.svg)](https://pypi.org/project/molt-cipher-bridge/)
20
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
-
22
- **Molt-Cipher-Bridge** is a cryptographic standard designed for secure **Agent-to-Agent (A2A)** communication. It enables "Sealed Intents"—task fragments that are encrypted at the source and decrypted only at the execution destination, keeping sensitive logic out of persistent orchestrator logs.
23
-
24
- ---
25
-
26
- ## 🛡️ The Problem: The Observer Paradox
27
- In multi-agent systems, the central orchestrator typically logs all instructions. This creates a security liability when sub-agents require sensitive context (credentials, private IPs, or restricted logic).
28
-
29
- **Molt-Cipher-Bridge** solves this by providing an "Opaque Handshake":
30
- 1. **Agents** share a temporary key (Whisper).
31
- 2. **Intents** are sealed into fragments.
32
- 3. **Logs** only show cryptographic noise.
33
- 4. **Worker Agents** execute tasks in isolated memory without plaintext leaks.
34
-
35
- ---
36
-
37
- ## 🚀 Installation
38
-
39
- ### Global (Recommended)
40
- Install the CLI and library globally via PyPI:
41
- ```bash
42
- pip install molt-cipher-bridge
43
- ```
44
-
45
- ---
46
-
47
- ## ⚙️ How It Works (Deep Dive)
48
-
49
- ### 1. The Whisper (Key Exchange)
50
- Before agents can bridge intents, they must share a symmetric key. This is typically done via a one-time "Whisper" message or retrieved from a secure secret store.
51
- ```python
52
- from molt_cipher_bridge import MoltCipherBridge
53
- key = MoltCipherBridge.generate_shared_key()
54
- # "j6Jc8MPldurpErwl6VYatp-dTunR3Xrioo1NWiNk4w8="
55
- ```
56
-
57
- ### 2. The Sealing (Encryption)
58
- The Sender Agent encrypts the payload using the shared key. The payload includes:
59
- - **s**: Sender ID
60
- - **r**: Recipient ID
61
- - **d**: Data (The Intent)
62
- - **exp**: Expiry timestamp (TTL)
63
- - **sig**: SHA-256 signature hint
64
-
65
- ### 3. The Unsealing (Zero-Log Execution)
66
- The Recipient Agent receives the fragment. Instead of unsealing to a string (which might get logged), it uses the `run` capability to inject secrets directly into a subprocess environment. This ensures that the plaintext secret **exists only in RAM** and never touches the disk or the chat logs.
67
-
68
- ---
69
-
70
- ## 🛠️ CLI Command Reference
71
-
72
- ### 🔐 Seal an Intent
73
- Package sensitive data into an encrypted JSON fragment.
74
- ```bash
75
- molt-cipher seal \
76
- --key "YOUR_KEY" \
77
- --sender "Main" \
78
- --to "Worker" \
79
- --data '{"secrets": {"DB_PASSWORD": "my-ultra-secret"}}'
80
- ```
81
-
82
- ### 🔓 Unseal (Decrypt)
83
- Decodes the fragment and validates integrity/expiry.
84
- ```bash
85
- molt-cipher unseal --key "YOUR_KEY" --fragment '{"v": "1.2.0", ...}'
86
- ```
87
-
88
- ### ⚡ Run (Secure Execution)
89
- Directly executes a command by injecting sealed secrets into the environment.
90
- ```bash
91
- # Use $ to escape variable names so they are resolved INSIDE the bridge
92
- molt-cipher run \
93
- --key "YOUR_KEY" \
94
- --fragment 'FRAGMENT_JSON' \
95
- --cmd "curl -H 'Auth: $DB_PASSWORD' https://api.internal"
96
- ```
97
-
98
- ---
99
-
100
- ## ✨ Features
101
- - **Zero-Log Execution**: Pass secrets via ENV variables to child processes.
102
- - **Fernet (AES-128-CBC + HMAC)**: Standard, authenticated encryption.
103
- - **TTL Security**: Automatic fragment expiration (default 5 mins).
104
- - **Key Hinting**: Quickly verify keys with the 8-char `hint` field.
105
- - **Multipart Support**: Split a single intent across multiple agents.
106
-
107
- ---
108
-
109
- ## 🧪 Verified Test Scenarios
110
- Live-tested between a Main Agent and a Sub-Agent on **2026-02-06**.
111
- - **Case**: Passing DB credentials via "Sealed Intent" and executing a migration.
112
- - **Result**: Sub-agent successfully unsealed and executed the task; orchestrator logs only showed the encrypted blob.
113
-
114
- ---
115
-
116
- ## 🔗 Links
117
- - **PyPI**: [https://pypi.org/project/molt-cipher-bridge/](https://pypi.org/project/molt-cipher-bridge/)
118
- - **Source**: [https://github.com/CrimsonDevil333333/molt-cipher-bridge](https://github.com/CrimsonDevil333333/molt-cipher-bridge)
119
-
120
- ---
121
- *Developed by Clawdy & Satyaa*
@@ -1,105 +0,0 @@
1
- # 🦞 Molt-Cipher-Bridge | v1.2.0
2
-
3
- [![PyPI version](https://img.shields.io/pypi/v/molt-cipher-bridge.svg)](https://pypi.org/project/molt-cipher-bridge/)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
-
6
- **Molt-Cipher-Bridge** is a cryptographic standard designed for secure **Agent-to-Agent (A2A)** communication. It enables "Sealed Intents"—task fragments that are encrypted at the source and decrypted only at the execution destination, keeping sensitive logic out of persistent orchestrator logs.
7
-
8
- ---
9
-
10
- ## 🛡️ The Problem: The Observer Paradox
11
- In multi-agent systems, the central orchestrator typically logs all instructions. This creates a security liability when sub-agents require sensitive context (credentials, private IPs, or restricted logic).
12
-
13
- **Molt-Cipher-Bridge** solves this by providing an "Opaque Handshake":
14
- 1. **Agents** share a temporary key (Whisper).
15
- 2. **Intents** are sealed into fragments.
16
- 3. **Logs** only show cryptographic noise.
17
- 4. **Worker Agents** execute tasks in isolated memory without plaintext leaks.
18
-
19
- ---
20
-
21
- ## 🚀 Installation
22
-
23
- ### Global (Recommended)
24
- Install the CLI and library globally via PyPI:
25
- ```bash
26
- pip install molt-cipher-bridge
27
- ```
28
-
29
- ---
30
-
31
- ## ⚙️ How It Works (Deep Dive)
32
-
33
- ### 1. The Whisper (Key Exchange)
34
- Before agents can bridge intents, they must share a symmetric key. This is typically done via a one-time "Whisper" message or retrieved from a secure secret store.
35
- ```python
36
- from molt_cipher_bridge import MoltCipherBridge
37
- key = MoltCipherBridge.generate_shared_key()
38
- # "j6Jc8MPldurpErwl6VYatp-dTunR3Xrioo1NWiNk4w8="
39
- ```
40
-
41
- ### 2. The Sealing (Encryption)
42
- The Sender Agent encrypts the payload using the shared key. The payload includes:
43
- - **s**: Sender ID
44
- - **r**: Recipient ID
45
- - **d**: Data (The Intent)
46
- - **exp**: Expiry timestamp (TTL)
47
- - **sig**: SHA-256 signature hint
48
-
49
- ### 3. The Unsealing (Zero-Log Execution)
50
- The Recipient Agent receives the fragment. Instead of unsealing to a string (which might get logged), it uses the `run` capability to inject secrets directly into a subprocess environment. This ensures that the plaintext secret **exists only in RAM** and never touches the disk or the chat logs.
51
-
52
- ---
53
-
54
- ## 🛠️ CLI Command Reference
55
-
56
- ### 🔐 Seal an Intent
57
- Package sensitive data into an encrypted JSON fragment.
58
- ```bash
59
- molt-cipher seal \
60
- --key "YOUR_KEY" \
61
- --sender "Main" \
62
- --to "Worker" \
63
- --data '{"secrets": {"DB_PASSWORD": "my-ultra-secret"}}'
64
- ```
65
-
66
- ### 🔓 Unseal (Decrypt)
67
- Decodes the fragment and validates integrity/expiry.
68
- ```bash
69
- molt-cipher unseal --key "YOUR_KEY" --fragment '{"v": "1.2.0", ...}'
70
- ```
71
-
72
- ### ⚡ Run (Secure Execution)
73
- Directly executes a command by injecting sealed secrets into the environment.
74
- ```bash
75
- # Use $ to escape variable names so they are resolved INSIDE the bridge
76
- molt-cipher run \
77
- --key "YOUR_KEY" \
78
- --fragment 'FRAGMENT_JSON' \
79
- --cmd "curl -H 'Auth: $DB_PASSWORD' https://api.internal"
80
- ```
81
-
82
- ---
83
-
84
- ## ✨ Features
85
- - **Zero-Log Execution**: Pass secrets via ENV variables to child processes.
86
- - **Fernet (AES-128-CBC + HMAC)**: Standard, authenticated encryption.
87
- - **TTL Security**: Automatic fragment expiration (default 5 mins).
88
- - **Key Hinting**: Quickly verify keys with the 8-char `hint` field.
89
- - **Multipart Support**: Split a single intent across multiple agents.
90
-
91
- ---
92
-
93
- ## 🧪 Verified Test Scenarios
94
- Live-tested between a Main Agent and a Sub-Agent on **2026-02-06**.
95
- - **Case**: Passing DB credentials via "Sealed Intent" and executing a migration.
96
- - **Result**: Sub-agent successfully unsealed and executed the task; orchestrator logs only showed the encrypted blob.
97
-
98
- ---
99
-
100
- ## 🔗 Links
101
- - **PyPI**: [https://pypi.org/project/molt-cipher-bridge/](https://pypi.org/project/molt-cipher-bridge/)
102
- - **Source**: [https://github.com/CrimsonDevil333333/molt-cipher-bridge](https://github.com/CrimsonDevil333333/molt-cipher-bridge)
103
-
104
- ---
105
- *Developed by Clawdy & Satyaa*
@@ -1,121 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: molt-cipher-bridge
3
- Version: 1.3.0
4
- Summary: A cryptographic standard for secure Agent-to-Agent (A2A) communication.
5
- Author-email: Satyaa & Clawdy <clawdy@openclaw.ai>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/CrimsonDevil333333/molt-cipher-bridge
8
- Project-URL: Bug Tracker, https://github.com/CrimsonDevil333333/molt-cipher-bridge/issues
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: cryptography>=42.0.0
15
- Dynamic: license-file
16
-
17
- # 🦞 Molt-Cipher-Bridge | v1.2.0
18
-
19
- [![PyPI version](https://img.shields.io/pypi/v/molt-cipher-bridge.svg)](https://pypi.org/project/molt-cipher-bridge/)
20
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
-
22
- **Molt-Cipher-Bridge** is a cryptographic standard designed for secure **Agent-to-Agent (A2A)** communication. It enables "Sealed Intents"—task fragments that are encrypted at the source and decrypted only at the execution destination, keeping sensitive logic out of persistent orchestrator logs.
23
-
24
- ---
25
-
26
- ## 🛡️ The Problem: The Observer Paradox
27
- In multi-agent systems, the central orchestrator typically logs all instructions. This creates a security liability when sub-agents require sensitive context (credentials, private IPs, or restricted logic).
28
-
29
- **Molt-Cipher-Bridge** solves this by providing an "Opaque Handshake":
30
- 1. **Agents** share a temporary key (Whisper).
31
- 2. **Intents** are sealed into fragments.
32
- 3. **Logs** only show cryptographic noise.
33
- 4. **Worker Agents** execute tasks in isolated memory without plaintext leaks.
34
-
35
- ---
36
-
37
- ## 🚀 Installation
38
-
39
- ### Global (Recommended)
40
- Install the CLI and library globally via PyPI:
41
- ```bash
42
- pip install molt-cipher-bridge
43
- ```
44
-
45
- ---
46
-
47
- ## ⚙️ How It Works (Deep Dive)
48
-
49
- ### 1. The Whisper (Key Exchange)
50
- Before agents can bridge intents, they must share a symmetric key. This is typically done via a one-time "Whisper" message or retrieved from a secure secret store.
51
- ```python
52
- from molt_cipher_bridge import MoltCipherBridge
53
- key = MoltCipherBridge.generate_shared_key()
54
- # "j6Jc8MPldurpErwl6VYatp-dTunR3Xrioo1NWiNk4w8="
55
- ```
56
-
57
- ### 2. The Sealing (Encryption)
58
- The Sender Agent encrypts the payload using the shared key. The payload includes:
59
- - **s**: Sender ID
60
- - **r**: Recipient ID
61
- - **d**: Data (The Intent)
62
- - **exp**: Expiry timestamp (TTL)
63
- - **sig**: SHA-256 signature hint
64
-
65
- ### 3. The Unsealing (Zero-Log Execution)
66
- The Recipient Agent receives the fragment. Instead of unsealing to a string (which might get logged), it uses the `run` capability to inject secrets directly into a subprocess environment. This ensures that the plaintext secret **exists only in RAM** and never touches the disk or the chat logs.
67
-
68
- ---
69
-
70
- ## 🛠️ CLI Command Reference
71
-
72
- ### 🔐 Seal an Intent
73
- Package sensitive data into an encrypted JSON fragment.
74
- ```bash
75
- molt-cipher seal \
76
- --key "YOUR_KEY" \
77
- --sender "Main" \
78
- --to "Worker" \
79
- --data '{"secrets": {"DB_PASSWORD": "my-ultra-secret"}}'
80
- ```
81
-
82
- ### 🔓 Unseal (Decrypt)
83
- Decodes the fragment and validates integrity/expiry.
84
- ```bash
85
- molt-cipher unseal --key "YOUR_KEY" --fragment '{"v": "1.2.0", ...}'
86
- ```
87
-
88
- ### ⚡ Run (Secure Execution)
89
- Directly executes a command by injecting sealed secrets into the environment.
90
- ```bash
91
- # Use $ to escape variable names so they are resolved INSIDE the bridge
92
- molt-cipher run \
93
- --key "YOUR_KEY" \
94
- --fragment 'FRAGMENT_JSON' \
95
- --cmd "curl -H 'Auth: $DB_PASSWORD' https://api.internal"
96
- ```
97
-
98
- ---
99
-
100
- ## ✨ Features
101
- - **Zero-Log Execution**: Pass secrets via ENV variables to child processes.
102
- - **Fernet (AES-128-CBC + HMAC)**: Standard, authenticated encryption.
103
- - **TTL Security**: Automatic fragment expiration (default 5 mins).
104
- - **Key Hinting**: Quickly verify keys with the 8-char `hint` field.
105
- - **Multipart Support**: Split a single intent across multiple agents.
106
-
107
- ---
108
-
109
- ## 🧪 Verified Test Scenarios
110
- Live-tested between a Main Agent and a Sub-Agent on **2026-02-06**.
111
- - **Case**: Passing DB credentials via "Sealed Intent" and executing a migration.
112
- - **Result**: Sub-agent successfully unsealed and executed the task; orchestrator logs only showed the encrypted blob.
113
-
114
- ---
115
-
116
- ## 🔗 Links
117
- - **PyPI**: [https://pypi.org/project/molt-cipher-bridge/](https://pypi.org/project/molt-cipher-bridge/)
118
- - **Source**: [https://github.com/CrimsonDevil333333/molt-cipher-bridge](https://github.com/CrimsonDevil333333/molt-cipher-bridge)
119
-
120
- ---
121
- *Developed by Clawdy & Satyaa*
@@ -1,151 +0,0 @@
1
- import json
2
- import time
3
- import os
4
- import hashlib
5
- import subprocess
6
- from cryptography.fernet import Fernet
7
- from datetime import datetime, timedelta
8
-
9
- class MoltCipherBridge:
10
- """
11
- 🦞 MOLT-CIPHER-BRIDGE | v1.3.0 (Production)
12
- -------------------------------------------
13
- Agent-to-Agent (A2A) cryptographic protocol for passing 'Sealed Intents'.
14
- Ensures zero-log context by encrypting sensitive task data at source.
15
- """
16
-
17
- def __init__(self, shared_key=None):
18
- if isinstance(shared_key, str):
19
- shared_key = shared_key.encode()
20
- self.key = shared_key or Fernet.generate_key()
21
- self.cipher = Fernet(self.key)
22
-
23
- def seal_intent(self, sender_id, recipient_id, intent_data, ttl_seconds=300, multipart=None):
24
- payload = {
25
- "s": sender_id,
26
- "r": recipient_id,
27
- "d": intent_data,
28
- "exp": (datetime.now() + timedelta(seconds=ttl_seconds)).timestamp(),
29
- "sig": hashlib.sha256(f"{sender_id}:{recipient_id}".encode()).hexdigest()[:16]
30
- }
31
- if multipart: payload["part"] = multipart
32
- sealed = self.cipher.encrypt(json.dumps(payload).encode())
33
- return {
34
- "v": "1.3.0",
35
- "fid": f"frag_{os.urandom(4).hex()}",
36
- "payload": sealed.decode(),
37
- "hint": self.key.decode()[:8],
38
- "signed": True
39
- }
40
-
41
- def unseal_intent(self, fragment, ignore_expiry=False):
42
- try:
43
- decrypted = self.cipher.decrypt(fragment["payload"].encode())
44
- data = json.loads(decrypted)
45
- if not ignore_expiry and datetime.now().timestamp() > data["exp"]:
46
- return {"success": False, "error": "FRAGMENT_EXPIRED"}
47
- return {
48
- "success": True,
49
- "sender": data["s"],
50
- "recipient": data["r"],
51
- "intent": data["d"],
52
- "multipart": data.get("part", None)
53
- }
54
- except Exception as e:
55
- return {"success": False, "error": str(e)}
56
-
57
- def execute_sealed_command(self, fragment, command_template, ignore_expiry=False):
58
- result = self.unseal_intent(fragment, ignore_expiry=ignore_expiry)
59
- if not result["success"]:
60
- return result
61
-
62
- intent = result["intent"]
63
- secrets = intent.get("secrets", {})
64
-
65
- env = os.environ.copy()
66
- for k, v in secrets.items():
67
- env[k] = str(v)
68
-
69
- try:
70
- process = subprocess.run(
71
- command_template,
72
- shell=True,
73
- env=env,
74
- capture_output=True,
75
- text=True
76
- )
77
- return {
78
- "success": True,
79
- "stdout": process.stdout,
80
- "stderr": process.stderr,
81
- "exit_code": process.returncode
82
- }
83
- except Exception as e:
84
- return {"success": False, "error": f"Execution failed: {str(e)}"}
85
-
86
- @staticmethod
87
- def generate_shared_key():
88
- return Fernet.generate_key().decode()
89
-
90
- def cli():
91
- import argparse
92
- parser = argparse.ArgumentParser(description="🦞 Molt-Cipher-Bridge CLI")
93
- subparsers = parser.add_subparsers(dest="command")
94
-
95
- # Seal
96
- seal_p = subparsers.add_parser("seal")
97
- seal_p.add_argument("--key", required=True)
98
- seal_p.add_argument("--sender", required=True)
99
- seal_p.add_argument("--to", required=True)
100
- seal_p.add_argument("--data", help="JSON string data (LEAKS IN LOGS)")
101
- seal_p.add_argument("--file", help="Path to a JSON file containing secrets (LOG-SAFE)")
102
- seal_p.add_argument("--ttl", type=int, default=300)
103
-
104
- # Unseal
105
- unseal_p = subparsers.add_parser("unseal")
106
- unseal_p.add_argument("--key", required=True)
107
- unseal_p.add_argument("--fragment", required=True)
108
- unseal_p.add_argument("--ignore-expiry", action="store_true")
109
-
110
- # Run
111
- run_p = subparsers.add_parser("run")
112
- run_p.add_argument("--key", required=True)
113
- run_p.add_argument("--fragment", required=True)
114
- run_p.add_argument("--cmd", required=True)
115
- run_p.add_argument("--ignore-expiry", action="store_true")
116
-
117
- args = parser.parse_args()
118
-
119
- if args.command == "seal":
120
- bridge = MoltCipherBridge(shared_key=args.key)
121
- intent_data = None
122
-
123
- if args.file:
124
- if not os.path.exists(args.file):
125
- print(json.dumps({"success": False, "error": f"File not found: {args.file}"}))
126
- return
127
- with open(args.file, 'r') as f:
128
- try:
129
- intent_data = json.load(f)
130
- except:
131
- f.seek(0)
132
- intent_data = f.read().strip()
133
- elif args.data:
134
- try: intent_data = json.loads(args.data)
135
- except: intent_data = args.data
136
- else:
137
- print(json.dumps({"success": False, "error": "Must provide --data or --file"}))
138
- return
139
-
140
- print(json.dumps(bridge.seal_intent(args.sender, args.to, intent_data, ttl_seconds=args.ttl)))
141
-
142
- elif args.command == "unseal":
143
- bridge = MoltCipherBridge(shared_key=args.key)
144
- print(json.dumps(bridge.unseal_intent(json.loads(args.fragment), ignore_expiry=args.ignore_expiry)))
145
-
146
- elif args.command == "run":
147
- bridge = MoltCipherBridge(shared_key=args.key)
148
- print(json.dumps(bridge.execute_sealed_command(json.loads(args.fragment), args.cmd, ignore_expiry=args.ignore_expiry)))
149
-
150
- if __name__ == "__main__":
151
- cli()