create-agent 0.0.5 → 0.0.7
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/README.md +113 -2
- package/bin/create-agent.js +11 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,2 +1,113 @@
|
|
|
1
|
-
# create-agent
|
|
2
|
-
|
|
1
|
+
# create-agent 🤖
|
|
2
|
+
|
|
3
|
+
A command-line tool to generate Agent keypairs with various encodings.
|
|
4
|
+
|
|
5
|
+
## Installation 📦
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g create-agent
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or simply run:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm create agent
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage 🚀
|
|
18
|
+
|
|
19
|
+
Simply run:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
create-agent
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The tool will generate a new Agent keypair and display it in various formats.
|
|
26
|
+
|
|
27
|
+
## Output Fields 🔑
|
|
28
|
+
|
|
29
|
+
The tool generates a JSON object containing:
|
|
30
|
+
|
|
31
|
+
### Private Key Formats
|
|
32
|
+
|
|
33
|
+
#### `privkey`
|
|
34
|
+
|
|
35
|
+
- 32-byte private key in hexadecimal format
|
|
36
|
+
- The private key of the Agent
|
|
37
|
+
- Used to sign Nostr events
|
|
38
|
+
- Example:
|
|
39
|
+
```
|
|
40
|
+
"7f7168866801e2003bfc6507f881783e23587d35ece7b1f1981891b9c9c26c55"
|
|
41
|
+
```
|
|
42
|
+
- ⚠️ **Keep this secret!**
|
|
43
|
+
|
|
44
|
+
#### `nsec`
|
|
45
|
+
|
|
46
|
+
- Bech32-encoded private key (starts with `nsec`)
|
|
47
|
+
- Human-friendly format
|
|
48
|
+
- Example:
|
|
49
|
+
```
|
|
50
|
+
"nsec1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3vk8rx"
|
|
51
|
+
```
|
|
52
|
+
- ⚠️ **Keep this secret!**
|
|
53
|
+
|
|
54
|
+
### Public Key Formats
|
|
55
|
+
|
|
56
|
+
#### `pubkey`
|
|
57
|
+
|
|
58
|
+
- 32-byte public key in hexadecimal format
|
|
59
|
+
- Derived from private key using Schnorr signatures
|
|
60
|
+
- Your identity in the Nostr network
|
|
61
|
+
- Example:
|
|
62
|
+
```
|
|
63
|
+
"06444f34c6c5f973d74b3c78214fd0bf694f0cf459651b2ffe651fa08ba00bf4"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### `npub`
|
|
67
|
+
|
|
68
|
+
- Bech32-encoded public key (starts with `npub`)
|
|
69
|
+
- Human-friendly format for sharing
|
|
70
|
+
- Example:
|
|
71
|
+
```
|
|
72
|
+
"npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Example Output 📝
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"privkey": "7f7168866801e2003bfc6507f881783e23587d35ece7b1f1981891b9c9c26c55",
|
|
80
|
+
"pubkey": "06444f34c6c5f973d74b3c78214fd0bf694f0cf459651b2ffe651fa08ba00bf4",
|
|
81
|
+
"nsec": "nsec1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3vk8rx",
|
|
82
|
+
"npub": "npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Security Notice 🔒
|
|
87
|
+
|
|
88
|
+
**Never share your private key!** Anyone with access to your private key (`privkey` or `nsec`) can:
|
|
89
|
+
|
|
90
|
+
- ✍️ Post messages as you
|
|
91
|
+
- 👤 Update your profile
|
|
92
|
+
- 👥 Follow/unfollow other users
|
|
93
|
+
- 📨 Send encrypted messages in your name
|
|
94
|
+
|
|
95
|
+
## About Nostr 📡
|
|
96
|
+
|
|
97
|
+
Nostr (Notes and Other Stuff Transmitted by Relays) is a decentralized social networking protocol. Each user is identified by a public key, and all actions are signed using their corresponding private key.
|
|
98
|
+
|
|
99
|
+
## Development 🛠️
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
git clone https://github.com/melvincarvalho/create-agent.git
|
|
103
|
+
cd create-agent
|
|
104
|
+
npm install
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## License 📄
|
|
108
|
+
|
|
109
|
+
MIT
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
Made with ❤️ for the [Agentic Alliance](https://agenticalliance.com/) community
|
package/bin/create-agent.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// Use nostr-tools to generate secure keypair
|
|
4
4
|
import { generateSecretKey, getPublicKey } from 'nostr-tools/pure';
|
|
5
|
+
import { nip19 } from 'nostr-tools';
|
|
5
6
|
|
|
6
7
|
// Generate cryptographically secure private key (32 bytes)
|
|
7
8
|
const privkey = generateSecretKey();
|
|
@@ -14,13 +15,21 @@ const privkeyHex = Array.from(privkey)
|
|
|
14
15
|
// Derive public key using Schnorr signatures (32 bytes, hex encoded)
|
|
15
16
|
const pubkey = getPublicKey(privkey);
|
|
16
17
|
|
|
18
|
+
// Encode the private key as nsec
|
|
19
|
+
const nsec = nip19.nsecEncode(privkey);
|
|
20
|
+
|
|
21
|
+
// Encode the public key as npub
|
|
22
|
+
const npub = nip19.npubEncode(pubkey);
|
|
23
|
+
|
|
17
24
|
// Cool console message
|
|
18
25
|
console.error('\x1b[36m%s\x1b[0m', '🤖 Creating new agent...');
|
|
19
26
|
console.error('\x1b[33m%s\x1b[0m', '⚠️ Keep your private key secret!');
|
|
20
27
|
console.error('');
|
|
21
28
|
|
|
22
|
-
// Output JSON with both keys
|
|
29
|
+
// Output JSON with both keys, nsec and npub
|
|
23
30
|
console.log(JSON.stringify({
|
|
24
31
|
privkey: privkeyHex,
|
|
25
|
-
pubkey: pubkey
|
|
32
|
+
pubkey: pubkey,
|
|
33
|
+
nsec: nsec,
|
|
34
|
+
npub: npub
|
|
26
35
|
}, null, 2));
|
package/package.json
CHANGED