create-agent 0.0.10 → 0.0.11

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.
@@ -17,7 +17,9 @@
17
17
  "Bash(gh api:*)",
18
18
  "WebFetch(domain:ai-sdk.dev)",
19
19
  "WebFetch(domain:github.com)",
20
- "Bash(git fetch:*)"
20
+ "Bash(git fetch:*)",
21
+ "Bash(gh repo fork:*)",
22
+ "Bash(node /home/melvin/agi/create-agent/bin/create-agent.js:*)"
21
23
  ]
22
24
  }
23
25
  }
package/README.md CHANGED
@@ -1,115 +1,201 @@
1
- # create-agent 🤖
1
+ # create-agent
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/create-agent.svg)](https://www.npmjs.com/package/create-agent)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-339933.svg)](https://nodejs.org/)
4
6
 
5
- A command-line tool to generate Agent keypairs with various encodings.
7
+ > **Your AI agent has no identity.** It can't prove who it is. It can't sign anything. It can't be trusted.
8
+ >
9
+ > Fix that in one command.
6
10
 
7
- ## Installation 📦
11
+ ```bash
12
+ npx create-agent
13
+ ```
14
+
15
+ Instantly generates a cryptographic identity with a [W3C DID document](https://www.w3.org/TR/did-core/) — the emerging standard for autonomous agent identity.
16
+
17
+ ---
18
+
19
+ ## Why create-agent?
20
+
21
+ AI agents and autonomous systems need verifiable identities. Traditional auth (API keys, OAuth) wasn't designed for machine-to-machine trust. **create-agent** provides:
22
+
23
+ - **Cryptographic Identity** — Schnorr keypairs on secp256k1
24
+ - **W3C Standards** — DID documents for interoperability
25
+ - **Decentralized** — No central authority, works with Nostr relays
26
+ - **Zero Config** — One command, instant identity
27
+
28
+ ---
29
+
30
+ ## Installation
8
31
 
9
32
  ```bash
33
+ # Run directly (no install)
34
+ npx create-agent
35
+
36
+ # Or install globally
10
37
  npm install -g create-agent
38
+
39
+ # Or as a dependency
40
+ npm install create-agent
11
41
  ```
12
42
 
13
- Or simply run:
43
+ ---
14
44
 
15
- ```bash
16
- npm create agent
45
+ ## CLI Output
46
+
47
+ The tool outputs a spec-compliant DID document to `stdout`:
48
+
49
+ ```json
50
+ {
51
+ "@context": [
52
+ "https://w3id.org/did",
53
+ "https://w3id.org/nostr/context"
54
+ ],
55
+ "id": "did:nostr:dd82687ee5a352c6d6de337bce53f150ca1567f3861475c74e7da62695931d23",
56
+ "type": "DIDNostr",
57
+ "verificationMethod": [
58
+ {
59
+ "id": "did:nostr:dd82687ee5a352c6d6de337bce53f150ca1567f3861475c74e7da62695931d23#key1",
60
+ "type": "Multikey",
61
+ "controller": "did:nostr:dd82687ee5a352c6d6de337bce53f150ca1567f3861475c74e7da62695931d23",
62
+ "publicKeyMultibase": "fe70102dd82687ee5a352c6d6de337bce53f150ca1567f3861475c74e7da62695931d23"
63
+ }
64
+ ],
65
+ "authentication": ["#key1"],
66
+ "assertionMethod": ["#key1"],
67
+ "service": []
68
+ }
17
69
  ```
18
70
 
19
- ## Usage 🚀
71
+ Key information is displayed on `stderr` for security (private keys in red).
20
72
 
21
- Simply run:
73
+ ---
22
74
 
23
- ```bash
24
- create-agent
75
+ ## Programmatic API
76
+
77
+ ```javascript
78
+ import { generateAgent } from 'create-agent'
79
+
80
+ const agent = generateAgent()
81
+
82
+ // Nostr keys
83
+ console.log(agent.pubkey) // hex public key
84
+ console.log(agent.npub) // bech32 public key
85
+ console.log(agent.privkey) // hex private key (keep secret)
86
+ console.log(agent.nsec) // bech32 private key (keep secret)
87
+
88
+ // W3C DID Document
89
+ console.log(agent.did.id) // did:nostr:<pubkey>
90
+ console.log(agent.did) // full DID document
25
91
  ```
26
92
 
27
- The tool will generate a new Agent keypair and display it in various formats.
93
+ ---
28
94
 
29
- ## Output Fields 🔑
95
+ ## CLI Examples
30
96
 
31
- The tool generates a JSON object containing:
97
+ ```bash
98
+ # Save DID document to file
99
+ create-agent > agent-identity.json
32
100
 
33
- ### Private Key Formats
101
+ # Extract DID identifier
102
+ create-agent | jq -r '.id'
34
103
 
35
- #### `privkey`
104
+ # Extract public key
105
+ create-agent | jq -r '.verificationMethod[0].publicKeyMultibase'
36
106
 
37
- - 32-byte private key in hexadecimal format
38
- - The private key of the Agent
39
- - Used to sign Nostr events
40
- - Example:
41
- ```
42
- "7f7168866801e2003bfc6507f881783e23587d35ece7b1f1981891b9c9c26c55"
43
- ```
44
- - ⚠️ **Keep this secret!**
107
+ # Suppress stderr, get only JSON
108
+ create-agent 2>/dev/null
109
+ ```
45
110
 
46
- #### `nsec`
111
+ ---
47
112
 
48
- - Bech32-encoded private key (starts with `nsec`)
49
- - Human-friendly format
50
- - Example:
51
- ```
52
- "nsec1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3vk8rx"
53
- ```
54
- - ⚠️ **Keep this secret!**
113
+ ## Output Reference
55
114
 
56
- ### Public Key Formats
115
+ ### Keys
57
116
 
58
- #### `pubkey`
117
+ | Field | Format | Description |
118
+ |-------|--------|-------------|
119
+ | `pubkey` | 64 hex chars | Public key (shareable) |
120
+ | `npub` | bech32 | Human-readable public key |
121
+ | `privkey` | 64 hex chars | Private key — **keep secret** |
122
+ | `nsec` | bech32 | Human-readable private key — **keep secret** |
59
123
 
60
- - 32-byte public key in hexadecimal format
61
- - Derived from private key using Schnorr signatures
62
- - Your identity in the Nostr network
63
- - Example:
64
- ```
65
- "06444f34c6c5f973d74b3c78214fd0bf694f0cf459651b2ffe651fa08ba00bf4"
66
- ```
124
+ ### DID Document
67
125
 
68
- #### `npub`
126
+ | Field | Value |
127
+ |-------|-------|
128
+ | `@context` | W3C DID v1 + Nostr context |
129
+ | `id` | `did:nostr:<pubkey>` |
130
+ | `type` | `DIDNostr` |
131
+ | `verificationMethod` | Multikey with secp256k1 |
132
+ | `authentication` | `#key1` reference |
133
+ | `assertionMethod` | `#key1` reference |
69
134
 
70
- - Bech32-encoded public key (starts with `npub`)
71
- - Human-friendly format for sharing
72
- - Example:
73
- ```
74
- "npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m"
75
- ```
135
+ ### Multibase Encoding
76
136
 
77
- ## Example Output 📝
137
+ The `publicKeyMultibase` follows multicodec standards:
78
138
 
79
- ```json
80
- {
81
- "privkey": "7f7168866801e2003bfc6507f881783e23587d35ece7b1f1981891b9c9c26c55",
82
- "pubkey": "06444f34c6c5f973d74b3c78214fd0bf694f0cf459651b2ffe651fa08ba00bf4",
83
- "nsec": "nsec1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3vk8rx",
84
- "npub": "npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m"
85
- }
86
139
  ```
140
+ fe70102<pubkey>
141
+ │└───┘└┘└─────┘
142
+ │ │ │ └── 32-byte x-coordinate
143
+ │ │ └────── 02 compressed key prefix
144
+ │ └────────── e701 secp256k1-pub varint
145
+ └───────────── f base16-lower prefix
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Use Cases
151
+
152
+ | Application | Description |
153
+ |-------------|-------------|
154
+ | **AI Agents** | Verifiable identity for autonomous systems |
155
+ | **Nostr Bots** | Generate keypairs for automated accounts |
156
+ | **Testing** | Create ephemeral identities for integration tests |
157
+ | **Credentials** | Subject identifiers for Verifiable Credentials |
158
+
159
+ ---
160
+
161
+ ## Security
87
162
 
88
- ## Security Notice 🔒
163
+ Private keys (`privkey`, `nsec`) are cryptographic secrets. Exposure allows:
89
164
 
90
- **Never share your private key!** Anyone with access to your private key (`privkey` or `nsec`) can:
165
+ - Signing messages as the identity
166
+ - Accessing encrypted communications
167
+ - Full impersonation
91
168
 
92
- - ✍️ Post messages as you
93
- - 👤 Update your profile
94
- - 👥 Follow/unfollow other users
95
- - 📨 Send encrypted messages in your name
169
+ The CLI outputs private keys to `stderr` only, allowing safe piping of the DID document.
170
+
171
+ ---
96
172
 
97
- ## About Nostr 📡
173
+ ## Specification
174
+
175
+ This implementation follows the [did:nostr Method Specification](https://nostrcg.github.io/did-nostr/) maintained by the [W3C Nostr Community Group](https://www.w3.org/community/nostr/).
176
+
177
+ ---
98
178
 
99
- 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.
179
+ ## Related
100
180
 
101
- ## Development 🛠️
181
+ - [did:nostr Specification](https://nostrcg.github.io/did-nostr/)
182
+ - [DID:nostr Explorer](https://nostrapps.github.io/did-explorer/)
183
+ - [nostr-tools](https://github.com/nbd-wtf/nostr-tools)
184
+ - [W3C DID Core](https://www.w3.org/TR/did-core/)
185
+
186
+ ---
187
+
188
+ ## Development
102
189
 
103
190
  ```bash
104
191
  git clone https://github.com/melvincarvalho/create-agent.git
105
192
  cd create-agent
106
193
  npm install
194
+ npm test
107
195
  ```
108
196
 
109
- ## License 📄
110
-
111
- MIT
112
-
113
197
  ---
114
198
 
115
- Made with ❤️ for the [Agentic Alliance](https://agenticalliance.com/) community
199
+ ## License
200
+
201
+ MIT — [Agentic Alliance](https://agenticalliance.com/)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-agent",
3
3
  "type": "module",
4
- "version": "0.0.10",
4
+ "version": "0.0.11",
5
5
  "description": "create an agent",
6
6
  "scripts": {
7
7
  "test": "node --test"