create-agent 0.0.10 → 0.0.12

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