@beclab/olaresid 0.1.4 → 0.1.6

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.
Files changed (52) hide show
  1. package/dist/business/index.d.ts +3 -3
  2. package/dist/business/index.d.ts.map +1 -1
  3. package/dist/business/index.js +49 -64
  4. package/dist/business/index.js.map +1 -1
  5. package/dist/cli.js +3 -3
  6. package/dist/cli.js.map +1 -1
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +6 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/utils/crypto-utils.d.ts +32 -4
  12. package/dist/utils/crypto-utils.d.ts.map +1 -1
  13. package/dist/utils/crypto-utils.js +117 -30
  14. package/dist/utils/crypto-utils.js.map +1 -1
  15. package/examples/crypto-utilities.ts +3 -3
  16. package/examples/ed25519-jwk.ts +1 -1
  17. package/examples/encoding-utils.ts +96 -0
  18. package/examples/frontend-demo/.dockerignore +40 -0
  19. package/examples/frontend-demo/index.html +13 -0
  20. package/examples/frontend-demo/package-lock.json +5304 -0
  21. package/examples/frontend-demo/package.json +32 -0
  22. package/examples/frontend-demo/src/App.vue +1156 -0
  23. package/examples/frontend-demo/src/main.ts +5 -0
  24. package/examples/frontend-demo/src/style.css +323 -0
  25. package/examples/frontend-demo/tsconfig.json +24 -0
  26. package/examples/frontend-demo/webpack.config.js +86 -0
  27. package/examples/generate-mnemonic.ts +3 -3
  28. package/examples/register-subdomain.ts +4 -3
  29. package/examples/transfer-domain.ts +1 -1
  30. package/examples/wallet-management.ts +8 -8
  31. package/package.json +1 -3
  32. package/src/business/index.ts +46 -58
  33. package/src/cli.ts +3 -3
  34. package/src/index.ts +6 -1
  35. package/src/utils/crypto-utils.ts +134 -32
  36. package/examples/quasar-demo/.eslintrc.js +0 -23
  37. package/examples/quasar-demo/.quasar/app.js +0 -43
  38. package/examples/quasar-demo/.quasar/client-entry.js +0 -38
  39. package/examples/quasar-demo/.quasar/client-prefetch.js +0 -130
  40. package/examples/quasar-demo/.quasar/quasar-user-options.js +0 -16
  41. package/examples/quasar-demo/README.md +0 -49
  42. package/examples/quasar-demo/index.html +0 -11
  43. package/examples/quasar-demo/package-lock.json +0 -6407
  44. package/examples/quasar-demo/package.json +0 -36
  45. package/examples/quasar-demo/quasar.config.js +0 -73
  46. package/examples/quasar-demo/src/App.vue +0 -13
  47. package/examples/quasar-demo/src/css/app.scss +0 -1
  48. package/examples/quasar-demo/src/layouts/MainLayout.vue +0 -21
  49. package/examples/quasar-demo/src/pages/IndexPage.vue +0 -905
  50. package/examples/quasar-demo/src/router/index.ts +0 -25
  51. package/examples/quasar-demo/src/router/routes.ts +0 -11
  52. package/examples/quasar-demo/tsconfig.json +0 -28
@@ -0,0 +1,5 @@
1
+ import { createApp } from 'vue';
2
+ import App from './App.vue';
3
+ import './style.css';
4
+
5
+ createApp(App).mount('#app');
@@ -0,0 +1,323 @@
1
+ /* Reset and base styles */
2
+ * {
3
+ margin: 0;
4
+ padding: 0;
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ body {
9
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
10
+ 'Helvetica Neue', Arial, sans-serif;
11
+ line-height: 1.6;
12
+ color: #333;
13
+ background: #f5f5f5;
14
+ }
15
+
16
+ /* App layout */
17
+ .app {
18
+ max-width: 900px;
19
+ margin: 0 auto;
20
+ padding: 20px;
21
+ min-height: 100vh;
22
+ display: flex;
23
+ flex-direction: column;
24
+ }
25
+
26
+ /* Header */
27
+ header {
28
+ text-align: center;
29
+ margin-bottom: 30px;
30
+ padding: 20px;
31
+ background: white;
32
+ border-radius: 8px;
33
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
34
+ }
35
+
36
+ header h1 {
37
+ font-size: 2rem;
38
+ margin-bottom: 15px;
39
+ color: #2c3e50;
40
+ }
41
+
42
+ nav {
43
+ display: flex;
44
+ gap: 10px;
45
+ justify-content: center;
46
+ flex-wrap: wrap;
47
+ }
48
+
49
+ /* Buttons */
50
+ button {
51
+ padding: 10px 20px;
52
+ border: 2px solid #3498db;
53
+ background: white;
54
+ color: #3498db;
55
+ font-size: 1rem;
56
+ cursor: pointer;
57
+ border-radius: 6px;
58
+ transition: all 0.3s ease;
59
+ font-weight: 500;
60
+ }
61
+
62
+ button:hover {
63
+ background: #3498db;
64
+ color: white;
65
+ }
66
+
67
+ button.active {
68
+ background: #3498db;
69
+ color: white;
70
+ }
71
+
72
+ button:disabled {
73
+ opacity: 0.5;
74
+ cursor: not-allowed;
75
+ background: #ddd;
76
+ border-color: #ddd;
77
+ color: #999;
78
+ }
79
+
80
+ .btn-primary {
81
+ background: #3498db;
82
+ color: white;
83
+ border-color: #3498db;
84
+ }
85
+
86
+ .btn-primary:hover:not(:disabled) {
87
+ background: #2980b9;
88
+ border-color: #2980b9;
89
+ }
90
+
91
+ .btn-secondary {
92
+ background: #95a5a6;
93
+ color: white;
94
+ border-color: #95a5a6;
95
+ margin-top: 15px;
96
+ }
97
+
98
+ .btn-secondary:hover:not(:disabled) {
99
+ background: #7f8c8d;
100
+ border-color: #7f8c8d;
101
+ }
102
+
103
+ .btn-copy {
104
+ padding: 5px 10px;
105
+ font-size: 0.9rem;
106
+ background: #ecf0f1;
107
+ border: 1px solid #bdc3c7;
108
+ color: #2c3e50;
109
+ }
110
+
111
+ .btn-copy:hover {
112
+ background: #bdc3c7;
113
+ color: #2c3e50;
114
+ }
115
+
116
+ /* Main content */
117
+ main {
118
+ flex: 1;
119
+ }
120
+
121
+ .section {
122
+ background: white;
123
+ padding: 30px;
124
+ border-radius: 8px;
125
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
126
+ }
127
+
128
+ .section h2 {
129
+ font-size: 1.5rem;
130
+ margin-bottom: 10px;
131
+ color: #2c3e50;
132
+ }
133
+
134
+ .subtitle {
135
+ color: #7f8c8d;
136
+ margin-bottom: 20px;
137
+ font-size: 0.95rem;
138
+ }
139
+
140
+ /* Input group */
141
+ .input-group {
142
+ display: flex;
143
+ gap: 10px;
144
+ margin-bottom: 20px;
145
+ }
146
+
147
+ input {
148
+ flex: 1;
149
+ padding: 12px;
150
+ border: 2px solid #ddd;
151
+ border-radius: 6px;
152
+ font-size: 1rem;
153
+ transition: border-color 0.3s ease;
154
+ }
155
+
156
+ input:focus {
157
+ outline: none;
158
+ border-color: #3498db;
159
+ }
160
+
161
+ input:disabled {
162
+ background: #f5f5f5;
163
+ cursor: not-allowed;
164
+ }
165
+
166
+ /* Result display */
167
+ .result {
168
+ margin-top: 25px;
169
+ padding: 20px;
170
+ background: #f8f9fa;
171
+ border-radius: 6px;
172
+ border-left: 4px solid #3498db;
173
+ }
174
+
175
+ .result h3 {
176
+ margin-bottom: 15px;
177
+ color: #27ae60;
178
+ font-size: 1.2rem;
179
+ }
180
+
181
+ .result-header {
182
+ display: flex;
183
+ justify-content: space-between;
184
+ align-items: center;
185
+ margin-bottom: 15px;
186
+ }
187
+
188
+ .field {
189
+ margin-bottom: 15px;
190
+ }
191
+
192
+ .field:last-child {
193
+ margin-bottom: 0;
194
+ }
195
+
196
+ .field label {
197
+ display: block;
198
+ font-weight: 600;
199
+ margin-bottom: 5px;
200
+ color: #555;
201
+ font-size: 0.9rem;
202
+ }
203
+
204
+ .field.warning {
205
+ background: #fff3cd;
206
+ padding: 15px;
207
+ border-radius: 6px;
208
+ border-left: 4px solid #f39c12;
209
+ }
210
+
211
+ .field.warning label {
212
+ color: #856404;
213
+ }
214
+
215
+ .value-row {
216
+ display: flex;
217
+ gap: 10px;
218
+ align-items: center;
219
+ }
220
+
221
+ code {
222
+ flex: 1;
223
+ display: block;
224
+ padding: 10px;
225
+ background: white;
226
+ border: 1px solid #ddd;
227
+ border-radius: 4px;
228
+ font-family: 'Monaco', 'Courier New', monospace;
229
+ font-size: 0.85rem;
230
+ word-break: break-all;
231
+ color: #333;
232
+ }
233
+
234
+ pre {
235
+ background: white;
236
+ padding: 15px;
237
+ border-radius: 6px;
238
+ overflow-x: auto;
239
+ font-family: 'Monaco', 'Courier New', monospace;
240
+ font-size: 0.85rem;
241
+ line-height: 1.5;
242
+ max-height: 500px;
243
+ overflow-y: auto;
244
+ border: 1px solid #ddd;
245
+ }
246
+
247
+ /* Error display */
248
+ .error {
249
+ margin-top: 20px;
250
+ padding: 15px;
251
+ background: #f8d7da;
252
+ color: #721c24;
253
+ border-radius: 6px;
254
+ border-left: 4px solid #dc3545;
255
+ }
256
+
257
+ /* Toast notification */
258
+ .toast {
259
+ position: fixed;
260
+ bottom: 30px;
261
+ right: 30px;
262
+ background: #27ae60;
263
+ color: white;
264
+ padding: 15px 25px;
265
+ border-radius: 6px;
266
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
267
+ animation: slideIn 0.3s ease;
268
+ z-index: 1000;
269
+ }
270
+
271
+ @keyframes slideIn {
272
+ from {
273
+ transform: translateY(100px);
274
+ opacity: 0;
275
+ }
276
+ to {
277
+ transform: translateY(0);
278
+ opacity: 1;
279
+ }
280
+ }
281
+
282
+ /* Footer */
283
+ footer {
284
+ text-align: center;
285
+ padding: 20px;
286
+ color: #7f8c8d;
287
+ font-size: 0.9rem;
288
+ margin-top: 30px;
289
+ }
290
+
291
+ /* Responsive */
292
+ @media (max-width: 768px) {
293
+ .app {
294
+ padding: 10px;
295
+ }
296
+
297
+ header h1 {
298
+ font-size: 1.5rem;
299
+ }
300
+
301
+ .section {
302
+ padding: 20px;
303
+ }
304
+
305
+ .input-group {
306
+ flex-direction: column;
307
+ }
308
+
309
+ .toast {
310
+ right: 10px;
311
+ left: 10px;
312
+ bottom: 10px;
313
+ }
314
+
315
+ nav {
316
+ gap: 5px;
317
+ }
318
+
319
+ button {
320
+ padding: 8px 16px;
321
+ font-size: 0.9rem;
322
+ }
323
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "skipLibCheck": true,
8
+
9
+ /* Webpack mode */
10
+ "moduleResolution": "node",
11
+ "isolatedModules": true,
12
+ "moduleDetection": "force",
13
+ "jsx": "preserve",
14
+
15
+ /* Linting */
16
+ "strict": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "noFallthroughCasesInSwitch": true,
20
+ "esModuleInterop": true,
21
+ "allowSyntheticDefaultImports": true
22
+ },
23
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
24
+ }
@@ -0,0 +1,86 @@
1
+ const path = require('path');
2
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
3
+ const { VueLoaderPlugin } = require('vue-loader');
4
+ const CopyWebpackPlugin = require('copy-webpack-plugin');
5
+
6
+ module.exports = (env, argv) => {
7
+ const isDevelopment = argv.mode === 'development';
8
+
9
+ return {
10
+ mode: isDevelopment ? 'development' : 'production',
11
+ entry: './src/main.ts',
12
+ output: {
13
+ path: path.resolve(__dirname, 'dist'),
14
+ filename: isDevelopment ? '[name].js' : '[name].[contenthash].js',
15
+ clean: true
16
+ },
17
+ resolve: {
18
+ extensions: ['.ts', '.js', '.vue', '.json', '.wasm'],
19
+ alias: {
20
+ '@': path.resolve(__dirname, 'src')
21
+ },
22
+ fallback: {
23
+ crypto: false,
24
+ fs: false,
25
+ path: false,
26
+ 'fs/promises': false
27
+ }
28
+ },
29
+ module: {
30
+ rules: [
31
+ {
32
+ test: /\.vue$/,
33
+ loader: 'vue-loader'
34
+ },
35
+ {
36
+ test: /\.ts$/,
37
+ loader: 'ts-loader',
38
+ options: {
39
+ appendTsSuffixTo: [/\.vue$/],
40
+ transpileOnly: true
41
+ },
42
+ exclude: /node_modules/
43
+ },
44
+ {
45
+ test: /\.css$/,
46
+ use: ['style-loader', 'css-loader']
47
+ },
48
+ {
49
+ test: /\.wasm$/,
50
+ type: 'webassembly/async'
51
+ }
52
+ ]
53
+ },
54
+ plugins: [
55
+ new VueLoaderPlugin(),
56
+ new HtmlWebpackPlugin({
57
+ template: './index.html',
58
+ inject: true
59
+ }),
60
+ new CopyWebpackPlugin({
61
+ patterns: [
62
+ {
63
+ from: path.resolve(
64
+ __dirname,
65
+ '../../node_modules/@trustwallet/wallet-core/dist/lib/wallet-core.wasm'
66
+ ),
67
+ to: 'wallet-core.wasm'
68
+ }
69
+ ]
70
+ })
71
+ ],
72
+ experiments: {
73
+ asyncWebAssembly: true,
74
+ topLevelAwait: true
75
+ },
76
+ devServer: {
77
+ port: 9000,
78
+ hot: true,
79
+ open: true
80
+ },
81
+ devtool: isDevelopment ? 'eval-source-map' : false,
82
+ performance: {
83
+ hints: false
84
+ }
85
+ };
86
+ };
@@ -21,7 +21,7 @@ async function example1_generateNew() {
21
21
 
22
22
  // Generate a 12-word mnemonic
23
23
  console.log('\nšŸ”‘ Generating 12-word mnemonic...');
24
- const mnemonic12 = generateMnemonic(12);
24
+ const mnemonic12 = await generateMnemonic(12);
25
25
  console.log(`Mnemonic: ${mnemonic12}`);
26
26
 
27
27
  console.log('\nā³ Deriving keys using Trust Wallet Core...');
@@ -35,7 +35,7 @@ async function example1_generateNew() {
35
35
  // Generate a 24-word mnemonic
36
36
  console.log('\n' + '-'.repeat(60));
37
37
  console.log('\nšŸ”‘ Generating 24-word mnemonic...');
38
- const mnemonic24 = generateMnemonic(24);
38
+ const mnemonic24 = await generateMnemonic(24);
39
39
  console.log(`Mnemonic: ${mnemonic24}`);
40
40
 
41
41
  console.log('\nā³ Deriving keys...');
@@ -95,7 +95,7 @@ async function example4_parallelDerivation() {
95
95
  console.log('Example 4: Parallel Key Derivation (Performance Test)');
96
96
  console.log('='.repeat(60));
97
97
 
98
- const mnemonic = generateMnemonic(12);
98
+ const mnemonic = await generateMnemonic(12);
99
99
  console.log(`\nšŸ“ Mnemonic: ${mnemonic}`);
100
100
 
101
101
  console.log('\nā³ Deriving owner and DID in parallel...');
@@ -53,7 +53,7 @@ async function main() {
53
53
  console.log('-'.repeat(60));
54
54
 
55
55
  // Replace with your actual parent domain
56
- const PARENT_DOMAIN = process.env.PARENT_DOMAIN || 'tw7613781.olares.com';
56
+ const PARENT_DOMAIN = process.env.PARENT_DOMAIN || '1.com';
57
57
  const parentDomain = olaresId.domain(PARENT_DOMAIN);
58
58
 
59
59
  console.log(`šŸ“‹ Parent domain: ${PARENT_DOMAIN}`);
@@ -79,7 +79,7 @@ async function main() {
79
79
  console.log('\nšŸ“ Step 4: Generate Mnemonic for Subdomain');
80
80
  console.log('-'.repeat(60));
81
81
 
82
- const mnemonic = generateMnemonic(12);
82
+ const mnemonic = await generateMnemonic(12);
83
83
  console.log('āœ… Generated 12-word mnemonic:');
84
84
  console.log(` ${mnemonic}`);
85
85
  console.log(
@@ -92,7 +92,8 @@ async function main() {
92
92
  console.log('\nšŸ“ Step 5: Register Subdomain');
93
93
  console.log('-'.repeat(60));
94
94
 
95
- const SUBDOMAIN_LABEL = process.env.SUBDOMAIN || 'example-child';
95
+ const SUBDOMAIN_LABEL =
96
+ process.env.SUBDOMAIN || `example-child-${Date.now()}`;
96
97
  console.log(`šŸ“‹ Subdomain label: ${SUBDOMAIN_LABEL}`);
97
98
  console.log(`šŸ“‹ Full domain will be: ${SUBDOMAIN_LABEL}.${PARENT_DOMAIN}`);
98
99
 
@@ -98,7 +98,7 @@ async function main() {
98
98
  mnemonic = process.env.NEW_OWNER_MNEMONIC;
99
99
  console.log('šŸ“ Using provided mnemonic');
100
100
  } else {
101
- mnemonic = generateMnemonic(12);
101
+ mnemonic = await generateMnemonic(12);
102
102
  console.log('šŸ”‘ Generated 12-word mnemonic:');
103
103
  console.log(` ${mnemonic}`);
104
104
  console.log(
@@ -56,10 +56,10 @@ async function main() {
56
56
  console.log('');
57
57
 
58
58
  // 2. Add a new EVM wallet (optional - only if you have an EVM private key)
59
- if (process.env.EVM_WALLET_PRIVATE_KEY) {
59
+ if (process.env.EVM_PRIVATE_KEY) {
60
60
  console.log('2ļøāƒ£ Adding a new EVM wallet...');
61
61
  const addResult = await domain.addEVMWallet(
62
- process.env.EVM_WALLET_PRIVATE_KEY
62
+ process.env.EVM_PRIVATE_KEY
63
63
  );
64
64
 
65
65
  if (addResult.success) {
@@ -87,10 +87,10 @@ async function main() {
87
87
  }
88
88
 
89
89
  // 4. Remove an EVM wallet (optional)
90
- if (process.env.EVM_WALLET_TO_REMOVE) {
90
+ if (process.env.EVM_PRIVATE_KEY) {
91
91
  console.log('4ļøāƒ£ Removing an EVM wallet...');
92
92
  const removeResult = await domain.removeEVMWallet(
93
- process.env.EVM_WALLET_TO_REMOVE
93
+ process.env.EVM_PRIVATE_KEY
94
94
  );
95
95
 
96
96
  if (removeResult.success) {
@@ -127,10 +127,10 @@ async function main() {
127
127
  console.log('');
128
128
 
129
129
  // 6. Add a new Solana wallet (optional - only if you have a Solana private key)
130
- if (process.env.SOLANA_WALLET_PRIVATE_KEY) {
130
+ if (process.env.SOLANA_PRIVATE_KEY) {
131
131
  console.log('6ļøāƒ£ Adding a new Solana wallet...');
132
132
  const addResult = await domain.addSolanaWallet(
133
- process.env.SOLANA_WALLET_PRIVATE_KEY
133
+ process.env.SOLANA_PRIVATE_KEY
134
134
  );
135
135
 
136
136
  if (addResult.success) {
@@ -162,10 +162,10 @@ async function main() {
162
162
  }
163
163
 
164
164
  // 8. Remove a Solana wallet (optional)
165
- if (process.env.SOLANA_WALLET_TO_REMOVE) {
165
+ if (process.env.SOLANA_PRIVATE_KEY) {
166
166
  console.log('8ļøāƒ£ Removing a Solana wallet...');
167
167
  const removeResult = await domain.removeSolanaWallet(
168
- process.env.SOLANA_WALLET_TO_REMOVE
168
+ process.env.SOLANA_PRIVATE_KEY
169
169
  );
170
170
 
171
171
  if (removeResult.success) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beclab/olaresid",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "DID Contract SDK with CLI tool",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,8 +39,6 @@
39
39
  "dependencies": {
40
40
  "@solana/web3.js": "^1.87.6",
41
41
  "@trustwallet/wallet-core": "^3.2.9",
42
- "bip39": "^3.1.0",
43
- "bs58": "^5.0.0",
44
42
  "ethers": "^6.9.1",
45
43
  "multiformats": "9.6.4",
46
44
  "tweetnacl": "^1.0.3",