@beclab/olaresid 0.1.1 → 0.1.3
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/CLI.md +1300 -0
- package/README.md +40 -31
- package/TAG.md +589 -0
- package/dist/abi/RootResolver2ABI.d.ts +54 -0
- package/dist/abi/RootResolver2ABI.d.ts.map +1 -0
- package/dist/abi/RootResolver2ABI.js +240 -0
- package/dist/abi/RootResolver2ABI.js.map +1 -0
- package/dist/business/index.d.ts +302 -0
- package/dist/business/index.d.ts.map +1 -0
- package/dist/business/index.js +1211 -0
- package/dist/business/index.js.map +1 -0
- package/dist/business/tag-context.d.ts +219 -0
- package/dist/business/tag-context.d.ts.map +1 -0
- package/dist/business/tag-context.js +560 -0
- package/dist/business/tag-context.js.map +1 -0
- package/dist/cli.js +2102 -39
- package/dist/cli.js.map +1 -1
- package/dist/debug.d.ts.map +1 -1
- package/dist/debug.js +14 -2
- package/dist/debug.js.map +1 -1
- package/dist/index.d.ts +51 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -12
- package/dist/index.js.map +1 -1
- package/dist/utils/crypto-utils.d.ts +130 -0
- package/dist/utils/crypto-utils.d.ts.map +1 -0
- package/dist/utils/crypto-utils.js +402 -0
- package/dist/utils/crypto-utils.js.map +1 -0
- package/dist/utils/error-parser.d.ts +35 -0
- package/dist/utils/error-parser.d.ts.map +1 -0
- package/dist/utils/error-parser.js +202 -0
- package/dist/utils/error-parser.js.map +1 -0
- package/dist/utils/olares-id.d.ts +36 -0
- package/dist/utils/olares-id.d.ts.map +1 -0
- package/dist/utils/olares-id.js +52 -0
- package/dist/utils/olares-id.js.map +1 -0
- package/dist/utils/tag-abi-codec.d.ts +69 -0
- package/dist/utils/tag-abi-codec.d.ts.map +1 -0
- package/dist/utils/tag-abi-codec.js +144 -0
- package/dist/utils/tag-abi-codec.js.map +1 -0
- package/dist/utils/tag-type-builder.d.ts +158 -0
- package/dist/utils/tag-type-builder.d.ts.map +1 -0
- package/dist/utils/tag-type-builder.js +410 -0
- package/dist/utils/tag-type-builder.js.map +1 -0
- package/examples/crypto-utilities.ts +140 -0
- package/examples/domain-context.ts +80 -0
- package/examples/generate-mnemonic.ts +149 -0
- package/examples/index.ts +1 -1
- package/examples/ip.ts +171 -0
- package/examples/legacy.ts +10 -10
- package/examples/list-wallets.ts +81 -0
- package/examples/olares-id-format.ts +197 -0
- package/examples/quasar-demo/.eslintrc.js +23 -0
- package/examples/quasar-demo/.quasar/app.js +43 -0
- package/examples/quasar-demo/.quasar/client-entry.js +38 -0
- package/examples/quasar-demo/.quasar/client-prefetch.js +130 -0
- package/examples/quasar-demo/.quasar/quasar-user-options.js +16 -0
- package/examples/quasar-demo/README.md +49 -0
- package/examples/quasar-demo/index.html +11 -0
- package/examples/quasar-demo/package-lock.json +6407 -0
- package/examples/quasar-demo/package.json +36 -0
- package/examples/quasar-demo/quasar.config.js +73 -0
- package/examples/quasar-demo/src/App.vue +13 -0
- package/examples/quasar-demo/src/css/app.scss +1 -0
- package/examples/quasar-demo/src/layouts/MainLayout.vue +21 -0
- package/examples/quasar-demo/src/pages/IndexPage.vue +905 -0
- package/examples/quasar-demo/src/router/index.ts +25 -0
- package/examples/quasar-demo/src/router/routes.ts +11 -0
- package/examples/quasar-demo/tsconfig.json +28 -0
- package/examples/register-subdomain.ts +152 -0
- package/examples/rsa-keypair.ts +148 -0
- package/examples/tag-builder.ts +235 -0
- package/examples/tag-management.ts +534 -0
- package/examples/tag-nested-tuple.ts +190 -0
- package/examples/tag-simple.ts +149 -0
- package/examples/tag-tagger.ts +217 -0
- package/examples/test-nested-tuple-conversion.ts +143 -0
- package/examples/test-type-bytes-parser.ts +70 -0
- package/examples/transfer-domain.ts +197 -0
- package/examples/wallet-management.ts +196 -0
- package/package.json +24 -15
- package/src/abi/RootResolver2ABI.ts +237 -0
- package/src/business/index.ts +1492 -0
- package/src/business/tag-context.ts +747 -0
- package/src/cli.ts +2772 -39
- package/src/debug.ts +17 -2
- package/src/index.ts +313 -17
- package/src/utils/crypto-utils.ts +459 -0
- package/src/utils/error-parser.ts +225 -0
- package/src/utils/olares-id.ts +49 -0
- package/src/utils/tag-abi-codec.ts +158 -0
- package/src/utils/tag-type-builder.ts +469 -0
- package/tsconfig.json +1 -1
package/CLI.md
ADDED
|
@@ -0,0 +1,1300 @@
|
|
|
1
|
+
# OlaresID CLI Tool
|
|
2
|
+
|
|
3
|
+
A comprehensive command-line interface for managing OlaresID domains, RSA keys, IP records, operators, domain transfers, and cryptographic utilities.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g olaresid
|
|
9
|
+
# or use npx
|
|
10
|
+
npx olaresid <command>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Get help
|
|
17
|
+
did-cli help
|
|
18
|
+
|
|
19
|
+
# Query domain information
|
|
20
|
+
did-cli info example.olares.com
|
|
21
|
+
|
|
22
|
+
# Get domain owner
|
|
23
|
+
did-cli owner example.olares.com
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Commands Overview
|
|
27
|
+
|
|
28
|
+
### Query Commands
|
|
29
|
+
|
|
30
|
+
#### Get Domain Metadata
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
did-cli info <domain> [options]
|
|
34
|
+
|
|
35
|
+
# Examples
|
|
36
|
+
did-cli info example.olares.com
|
|
37
|
+
did-cli info example.olares.com --json
|
|
38
|
+
did-cli info example.olares.com --network mainnet
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Get Domain Owner
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
did-cli owner <domain> [options]
|
|
45
|
+
|
|
46
|
+
# Examples
|
|
47
|
+
did-cli owner example.olares.com
|
|
48
|
+
did-cli owner example.olares.com --json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### Check Domain Ownership
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
did-cli is-owner <domain>
|
|
55
|
+
|
|
56
|
+
# Examples
|
|
57
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
58
|
+
did-cli is-owner example.olares.com
|
|
59
|
+
did-cli is-owner example.olares.com --json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### RSA Key Management
|
|
63
|
+
|
|
64
|
+
#### Generate RSA Key Pair
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
did-cli rsa generate [options]
|
|
68
|
+
|
|
69
|
+
# Examples
|
|
70
|
+
did-cli rsa generate
|
|
71
|
+
did-cli rsa generate --output ./my-key.pem
|
|
72
|
+
did-cli rsa generate --key-length 4096 --output ./my-key.pem
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Output:**
|
|
76
|
+
|
|
77
|
+
- Public key: `<output-path>.pem` (PEM PKCS#8 format)
|
|
78
|
+
- Private key: `<output-path>-private.pem` (PEM PKCS#8 format)
|
|
79
|
+
|
|
80
|
+
#### Get RSA Public Key
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
did-cli rsa get <domain> [options]
|
|
84
|
+
|
|
85
|
+
# Examples
|
|
86
|
+
did-cli rsa get example.olares.com
|
|
87
|
+
did-cli rsa get example.olares.com --json
|
|
88
|
+
did-cli rsa get example.olares.com --output ./public-key.pem
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Set RSA Public Key
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
did-cli rsa set <domain> <pem-file>
|
|
95
|
+
|
|
96
|
+
# Examples
|
|
97
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
98
|
+
did-cli rsa set example.olares.com ./public-key.pem
|
|
99
|
+
did-cli rsa set example.olares.com ./public-key.pem --json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Remove RSA Public Key
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
did-cli rsa remove <domain>
|
|
106
|
+
|
|
107
|
+
# Examples
|
|
108
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
109
|
+
did-cli rsa remove example.olares.com
|
|
110
|
+
did-cli rsa remove example.olares.com --json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### IP Management
|
|
114
|
+
|
|
115
|
+
#### Get IP Address (DNS A Record)
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
did-cli ip get <domain> [options]
|
|
119
|
+
|
|
120
|
+
# Examples
|
|
121
|
+
did-cli ip get example.olares.com
|
|
122
|
+
did-cli ip get example.olares.com --json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Set IP Address
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
did-cli ip set <domain> <ipv4-address>
|
|
129
|
+
|
|
130
|
+
# Examples
|
|
131
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
132
|
+
did-cli ip set example.olares.com 192.168.1.100
|
|
133
|
+
did-cli ip set example.olares.com 192.168.1.100 --json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Remove IP Address
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
did-cli ip remove <domain>
|
|
140
|
+
|
|
141
|
+
# Examples
|
|
142
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
143
|
+
did-cli ip remove example.olares.com
|
|
144
|
+
did-cli ip remove example.olares.com --json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Subdomain Management
|
|
148
|
+
|
|
149
|
+
#### Register Subdomain
|
|
150
|
+
|
|
151
|
+
Register a new subdomain under a parent domain. The subdomain will have its own owner (derived from a mnemonic) and inherit the parent's metadata settings.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
did-cli subdomain register <parent-domain> <subdomain-label> [options]
|
|
155
|
+
|
|
156
|
+
# Examples
|
|
157
|
+
|
|
158
|
+
# Generate a new 12-word mnemonic automatically
|
|
159
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234... # Parent domain owner's private key
|
|
160
|
+
did-cli subdomain register parent.com child
|
|
161
|
+
|
|
162
|
+
# Generate a 24-word mnemonic
|
|
163
|
+
did-cli subdomain register parent.com child --words 24
|
|
164
|
+
|
|
165
|
+
# Use an existing mnemonic for subdomain owner
|
|
166
|
+
export MNEMONIC="your twelve word mnemonic phrase here that will derive the keys"
|
|
167
|
+
did-cli subdomain register parent.com child
|
|
168
|
+
|
|
169
|
+
# JSON output
|
|
170
|
+
did-cli subdomain register parent.com child --json
|
|
171
|
+
|
|
172
|
+
# Use mainnet
|
|
173
|
+
did-cli subdomain register parent.com child --network mainnet
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Important Notes:**
|
|
177
|
+
|
|
178
|
+
1. **Authentication**: You need the parent domain owner's private key or mnemonic via `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
179
|
+
2. **Subdomain Owner Mnemonic**:
|
|
180
|
+
- Set via `MNEMONIC` environment variable to use an existing mnemonic
|
|
181
|
+
- If `MNEMONIC` is not set, a new one will be auto-generated and saved to `./subdomain-mnemonic.txt`
|
|
182
|
+
- The mnemonic derives the subdomain's owner address and DID
|
|
183
|
+
- **Save the mnemonic securely** - it's the only way to control the subdomain
|
|
184
|
+
3. **Full Domain**: If you register `child` under `parent.com`, the full domain will be `child.parent.com`
|
|
185
|
+
4. **Inheritance**: The subdomain inherits `note` and `allowSubdomain` settings from the parent
|
|
186
|
+
|
|
187
|
+
**Output Example:**
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
🔑 Generated 12-word mnemonic:
|
|
191
|
+
abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
|
|
192
|
+
|
|
193
|
+
⚠️ IMPORTANT: Save this mnemonic securely! It controls the subdomain.
|
|
194
|
+
|
|
195
|
+
📋 Registering subdomain: child.parent.com
|
|
196
|
+
⏳ Submitting transaction...
|
|
197
|
+
|
|
198
|
+
✅ Subdomain registered successfully!
|
|
199
|
+
|
|
200
|
+
════════════════════════════════════════════════════════════
|
|
201
|
+
Registration Details:
|
|
202
|
+
════════════════════════════════════════════════════════════
|
|
203
|
+
Subdomain label: child
|
|
204
|
+
Full domain name: child.parent.com
|
|
205
|
+
Owner address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
206
|
+
DID: did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
207
|
+
Transaction hash: 0xabcd1234...
|
|
208
|
+
Gas used: 150000
|
|
209
|
+
Block number: 12345678
|
|
210
|
+
════════════════════════════════════════════════════════════
|
|
211
|
+
|
|
212
|
+
🔗 View on block explorer:
|
|
213
|
+
https://sepolia-optimism.etherscan.io/tx/0xabcd1234...
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Domain Transfer
|
|
217
|
+
|
|
218
|
+
Transfer domain ownership to a new owner. This operation involves two transactions:
|
|
219
|
+
|
|
220
|
+
1. Transfer the NFT (domain) ownership
|
|
221
|
+
2. Update the domain's DID to match the new owner's DID
|
|
222
|
+
|
|
223
|
+
#### Transfer Domain Ownership
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
did-cli transfer <domain> [options]
|
|
227
|
+
|
|
228
|
+
# Examples
|
|
229
|
+
|
|
230
|
+
# Auto-generate new owner credentials (12-word mnemonic)
|
|
231
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234... # Current owner's private key
|
|
232
|
+
did-cli transfer example.com
|
|
233
|
+
|
|
234
|
+
# Auto-generate with 24-word mnemonic
|
|
235
|
+
did-cli transfer example.com --words 24
|
|
236
|
+
|
|
237
|
+
# Use specific mnemonic for new owner
|
|
238
|
+
export MNEMONIC="new owner twelve word mnemonic phrase here"
|
|
239
|
+
did-cli transfer example.com
|
|
240
|
+
|
|
241
|
+
# JSON output
|
|
242
|
+
did-cli transfer example.com --json
|
|
243
|
+
|
|
244
|
+
# Use mainnet
|
|
245
|
+
did-cli transfer example.com --network mainnet
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Important Notes:**
|
|
249
|
+
|
|
250
|
+
1. **Authentication**: You need the current owner's private key or mnemonic via `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
251
|
+
2. **New Owner Mnemonic**:
|
|
252
|
+
- Set via `MNEMONIC` environment variable to use an existing mnemonic
|
|
253
|
+
- If `MNEMONIC` is not set, a new one will be auto-generated and saved to `./transfer-new-owner-mnemonic.txt`
|
|
254
|
+
- The mnemonic derives the new owner's address and DID
|
|
255
|
+
- **Save the new owner's mnemonic securely** - it's the only way to control the domain after transfer
|
|
256
|
+
3. **Two Transactions**: The operation submits two transactions to the blockchain
|
|
257
|
+
- First: Transfer NFT ownership
|
|
258
|
+
- Second: Update domain DID
|
|
259
|
+
4. **Irreversible**: Once transferred, the domain is controlled by the new owner
|
|
260
|
+
|
|
261
|
+
**Output Example:**
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
🔑 Generated 12-word mnemonic for new owner:
|
|
265
|
+
abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
|
|
266
|
+
|
|
267
|
+
⚠️ IMPORTANT: Save this mnemonic securely! It controls the domain.
|
|
268
|
+
|
|
269
|
+
📋 Transferring domain: example.com
|
|
270
|
+
⏳ Submitting transactions...
|
|
271
|
+
|
|
272
|
+
✅ Domain transfer successful!
|
|
273
|
+
|
|
274
|
+
Transaction Details:
|
|
275
|
+
Domain: example.com
|
|
276
|
+
New Owner: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
277
|
+
New DID: did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
278
|
+
Transfer Tx: 0xabcd1234...
|
|
279
|
+
Set DID Tx: 0xefgh5678...
|
|
280
|
+
|
|
281
|
+
🔑 New Owner Mnemonic (SAVE THIS!):
|
|
282
|
+
abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Crypto Utilities
|
|
286
|
+
|
|
287
|
+
Generate and derive cryptographic keys from mnemonic phrases. These utilities work offline and don't require blockchain access.
|
|
288
|
+
|
|
289
|
+
#### Generate Mnemonic
|
|
290
|
+
|
|
291
|
+
Generate a new BIP39 mnemonic phrase. **The mnemonic is automatically saved to a file for security.**
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
did-cli crypto generate [options]
|
|
295
|
+
|
|
296
|
+
# Examples
|
|
297
|
+
did-cli crypto generate # 12-word mnemonic (default)
|
|
298
|
+
did-cli crypto generate --words 12 # 12-word mnemonic
|
|
299
|
+
did-cli crypto generate --words 24 # 24-word mnemonic
|
|
300
|
+
did-cli crypto generate --output ./my-mnemonic.txt # Custom output file
|
|
301
|
+
did-cli crypto generate --json # JSON output
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Output Example:**
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
🔑 Generated 12-word mnemonic
|
|
308
|
+
📄 Mnemonic saved to: ./mnemonic.txt
|
|
309
|
+
|
|
310
|
+
⚠️ SECURITY WARNING:
|
|
311
|
+
• Keep this mnemonic secure! It controls all derived keys!
|
|
312
|
+
• Store it in a safe place (paper backup, hardware wallet, etc.)
|
|
313
|
+
• Delete the file after copying to a secure location
|
|
314
|
+
• Command: rm ./mnemonic.txt
|
|
315
|
+
|
|
316
|
+
💡 To use the mnemonic:
|
|
317
|
+
export MNEMONIC="$(cat ./mnemonic.txt)"
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Note:** The default output file is `./mnemonic.txt`. Use `--output` option to specify a different location.
|
|
321
|
+
|
|
322
|
+
#### Get Ethereum Address from Mnemonic
|
|
323
|
+
|
|
324
|
+
Derive an Ethereum address from a mnemonic phrase.
|
|
325
|
+
|
|
326
|
+
**Requirements:** `MNEMONIC` environment variable must be set.
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
export MNEMONIC="your twelve word mnemonic phrase here"
|
|
330
|
+
did-cli crypto address
|
|
331
|
+
|
|
332
|
+
# JSON output
|
|
333
|
+
did-cli crypto address --json
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Output Example:**
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
🏠 Ethereum Address:
|
|
340
|
+
0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
#### Get DID from Mnemonic
|
|
344
|
+
|
|
345
|
+
Derive a DID (Decentralized Identifier) from a mnemonic phrase.
|
|
346
|
+
|
|
347
|
+
**Requirements:** `MNEMONIC` environment variable must be set.
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
export MNEMONIC="your twelve word mnemonic phrase here"
|
|
351
|
+
did-cli crypto did
|
|
352
|
+
|
|
353
|
+
# JSON output
|
|
354
|
+
did-cli crypto did --json
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**Output Example:**
|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
🆔 DID:
|
|
361
|
+
did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
#### Get EVM Private Key from Mnemonic
|
|
365
|
+
|
|
366
|
+
Derive an EVM-compatible private key from a mnemonic phrase. **The private key is automatically saved to a file.**
|
|
367
|
+
|
|
368
|
+
**Requirements:** `MNEMONIC` environment variable must be set.
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
export MNEMONIC="your twelve word mnemonic phrase here"
|
|
372
|
+
did-cli crypto privatekey
|
|
373
|
+
|
|
374
|
+
# Specify output file
|
|
375
|
+
did-cli crypto privatekey --output ./my-private-key.txt
|
|
376
|
+
|
|
377
|
+
# JSON output
|
|
378
|
+
did-cli crypto privatekey --json
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Output Example:**
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
🔑 EVM Private Key:
|
|
385
|
+
0x1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727
|
|
386
|
+
|
|
387
|
+
📄 Private key saved to: ./private-key.txt
|
|
388
|
+
|
|
389
|
+
⚠️ SECURITY WARNING:
|
|
390
|
+
• Keep this private key secure! Never share it!
|
|
391
|
+
• Delete the file after copying to a secure location
|
|
392
|
+
• Command: rm ./private-key.txt
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**Note:** The default output file is `./private-key.txt`. Use `--output` option to specify a different location.
|
|
396
|
+
|
|
397
|
+
#### Derive All Keys from Mnemonic
|
|
398
|
+
|
|
399
|
+
Derive all keys (address, DID, and private key) from a mnemonic in one command. **All keys are automatically saved to a file.**
|
|
400
|
+
|
|
401
|
+
**Requirements:** `MNEMONIC` environment variable must be set.
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
export MNEMONIC="your twelve word mnemonic phrase here"
|
|
405
|
+
did-cli crypto derive
|
|
406
|
+
|
|
407
|
+
# Specify output file
|
|
408
|
+
did-cli crypto derive --output ./my-keys.txt
|
|
409
|
+
|
|
410
|
+
# JSON output
|
|
411
|
+
did-cli crypto derive --json
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
**Output Example:**
|
|
415
|
+
|
|
416
|
+
```
|
|
417
|
+
🔐 Derived Keys:
|
|
418
|
+
Address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
419
|
+
DID: did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
420
|
+
Private Key: 0x1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727
|
|
421
|
+
|
|
422
|
+
📄 Keys saved to: ./derived-keys.txt
|
|
423
|
+
|
|
424
|
+
⚠️ SECURITY WARNING:
|
|
425
|
+
• Keep these credentials secure! Never share them!
|
|
426
|
+
• Delete the file after copying to a secure location
|
|
427
|
+
• Command: rm ./derived-keys.txt
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**File Content Example:**
|
|
431
|
+
|
|
432
|
+
```
|
|
433
|
+
Ethereum Address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
434
|
+
DID: did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
435
|
+
Private Key: 0x1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**Note:** The default output file is `./derived-keys.txt`. Use `--output` option to specify a different location.
|
|
439
|
+
|
|
440
|
+
**Important Notes:**
|
|
441
|
+
|
|
442
|
+
1. **Offline Operation**: All crypto utilities work offline and don't require network access
|
|
443
|
+
2. **Deterministic**: Same mnemonic always produces the same keys
|
|
444
|
+
3. **BIP39 Standard**: Uses standard BIP39 mnemonic generation
|
|
445
|
+
4. **BIP44 Derivation**: Follows BIP44 standard for Ethereum key derivation (m/44'/60'/0'/0/0)
|
|
446
|
+
5. **Ed25519 for DID**: Uses Ed25519 curve for DID key generation (compatible with TermiPass)
|
|
447
|
+
6. **Security**:
|
|
448
|
+
- Never share your mnemonic or private key
|
|
449
|
+
- Store mnemonics securely (paper backup, hardware wallet, etc.)
|
|
450
|
+
- Be cautious when using `privatekey` and `derive` commands in shared environments
|
|
451
|
+
|
|
452
|
+
### Wallet Management
|
|
453
|
+
|
|
454
|
+
Manage EVM and Solana wallet addresses associated with your domain. These authenticated addresses can be used for various authorization and verification purposes.
|
|
455
|
+
|
|
456
|
+
#### Add EVM Wallet
|
|
457
|
+
|
|
458
|
+
Add an EVM wallet address to your domain's authenticated addresses.
|
|
459
|
+
|
|
460
|
+
**Requirements:**
|
|
461
|
+
|
|
462
|
+
- `PRIVATE_KEY_OR_MNEMONIC` environment variable (domain owner's key for signing)
|
|
463
|
+
- `EVM_PRIVATE_KEY` environment variable (wallet to add)
|
|
464
|
+
|
|
465
|
+
```bash
|
|
466
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_DOMAIN_OWNER_KEY"
|
|
467
|
+
export EVM_PRIVATE_KEY="0xWALLET_TO_ADD"
|
|
468
|
+
did-cli wallet evm add example.com
|
|
469
|
+
|
|
470
|
+
# With JSON output
|
|
471
|
+
did-cli wallet evm add example.com --json
|
|
472
|
+
|
|
473
|
+
# On mainnet
|
|
474
|
+
did-cli wallet evm add example.com --network mainnet
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**Output Example:**
|
|
478
|
+
|
|
479
|
+
```
|
|
480
|
+
💼 Adding EVM wallet to domain: example.com
|
|
481
|
+
|
|
482
|
+
✅ EVM wallet added successfully!
|
|
483
|
+
Address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
484
|
+
Transaction: 0x123abc...
|
|
485
|
+
Gas used: 150000
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**Important Notes:**
|
|
489
|
+
|
|
490
|
+
- The EVM_PRIVATE_KEY is the wallet you want to add as an authenticated address
|
|
491
|
+
- The PRIVATE_KEY_OR_MNEMONIC is your domain owner's key for authorization
|
|
492
|
+
- The signature is valid for 1 hour from the timestamp
|
|
493
|
+
- Duplicate addresses will be rejected with a friendly error message
|
|
494
|
+
|
|
495
|
+
#### Remove EVM Wallet
|
|
496
|
+
|
|
497
|
+
Remove an EVM wallet address from your domain.
|
|
498
|
+
|
|
499
|
+
**Requirements:**
|
|
500
|
+
|
|
501
|
+
- `PRIVATE_KEY_OR_MNEMONIC` environment variable (domain owner's key)
|
|
502
|
+
- `EVM_PRIVATE_KEY` environment variable (wallet to remove)
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_DOMAIN_OWNER_KEY"
|
|
506
|
+
export EVM_PRIVATE_KEY="0xWALLET_TO_REMOVE"
|
|
507
|
+
did-cli wallet evm remove example.com
|
|
508
|
+
|
|
509
|
+
# With JSON output
|
|
510
|
+
did-cli wallet evm remove example.com --json
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
#### List EVM Wallets
|
|
514
|
+
|
|
515
|
+
List all EVM wallet addresses associated with a domain.
|
|
516
|
+
|
|
517
|
+
**No authentication required** (read-only operation)
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
did-cli wallet evm list example.com
|
|
521
|
+
|
|
522
|
+
# With JSON output
|
|
523
|
+
did-cli wallet evm list example.com --json
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
**Output Example:**
|
|
527
|
+
|
|
528
|
+
```
|
|
529
|
+
📋 Listing EVM wallets for domain: example.com
|
|
530
|
+
Found 2 wallet(s):
|
|
531
|
+
1. 0x9858effd232b4033e47d90003d41ec34ecaeda94
|
|
532
|
+
2. 0x1234567890abcdef1234567890abcdef12345678
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**JSON Output Example:**
|
|
536
|
+
|
|
537
|
+
```json
|
|
538
|
+
{
|
|
539
|
+
"domain": "example.com",
|
|
540
|
+
"wallets": [
|
|
541
|
+
"0x9858effd232b4033e47d90003d41ec34ecaeda94",
|
|
542
|
+
"0x1234567890abcdef1234567890abcdef12345678"
|
|
543
|
+
],
|
|
544
|
+
"count": 2
|
|
545
|
+
}
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
#### Add Solana Wallet
|
|
549
|
+
|
|
550
|
+
Add a Solana wallet address to your domain's authenticated addresses.
|
|
551
|
+
|
|
552
|
+
**Requirements:**
|
|
553
|
+
|
|
554
|
+
- `PRIVATE_KEY_OR_MNEMONIC` environment variable (domain owner's key)
|
|
555
|
+
- `SOLANA_PRIVATE_KEY` environment variable (wallet to add)
|
|
556
|
+
|
|
557
|
+
**Solana Private Key Formats:**
|
|
558
|
+
|
|
559
|
+
- **Base58 format** (from Phantom wallet export): `"5J7W..."`
|
|
560
|
+
- **JSON array format**: `"[1,2,3,...]"` (64 bytes)
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_DOMAIN_OWNER_KEY"
|
|
564
|
+
|
|
565
|
+
# Using base58 format (Phantom export)
|
|
566
|
+
export SOLANA_PRIVATE_KEY="5J7WpQXHJkD3..."
|
|
567
|
+
did-cli wallet solana add example.com
|
|
568
|
+
|
|
569
|
+
# Using JSON array format
|
|
570
|
+
export SOLANA_PRIVATE_KEY='[174,47,154,...]'
|
|
571
|
+
did-cli wallet solana add example.com
|
|
572
|
+
|
|
573
|
+
# With JSON output
|
|
574
|
+
did-cli wallet solana add example.com --json
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
**Output Example:**
|
|
578
|
+
|
|
579
|
+
```
|
|
580
|
+
💼 Adding Solana wallet to domain: example.com
|
|
581
|
+
|
|
582
|
+
✅ Solana wallet added successfully!
|
|
583
|
+
Address: 8aKDo9WRy9YyJD5ZjL6nF5zEqG1N4mPxB7sU2wVqT3cH
|
|
584
|
+
Transaction: 0x456def...
|
|
585
|
+
Gas used: 180000
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
#### Remove Solana Wallet
|
|
589
|
+
|
|
590
|
+
Remove a Solana wallet address from your domain.
|
|
591
|
+
|
|
592
|
+
**Requirements:**
|
|
593
|
+
|
|
594
|
+
- `PRIVATE_KEY_OR_MNEMONIC` environment variable (domain owner's key)
|
|
595
|
+
- `SOLANA_PRIVATE_KEY` environment variable (wallet to remove)
|
|
596
|
+
|
|
597
|
+
```bash
|
|
598
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_DOMAIN_OWNER_KEY"
|
|
599
|
+
export SOLANA_PRIVATE_KEY="5J7WpQXHJkD3..."
|
|
600
|
+
did-cli wallet solana remove example.com
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
#### List Solana Wallets
|
|
604
|
+
|
|
605
|
+
List all Solana wallet addresses associated with a domain.
|
|
606
|
+
|
|
607
|
+
**No authentication required** (read-only operation)
|
|
608
|
+
|
|
609
|
+
```bash
|
|
610
|
+
did-cli wallet solana list example.com
|
|
611
|
+
|
|
612
|
+
# With JSON output
|
|
613
|
+
did-cli wallet solana list example.com --json
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
**Output Example:**
|
|
617
|
+
|
|
618
|
+
```
|
|
619
|
+
📋 Listing Solana wallets for domain: example.com
|
|
620
|
+
Found 1 wallet(s):
|
|
621
|
+
1. 8aKDo9WRy9YyJD5ZjL6nF5zEqG1N4mPxB7sU2wVqT3cH
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
**Technical Details:**
|
|
625
|
+
|
|
626
|
+
1. **Signature Verification**: Both EVM and Solana wallets use EIP-712 typed data signing for verification
|
|
627
|
+
2. **Ed25519 Signatures**: Solana uses Ed25519 signatures for authentication
|
|
628
|
+
3. **Timestamp Validation**: Signatures must be generated within 1 hour of the current time
|
|
629
|
+
4. **Storage**: Wallet addresses are stored in the RootTagger2 contract
|
|
630
|
+
5. **Backward Compatibility**: `list` command also fetches addresses from legacy RootResolver contract
|
|
631
|
+
|
|
632
|
+
### Operator Management
|
|
633
|
+
|
|
634
|
+
#### Get Operator Address
|
|
635
|
+
|
|
636
|
+
```bash
|
|
637
|
+
did-cli operator get [options]
|
|
638
|
+
|
|
639
|
+
# Examples
|
|
640
|
+
did-cli operator get
|
|
641
|
+
did-cli operator get --json
|
|
642
|
+
did-cli operator get --network mainnet
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
#### Set Operator Address
|
|
646
|
+
|
|
647
|
+
```bash
|
|
648
|
+
did-cli operator set <address>
|
|
649
|
+
|
|
650
|
+
# Examples
|
|
651
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
652
|
+
did-cli operator set 0x5678...
|
|
653
|
+
did-cli operator set 0x5678... --json
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### Utility Commands
|
|
657
|
+
|
|
658
|
+
#### Convert PEM to DER
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
did-cli convert pem-to-der <pem-file> [options]
|
|
662
|
+
|
|
663
|
+
# Examples
|
|
664
|
+
did-cli convert pem-to-der ./public-key.pem
|
|
665
|
+
did-cli convert pem-to-der ./public-key.pem --json
|
|
666
|
+
did-cli convert pem-to-der ./public-key.pem --output ./key.der
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
#### Convert DER to PEM
|
|
670
|
+
|
|
671
|
+
```bash
|
|
672
|
+
did-cli convert der-to-pem <der-hex> [options]
|
|
673
|
+
|
|
674
|
+
# Examples
|
|
675
|
+
did-cli convert der-to-pem 0x3082010a...
|
|
676
|
+
did-cli convert der-to-pem 0x3082010a... --json
|
|
677
|
+
did-cli convert der-to-pem 0x3082010a... --output ./key.pem
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
#### Convert IPv4 to Bytes4
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
did-cli convert ip-to-bytes <ipv4-address> [options]
|
|
684
|
+
|
|
685
|
+
# Examples
|
|
686
|
+
did-cli convert ip-to-bytes 192.168.1.1
|
|
687
|
+
did-cli convert ip-to-bytes 192.168.1.1 --json
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
#### Convert Bytes4 to IPv4
|
|
691
|
+
|
|
692
|
+
```bash
|
|
693
|
+
did-cli convert bytes-to-ip <bytes4-hex> [options]
|
|
694
|
+
|
|
695
|
+
# Examples
|
|
696
|
+
did-cli convert bytes-to-ip 0xc0a80101
|
|
697
|
+
did-cli convert bytes-to-ip 0xc0a80101 --json
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
## Tag Management Commands
|
|
703
|
+
|
|
704
|
+
Tags are typed key-value pairs that can be attached to domains for storing structured metadata on-chain. The CLI provides simple commands for basic tag operations with common types.
|
|
705
|
+
|
|
706
|
+
> **📖 For Advanced Usage**: For complex types (tuples/structs), array element operations, and detailed API documentation, see the [Tag System Documentation](./docs/TAG_SYSTEM.md) and check the [examples](./examples/) directory.
|
|
707
|
+
|
|
708
|
+
### Define Tag Type
|
|
709
|
+
|
|
710
|
+
Define a new tag with a specific type. Tags must be defined before they can be used.
|
|
711
|
+
|
|
712
|
+
```bash
|
|
713
|
+
did-cli tag define <domain> <tag-name> <type>
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
**Supported Types:**
|
|
717
|
+
|
|
718
|
+
- Simple types: `string`, `uint8`, `uint256`, `int8`, `int256`, `bool`, `address`, `bytes`, `bytes32`
|
|
719
|
+
- Array types: `"string[]"`, `"uint8[]"`, `"address[]"`, etc. (must be quoted!)
|
|
720
|
+
|
|
721
|
+
**Requirements:** `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
722
|
+
|
|
723
|
+
**Examples:**
|
|
724
|
+
|
|
725
|
+
```bash
|
|
726
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
727
|
+
|
|
728
|
+
# Define simple types
|
|
729
|
+
did-cli tag define example.com email string
|
|
730
|
+
did-cli tag define example.com age uint8
|
|
731
|
+
did-cli tag define example.com verified bool
|
|
732
|
+
did-cli tag define example.com owner address
|
|
733
|
+
|
|
734
|
+
# Define array types (MUST be quoted!)
|
|
735
|
+
did-cli tag define example.com wallets "address[]"
|
|
736
|
+
did-cli tag define example.com socialLinks "string[]"
|
|
737
|
+
|
|
738
|
+
# With JSON output
|
|
739
|
+
did-cli tag define example.com followers uint256 --json
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
**Output Example:**
|
|
743
|
+
|
|
744
|
+
```
|
|
745
|
+
📝 Defining tag "email" for domain: example.com
|
|
746
|
+
Type: string
|
|
747
|
+
|
|
748
|
+
✅ Tag "email" defined successfully
|
|
749
|
+
Transaction: 0x123abc...
|
|
750
|
+
Gas used: 150000
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
### Set Tagger
|
|
754
|
+
|
|
755
|
+
Set the authorized address (tagger) that can modify a tag's value. Only the domain owner can set the tagger.
|
|
756
|
+
|
|
757
|
+
```bash
|
|
758
|
+
did-cli tag set-tagger <domain> <tag-name> <tagger-address>
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
**Requirements:** `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
762
|
+
|
|
763
|
+
**Examples:**
|
|
764
|
+
|
|
765
|
+
```bash
|
|
766
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
767
|
+
|
|
768
|
+
# Set tagger to a specific address
|
|
769
|
+
did-cli tag set-tagger example.com email 0x1234567890abcdef...
|
|
770
|
+
|
|
771
|
+
# Set tagger to yourself
|
|
772
|
+
SIGNER_ADDRESS=$(did-cli crypto address)
|
|
773
|
+
did-cli tag set-tagger example.com email $SIGNER_ADDRESS
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
**Output Example:**
|
|
777
|
+
|
|
778
|
+
```
|
|
779
|
+
🔐 Setting tagger for tag "email" in domain: example.com
|
|
780
|
+
Tagger address: 0x1234567890abcdef...
|
|
781
|
+
|
|
782
|
+
✅ Tagger set successfully
|
|
783
|
+
Transaction: 0x456def...
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
### Set Tag Value
|
|
787
|
+
|
|
788
|
+
Set or update a tag's value. You must be the designated tagger for this tag.
|
|
789
|
+
|
|
790
|
+
```bash
|
|
791
|
+
did-cli tag set <domain> <tag-name> <value>
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
**Value Formats:**
|
|
795
|
+
|
|
796
|
+
- **Strings**: Direct input (`user@example.com`) or JSON string
|
|
797
|
+
- **Numbers**: Direct input (`30`, `1000`)
|
|
798
|
+
- **Booleans**: `true` or `false`
|
|
799
|
+
- **Arrays**: JSON format, must be quoted (`'["item1","item2"]'`)
|
|
800
|
+
|
|
801
|
+
**Requirements:** `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
802
|
+
|
|
803
|
+
**Examples:**
|
|
804
|
+
|
|
805
|
+
```bash
|
|
806
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
807
|
+
|
|
808
|
+
# Set string value
|
|
809
|
+
did-cli tag set example.com email "user@example.com"
|
|
810
|
+
did-cli tag set example.com bio "Web3 developer and blockchain enthusiast"
|
|
811
|
+
|
|
812
|
+
# Set number value
|
|
813
|
+
did-cli tag set example.com age 30
|
|
814
|
+
did-cli tag set example.com followers 1350
|
|
815
|
+
|
|
816
|
+
# Set boolean value
|
|
817
|
+
did-cli tag set example.com verified true
|
|
818
|
+
did-cli tag set example.com premium false
|
|
819
|
+
|
|
820
|
+
# Set array value (use JSON, must be quoted!)
|
|
821
|
+
did-cli tag set example.com socialLinks '["https://twitter.com/alice","https://github.com/alice"]'
|
|
822
|
+
did-cli tag set example.com wallets '["0x1111111111111111111111111111111111111111","0x2222222222222222222222222222222222222222"]'
|
|
823
|
+
|
|
824
|
+
# With JSON output
|
|
825
|
+
did-cli tag set example.com email "user@example.com" --json
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
**Output Example:**
|
|
829
|
+
|
|
830
|
+
```
|
|
831
|
+
📝 Setting tag "email" for domain: example.com
|
|
832
|
+
Value: user@example.com
|
|
833
|
+
|
|
834
|
+
✅ Tag "email" set successfully
|
|
835
|
+
Transaction: 0x789ghi...
|
|
836
|
+
Gas used: 120000
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
### Get Tag Value
|
|
840
|
+
|
|
841
|
+
Read a tag's current value. This is a read-only operation and doesn't require authentication.
|
|
842
|
+
|
|
843
|
+
```bash
|
|
844
|
+
did-cli tag get <domain> <tag-name>
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
**Requirements:** None (read-only)
|
|
848
|
+
|
|
849
|
+
**Examples:**
|
|
850
|
+
|
|
851
|
+
```bash
|
|
852
|
+
# Get any tag value
|
|
853
|
+
did-cli tag get example.com email
|
|
854
|
+
did-cli tag get example.com age
|
|
855
|
+
did-cli tag get example.com socialLinks
|
|
856
|
+
|
|
857
|
+
# With JSON output
|
|
858
|
+
did-cli tag get example.com email --json
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
**Output Examples:**
|
|
862
|
+
|
|
863
|
+
```
|
|
864
|
+
📖 Getting tag "email" for domain: example.com
|
|
865
|
+
|
|
866
|
+
✅ Tag value:
|
|
867
|
+
user@example.com
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
```
|
|
871
|
+
📖 Getting tag "socialLinks" for domain: example.com
|
|
872
|
+
|
|
873
|
+
✅ Tag value:
|
|
874
|
+
["https://twitter.com/alice","https://github.com/alice"]
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
### Remove Tag Value
|
|
878
|
+
|
|
879
|
+
Remove a tag's value while keeping its definition. The tag can be set again later.
|
|
880
|
+
|
|
881
|
+
```bash
|
|
882
|
+
did-cli tag remove <domain> <tag-name>
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
**Requirements:** `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
886
|
+
|
|
887
|
+
**Examples:**
|
|
888
|
+
|
|
889
|
+
```bash
|
|
890
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
891
|
+
|
|
892
|
+
# Remove tag value
|
|
893
|
+
did-cli tag remove example.com email
|
|
894
|
+
|
|
895
|
+
# With JSON output
|
|
896
|
+
did-cli tag remove example.com email --json
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
**Output Example:**
|
|
900
|
+
|
|
901
|
+
```
|
|
902
|
+
🗑️ Removing tag "email" for domain: example.com
|
|
903
|
+
|
|
904
|
+
✅ Tag "email" value removed successfully
|
|
905
|
+
Transaction: 0xabc123...
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
**Note:** This removes the _value_ only, not the tag definition. The tag type remains defined and can be set again.
|
|
909
|
+
|
|
910
|
+
### List All Tags
|
|
911
|
+
|
|
912
|
+
List all tags and their current values for a domain.
|
|
913
|
+
|
|
914
|
+
```bash
|
|
915
|
+
did-cli tag list <domain>
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
**Requirements:** None (read-only)
|
|
919
|
+
|
|
920
|
+
**Examples:**
|
|
921
|
+
|
|
922
|
+
```bash
|
|
923
|
+
# List all tags
|
|
924
|
+
did-cli tag list example.com
|
|
925
|
+
|
|
926
|
+
# With JSON output
|
|
927
|
+
did-cli tag list example.com --json
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
**Output Example:**
|
|
931
|
+
|
|
932
|
+
```
|
|
933
|
+
📋 Listing all tags for domain: example.com
|
|
934
|
+
|
|
935
|
+
✅ Found 7 tags:
|
|
936
|
+
|
|
937
|
+
Tag: "email"
|
|
938
|
+
Value: user@example.com
|
|
939
|
+
Tag: "age"
|
|
940
|
+
Value: 30
|
|
941
|
+
Tag: "verified"
|
|
942
|
+
Value: true
|
|
943
|
+
Tag: "bio"
|
|
944
|
+
Value: Web3 developer and blockchain enthusiast
|
|
945
|
+
Tag: "followers"
|
|
946
|
+
Value: 1350
|
|
947
|
+
Tag: "socialLinks"
|
|
948
|
+
Value: ["https://twitter.com/alice","https://github.com/alice"]
|
|
949
|
+
Tag: "wallets"
|
|
950
|
+
Value: ["0x1111111111111111111111111111111111111111"]
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
### List Defined Tag Types
|
|
954
|
+
|
|
955
|
+
List all defined tag types for a domain, including those without values.
|
|
956
|
+
|
|
957
|
+
```bash
|
|
958
|
+
did-cli tag list-defined <domain>
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
**Requirements:** None (read-only)
|
|
962
|
+
|
|
963
|
+
**Examples:**
|
|
964
|
+
|
|
965
|
+
```bash
|
|
966
|
+
# List defined tag types
|
|
967
|
+
did-cli tag list-defined example.com
|
|
968
|
+
|
|
969
|
+
# With JSON output
|
|
970
|
+
did-cli tag list-defined example.com --json
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
**Output Example:**
|
|
974
|
+
|
|
975
|
+
```
|
|
976
|
+
📋 Listing defined tag types for domain: example.com
|
|
977
|
+
|
|
978
|
+
✅ Found 9 defined tag types:
|
|
979
|
+
|
|
980
|
+
- email
|
|
981
|
+
- age
|
|
982
|
+
- verified
|
|
983
|
+
- bio
|
|
984
|
+
- followers
|
|
985
|
+
- premium
|
|
986
|
+
- socialLinks
|
|
987
|
+
- wallets
|
|
988
|
+
- userInfo
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
### Get Tagger
|
|
992
|
+
|
|
993
|
+
Get the current tagger address for a tag.
|
|
994
|
+
|
|
995
|
+
```bash
|
|
996
|
+
did-cli tag get-tagger <domain> <tag-name>
|
|
997
|
+
```
|
|
998
|
+
|
|
999
|
+
**Requirements:** None (read-only)
|
|
1000
|
+
|
|
1001
|
+
**Examples:**
|
|
1002
|
+
|
|
1003
|
+
```bash
|
|
1004
|
+
# Get tagger address
|
|
1005
|
+
did-cli tag get-tagger example.com email
|
|
1006
|
+
|
|
1007
|
+
# With JSON output
|
|
1008
|
+
did-cli tag get-tagger example.com email --json
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
**Output Example:**
|
|
1012
|
+
|
|
1013
|
+
```
|
|
1014
|
+
🔍 Getting tagger for tag "email" in domain: example.com
|
|
1015
|
+
|
|
1016
|
+
✅ Tagger address: 0x1234567890abcdef...
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
### Complete Tag Workflow Example
|
|
1020
|
+
|
|
1021
|
+
```bash
|
|
1022
|
+
# 1. Set authentication
|
|
1023
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
1024
|
+
|
|
1025
|
+
# 2. Define tag types
|
|
1026
|
+
did-cli tag define example.com bio string
|
|
1027
|
+
did-cli tag define example.com followers uint256
|
|
1028
|
+
did-cli tag define example.com premium bool
|
|
1029
|
+
did-cli tag define example.com socialLinks "string[]"
|
|
1030
|
+
|
|
1031
|
+
# 3. Get your address and set as tagger
|
|
1032
|
+
SIGNER_ADDRESS=$(did-cli crypto address)
|
|
1033
|
+
did-cli tag set-tagger example.com bio $SIGNER_ADDRESS
|
|
1034
|
+
did-cli tag set-tagger example.com followers $SIGNER_ADDRESS
|
|
1035
|
+
did-cli tag set-tagger example.com premium $SIGNER_ADDRESS
|
|
1036
|
+
did-cli tag set-tagger example.com socialLinks $SIGNER_ADDRESS
|
|
1037
|
+
|
|
1038
|
+
# 4. Set tag values
|
|
1039
|
+
did-cli tag set example.com bio "Web3 developer and blockchain enthusiast"
|
|
1040
|
+
did-cli tag set example.com followers 1350
|
|
1041
|
+
did-cli tag set example.com premium true
|
|
1042
|
+
did-cli tag set example.com socialLinks '["https://twitter.com/alice","https://github.com/alice"]'
|
|
1043
|
+
|
|
1044
|
+
# 5. Read values (no auth required)
|
|
1045
|
+
did-cli tag get example.com bio
|
|
1046
|
+
did-cli tag list example.com
|
|
1047
|
+
|
|
1048
|
+
# 6. Update a value
|
|
1049
|
+
did-cli tag set example.com followers 1500
|
|
1050
|
+
|
|
1051
|
+
# 7. Remove a value
|
|
1052
|
+
did-cli tag remove example.com premium
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
### Important Notes
|
|
1056
|
+
|
|
1057
|
+
1. **Array Types Must Be Quoted**: When using array types like `address[]` or `string[]`, you must quote them to prevent shell interpretation:
|
|
1058
|
+
|
|
1059
|
+
```bash
|
|
1060
|
+
# ✅ Correct
|
|
1061
|
+
did-cli tag define example.com wallets "address[]"
|
|
1062
|
+
|
|
1063
|
+
# ❌ Wrong - shell will interpret []
|
|
1064
|
+
did-cli tag define example.com wallets address[]
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
2. **Array Values Must Be JSON**: When setting array values, use valid JSON and quote the entire value:
|
|
1068
|
+
|
|
1069
|
+
```bash
|
|
1070
|
+
# ✅ Correct
|
|
1071
|
+
did-cli tag set example.com links '["https://twitter.com","https://github.com"]'
|
|
1072
|
+
|
|
1073
|
+
# ❌ Wrong
|
|
1074
|
+
did-cli tag set example.com links https://twitter.com,https://github.com
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
3. **Set Tagger Before Setting Values**: You must set a tagger after defining a tag and before you can set its value:
|
|
1078
|
+
|
|
1079
|
+
```bash
|
|
1080
|
+
did-cli tag define example.com email string
|
|
1081
|
+
did-cli tag set-tagger example.com email $YOUR_ADDRESS # Required!
|
|
1082
|
+
did-cli tag set example.com email "user@example.com"
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
4. **CLI Limitations**: The CLI only supports simple types and arrays. For complex tuple types and advanced operations:
|
|
1086
|
+
|
|
1087
|
+
- Use the SDK directly (see [TAG.md](./TAG.md))
|
|
1088
|
+
- Check examples in [`examples/tag-management.ts`](./examples/tag-management.ts)
|
|
1089
|
+
|
|
1090
|
+
5. **Tags Are Immutable After Definition**: You cannot change a tag's type once defined. You can only set/update/remove values.
|
|
1091
|
+
|
|
1092
|
+
---
|
|
1093
|
+
|
|
1094
|
+
## Global Options
|
|
1095
|
+
|
|
1096
|
+
| Option | Description | Default |
|
|
1097
|
+
| --- | --- | --- |
|
|
1098
|
+
| `-n, --network <network>` | Network to use (sepolia\|mainnet) | sepolia |
|
|
1099
|
+
| `--rpc <url>` | Custom RPC endpoint URL | - |
|
|
1100
|
+
| `--contract-did <address>` | Custom DID contract address | - |
|
|
1101
|
+
| `--contract-resolver <address>` | Custom RootResolver contract address | - |
|
|
1102
|
+
| `--contract-abi <address>` | Custom ABIType contract address | - |
|
|
1103
|
+
| `--contract-resolver2 <address>` | Custom RootResolver2 contract address | - |
|
|
1104
|
+
| `--support-svc-url <url>` | Custom support service URL | - |
|
|
1105
|
+
| `-o, --output <file>` | Output file path | - |
|
|
1106
|
+
| `--key-length <bits>` | RSA key length in bits | 2048 |
|
|
1107
|
+
| `-w, --words <count>` | Mnemonic word count (12\|15\|18\|21\|24) | 12 |
|
|
1108
|
+
| `-j, --json` | Output in JSON format | false |
|
|
1109
|
+
| `-v, --verbose` | Enable verbose debug output | false |
|
|
1110
|
+
| `--debug` | Enable debug output | false |
|
|
1111
|
+
| `--debug-level <level>` | Set debug level (debug\|info\|warn\|error) | info |
|
|
1112
|
+
| `-h, --help` | Show help message | - |
|
|
1113
|
+
| `-V, --version` | Show version number | - |
|
|
1114
|
+
|
|
1115
|
+
## Environment Variables
|
|
1116
|
+
|
|
1117
|
+
| Variable | Description |
|
|
1118
|
+
| --- | --- |
|
|
1119
|
+
| `PRIVATE_KEY_OR_MNEMONIC` | Private key (0x...) or BIP39 mnemonic phrase for signing transactions (required for write operations like transfer, set RSA key, set IP, wallet management, etc.) |
|
|
1120
|
+
| `MNEMONIC` | BIP39 mnemonic phrase for generating owner identity (used in subdomain registration, domain transfer, and crypto utilities) |
|
|
1121
|
+
| `EVM_PRIVATE_KEY` | EVM wallet private key (0x...) for wallet management operations (required for `wallet evm add/remove` commands) |
|
|
1122
|
+
| `SOLANA_PRIVATE_KEY` | Solana wallet private key for wallet management operations (required for `wallet solana add/remove` commands). Supports base58 or JSON array format |
|
|
1123
|
+
|
|
1124
|
+
**Security Note:** Using environment variables for private keys or mnemonics prevents them from being stored in shell history, which is more secure than passing them as command-line arguments.
|
|
1125
|
+
|
|
1126
|
+
**Format Examples:**
|
|
1127
|
+
|
|
1128
|
+
- Private key: `export PRIVATE_KEY_OR_MNEMONIC=0x1234567890abcdef...`
|
|
1129
|
+
- Mnemonic: `export PRIVATE_KEY_OR_MNEMONIC="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"`
|
|
1130
|
+
|
|
1131
|
+
> **⚠️ Important: Always use quotes for mnemonic phrases!**
|
|
1132
|
+
>
|
|
1133
|
+
> Without quotes, the shell will only capture the first word:
|
|
1134
|
+
>
|
|
1135
|
+
> ```bash
|
|
1136
|
+
> # ❌ WRONG - Only captures "advice"
|
|
1137
|
+
> export PRIVATE_KEY_OR_MNEMONIC=advice wrestle recycle yellow light avoid shell mutual ketchup obscure game corn
|
|
1138
|
+
>
|
|
1139
|
+
> # ✅ CORRECT - Captures the entire phrase
|
|
1140
|
+
> export PRIVATE_KEY_OR_MNEMONIC="advice wrestle recycle yellow light avoid shell mutual ketchup obscure game corn"
|
|
1141
|
+
> ```
|
|
1142
|
+
|
|
1143
|
+
## Network Configuration
|
|
1144
|
+
|
|
1145
|
+
### Sepolia (Default)
|
|
1146
|
+
|
|
1147
|
+
- RPC: `https://sepolia.optimism.io`
|
|
1148
|
+
- DID Contract: `0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8`
|
|
1149
|
+
- RootResolver: `0xeF727cb066Fee98F88Db84555830063b4A24ddfc`
|
|
1150
|
+
- ABI Type: `0x7386fCBae6Ad4CCE1499d9153D99bc950B589718`
|
|
1151
|
+
- RootResolver2: `0xcbC02aa08c77a374eC0D5A0403E108b7573d96e8`
|
|
1152
|
+
- Support Service: `https://api-test.olares.com/did/support`
|
|
1153
|
+
|
|
1154
|
+
### Mainnet
|
|
1155
|
+
|
|
1156
|
+
- RPC: `https://optimism-rpc.publicnode.com`
|
|
1157
|
+
- DID Contract: `0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D`
|
|
1158
|
+
- RootResolver: `0xE2EABA0979277A90511F8873ae1e8cA26B54E740`
|
|
1159
|
+
- ABI Type: `0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365`
|
|
1160
|
+
- RootResolver2: `0x50724411eb1817822e2590a43a8F0859FCc6fCD5`
|
|
1161
|
+
- Support Service: `https://api.olares.com/did/support`
|
|
1162
|
+
|
|
1163
|
+
## Output Formats
|
|
1164
|
+
|
|
1165
|
+
### Human-Readable (Default)
|
|
1166
|
+
|
|
1167
|
+
```bash
|
|
1168
|
+
$ did-cli info example.olares.com
|
|
1169
|
+
|
|
1170
|
+
📋 Domain Metadata:
|
|
1171
|
+
Name: example.olares.com
|
|
1172
|
+
DID: did:key:z6Mkm...
|
|
1173
|
+
Token ID: 1234567890123456789012345678901234567890
|
|
1174
|
+
Note: Individual:TerminusUser
|
|
1175
|
+
Allow Subdomain: true
|
|
1176
|
+
```
|
|
1177
|
+
|
|
1178
|
+
### JSON Format
|
|
1179
|
+
|
|
1180
|
+
```bash
|
|
1181
|
+
$ did-cli info example.olares.com --json
|
|
1182
|
+
|
|
1183
|
+
{
|
|
1184
|
+
"name": "example.olares.com",
|
|
1185
|
+
"did": "did:key:z6Mkm...",
|
|
1186
|
+
"id": "1234567890123456789012345678901234567890",
|
|
1187
|
+
"note": "Individual:TerminusUser",
|
|
1188
|
+
"allowSubdomain": true
|
|
1189
|
+
}
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
## Examples
|
|
1193
|
+
|
|
1194
|
+
### Complete Workflow: Register and Configure a Domain
|
|
1195
|
+
|
|
1196
|
+
```bash
|
|
1197
|
+
# 1. Set your private key or mnemonic (do this once per session)
|
|
1198
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234567890abcdef...
|
|
1199
|
+
# Or use mnemonic
|
|
1200
|
+
export PRIVATE_KEY_OR_MNEMONIC="your twelve word mnemonic phrase here"
|
|
1201
|
+
|
|
1202
|
+
# 2. Check ownership
|
|
1203
|
+
did-cli is-owner example.olares.com
|
|
1204
|
+
|
|
1205
|
+
# 3. Generate RSA key pair
|
|
1206
|
+
did-cli rsa generate --output ./example-key.pem --key-length 2048
|
|
1207
|
+
|
|
1208
|
+
# 4. Set RSA public key
|
|
1209
|
+
did-cli rsa set example.olares.com ./example-key.pem
|
|
1210
|
+
|
|
1211
|
+
# 5. Set IP address
|
|
1212
|
+
did-cli ip set example.olares.com 192.168.1.100
|
|
1213
|
+
|
|
1214
|
+
# 6. Verify configuration
|
|
1215
|
+
did-cli info example.olares.com
|
|
1216
|
+
did-cli rsa get example.olares.com
|
|
1217
|
+
did-cli ip get example.olares.com
|
|
1218
|
+
```
|
|
1219
|
+
|
|
1220
|
+
### Persisting Private Key Across Sessions
|
|
1221
|
+
|
|
1222
|
+
```bash
|
|
1223
|
+
# Add to your ~/.bashrc or ~/.zshrc for persistence
|
|
1224
|
+
echo 'export PRIVATE_KEY_OR_MNEMONIC=0x1234567890abcdef...' >> ~/.bashrc
|
|
1225
|
+
source ~/.bashrc
|
|
1226
|
+
|
|
1227
|
+
# Or use a .env file (recommended for development)
|
|
1228
|
+
echo 'PRIVATE_KEY_OR_MNEMONIC=0x1234567890abcdef...' > .env
|
|
1229
|
+
# Then load it before using CLI
|
|
1230
|
+
export $(cat .env | xargs)
|
|
1231
|
+
|
|
1232
|
+
# Now you can use commands without setting PRIVATE_KEY_OR_MNEMONIC each time
|
|
1233
|
+
did-cli rsa set example.olares.com ./key.pem
|
|
1234
|
+
did-cli ip set example.olares.com 192.168.1.100
|
|
1235
|
+
did-cli operator set 0x5678...
|
|
1236
|
+
```
|
|
1237
|
+
|
|
1238
|
+
### Batch Operations with JSON Output
|
|
1239
|
+
|
|
1240
|
+
```bash
|
|
1241
|
+
# Query multiple domains
|
|
1242
|
+
for domain in example1.olares.com example2.olares.com; do
|
|
1243
|
+
did-cli info $domain --json >> domains.json
|
|
1244
|
+
done
|
|
1245
|
+
|
|
1246
|
+
# Process JSON output with jq
|
|
1247
|
+
did-cli info example.olares.com --json | jq '.owner'
|
|
1248
|
+
```
|
|
1249
|
+
|
|
1250
|
+
## Error Handling
|
|
1251
|
+
|
|
1252
|
+
The CLI provides clear error messages for common issues:
|
|
1253
|
+
|
|
1254
|
+
```bash
|
|
1255
|
+
# Missing required argument
|
|
1256
|
+
$ did-cli info
|
|
1257
|
+
❌ Error: Domain argument is required
|
|
1258
|
+
Usage: did-cli info <domain>
|
|
1259
|
+
|
|
1260
|
+
# Invalid IP address
|
|
1261
|
+
$ did-cli ip set example.olares.com invalid-ip
|
|
1262
|
+
❌ Error: Invalid IPv4 address format
|
|
1263
|
+
|
|
1264
|
+
# Missing private key or mnemonic
|
|
1265
|
+
$ did-cli is-owner example.olares.com
|
|
1266
|
+
❌ Error: Private key or mnemonic is required for this operation
|
|
1267
|
+
Please set PRIVATE_KEY_OR_MNEMONIC environment variable
|
|
1268
|
+
Example: export PRIVATE_KEY_OR_MNEMONIC=0xYOUR_PRIVATE_KEY
|
|
1269
|
+
Or: export PRIVATE_KEY_OR_MNEMONIC="your twelve words..."
|
|
1270
|
+
```
|
|
1271
|
+
|
|
1272
|
+
## Development
|
|
1273
|
+
|
|
1274
|
+
### Run from Source
|
|
1275
|
+
|
|
1276
|
+
```bash
|
|
1277
|
+
# Clone repository
|
|
1278
|
+
git clone https://github.com/olares/did-system.git
|
|
1279
|
+
cd did-system/packages/olaresid
|
|
1280
|
+
|
|
1281
|
+
# Install dependencies
|
|
1282
|
+
npm install
|
|
1283
|
+
|
|
1284
|
+
# Run CLI
|
|
1285
|
+
npx ts-node src/cli.ts <command>
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1288
|
+
### Debug Mode
|
|
1289
|
+
|
|
1290
|
+
```bash
|
|
1291
|
+
# Enable verbose output
|
|
1292
|
+
did-cli info example.olares.com --verbose
|
|
1293
|
+
|
|
1294
|
+
# Enable debug output with level
|
|
1295
|
+
did-cli info example.olares.com --debug --debug-level debug
|
|
1296
|
+
```
|
|
1297
|
+
|
|
1298
|
+
## License
|
|
1299
|
+
|
|
1300
|
+
See the main repository LICENSE file.
|