@beclab/olaresid 0.1.6 → 0.1.8

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 CHANGED
@@ -35,7 +35,7 @@ did-cli info <domain> [options]
35
35
  # Examples
36
36
  did-cli info example.olares.com
37
37
  did-cli info example.olares.com --json
38
- did-cli info example.olares.com --network mainnet
38
+ did-cli info example.olares.com --network sepolia
39
39
  ```
40
40
 
41
41
  #### Get Domain Owner
@@ -163,22 +163,22 @@ did-cli subdomain register parent.com child
163
163
  did-cli subdomain register parent.com child --words 24
164
164
 
165
165
  # Use an existing mnemonic for subdomain owner
166
- export MNEMONIC="your twelve word mnemonic phrase here that will derive the keys"
166
+ export SUBDOMAIN_OWNER_MNEMONIC="your twelve word mnemonic phrase here that will derive the keys"
167
167
  did-cli subdomain register parent.com child
168
168
 
169
169
  # JSON output
170
170
  did-cli subdomain register parent.com child --json
171
171
 
172
- # Use mainnet
173
- did-cli subdomain register parent.com child --network mainnet
172
+ # Use sepolia testnet
173
+ did-cli subdomain register parent.com child --network sepolia
174
174
  ```
175
175
 
176
176
  **Important Notes:**
177
177
 
178
178
  1. **Authentication**: You need the parent domain owner's private key or mnemonic via `PRIVATE_KEY_OR_MNEMONIC` environment variable
179
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`
180
+ - Set via `SUBDOMAIN_OWNER_MNEMONIC` environment variable to use an existing mnemonic
181
+ - If `SUBDOMAIN_OWNER_MNEMONIC` is not set, a new one will be auto-generated and saved to `./subdomain-mnemonic.txt`
182
182
  - The mnemonic derives the subdomain's owner address and DID
183
183
  - **Save the mnemonic securely** - it's the only way to control the subdomain
184
184
  3. **Full Domain**: If you register `child` under `parent.com`, the full domain will be `child.parent.com`
@@ -235,22 +235,22 @@ did-cli transfer example.com
235
235
  did-cli transfer example.com --words 24
236
236
 
237
237
  # Use specific mnemonic for new owner
238
- export MNEMONIC="new owner twelve word mnemonic phrase here"
238
+ export TO_MNEMONIC="new owner twelve word mnemonic phrase here"
239
239
  did-cli transfer example.com
240
240
 
241
241
  # JSON output
242
242
  did-cli transfer example.com --json
243
243
 
244
- # Use mainnet
245
- did-cli transfer example.com --network mainnet
244
+ # Use sepolia testnet
245
+ did-cli transfer example.com --network sepolia
246
246
  ```
247
247
 
248
248
  **Important Notes:**
249
249
 
250
250
  1. **Authentication**: You need the current owner's private key or mnemonic via `PRIVATE_KEY_OR_MNEMONIC` environment variable
251
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`
252
+ - Set via `TO_MNEMONIC` environment variable to use an existing mnemonic
253
+ - If `TO_MNEMONIC` is not set, a new one will be auto-generated and saved to `./transfer-new-owner-mnemonic.txt`
254
254
  - The mnemonic derives the new owner's address and DID
255
255
  - **Save the new owner's mnemonic securely** - it's the only way to control the domain after transfer
256
256
  3. **Two Transactions**: The operation submits two transactions to the blockchain
@@ -470,8 +470,8 @@ did-cli wallet evm add example.com
470
470
  # With JSON output
471
471
  did-cli wallet evm add example.com --json
472
472
 
473
- # On mainnet
474
- did-cli wallet evm add example.com --network mainnet
473
+ # On sepolia testnet
474
+ did-cli wallet evm add example.com --network sepolia
475
475
  ```
476
476
 
477
477
  **Output Example:**
@@ -629,29 +629,144 @@ did-cli wallet solana list example.com --json
629
629
  4. **Storage**: Wallet addresses are stored in the RootTagger2 contract
630
630
  5. **Backward Compatibility**: `list` command also fetches addresses from legacy RootResolver contract
631
631
 
632
- ### Operator Management
632
+ ### Admin Commands
633
+
634
+ Manage contract-level administrative functions including ownership and operator management.
635
+
636
+ #### Get Contract Owner
637
+
638
+ Get the current owner address of the DID contract.
639
+
640
+ ```bash
641
+ did-cli admin get-owner [options]
642
+
643
+ # Examples
644
+ did-cli admin get-owner
645
+ did-cli admin get-owner --json
646
+ did-cli admin get-owner --network sepolia
647
+ ```
648
+
649
+ **Output Example:**
650
+
651
+ ```
652
+ 👤 Contract Owner: 0x1234567890abcdef...
653
+ ```
654
+
655
+ #### Get Total Supply
656
+
657
+ Get the total number of registered domains.
658
+
659
+ ```bash
660
+ did-cli admin get-totalsupply [options]
661
+
662
+ # Examples
663
+ did-cli admin get-totalsupply
664
+ did-cli admin get-totalsupply --json
665
+ ```
666
+
667
+ **Output Example:**
668
+
669
+ ```
670
+ 📊 Total Domains: 12345
671
+ ```
633
672
 
634
673
  #### Get Operator Address
635
674
 
675
+ Get the current operator address (super admin).
676
+
636
677
  ```bash
637
- did-cli operator get [options]
678
+ did-cli admin get-operator [options]
638
679
 
639
680
  # Examples
640
- did-cli operator get
641
- did-cli operator get --json
642
- did-cli operator get --network mainnet
681
+ did-cli admin get-operator
682
+ did-cli admin get-operator --json
683
+ did-cli admin get-operator --network sepolia
684
+ ```
685
+
686
+ **Output Example:**
687
+
688
+ ```
689
+ 👔 Operator: 0x5678901234abcdef...
643
690
  ```
644
691
 
645
692
  #### Set Operator Address
646
693
 
694
+ Set the operator address. Only the contract owner can call this.
695
+
647
696
  ```bash
648
- did-cli operator set <address>
697
+ did-cli admin set-operator <address>
649
698
 
650
699
  # Examples
651
700
  export PRIVATE_KEY_OR_MNEMONIC=0x1234...
652
- did-cli operator set 0x5678...
653
- did-cli operator set 0x5678... --json
701
+ did-cli admin set-operator 0x5678...
702
+ did-cli admin set-operator 0x5678... --json
703
+ ```
704
+
705
+ **Output Example:**
706
+
707
+ ```
708
+ ✅ Operator set to 0x5678...
709
+ 📝 Transaction: 0xabc123...
710
+ ⛽ Gas used: 45000
711
+ ```
712
+
713
+ #### Transfer Contract Ownership
714
+
715
+ Initiate transfer of contract ownership to a new address. The new owner must call `accept-ownership` to complete the transfer.
716
+
717
+ ```bash
718
+ did-cli admin transfer-ownership <new-owner-address>
719
+
720
+ # Examples
721
+ export PRIVATE_KEY_OR_MNEMONIC=0x1234...
722
+ did-cli admin transfer-ownership 0x9999...
723
+ did-cli admin transfer-ownership 0x9999... --json
724
+ ```
725
+
726
+ **Output Example:**
727
+
728
+ ```
729
+ ✅ Ownership transfer initiated to 0x9999...
730
+ 📝 Transaction: 0xdef456...
731
+ ⛽ Gas used: 50000
732
+
733
+ ⚠️ Note: The new owner must call "admin accept-ownership" to complete the transfer
734
+ ```
735
+
736
+ **Important Notes:**
737
+
738
+ - Only the current contract owner can initiate ownership transfer
739
+ - This is a two-step process for safety:
740
+ 1. Current owner calls `transfer-ownership`
741
+ 2. New owner calls `accept-ownership`
742
+ - The pending owner can be queried from the contract
743
+
744
+ #### Accept Ownership Transfer
745
+
746
+ Accept a pending ownership transfer. Must be called by the pending owner.
747
+
748
+ ```bash
749
+ did-cli admin accept-ownership
750
+
751
+ # Examples
752
+ export PRIVATE_KEY_OR_MNEMONIC=0x9999... # New owner's private key
753
+ did-cli admin accept-ownership
754
+ did-cli admin accept-ownership --json
755
+ ```
756
+
757
+ **Output Example:**
758
+
654
759
  ```
760
+ ✅ Ownership transfer accepted successfully
761
+ 📝 Transaction: 0xghi789...
762
+ ⛽ Gas used: 48000
763
+ ```
764
+
765
+ **Important Notes:**
766
+
767
+ - Only the pending owner (set by `transfer-ownership`) can accept
768
+ - After acceptance, you become the new contract owner
769
+ - This completes the ownership transfer process
655
770
 
656
771
  ### Utility Commands
657
772
 
@@ -1095,7 +1210,7 @@ did-cli tag remove example.com premium
1095
1210
 
1096
1211
  | Option | Description | Default |
1097
1212
  | --- | --- | --- |
1098
- | `-n, --network <network>` | Network to use (sepolia\|mainnet) | sepolia |
1213
+ | `-n, --network <network>` | Network to use (sepolia\|mainnet) | mainnet |
1099
1214
  | `--rpc <url>` | Custom RPC endpoint URL | - |
1100
1215
  | `--contract-did <address>` | Custom DID contract address | - |
1101
1216
  | `--contract-resolver <address>` | Custom RootResolver contract address | - |
@@ -1117,7 +1232,9 @@ did-cli tag remove example.com premium
1117
1232
  | Variable | Description |
1118
1233
  | --- | --- |
1119
1234
  | `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) |
1235
+ | `SUBDOMAIN_OWNER_MNEMONIC` | BIP39 mnemonic phrase for generating subdomain owner identity (used in subdomain registration) |
1236
+ | `TO_MNEMONIC` | BIP39 mnemonic phrase for generating new owner identity (used in domain transfer) |
1237
+ | `MNEMONIC` | BIP39 mnemonic phrase for crypto utility commands (used in crypto address, did, privatekey, derive) |
1121
1238
  | `EVM_PRIVATE_KEY` | EVM wallet private key (0x...) for wallet management operations (required for `wallet evm add/remove` commands) |
1122
1239
  | `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
1240
 
@@ -1142,7 +1259,16 @@ did-cli tag remove example.com premium
1142
1259
 
1143
1260
  ## Network Configuration
1144
1261
 
1145
- ### Sepolia (Default)
1262
+ ### Mainnet (Default)
1263
+
1264
+ - RPC: `https://optimism-rpc.publicnode.com`
1265
+ - DID Contract: `0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D`
1266
+ - RootResolver: `0xE2EABA0979277A90511F8873ae1e8cA26B54E740`
1267
+ - ABI Type: `0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365`
1268
+ - RootResolver2: `0x7e7961aB771cA942CE4DB6e79579e016a33Dc95B`
1269
+ - Support Service: `https://api.olares.com/did/support`
1270
+
1271
+ ### Sepolia Testnet
1146
1272
 
1147
1273
  - RPC: `https://sepolia.optimism.io`
1148
1274
  - DID Contract: `0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8`
@@ -1151,15 +1277,6 @@ did-cli tag remove example.com premium
1151
1277
  - RootResolver2: `0xcbC02aa08c77a374eC0D5A0403E108b7573d96e8`
1152
1278
  - Support Service: `https://api-test.olares.com/did/support`
1153
1279
 
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
1280
  ## Output Formats
1164
1281
 
1165
1282
  ### Human-Readable (Default)
package/README.md CHANGED
@@ -11,11 +11,11 @@
11
11
  ```bash
12
12
  npm install -g @beclab/olaresid
13
13
 
14
- # Query Olares ID information on testnet
14
+ # Query Olares ID information on mainnet (default)
15
15
  did-cli info example.olares.com
16
16
 
17
- # Query Olares ID information on mainnet
18
- did-cli info example.olares.com --network mainnet
17
+ # Query Olares ID information on sepolia testnet
18
+ did-cli info example.olares.com --network sepolia
19
19
 
20
20
  # Support Olares ID Format
21
21
  did-cli info alice@example.com
@@ -33,6 +33,16 @@ Refer to the [examples](./examples) directory.
33
33
 
34
34
  For Tag System usage, see [TAG.md](./TAG.md).
35
35
 
36
+ #### Frontend Usage (Browser Environment)
37
+
38
+ When using `@beclab/olaresid` in frontend applications (React, Vue, etc.), you need to configure polyfills and bundler settings due to:
39
+
40
+ 1. **WASM Support**: The package includes Trust Wallet Core WASM module
41
+ 2. **Node.js Polyfills**: Browser environments need `buffer` polyfill
42
+ 3. **CommonJS Format**: The package is in CommonJS format
43
+
44
+ **Webpack has better support for CommonJS packages and WASM modules.** We strongly recommend using Webpack for bundling.
45
+
36
46
  ---
37
47
 
38
48
  ## Contribution Guide
@@ -61,7 +71,7 @@ npm link
61
71
 
62
72
  # Test CLI functionality
63
73
  did-cli info tw7613781.olares.com
64
- did-cli info pengpeng8.olares.com --network mainnet
74
+ did-cli info pengpeng8.olares.com --network sepolia
65
75
  ```
66
76
 
67
77
  ### Testing Method 2: Debug via Example Code
@@ -85,18 +95,18 @@ After testing, feel free to submit a Pull Request!
85
95
 
86
96
  ## Network Configuration
87
97
 
88
- #### Sepolia Testnet (Default)
89
-
90
- - **RPC:** https://sepolia.optimism.io
91
- - **DID Contract:** 0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8
92
- - **Root Resolver:** 0xeF727cb066Fee98F88Db84555830063b4A24ddfc
93
- - **Root Resolver2:** 0xcbC02aa08c77a374eC0D5A0403E108b7573d96e8
94
- - **ABI Type:** 0x7386fCBae6Ad4CCE1499d9153D99bc950B589718
95
-
96
- #### Mainnet
98
+ #### Mainnet (Default)
97
99
 
98
100
  - **RPC:** https://optimism-rpc.publicnode.com
99
101
  - **DID Contract:** 0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D
100
102
  - **Root Resolver:** 0xE2EABA0979277A90511F8873ae1e8cA26B54E740
101
103
  - **Root Resolver2:** 0x7e7961aB771cA942CE4DB6e79579e016a33Dc95B
102
104
  - **ABI Type:** 0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365
105
+
106
+ #### Sepolia Testnet
107
+
108
+ - **RPC:** https://sepolia.optimism.io
109
+ - **DID Contract:** 0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8
110
+ - **Root Resolver:** 0xeF727cb066Fee98F88Db84555830063b4A24ddfc
111
+ - **Root Resolver2:** 0xcbC02aa08c77a374eC0D5A0403E108b7573d96e8
112
+ - **ABI Type:** 0x7386fCBae6Ad4CCE1499d9153D99bc950B589718
@@ -26,7 +26,7 @@ export interface TagInfo {
26
26
  type: string;
27
27
  value: any;
28
28
  }
29
- export { createRsaKeyPair, generateMnemonic, getEthereumAddressFromMnemonic, getEVMPrivateKeyFromMnemonic, getDIDFromMnemonic, generateDIDKeyData, deriveDIDFromMnemonic, getEd25519JwkFromMnemonic, base64ToUint8Array, uint8ArrayToHex, hexToUint8Array, uint8ArrayToBase64 } from '../utils/crypto-utils';
29
+ export { createRsaKeyPair, generateMnemonic, getEthereumAddressFromMnemonic, getEVMPrivateKeyFromMnemonic, getDIDFromMnemonic, generateDIDKeyData, deriveDIDFromMnemonic, getEd25519JwkFromMnemonic } from '../utils/crypto-utils';
30
30
  export type { RSAPublicKeyData, DIDKeyData } from '../utils/crypto-utils';
31
31
  export { TagContext } from './tag-context';
32
32
  export { TagTypeBuilder } from '../utils/tag-type-builder';
@@ -88,7 +88,7 @@ export declare class DomainContext {
88
88
  * ```typescript
89
89
  * // For parent domain "parent.com", register subdomain "child"
90
90
  * const parentDomain = olaresId.domain('parent.com');
91
- * const mnemonic = await generateMnemonic(12);
91
+ * const mnemonic = generateMnemonic(12);
92
92
  *
93
93
  * const result = await parentDomain.registerSubdomain('child', mnemonic);
94
94
  * // This will register "child.parent.com"
@@ -113,7 +113,7 @@ export declare class DomainContext {
113
113
  *
114
114
  * @example
115
115
  * ```typescript
116
- * const mnemonic = await generateMnemonic(12);
116
+ * const mnemonic = generateMnemonic(12);
117
117
  * const result = await domain.transfer(mnemonic);
118
118
  * if (result.success) {
119
119
  * console.log('Domain transferred!');
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/business/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAU3C,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG;IAEzC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,IAAI,CAAC,EAAE,CAAC,CAAC;IAET,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,C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7B;;;;;;;;;;;OAWG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIrE;;;;;;OAMG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IAIlD;;;;;;OAMG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI5D;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAIhE;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAGzC;AAOD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA0BjD;AAOD,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAqBtD;AAOD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY5C;AAOD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAmB/C"}
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.DomainContext = exports.UserType = exports.TagTypeBuilder = exports.TagContext = exports.uint8ArrayToBase64 = exports.hexToUint8Array = exports.uint8ArrayToHex = exports.base64ToUint8Array = exports.getEd25519JwkFromMnemonic = exports.deriveDIDFromMnemonic = exports.generateDIDKeyData = exports.getDIDFromMnemonic = exports.getEVMPrivateKeyFromMnemonic = exports.getEthereumAddressFromMnemonic = exports.generateMnemonic = exports.createRsaKeyPair = void 0;
36
+ exports.DomainContext = exports.UserType = exports.TagTypeBuilder = exports.TagContext = exports.getEd25519JwkFromMnemonic = exports.deriveDIDFromMnemonic = exports.generateDIDKeyData = exports.getDIDFromMnemonic = exports.getEVMPrivateKeyFromMnemonic = exports.getEthereumAddressFromMnemonic = exports.generateMnemonic = exports.createRsaKeyPair = void 0;
37
37
  exports.ipv4ToBytes4 = ipv4ToBytes4;
38
38
  exports.bytes4ToIpv4 = bytes4ToIpv4;
39
39
  exports.pemToDer = pemToDer;
@@ -43,21 +43,16 @@ const error_parser_1 = require("../utils/error-parser");
43
43
  const tag_context_1 = require("./tag-context");
44
44
  const tag_type_builder_1 = require("../utils/tag-type-builder");
45
45
  const olares_id_1 = require("../utils/olares-id");
46
- const crypto_utils_1 = require("../utils/crypto-utils");
47
46
  // Re-export from crypto-utils
48
- var crypto_utils_2 = require("../utils/crypto-utils");
49
- Object.defineProperty(exports, "createRsaKeyPair", { enumerable: true, get: function () { return crypto_utils_2.createRsaKeyPair; } });
50
- Object.defineProperty(exports, "generateMnemonic", { enumerable: true, get: function () { return crypto_utils_2.generateMnemonic; } });
51
- Object.defineProperty(exports, "getEthereumAddressFromMnemonic", { enumerable: true, get: function () { return crypto_utils_2.getEthereumAddressFromMnemonic; } });
52
- Object.defineProperty(exports, "getEVMPrivateKeyFromMnemonic", { enumerable: true, get: function () { return crypto_utils_2.getEVMPrivateKeyFromMnemonic; } });
53
- Object.defineProperty(exports, "getDIDFromMnemonic", { enumerable: true, get: function () { return crypto_utils_2.getDIDFromMnemonic; } });
54
- Object.defineProperty(exports, "generateDIDKeyData", { enumerable: true, get: function () { return crypto_utils_2.generateDIDKeyData; } });
55
- Object.defineProperty(exports, "deriveDIDFromMnemonic", { enumerable: true, get: function () { return crypto_utils_2.deriveDIDFromMnemonic; } });
56
- Object.defineProperty(exports, "getEd25519JwkFromMnemonic", { enumerable: true, get: function () { return crypto_utils_2.getEd25519JwkFromMnemonic; } });
57
- Object.defineProperty(exports, "base64ToUint8Array", { enumerable: true, get: function () { return crypto_utils_2.base64ToUint8Array; } });
58
- Object.defineProperty(exports, "uint8ArrayToHex", { enumerable: true, get: function () { return crypto_utils_2.uint8ArrayToHex; } });
59
- Object.defineProperty(exports, "hexToUint8Array", { enumerable: true, get: function () { return crypto_utils_2.hexToUint8Array; } });
60
- Object.defineProperty(exports, "uint8ArrayToBase64", { enumerable: true, get: function () { return crypto_utils_2.uint8ArrayToBase64; } });
47
+ var crypto_utils_1 = require("../utils/crypto-utils");
48
+ Object.defineProperty(exports, "createRsaKeyPair", { enumerable: true, get: function () { return crypto_utils_1.createRsaKeyPair; } });
49
+ Object.defineProperty(exports, "generateMnemonic", { enumerable: true, get: function () { return crypto_utils_1.generateMnemonic; } });
50
+ Object.defineProperty(exports, "getEthereumAddressFromMnemonic", { enumerable: true, get: function () { return crypto_utils_1.getEthereumAddressFromMnemonic; } });
51
+ Object.defineProperty(exports, "getEVMPrivateKeyFromMnemonic", { enumerable: true, get: function () { return crypto_utils_1.getEVMPrivateKeyFromMnemonic; } });
52
+ Object.defineProperty(exports, "getDIDFromMnemonic", { enumerable: true, get: function () { return crypto_utils_1.getDIDFromMnemonic; } });
53
+ Object.defineProperty(exports, "generateDIDKeyData", { enumerable: true, get: function () { return crypto_utils_1.generateDIDKeyData; } });
54
+ Object.defineProperty(exports, "deriveDIDFromMnemonic", { enumerable: true, get: function () { return crypto_utils_1.deriveDIDFromMnemonic; } });
55
+ Object.defineProperty(exports, "getEd25519JwkFromMnemonic", { enumerable: true, get: function () { return crypto_utils_1.getEd25519JwkFromMnemonic; } });
61
56
  // Re-export Tag-related classes
62
57
  var tag_context_2 = require("./tag-context");
63
58
  Object.defineProperty(exports, "TagContext", { enumerable: true, get: function () { return tag_context_2.TagContext; } });
@@ -167,7 +162,7 @@ class DomainContext {
167
162
  * ```typescript
168
163
  * // For parent domain "parent.com", register subdomain "child"
169
164
  * const parentDomain = olaresId.domain('parent.com');
170
- * const mnemonic = await generateMnemonic(12);
165
+ * const mnemonic = generateMnemonic(12);
171
166
  *
172
167
  * const result = await parentDomain.registerSubdomain('child', mnemonic);
173
168
  * // This will register "child.parent.com"
@@ -239,7 +234,7 @@ class DomainContext {
239
234
  *
240
235
  * @example
241
236
  * ```typescript
242
- * const mnemonic = await generateMnemonic(12);
237
+ * const mnemonic = generateMnemonic(12);
243
238
  * const result = await domain.transfer(mnemonic);
244
239
  * if (result.success) {
245
240
  * console.log('Domain transferred!');
@@ -711,7 +706,7 @@ class DomainContext {
711
706
  catch {
712
707
  // Try base64
713
708
  try {
714
- const secretKey = (0, crypto_utils_1.base64ToUint8Array)(solanaPrivateKey);
709
+ const secretKey = Buffer.from(solanaPrivateKey, 'base64');
715
710
  solanaWallet = Keypair.fromSecretKey(secretKey);
716
711
  }
717
712
  catch {
@@ -720,8 +715,8 @@ class DomainContext {
720
715
  solanaWallet = Keypair.fromSecretKey(Uint8Array.from(secretKey));
721
716
  }
722
717
  }
723
- // Get Solana address as bytes32 (cross-platform)
724
- const solanaAddressBytes = '0x' + (0, crypto_utils_1.uint8ArrayToHex)(solanaWallet.publicKey.toBytes());
718
+ // Get Solana address as bytes32
719
+ const solanaAddressBytes = '0x' + solanaWallet.publicKey.toBuffer().toString('hex');
725
720
  // Get current timestamp
726
721
  const signAt = Math.floor(Date.now() / 1000) - 30 * 60; // 30 minutes ago
727
722
  // Prepare the request value
@@ -763,8 +758,7 @@ class DomainContext {
763
758
  ' for Terminus DID ' +
764
759
  this.domainName;
765
760
  const sigFromAuthAddr = nacl.default.sign.detached(decodeUTF8(solanaMsg), solanaWallet.secretKey);
766
- // Convert signature to hex (cross-platform)
767
- const sigFromAuthAddrHex = '0x' + (0, crypto_utils_1.uint8ArrayToHex)(sigFromAuthAddr);
761
+ const sigFromAuthAddrHex = '0x' + Buffer.from(sigFromAuthAddr).toString('hex');
768
762
  // Call contract
769
763
  const tx = await rootTagger.updateSolanaWallet(value, sigFromDomainOwner, sigFromAuthAddrHex);
770
764
  const receipt = await tx.wait();
@@ -816,7 +810,7 @@ class DomainContext {
816
810
  catch {
817
811
  // Try base64
818
812
  try {
819
- const secretKey = (0, crypto_utils_1.base64ToUint8Array)(solanaPrivateKey);
813
+ const secretKey = Buffer.from(solanaPrivateKey, 'base64');
820
814
  solanaWallet = Keypair.fromSecretKey(secretKey);
821
815
  }
822
816
  catch {
@@ -825,8 +819,8 @@ class DomainContext {
825
819
  solanaWallet = Keypair.fromSecretKey(Uint8Array.from(secretKey));
826
820
  }
827
821
  }
828
- // Get Solana address as bytes32 (cross-platform)
829
- const solanaAddressBytes = '0x' + (0, crypto_utils_1.uint8ArrayToHex)(solanaWallet.publicKey.toBytes());
822
+ // Get Solana address as bytes32
823
+ const solanaAddressBytes = '0x' + solanaWallet.publicKey.toBuffer().toString('hex');
830
824
  // Get current timestamp
831
825
  const signAt = Math.floor(Date.now() / 1000) - 30 * 60; // 30 minutes ago
832
826
  // Prepare the request value
@@ -903,8 +897,11 @@ class DomainContext {
903
897
  // Extract addresses from the result and convert to base58
904
898
  // Result is array of { algorithm, addr } where addr is bytes32
905
899
  return result.map((item) => {
906
- // Convert hex to Uint8Array (cross-platform)
907
- const buffer = (0, crypto_utils_1.hexToUint8Array)(item.addr);
900
+ // Remove 0x prefix and convert hex to buffer
901
+ const hexStr = item.addr.startsWith('0x')
902
+ ? item.addr.slice(2)
903
+ : item.addr;
904
+ const buffer = Buffer.from(hexStr, 'hex');
908
905
  // Convert to Solana public key and then to base58
909
906
  return new PublicKey(buffer).toBase58();
910
907
  });
@@ -1162,14 +1159,12 @@ function bytes4ToIpv4(bytes4Hex) {
1162
1159
  */
1163
1160
  function pemToDer(pem) {
1164
1161
  // Remove PEM headers, footers, and whitespace
1165
- const base64Str = pem
1162
+ const base64 = pem
1166
1163
  .replace(/-----BEGIN.*?-----/g, '')
1167
1164
  .replace(/-----END.*?-----/g, '')
1168
1165
  .replace(/\s/g, '');
1169
- // Convert base64 to Uint8Array using cross-platform method
1170
- const derBuffer = (0, crypto_utils_1.base64ToUint8Array)(base64Str);
1171
- // Convert to hex string
1172
- const hexString = (0, crypto_utils_1.uint8ArrayToHex)(derBuffer);
1166
+ const derBuffer = Buffer.from(base64, 'base64');
1167
+ const hexString = derBuffer.toString('hex');
1173
1168
  // Convert to hex string with 0x prefix
1174
1169
  return '0x' + hexString;
1175
1170
  }
@@ -1181,13 +1176,12 @@ function pemToDer(pem) {
1181
1176
  function derToPem(derHex) {
1182
1177
  // Remove '0x' prefix if present
1183
1178
  const hexString = derHex.startsWith('0x') ? derHex.slice(2) : derHex;
1184
- // Convert hex to base64 using cross-platform methods
1185
- const bytes = (0, crypto_utils_1.hexToUint8Array)(hexString);
1186
- const base64Str = (0, crypto_utils_1.uint8ArrayToBase64)(bytes);
1179
+ const derBuffer = Buffer.from(hexString, 'hex');
1180
+ const base64 = derBuffer.toString('base64');
1187
1181
  // Split base64 into 64-character lines for PEM format
1188
1182
  const lines = [];
1189
- for (let i = 0; i < base64Str.length; i += 64) {
1190
- lines.push(base64Str.slice(i, i + 64));
1183
+ for (let i = 0; i < base64.length; i += 64) {
1184
+ lines.push(base64.slice(i, i + 64));
1191
1185
  }
1192
1186
  // Construct PEM format with headers and footers
1193
1187
  return ('-----BEGIN PUBLIC KEY-----\n' +