create-agent 0.0.3 → 0.0.4

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,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Use nostr-tools to generate secure keypair
4
+ import { generateSecretKey, getPublicKey } from 'nostr-tools/pure';
5
+
6
+ // Generate cryptographically secure private key (32 bytes)
7
+ const privkey = generateSecretKey();
8
+
9
+ // Convert Uint8Array to hex string
10
+ const privkeyHex = Array.from(privkey)
11
+ .map(b => b.toString(16).padStart(2, '0'))
12
+ .join('');
13
+
14
+ // Derive public key using Schnorr signatures (32 bytes, hex encoded)
15
+ const pubkey = getPublicKey(privkey);
16
+
17
+ // Cool console message
18
+ console.error('\x1b[36m%s\x1b[0m', '🤖 Creating new agent...');
19
+ console.error('\x1b[33m%s\x1b[0m', '⚠️ Keep your private key secret!');
20
+ console.error('');
21
+
22
+ // Output JSON with both keys
23
+ console.log(JSON.stringify({
24
+ privkey: privkeyHex,
25
+ pubkey: pubkey
26
+ }, null, 2));
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "create-agent",
3
- "version": "0.0.3",
3
+ "type": "module",
4
+ "version": "0.0.4",
4
5
  "description": "create an agent",
5
6
  "main": "index.js",
6
7
  "scripts": {
7
8
  "test": "echo \"Error: no test specified\" && exit 1"
8
9
  },
9
10
  "bin": {
10
- "create-agent": "bin/create-agent"
11
+ "create-agent": "bin/create-agent.js"
11
12
  },
12
13
  "repository": {
13
14
  "type": "git",
@@ -23,5 +24,8 @@
23
24
  "aam",
24
25
  "create-agent",
25
26
  "agent"
26
- ]
27
- }
27
+ ],
28
+ "dependencies": {
29
+ "nostr-tools": "^2.10.4"
30
+ }
31
+ }
package/bin/create-agent DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- echo "init agent: coming soon..."