buzzster 1.0.1 → 1.0.2

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/.env.example CHANGED
@@ -1,7 +1,7 @@
1
1
  # Buzzster Client - Configuration
2
2
 
3
3
  # Central API
4
- BUZZSTER_API=https://api.buzzster.xyz
4
+ BIOFIREWALL_API=http://localhost:3333
5
5
 
6
6
  # Client Options
7
7
  BLOCK_BROWSERS=true
package/README.md CHANGED
@@ -13,26 +13,26 @@ Express middleware to protect your routes with agent authentication.
13
13
  ## Installation
14
14
 
15
15
  ```bash
16
- npm install Buzzster-client
16
+ npm install buzzster-client
17
17
  ```
18
18
 
19
19
  ## Quick Start
20
20
 
21
21
  ```javascript
22
22
  const express = require('express');
23
- const Buzzster = require('Buzzster-client');
23
+ const Buzzster = require('buzzster-client');
24
24
 
25
25
  const app = express();
26
26
 
27
27
  // Create middleware
28
- const Buzzster = new Buzzster({
29
- apiUrl: 'http://localhost:3333', // Central API
28
+ const buzzster = new Buzzster({
29
+ apiUrl: 'https://api.buzzster.xyz', // Central API
30
30
  blockBrowsers: true,
31
31
  enforceAuthentication: true
32
32
  });
33
33
 
34
34
  // Apply to all routes
35
- app.use(Buzzster);
35
+ app.use(buzzster);
36
36
 
37
37
  // Now only agents can access
38
38
  app.get('/api/secret', (req, res) => {
@@ -48,9 +48,9 @@ app.listen(8080);
48
48
  ## Configuration Options
49
49
 
50
50
  ```javascript
51
- const Buzzster = new Buzzster({
51
+ const buzzster = new Buzzster({
52
52
  // Required
53
- apiUrl: 'http://localhost:3333',
53
+ apiUrl: 'https://api.buzzster.xyz',
54
54
 
55
55
  // Optional
56
56
  blockBrowsers: true, // Block User-Agent that look like browsers
@@ -100,7 +100,7 @@ Reduces API calls during request burst
100
100
 
101
101
  ```javascript
102
102
  const express = require('express');
103
- const Buzzster = require('Buzzster-client');
103
+ const Buzzster = require('buzzster-client');
104
104
 
105
105
  const app = express();
106
106
  const publicRoutes = require('./routes/public');
@@ -110,8 +110,8 @@ const agentOnlyRoutes = require('./routes/agent-only');
110
110
  app.use('/public', publicRoutes);
111
111
 
112
112
  // Apply Buzzster middleware
113
- const Buzzster = new Buzzster('http://localhost:3333');
114
- app.use('/api', Buzzster, agentOnlyRoutes);
113
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
114
+ app.use('/api', buzzster, agentOnlyRoutes);
115
115
 
116
116
  app.listen(8080);
117
117
  ```
@@ -119,10 +119,10 @@ app.listen(8080);
119
119
  ### Custom Error Handling
120
120
 
121
121
  ```javascript
122
- const Buzzster = new Buzzster('http://localhost:3333');
122
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
123
123
 
124
124
  app.use((req, res, next) => {
125
- Buzzster(req, res, (err) => {
125
+ buzzster(req, res, (err) => {
126
126
  if (err) {
127
127
  // Custom error handling
128
128
  console.error('Auth error:', err);
@@ -228,10 +228,10 @@ By default, token verification results are cached for 30 seconds:
228
228
  // during request bursts
229
229
 
230
230
  // Clear all cache
231
- Buzzster.clearCache();
231
+ buzzster.clearCache();
232
232
 
233
233
  // Clear specific token
234
- Buzzster.clearCacheEntry(agentId, token);
234
+ buzzster.clearCacheEntry(agentId, token);
235
235
  ```
236
236
 
237
237
  ## Performance Notes
@@ -283,10 +283,10 @@ describe('Protected endpoint', () => {
283
283
  ### "Cannot connect to central API"
284
284
  ```javascript
285
285
  // Check API URL
286
- const Buzzster = new Buzzster('http://localhost:3333');
286
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
287
287
 
288
288
  // Verify API is running
289
- curl http://localhost:3333/health
289
+ curl https://api.buzzster.xyz/health
290
290
  ```
291
291
 
292
292
  ### "Token always invalid"
@@ -321,5 +321,5 @@ MIT
321
321
 
322
322
  - 📖 [SKILL.md](../SKILL.md) — Full developer guide
323
323
  - 🏗️ [ARCHITECTURE.md](../ARCHITECTURE.md) — System design
324
- - 🛡️ [Buzzster-api](../Buzzster-api) — Central API server
325
- - 🔗 GitHub: https://github.com/openclaw/Buzzster
324
+ - 🛡️ [buzzster-api](../buzzster-api) — Central API server
325
+ - 🔗 GitHub: https://github.com/openclaw/buzzster
package/SKILL.md CHANGED
@@ -1,9 +1,9 @@
1
1
  ---
2
- name: Buzzster-client
2
+ name: buzzster-client
3
3
  version: 3.0.0
4
4
  description: Express middleware to protect your APIs with agent authentication.
5
- homepage: https://github.com/openclaw/Buzzster
6
- metadata: {"Buzzster-client":{"emoji":"🔒","category":"security"}}
5
+ homepage: https://github.com/openclaw/buzzster
6
+ metadata: {"buzzster-client":{"emoji":"🔒","category":"security"}}
7
7
  ---
8
8
 
9
9
  # Buzzster Client 🔒 SKILL.md
@@ -12,7 +12,7 @@ metadata: {"Buzzster-client":{"emoji":"🔒","category":"security"}}
12
12
 
13
13
  ---
14
14
 
15
- ## What Is Buzzster-client?
15
+ ## What Is buzzster-client?
16
16
 
17
17
  An Express middleware that:
18
18
  1. **Blocks browsers** (User-Agent detection)
@@ -28,7 +28,7 @@ An Express middleware that:
28
28
  ## Installation
29
29
 
30
30
  ```bash
31
- npm install Buzzster-client
31
+ npm install buzzster-client
32
32
  ```
33
33
 
34
34
  ---
@@ -39,15 +39,15 @@ npm install Buzzster-client
39
39
 
40
40
  ```javascript
41
41
  const express = require('express');
42
- const Buzzster = require('Buzzster-client');
42
+ const Buzzster = require('buzzster-client');
43
43
 
44
44
  const app = express();
45
45
 
46
46
  // Create middleware
47
- const Buzzster = new Buzzster('http://localhost:3333');
47
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
48
48
 
49
49
  // Protect all routes
50
- app.use(Buzzster);
50
+ app.use(buzzster);
51
51
 
52
52
  // Now only agents can access
53
53
  app.get('/api/secret', (req, res) => {
@@ -82,9 +82,9 @@ curl http://localhost:8080/api/secret \
82
82
  ## Configuration
83
83
 
84
84
  ```javascript
85
- const Buzzster = new Buzzster({
85
+ const buzzster = new Buzzster({
86
86
  // Required
87
- apiUrl: 'http://localhost:3333',
87
+ apiUrl: 'https://api.buzzster.xyz',
88
88
 
89
89
  // Optional
90
90
  blockBrowsers: true, // Block User-Agents that look like browsers
@@ -93,7 +93,7 @@ const Buzzster = new Buzzster({
93
93
  cacheTTL: 30000 // Cache time-to-live (milliseconds)
94
94
  });
95
95
 
96
- app.use(Buzzster);
96
+ app.use(buzzster);
97
97
  ```
98
98
 
99
99
  ### Configuration Options
@@ -165,10 +165,10 @@ Request 4 (07:00:35) → API call ~20ms (cache expired)
165
165
 
166
166
  ```javascript
167
167
  const express = require('express');
168
- const Buzzster = require('Buzzster-client');
168
+ const Buzzster = require('buzzster-client');
169
169
 
170
170
  const app = express();
171
- const Buzzster = new Buzzster('http://localhost:3333');
171
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
172
172
 
173
173
  // Public routes (no auth)
174
174
  app.get('/', (req, res) => {
@@ -176,14 +176,14 @@ app.get('/', (req, res) => {
176
176
  });
177
177
 
178
178
  // Protected routes (auth required)
179
- app.get('/api/secret', Buzzster, (req, res) => {
179
+ app.get('/api/secret', buzzster, (req, res) => {
180
180
  res.json({
181
181
  message: 'Secret data',
182
182
  agent: req.agent
183
183
  });
184
184
  });
185
185
 
186
- app.post('/api/data', Buzzster, (req, res) => {
186
+ app.post('/api/data', buzzster, (req, res) => {
187
187
  res.json({
188
188
  success: true,
189
189
  agent: req.agent.id
@@ -197,7 +197,7 @@ app.listen(8080);
197
197
 
198
198
  ```javascript
199
199
  const app = express();
200
- const Buzzster = new Buzzster('http://localhost:3333');
200
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
201
201
 
202
202
  // Health check (no auth)
203
203
  app.get('/health', (req, res) => {
@@ -205,7 +205,7 @@ app.get('/health', (req, res) => {
205
205
  });
206
206
 
207
207
  // Protect everything else
208
- app.use(Buzzster);
208
+ app.use(buzzster);
209
209
 
210
210
  app.get('/api/data', (req, res) => {
211
211
  res.json({ agent: req.agent.name });
@@ -215,7 +215,7 @@ app.get('/api/data', (req, res) => {
215
215
  ### Access Agent Information
216
216
 
217
217
  ```javascript
218
- app.get('/api/profile', Buzzster, (req, res) => {
218
+ app.get('/api/profile', buzzster, (req, res) => {
219
219
  // req.agent is populated by middleware
220
220
  res.json({
221
221
  you: req.agent.name,
@@ -229,10 +229,10 @@ app.get('/api/profile', Buzzster, (req, res) => {
229
229
  ### Custom Error Handling
230
230
 
231
231
  ```javascript
232
- const Buzzster = new Buzzster('http://localhost:3333');
232
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
233
233
 
234
234
  app.use((req, res, next) => {
235
- Buzzster(req, res, (err) => {
235
+ buzzster(req, res, (err) => {
236
236
  if (err) {
237
237
  // Custom error handling
238
238
  console.error('Auth error:', err);
@@ -249,10 +249,10 @@ app.use((req, res, next) => {
249
249
  ### With Route Guards
250
250
 
251
251
  ```javascript
252
- const Buzzster = new Buzzster('http://localhost:3333');
252
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
253
253
 
254
254
  // Middleware
255
- const requireAgent = Buzzster;
255
+ const requireAgent = buzzster;
256
256
 
257
257
  const requireAdmin = (req, res, next) => {
258
258
  if (req.agent.permissions.includes('admin')) {
@@ -317,7 +317,7 @@ X-Bio-Version: 3.0
317
317
  Use these in your code:
318
318
 
319
319
  ```javascript
320
- app.get('/api/secret', Buzzster, (req, res) => {
320
+ app.get('/api/secret', buzzster, (req, res) => {
321
321
  const headers = res.getHeaders();
322
322
  console.log(headers['x-bio-verified']); // 'true'
323
323
  console.log(headers['x-bio-agent-name']); // 'MyAgent'
@@ -431,7 +431,7 @@ const newToken = crypto.createToken(privateKey, agentId, metadata, 3600);
431
431
 
432
432
  **Fix:** Register agent first:
433
433
  ```bash
434
- curl -X POST http://localhost:3333/register \
434
+ curl -X POST https://api.buzzster.xyz/register \
435
435
  -d '{"publicKey": "...", "metadata": {...}}'
436
436
  ```
437
437
 
@@ -446,11 +446,11 @@ By default, token verification results are cached for 30 seconds locally:
446
446
  // Typical cache hit rate: 95%+ for normal usage
447
447
 
448
448
  // Clear all cache (if needed)
449
- Buzzster.clearCache?.();
449
+ buzzster.clearCache?.();
450
450
 
451
451
  // Or disable caching
452
- const Buzzster = new Buzzster({
453
- apiUrl: 'http://localhost:3333',
452
+ const buzzster = new Buzzster({
453
+ apiUrl: 'https://api.buzzster.xyz',
454
454
  cacheTokens: false // No local caching
455
455
  });
456
456
  ```
@@ -471,14 +471,14 @@ Agent request (Layer 2 API): ~20ms (central API call)
471
471
 
472
472
  1. **Reuse middleware instance:**
473
473
  ```javascript
474
- const Buzzster = new Buzzster('http://localhost:3333');
475
- app.use('/api', Buzzster); // Single instance
474
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
475
+ app.use('/api', buzzster); // Single instance
476
476
  ```
477
477
 
478
478
  2. **Use token caching (default):**
479
479
  ```javascript
480
- const Buzzster = new Buzzster({
481
- apiUrl: 'http://localhost:3333',
480
+ const buzzster = new Buzzster({
481
+ apiUrl: 'https://api.buzzster.xyz',
482
482
  cacheTokens: true, // Default: ON
483
483
  cacheTTL: 30000 // 30 seconds
484
484
  });
@@ -578,10 +578,10 @@ curl -v \
578
578
 
579
579
  ```javascript
580
580
  // Check API URL
581
- const Buzzster = new Buzzster('http://localhost:3333');
581
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
582
582
 
583
583
  // Verify API is running
584
- curl http://localhost:3333/health
584
+ curl https://api.buzzster.xyz/health
585
585
 
586
586
  // Check firewall rules
587
587
  # Allow traffic on 3333
@@ -594,7 +594,7 @@ curl http://localhost:3333/health
594
594
  const token = jwt.sign(payload, privateKey, { algorithm: 'RS256' });
595
595
 
596
596
  // Verify agent is registered
597
- curl http://localhost:3333/agents/agent_abc123
597
+ curl https://api.buzzster.xyz/agents/agent_abc123
598
598
 
599
599
  // Check token not expired (max 1 hour old)
600
600
  ```
@@ -622,12 +622,12 @@ curl -v \
622
622
 
623
623
  ```javascript
624
624
  const express = require('express');
625
- const Buzzster = require('Buzzster-client');
625
+ const Buzzster = require('buzzster-client');
626
626
 
627
627
  const app = express();
628
628
 
629
629
  // Setup
630
- const Buzzster = new Buzzster('http://localhost:3333');
630
+ const buzzster = new Buzzster('https://api.buzzster.xyz');
631
631
 
632
632
  // Middleware
633
633
  app.use(express.json());
@@ -645,7 +645,7 @@ app.get('/', (req, res) => {
645
645
  });
646
646
 
647
647
  // Protected routes
648
- app.get('/api/secret', Buzzster, (req, res) => {
648
+ app.get('/api/secret', buzzster, (req, res) => {
649
649
  res.json({
650
650
  message: 'Secret data',
651
651
  agent: {
@@ -656,7 +656,7 @@ app.get('/api/secret', Buzzster, (req, res) => {
656
656
  });
657
657
  });
658
658
 
659
- app.post('/api/data', Buzzster, (req, res) => {
659
+ app.post('/api/data', buzzster, (req, res) => {
660
660
  res.json({
661
661
  success: true,
662
662
  message: 'Data received',
@@ -677,7 +677,7 @@ app.use((err, req, res, next) => {
677
677
  const PORT = process.env.PORT || 8080;
678
678
  app.listen(PORT, () => {
679
679
  console.log(`🔒 Protected API running on port ${PORT}`);
680
- console.log(` Central API: http://localhost:3333`);
680
+ console.log(` Central API: https://api.buzzster.xyz`);
681
681
  });
682
682
  ```
683
683
 
@@ -697,7 +697,7 @@ RUN npm install
697
697
 
698
698
  COPY . .
699
699
 
700
- ENV Buzzster_API=http://Buzzster-api:3333
700
+ ENV BIOFIREWALL_API=http://buzzster-api:3333
701
701
  ENV PORT=8080
702
702
 
703
703
  EXPOSE 8080
@@ -708,7 +708,7 @@ CMD ["npm", "start"]
708
708
  ### Environment Variables
709
709
 
710
710
  ```bash
711
- Buzzster_API=http://localhost:3333
711
+ BIOFIREWALL_API=https://api.buzzster.xyz
712
712
  NODE_ENV=production
713
713
  PORT=8080
714
714
  ```
@@ -736,14 +736,14 @@ PORT=8080
736
736
 
737
737
  ## FAQ
738
738
 
739
- **Q: Can I use Buzzster-client without central API?**
739
+ **Q: Can I use buzzster-client without central API?**
740
740
  A: No. It requires a running central API for token verification.
741
741
 
742
742
  **Q: How do I set up central API?**
743
- A: See `/Buzzster-api/README.md` or `npm install Buzzster-api`.
743
+ A: See `/buzzster-api/README.md` or `npm install buzzster-api`.
744
744
 
745
745
  **Q: Can I customize error messages?**
746
- A: Yes, implement custom middleware before Buzzster.
746
+ A: Yes, implement custom middleware before buzzster.
747
747
 
748
748
  **Q: How do I handle 404 from central API?**
749
749
  A: Middleware will return 500. Ensure central API is reachable.
@@ -755,10 +755,10 @@ A: Yes! That's the point. Central API is shared.
755
755
 
756
756
  ## Support
757
757
 
758
- - 📖 [Buzzster-api/SKILL.md](../Buzzster-api/SKILL.md) — Agent registration guide
759
- - 💓 [Buzzster-api/HEARTBEAT.md](../Buzzster-api/HEARTBEAT.md) — Agent activity routine
758
+ - 📖 [buzzster-api/SKILL.md](../buzzster-api/SKILL.md) — Agent registration guide
759
+ - 💓 [buzzster-api/HEARTBEAT.md](../buzzster-api/HEARTBEAT.md) — Agent activity routine
760
760
  - 🏗️ [ARCHITECTURE.md](../ARCHITECTURE.md) — System design
761
- - 🔗 GitHub: https://github.com/openclaw/Buzzster
761
+ - 🔗 GitHub: https://github.com/openclaw/buzzster
762
762
 
763
763
  ---
764
764
 
package/client.js CHANGED
@@ -20,7 +20,7 @@ class BuzzsterClient {
20
20
  timeout: this.timeout,
21
21
  headers: {
22
22
  'Content-Type': 'application/json',
23
- 'User-Agent': 'BuzzsterClient/1.0'
23
+ 'User-Agent': 'BuzzsterClient/3.0'
24
24
  }
25
25
  });
26
26
  }
package/middleware.js CHANGED
@@ -60,6 +60,7 @@ function createMiddleware(options = {}) {
60
60
  'X-Bio-Token': 'JWT token signed with your private key'
61
61
  }
62
62
  },
63
+ documentation: 'https://github.com/openclaw/buzzster',
63
64
  hint: 'Register your agent first at POST /register'
64
65
  });
65
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "buzzster",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Buzzster Client - Express middleware to protect routes with agent authentication",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "authentication",
15
15
  "agents"
16
16
  ],
17
- "author": "Comma",
17
+ "author": "OpenClaw Community",
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
20
  "axios": "^1.6.0",
package/setup.sh CHANGED
@@ -16,14 +16,14 @@ echo "✅ Node.js $(node --version)"
16
16
  # Check if already in a project with express
17
17
  if ! grep -q "\"express\"" package.json 2>/dev/null; then
18
18
  echo "⚠️ This is a module. Use in your Express project:"
19
- echo " npm install Buzzster-client"
19
+ echo " npm install buzzster-client"
20
20
  exit 0
21
21
  fi
22
22
 
23
- # Install Buzzster-client
23
+ # Install buzzster-client
24
24
  echo ""
25
- echo "📦 Installing Buzzster-client..."
26
- npm install Buzzster-client
25
+ echo "📦 Installing buzzster-client..."
26
+ npm install buzzster-client
27
27
 
28
28
  # Create .env if doesn't exist
29
29
  if [ ! -f .env ]; then
@@ -42,7 +42,7 @@ echo "Next steps:"
42
42
  echo "1. Update .env with your configuration"
43
43
  echo "2. Add middleware to your Express app:"
44
44
  echo ""
45
- echo " const Buzzster = require('Buzzster-client');"
45
+ echo " const Buzzster = require('buzzster-client');"
46
46
  echo " const bio = new Buzzster('http://localhost:3333');"
47
47
  echo " app.use(bio);"
48
48
  echo ""