@i4ctime/q-ring 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +286 -0
- package/dist/index.js +1525 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.js +1339 -0
- package/dist/mcp.js.map +1 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) 2026 I4cTime
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to use,
|
|
5
|
+
copy, modify, and merge the Software for their own use only, subject to the
|
|
6
|
+
following conditions:
|
|
7
|
+
|
|
8
|
+
You may not publish, distribute, sublicense, or sell copies of the Software
|
|
9
|
+
or any derivative work, in source or binary form, without explicit written
|
|
10
|
+
permission from the copyright holder.
|
|
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,286 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="./assets/logo.png" alt="q-ring logo" width="100%" />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
# q-ring
|
|
6
|
+
|
|
7
|
+
Quantum keyring for AI coding tools — Cursor, Kiro, Claude Code, and more.
|
|
8
|
+
|
|
9
|
+
Secrets are stored in your OS native keyring (macOS Keychain, GNOME/KDE Keyring, Windows Credential Manager). q-ring layers quantum mechanics concepts on top to create a secret management system that's actually novel: superposition, entanglement, decay, tunneling, teleportation, and an autonomous agent.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g q-ring
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Store a secret
|
|
21
|
+
qring set OPENAI_API_KEY sk-...
|
|
22
|
+
|
|
23
|
+
# Retrieve it
|
|
24
|
+
qring get OPENAI_API_KEY
|
|
25
|
+
|
|
26
|
+
# List all keys (values are never shown)
|
|
27
|
+
qring list
|
|
28
|
+
|
|
29
|
+
# Generate a cryptographic secret
|
|
30
|
+
qring generate --format api-key --prefix "sk-" --save MY_KEY
|
|
31
|
+
|
|
32
|
+
# Check health of all secrets
|
|
33
|
+
qring health
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quantum Features
|
|
37
|
+
|
|
38
|
+
### Superposition — One Key, Multiple Environments
|
|
39
|
+
|
|
40
|
+
A single secret can hold different values for dev, staging, and prod simultaneously. The correct value resolves based on your current context.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Set environment-specific values
|
|
44
|
+
qring set API_KEY "sk-dev-123" --env dev
|
|
45
|
+
qring set API_KEY "sk-stg-456" --env staging
|
|
46
|
+
qring set API_KEY "sk-prod-789" --env prod
|
|
47
|
+
|
|
48
|
+
# Value resolves based on context
|
|
49
|
+
QRING_ENV=prod qring get API_KEY # → sk-prod-789
|
|
50
|
+
QRING_ENV=dev qring get API_KEY # → sk-dev-123
|
|
51
|
+
|
|
52
|
+
# Inspect the quantum state
|
|
53
|
+
qring inspect API_KEY
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Wavefunction Collapse — Smart Environment Detection
|
|
57
|
+
|
|
58
|
+
q-ring auto-detects your environment without explicit flags. Resolution order:
|
|
59
|
+
|
|
60
|
+
1. `--env` flag
|
|
61
|
+
2. `QRING_ENV` environment variable
|
|
62
|
+
3. `NODE_ENV` environment variable
|
|
63
|
+
4. Git branch heuristics (`main`/`master` → prod, `develop` → dev)
|
|
64
|
+
5. `.q-ring.json` project config
|
|
65
|
+
6. Default environment from the secret
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# See what environment q-ring detects
|
|
69
|
+
qring env
|
|
70
|
+
|
|
71
|
+
# Project config (.q-ring.json)
|
|
72
|
+
echo '{"env": "staging", "branchMap": {"release/*": "staging"}}' > .q-ring.json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Quantum Decay — Secrets with TTL
|
|
76
|
+
|
|
77
|
+
Secrets can have a time-to-live. Expired secrets are blocked from reads. Stale secrets (75%+ lifetime) trigger warnings.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Set a secret that expires in 1 hour
|
|
81
|
+
qring set SESSION_TOKEN "tok-..." --ttl 3600
|
|
82
|
+
|
|
83
|
+
# Set with explicit expiry
|
|
84
|
+
qring set CERT_KEY "..." --expires "2026-06-01T00:00:00Z"
|
|
85
|
+
|
|
86
|
+
# Health check shows decay status
|
|
87
|
+
qring health
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Observer Effect — Audit Everything
|
|
91
|
+
|
|
92
|
+
Every secret read, write, and delete is logged. Access patterns are tracked for anomaly detection.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# View audit log
|
|
96
|
+
qring audit
|
|
97
|
+
qring audit --key OPENAI_KEY --limit 50
|
|
98
|
+
|
|
99
|
+
# Detect anomalies (burst access, unusual hours)
|
|
100
|
+
qring audit --anomalies
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Quantum Noise — Secret Generation
|
|
104
|
+
|
|
105
|
+
Generate cryptographically strong secrets in common formats.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
qring generate # API key (default)
|
|
109
|
+
qring generate --format password -l 32 # Strong password
|
|
110
|
+
qring generate --format uuid # UUID v4
|
|
111
|
+
qring generate --format token # Base64url token
|
|
112
|
+
qring generate --format hex -l 64 # 64-byte hex
|
|
113
|
+
qring generate --format api-key --prefix "sk-live-" --save STRIPE_KEY
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Entanglement — Linked Secrets
|
|
117
|
+
|
|
118
|
+
Link secrets across projects. When you rotate one, all entangled copies update automatically.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Entangle two secrets
|
|
122
|
+
qring entangle API_KEY API_KEY_BACKUP
|
|
123
|
+
|
|
124
|
+
# Now updating API_KEY also updates API_KEY_BACKUP
|
|
125
|
+
qring set API_KEY "new-value"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Tunneling — Ephemeral Secrets
|
|
129
|
+
|
|
130
|
+
Create secrets that exist only in memory. They never touch disk. Optional TTL and max-read self-destruction.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Create an ephemeral secret (returns tunnel ID)
|
|
134
|
+
qring tunnel create "temporary-token-xyz" --ttl 300 --max-reads 1
|
|
135
|
+
|
|
136
|
+
# Read it (self-destructs after this read)
|
|
137
|
+
qring tunnel read tun_abc123
|
|
138
|
+
|
|
139
|
+
# List active tunnels
|
|
140
|
+
qring tunnel list
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Teleportation — Encrypted Sharing
|
|
144
|
+
|
|
145
|
+
Pack secrets into AES-256-GCM encrypted bundles for secure transfer between machines.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Pack secrets (prompts for passphrase)
|
|
149
|
+
qring teleport pack --keys "API_KEY,DB_PASS" > bundle.txt
|
|
150
|
+
|
|
151
|
+
# On another machine: unpack (prompts for passphrase)
|
|
152
|
+
cat bundle.txt | qring teleport unpack
|
|
153
|
+
|
|
154
|
+
# Preview without importing
|
|
155
|
+
qring teleport unpack <bundle> --dry-run
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Agent Mode — Autonomous Monitoring
|
|
159
|
+
|
|
160
|
+
A background daemon that continuously monitors secret health, detects anomalies, and optionally auto-rotates expired secrets.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Start the agent
|
|
164
|
+
qring agent --interval 60 --verbose
|
|
165
|
+
|
|
166
|
+
# With auto-rotation of expired secrets
|
|
167
|
+
qring agent --auto-rotate
|
|
168
|
+
|
|
169
|
+
# Single scan (for CI/cron)
|
|
170
|
+
qring agent --once
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## MCP Server
|
|
174
|
+
|
|
175
|
+
q-ring includes a full MCP server with 20 tools for AI agent integration.
|
|
176
|
+
|
|
177
|
+
### Core Tools
|
|
178
|
+
|
|
179
|
+
| Tool | Description |
|
|
180
|
+
|------|-------------|
|
|
181
|
+
| `get_secret` | Retrieve with superposition collapse + observer logging |
|
|
182
|
+
| `list_secrets` | List keys with quantum metadata (never exposes values) |
|
|
183
|
+
| `set_secret` | Store with optional TTL, env state, tags |
|
|
184
|
+
| `delete_secret` | Remove a secret |
|
|
185
|
+
| `has_secret` | Boolean check (respects decay) |
|
|
186
|
+
|
|
187
|
+
### Quantum Tools
|
|
188
|
+
|
|
189
|
+
| Tool | Description |
|
|
190
|
+
|------|-------------|
|
|
191
|
+
| `inspect_secret` | Full quantum state (states, decay, entanglement, access count) |
|
|
192
|
+
| `detect_environment` | Wavefunction collapse — detect current env context |
|
|
193
|
+
| `generate_secret` | Quantum noise — generate and optionally save secrets |
|
|
194
|
+
| `entangle_secrets` | Link two secrets for synchronized rotation |
|
|
195
|
+
|
|
196
|
+
### Tunneling Tools
|
|
197
|
+
|
|
198
|
+
| Tool | Description |
|
|
199
|
+
|------|-------------|
|
|
200
|
+
| `tunnel_create` | Create ephemeral in-memory secret |
|
|
201
|
+
| `tunnel_read` | Read (may self-destruct) |
|
|
202
|
+
| `tunnel_list` | List active tunnels |
|
|
203
|
+
| `tunnel_destroy` | Immediately destroy |
|
|
204
|
+
|
|
205
|
+
### Teleportation Tools
|
|
206
|
+
|
|
207
|
+
| Tool | Description |
|
|
208
|
+
|------|-------------|
|
|
209
|
+
| `teleport_pack` | Encrypt secrets into a portable bundle |
|
|
210
|
+
| `teleport_unpack` | Decrypt and import a bundle |
|
|
211
|
+
|
|
212
|
+
### Observer & Health Tools
|
|
213
|
+
|
|
214
|
+
| Tool | Description |
|
|
215
|
+
|------|-------------|
|
|
216
|
+
| `audit_log` | Query access history |
|
|
217
|
+
| `detect_anomalies` | Scan for unusual access patterns |
|
|
218
|
+
| `health_check` | Full health report |
|
|
219
|
+
| `agent_scan` | Run autonomous agent scan |
|
|
220
|
+
|
|
221
|
+
### Cursor / Kiro Configuration
|
|
222
|
+
|
|
223
|
+
Add to `.cursor/mcp.json` or `.kiro/mcp.json`:
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"mcpServers": {
|
|
228
|
+
"q-ring": {
|
|
229
|
+
"command": "node",
|
|
230
|
+
"args": ["/path/to/quantum_ring/dist/mcp.js"]
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Claude Code Configuration
|
|
237
|
+
|
|
238
|
+
Add to `~/.claude/claude_desktop_config.json`:
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"mcpServers": {
|
|
243
|
+
"q-ring": {
|
|
244
|
+
"command": "node",
|
|
245
|
+
"args": ["/path/to/quantum_ring/dist/mcp.js"]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Architecture
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
qring CLI ─────┐
|
|
255
|
+
├──▶ Core Engine ──▶ @napi-rs/keyring ──▶ OS Keyring
|
|
256
|
+
MCP Server ────┘ │
|
|
257
|
+
├── Envelope (quantum metadata)
|
|
258
|
+
├── Scope Resolver (global / project)
|
|
259
|
+
├── Collapse (env detection)
|
|
260
|
+
├── Observer (audit log)
|
|
261
|
+
├── Noise (secret generation)
|
|
262
|
+
├── Entanglement (cross-secret linking)
|
|
263
|
+
├── Tunnel (ephemeral in-memory)
|
|
264
|
+
├── Teleport (encrypted sharing)
|
|
265
|
+
└── Agent (autonomous monitor)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Project Config (`.q-ring.json`)
|
|
269
|
+
|
|
270
|
+
Optional per-project configuration:
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
{
|
|
274
|
+
"env": "dev",
|
|
275
|
+
"defaultEnv": "dev",
|
|
276
|
+
"branchMap": {
|
|
277
|
+
"main": "prod",
|
|
278
|
+
"develop": "dev",
|
|
279
|
+
"staging": "staging"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## License
|
|
285
|
+
|
|
286
|
+
MIT
|