@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.
Files changed (93) hide show
  1. package/CLI.md +1300 -0
  2. package/README.md +40 -31
  3. package/TAG.md +589 -0
  4. package/dist/abi/RootResolver2ABI.d.ts +54 -0
  5. package/dist/abi/RootResolver2ABI.d.ts.map +1 -0
  6. package/dist/abi/RootResolver2ABI.js +240 -0
  7. package/dist/abi/RootResolver2ABI.js.map +1 -0
  8. package/dist/business/index.d.ts +302 -0
  9. package/dist/business/index.d.ts.map +1 -0
  10. package/dist/business/index.js +1211 -0
  11. package/dist/business/index.js.map +1 -0
  12. package/dist/business/tag-context.d.ts +219 -0
  13. package/dist/business/tag-context.d.ts.map +1 -0
  14. package/dist/business/tag-context.js +560 -0
  15. package/dist/business/tag-context.js.map +1 -0
  16. package/dist/cli.js +2102 -39
  17. package/dist/cli.js.map +1 -1
  18. package/dist/debug.d.ts.map +1 -1
  19. package/dist/debug.js +14 -2
  20. package/dist/debug.js.map +1 -1
  21. package/dist/index.d.ts +51 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +241 -12
  24. package/dist/index.js.map +1 -1
  25. package/dist/utils/crypto-utils.d.ts +130 -0
  26. package/dist/utils/crypto-utils.d.ts.map +1 -0
  27. package/dist/utils/crypto-utils.js +402 -0
  28. package/dist/utils/crypto-utils.js.map +1 -0
  29. package/dist/utils/error-parser.d.ts +35 -0
  30. package/dist/utils/error-parser.d.ts.map +1 -0
  31. package/dist/utils/error-parser.js +202 -0
  32. package/dist/utils/error-parser.js.map +1 -0
  33. package/dist/utils/olares-id.d.ts +36 -0
  34. package/dist/utils/olares-id.d.ts.map +1 -0
  35. package/dist/utils/olares-id.js +52 -0
  36. package/dist/utils/olares-id.js.map +1 -0
  37. package/dist/utils/tag-abi-codec.d.ts +69 -0
  38. package/dist/utils/tag-abi-codec.d.ts.map +1 -0
  39. package/dist/utils/tag-abi-codec.js +144 -0
  40. package/dist/utils/tag-abi-codec.js.map +1 -0
  41. package/dist/utils/tag-type-builder.d.ts +158 -0
  42. package/dist/utils/tag-type-builder.d.ts.map +1 -0
  43. package/dist/utils/tag-type-builder.js +410 -0
  44. package/dist/utils/tag-type-builder.js.map +1 -0
  45. package/examples/crypto-utilities.ts +140 -0
  46. package/examples/domain-context.ts +80 -0
  47. package/examples/generate-mnemonic.ts +149 -0
  48. package/examples/index.ts +1 -1
  49. package/examples/ip.ts +171 -0
  50. package/examples/legacy.ts +10 -10
  51. package/examples/list-wallets.ts +81 -0
  52. package/examples/olares-id-format.ts +197 -0
  53. package/examples/quasar-demo/.eslintrc.js +23 -0
  54. package/examples/quasar-demo/.quasar/app.js +43 -0
  55. package/examples/quasar-demo/.quasar/client-entry.js +38 -0
  56. package/examples/quasar-demo/.quasar/client-prefetch.js +130 -0
  57. package/examples/quasar-demo/.quasar/quasar-user-options.js +16 -0
  58. package/examples/quasar-demo/README.md +49 -0
  59. package/examples/quasar-demo/index.html +11 -0
  60. package/examples/quasar-demo/package-lock.json +6407 -0
  61. package/examples/quasar-demo/package.json +36 -0
  62. package/examples/quasar-demo/quasar.config.js +73 -0
  63. package/examples/quasar-demo/src/App.vue +13 -0
  64. package/examples/quasar-demo/src/css/app.scss +1 -0
  65. package/examples/quasar-demo/src/layouts/MainLayout.vue +21 -0
  66. package/examples/quasar-demo/src/pages/IndexPage.vue +905 -0
  67. package/examples/quasar-demo/src/router/index.ts +25 -0
  68. package/examples/quasar-demo/src/router/routes.ts +11 -0
  69. package/examples/quasar-demo/tsconfig.json +28 -0
  70. package/examples/register-subdomain.ts +152 -0
  71. package/examples/rsa-keypair.ts +148 -0
  72. package/examples/tag-builder.ts +235 -0
  73. package/examples/tag-management.ts +534 -0
  74. package/examples/tag-nested-tuple.ts +190 -0
  75. package/examples/tag-simple.ts +149 -0
  76. package/examples/tag-tagger.ts +217 -0
  77. package/examples/test-nested-tuple-conversion.ts +143 -0
  78. package/examples/test-type-bytes-parser.ts +70 -0
  79. package/examples/transfer-domain.ts +197 -0
  80. package/examples/wallet-management.ts +196 -0
  81. package/package.json +24 -15
  82. package/src/abi/RootResolver2ABI.ts +237 -0
  83. package/src/business/index.ts +1492 -0
  84. package/src/business/tag-context.ts +747 -0
  85. package/src/cli.ts +2772 -39
  86. package/src/debug.ts +17 -2
  87. package/src/index.ts +313 -17
  88. package/src/utils/crypto-utils.ts +459 -0
  89. package/src/utils/error-parser.ts +225 -0
  90. package/src/utils/olares-id.ts +49 -0
  91. package/src/utils/tag-abi-codec.ts +158 -0
  92. package/src/utils/tag-type-builder.ts +469 -0
  93. package/tsconfig.json +1 -1
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ abi: [
5
+ // Error definitions
6
+ {
7
+ inputs: [
8
+ {
9
+ internalType: 'string',
10
+ name: 'domain',
11
+ type: 'string'
12
+ },
13
+ {
14
+ internalType: 'string',
15
+ name: 'tagName',
16
+ type: 'string'
17
+ }
18
+ ],
19
+ name: 'RootTagNoExists',
20
+ type: 'error'
21
+ },
22
+ {
23
+ inputs: [],
24
+ name: 'AddressNoExists',
25
+ type: 'error'
26
+ },
27
+ {
28
+ inputs: [],
29
+ name: 'AddressHasExisted',
30
+ type: 'error'
31
+ },
32
+ {
33
+ inputs: [],
34
+ name: 'Unauthorized',
35
+ type: 'error'
36
+ },
37
+ {
38
+ inputs: [
39
+ {
40
+ internalType: 'uint256',
41
+ name: 'signAt',
42
+ type: 'uint256'
43
+ },
44
+ {
45
+ internalType: 'uint256',
46
+ name: 'blockchainCurTimeStamp',
47
+ type: 'uint256'
48
+ }
49
+ ],
50
+ name: 'SignatureIsValidOnlyInOneHour',
51
+ type: 'error'
52
+ },
53
+ {
54
+ inputs: [
55
+ {
56
+ internalType: 'address',
57
+ name: 'addr',
58
+ type: 'address'
59
+ },
60
+ {
61
+ internalType: 'bytes',
62
+ name: 'signature',
63
+ type: 'bytes'
64
+ }
65
+ ],
66
+ name: 'InvalidAddressSignature',
67
+ type: 'error'
68
+ },
69
+ {
70
+ inputs: [
71
+ {
72
+ internalType: 'string',
73
+ name: 'addr',
74
+ type: 'string'
75
+ },
76
+ {
77
+ internalType: 'bytes',
78
+ name: 'signature',
79
+ type: 'bytes'
80
+ }
81
+ ],
82
+ name: 'InvalidSolanaAddressSignature',
83
+ type: 'error'
84
+ },
85
+ // Function definitions
86
+ {
87
+ inputs: [
88
+ {
89
+ components: [
90
+ {
91
+ internalType: 'address',
92
+ name: 'addr',
93
+ type: 'address'
94
+ },
95
+ {
96
+ internalType: 'string',
97
+ name: 'domain',
98
+ type: 'string'
99
+ },
100
+ {
101
+ internalType: 'uint256',
102
+ name: 'signAt',
103
+ type: 'uint256'
104
+ },
105
+ {
106
+ internalType: 'enum RootTagger2.Action',
107
+ name: 'action',
108
+ type: 'uint8'
109
+ }
110
+ ],
111
+ internalType: 'struct RootTagger2.EVMAuthAddressReq',
112
+ name: 'evmAuthAddressReq',
113
+ type: 'tuple'
114
+ },
115
+ {
116
+ internalType: 'bytes',
117
+ name: 'sigFromDomainOwnerPrivKey',
118
+ type: 'bytes'
119
+ },
120
+ {
121
+ internalType: 'bytes',
122
+ name: 'sigFromAddressPrivKey',
123
+ type: 'bytes'
124
+ }
125
+ ],
126
+ name: 'updateEVMWallet',
127
+ outputs: [],
128
+ stateMutability: 'nonpayable',
129
+ type: 'function'
130
+ },
131
+ {
132
+ inputs: [
133
+ {
134
+ internalType: 'string',
135
+ name: 'domain',
136
+ type: 'string'
137
+ }
138
+ ],
139
+ name: 'getEVMWallets',
140
+ outputs: [
141
+ {
142
+ components: [
143
+ {
144
+ internalType: 'enum RootTagger2.SigAlg',
145
+ name: 'algorithm',
146
+ type: 'uint8'
147
+ },
148
+ {
149
+ internalType: 'address',
150
+ name: 'addr',
151
+ type: 'address'
152
+ }
153
+ ],
154
+ internalType: 'struct RootTagger2.EVMAuthAddress[]',
155
+ name: '',
156
+ type: 'tuple[]'
157
+ }
158
+ ],
159
+ stateMutability: 'view',
160
+ type: 'function'
161
+ },
162
+ {
163
+ inputs: [
164
+ {
165
+ components: [
166
+ {
167
+ internalType: 'bytes32',
168
+ name: 'addr',
169
+ type: 'bytes32'
170
+ },
171
+ {
172
+ internalType: 'string',
173
+ name: 'domain',
174
+ type: 'string'
175
+ },
176
+ {
177
+ internalType: 'uint256',
178
+ name: 'signAt',
179
+ type: 'uint256'
180
+ },
181
+ {
182
+ internalType: 'enum RootTagger2.Action',
183
+ name: 'action',
184
+ type: 'uint8'
185
+ }
186
+ ],
187
+ internalType: 'struct RootTagger2.SolanaAuthAddressReq',
188
+ name: 'solanaAuthAddressReq',
189
+ type: 'tuple'
190
+ },
191
+ {
192
+ internalType: 'bytes',
193
+ name: 'sigFromDomainOwnerPrivKey',
194
+ type: 'bytes'
195
+ },
196
+ {
197
+ internalType: 'bytes',
198
+ name: 'sigFromAddressPrivKey',
199
+ type: 'bytes'
200
+ }
201
+ ],
202
+ name: 'updateSolanaWallet',
203
+ outputs: [],
204
+ stateMutability: 'nonpayable',
205
+ type: 'function'
206
+ },
207
+ {
208
+ inputs: [
209
+ {
210
+ internalType: 'string',
211
+ name: 'domain',
212
+ type: 'string'
213
+ }
214
+ ],
215
+ name: 'getSolanaWallets',
216
+ outputs: [
217
+ {
218
+ components: [
219
+ {
220
+ internalType: 'enum RootTagger2.SigAlg',
221
+ name: 'algorithm',
222
+ type: 'uint8'
223
+ },
224
+ {
225
+ internalType: 'bytes32',
226
+ name: 'addr',
227
+ type: 'bytes32'
228
+ }
229
+ ],
230
+ internalType: 'struct RootTagger2.SolanaAuthAddress[]',
231
+ name: '',
232
+ type: 'tuple[]'
233
+ }
234
+ ],
235
+ stateMutability: 'view',
236
+ type: 'function'
237
+ }
238
+ ]
239
+ };
240
+ //# sourceMappingURL=RootResolver2ABI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootResolver2ABI.js","sourceRoot":"","sources":["../../src/ab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;4BACC,YAAY,EAAE,SAAS;4BACvB,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,SAAS;yBACf;qBACD;oBACD,YAAY,EAAE,wCAAwC;oBACtD,IAAI,EAAE,EAAE;oBACR,IAAI,EAAE,SAAS;iBACf;aACD;YACD,eAAe,EAAE,MAAM;YACvB,IAAI,EAAE,UAAU;SAChB;KACD;CACD,CAAC"}
@@ -0,0 +1,302 @@
1
+ import { DIDConsole } from '..';
2
+ import { TagContext } from './tag-context';
3
+ export interface TransactionResult<T = any> {
4
+ success: boolean;
5
+ transactionHash: string;
6
+ gasUsed?: bigint;
7
+ blockNumber?: number;
8
+ data?: T;
9
+ error?: string;
10
+ }
11
+ export interface DomainMetaInfo {
12
+ id: string;
13
+ name: string;
14
+ did: string;
15
+ note: string;
16
+ allowSubdomain: boolean;
17
+ }
18
+ export interface DomainInfo {
19
+ meta: DomainMetaInfo;
20
+ owner: string;
21
+ tags: TagInfo[];
22
+ subdomains?: string[];
23
+ }
24
+ export interface TagInfo {
25
+ name: string;
26
+ type: string;
27
+ value: any;
28
+ }
29
+ export { createRsaKeyPair, generateMnemonic, getEthereumAddressFromMnemonic, getEVMPrivateKeyFromMnemonic, getDIDFromMnemonic, generateDIDKeyData, deriveDIDFromMnemonic } from '../utils/crypto-utils';
30
+ export type { RSAPublicKeyData, DIDKeyData } from '../utils/crypto-utils';
31
+ export { TagContext } from './tag-context';
32
+ export { TagTypeBuilder } from '../utils/tag-type-builder';
33
+ /**
34
+ * Domain registration type
35
+ */
36
+ export declare enum UserType {
37
+ IndividualOrganizationalUser = "Individual:OrganizationalUser",
38
+ IndividualTerminusUser = "Individual:TerminusUser",
39
+ Organization = "Organization",
40
+ Entity = "Entity"
41
+ }
42
+ export declare class DomainContext {
43
+ private domainName;
44
+ private console;
45
+ private owner?;
46
+ private tokenId?;
47
+ constructor(domainName: string, console: DIDConsole);
48
+ /**
49
+ * Calculate the tokenId for the domain name
50
+ * This is a pure function that hashes the domain name using keccak256
51
+ * The result is cached after the first call
52
+ * @returns The tokenId as a decimal string
53
+ */
54
+ getTokenId(): string;
55
+ /**
56
+ * Get only the basic information of the domain
57
+ * Uses parallel RPC calls to get metadata and latest DID for optimal performance
58
+ * TokenId is calculated locally using keccak256
59
+ * @throws Error if domain is not registered or RPC call fails
60
+ */
61
+ getMetaInfo(): Promise<DomainMetaInfo>;
62
+ /**
63
+ * Get the owner address of the domain
64
+ * Uses cached value if available, otherwise fetches from chain
65
+ * @throws Error if domain is not registered or RPC call fails
66
+ */
67
+ getOwner(): Promise<string>;
68
+ /**
69
+ * Check if the connected signer is the owner of the domain
70
+ * @throws Error if no signer is connected or RPC call fails
71
+ */
72
+ isOwner(): Promise<boolean>;
73
+ /**
74
+ * Register a subdomain using mnemonic-derived keys
75
+ *
76
+ * @param subdomain Subdomain label only (e.g., "child" for "child.parent.com")
77
+ * @param mnemonic BIP39 mnemonic phrase (12 words by default) to derive owner and DID
78
+ * @returns Transaction result with success status and transaction hash
79
+ * @throws Error if no signer is connected, parent domain doesn't exist, or transaction fails
80
+ *
81
+ * The subdomain's metadata:
82
+ * - owner: derived from mnemonic using Trust Wallet Core (same as TermiPass)
83
+ * - DID: derived from mnemonic using Ed25519 (same as TermiPass)
84
+ * - note: inherits from parent domain
85
+ * - allowSubdomain: inherits from parent domain
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * // For parent domain "parent.com", register subdomain "child"
90
+ * const parentDomain = olaresId.domain('parent.com');
91
+ * const mnemonic = generateMnemonic(12);
92
+ *
93
+ * const result = await parentDomain.registerSubdomain('child', mnemonic);
94
+ * // This will register "child.parent.com"
95
+ *
96
+ * if (result.success) {
97
+ * console.log('Full domain:', result.data.fullDomainName); // "child.parent.com"
98
+ * console.log('Owner:', result.data.owner);
99
+ * console.log('DID:', result.data.did);
100
+ * }
101
+ * ```
102
+ */
103
+ registerSubdomain(subdomain: string, mnemonic: string): Promise<TransactionResult>;
104
+ /**
105
+ * Transfer domain ownership to a new owner derived from mnemonic
106
+ *
107
+ * @param mnemonic BIP39 mnemonic phrase to derive new owner and DID
108
+ * @returns Transaction result with success status
109
+ *
110
+ * This function performs two operations:
111
+ * 1. Transfer NFT ownership via DID contract's transferFrom
112
+ * 2. Update DID via RootResolver's setLatestDID
113
+ *
114
+ * @example
115
+ * ```typescript
116
+ * const mnemonic = generateMnemonic(12);
117
+ * const result = await domain.transfer(mnemonic);
118
+ * if (result.success) {
119
+ * console.log('Domain transferred!');
120
+ * console.log('New Owner:', result.data.newOwner);
121
+ * console.log('New DID:', result.data.newDid);
122
+ * }
123
+ * ```
124
+ */
125
+ transfer(mnemonic: string): Promise<TransactionResult>;
126
+ /**
127
+ * Set the RSA public key for your own domain
128
+ * Users can use the helper function createRsaKeyPair to generate a new RSA key pair
129
+ * The pubKey parameter should be in RSA PKCS8 ASN.1 format
130
+ * @param rsaPublicKey - The RSA public key in PEM format or DER hex format (with or without '0x' prefix)
131
+ * @throws Error if no signer is connected or transaction fails
132
+ */
133
+ setRSAPublicKey(rsaPublicKey: string): Promise<TransactionResult>;
134
+ /**
135
+ * Remove the RSA public key for your own domain
136
+ * This is done by calling setRsaPubKey with empty bytes
137
+ * @throws Error if no signer is connected or transaction fails
138
+ */
139
+ removeRSAPublicKey(): Promise<TransactionResult>;
140
+ /**
141
+ * Get the RSA public key for the domain
142
+ * @returns The RSA public key in PEM PKCS#8 format, or null if not set
143
+ * @throws Error if network error or unexpected contract error occurs
144
+ */
145
+ getRSAPublicKey(): Promise<string | null>;
146
+ /**
147
+ * Set the DNS A record for your own domain, currently the contract only supports IPv4 address format
148
+ * The parameter is an IPv4 address, in xxx.xxx.xxx.xxx format
149
+ * @param aRecord - IPv4 address string (e.g., "192.168.1.1")
150
+ * @throws Error if no signer is connected or transaction fails
151
+ */
152
+ setIP(aRecord: string): Promise<TransactionResult>;
153
+ /**
154
+ * Remove the DNS A record for your own domain
155
+ * This is done by calling setDnsARecord with bytes4(0)
156
+ * @throws Error if no signer is connected or transaction fails
157
+ */
158
+ removeIP(): Promise<TransactionResult>;
159
+ /**
160
+ * Get the DNS A record for your own domain
161
+ * @returns The IPv4 address as a string (e.g., "192.168.1.1"), or null if not set
162
+ * @throws Error if network error or unexpected contract error occurs
163
+ */
164
+ getIP(): Promise<string | null>;
165
+ /**
166
+ * Add EVM wallet address to the domain's authenticated address tag
167
+ * @param evmPrivateKey - EVM private key (hex string with 0x prefix)
168
+ * @returns Transaction result with success status and transaction hash
169
+ */
170
+ addEVMWallet(evmPrivateKey: string): Promise<TransactionResult>;
171
+ /**
172
+ * Remove EVM wallet address from the domain's authenticated address tag
173
+ * @param evmPrivateKey - EVM private key (hex string with 0x prefix)
174
+ * @returns Transaction result with success status and transaction hash
175
+ */
176
+ removeEVMWallet(evmPrivateKey: string): Promise<TransactionResult>;
177
+ /**
178
+ * Get all EVM wallet addresses for the domain
179
+ * Combines addresses from both RootTagger2 (new) and RootResolver (legacy) for backward compatibility
180
+ * @returns Array of unique EVM wallet addresses
181
+ */
182
+ getEVMWallets(): Promise<string[]>;
183
+ /**
184
+ * Add Solana wallet address to the domain's authenticated address tag
185
+ * @param solanaPrivateKey - Solana private key (base64 or base58 encoded string)
186
+ * @returns Transaction result with success status and transaction hash
187
+ */
188
+ addSolanaWallet(solanaPrivateKey: string): Promise<TransactionResult>;
189
+ /**
190
+ * Remove Solana wallet address from the domain's authenticated address tag
191
+ * @param solanaPrivateKey - Solana private key (base64 or base58 encoded string)
192
+ * @returns Transaction result with success status and transaction hash
193
+ */
194
+ removeSolanaWallet(solanaPrivateKey: string): Promise<TransactionResult>;
195
+ /**
196
+ * Get all Solana wallet addresses for the domain
197
+ * @returns Array of Solana wallet addresses (in base58 format)
198
+ */
199
+ getSolanaWallets(): Promise<string[]>;
200
+ /**
201
+ * Create a Tag context for advanced Tag operations
202
+ * @param fromDomain The domain that defines the Tag (defaults to current domain)
203
+ * @returns TagContext instance
204
+ *
205
+ * @example
206
+ * // Use current domain as the Tag definer
207
+ * const tagCtx = domain.tag();
208
+ *
209
+ * // Use a specific domain as the Tag definer (cross-domain operations)
210
+ * const tagCtx = domain.tag('parent.com');
211
+ */
212
+ tag(fromDomain?: string): TagContext;
213
+ /**
214
+ * Set the tagger (manager) for a Tag
215
+ * Only the domain owner can set the tagger
216
+ *
217
+ * @param tagName Tag name
218
+ * @param taggerAddress Address of the tagger (manager)
219
+ * @returns Transaction result
220
+ *
221
+ * @example
222
+ * // Set a specific address as the tagger
223
+ * await domain.setTagger('email', '0x1234...');
224
+ *
225
+ * // Set zero address to allow anyone to manage
226
+ * await domain.setTagger('email', '0x0000000000000000000000000000000000000000');
227
+ */
228
+ setTagger(tagName: string, taggerAddress: string): Promise<TransactionResult>;
229
+ /**
230
+ * Get the tagger (manager) address for a Tag
231
+ *
232
+ * @param tagName Tag name
233
+ * @returns Tagger address (returns zero address if no tagger is set)
234
+ *
235
+ * @example
236
+ * const tagger = await domain.getTagger('email');
237
+ * console.log('Tagger address:', tagger);
238
+ */
239
+ getTagger(tagName: string): Promise<string>;
240
+ /**
241
+ * Define a simple Tag type
242
+ * Only supports common simple types; use tag() for complex types
243
+ *
244
+ * @param tagName Tag name
245
+ * @param type Supported simple type
246
+ * @returns Transaction result
247
+ *
248
+ * @example
249
+ * await domain.defineSimpleTag('email', 'string');
250
+ * await domain.defineSimpleTag('age', 'uint8');
251
+ * await domain.defineSimpleTag('verified', 'bool');
252
+ * await domain.defineSimpleTag('wallets', 'address[]');
253
+ */
254
+ defineSimpleTag(tagName: string, type: 'string' | 'address' | 'bool' | 'uint8' | 'uint16' | 'uint32' | 'uint64' | 'uint128' | 'uint256' | 'int8' | 'int16' | 'int32' | 'int64' | 'int128' | 'int256' | 'bytes' | 'bytes32' | 'string[]' | 'address[]' | 'uint256[]'): Promise<TransactionResult>;
255
+ /**
256
+ * Set a Tag value for the current domain
257
+ * from = current domain, to = current domain
258
+ *
259
+ * @param tagName Tag name
260
+ * @param value Tag value
261
+ * @returns Transaction result
262
+ *
263
+ * @example
264
+ * await domain.setTag('email', 'user@example.com');
265
+ * await domain.setTag('links', ['https://...', 'https://...']);
266
+ */
267
+ setTag(tagName: string, value: any): Promise<TransactionResult>;
268
+ /**
269
+ * Get a Tag value for the current domain
270
+ * from = current domain, to = current domain
271
+ *
272
+ * @param tagName Tag name
273
+ * @returns Tag value, or null if not found
274
+ */
275
+ getTag(tagName: string): Promise<any | null>;
276
+ /**
277
+ * Remove a Tag from the current domain
278
+ * from = current domain, to = current domain
279
+ *
280
+ * @param tagName Tag name
281
+ * @returns Transaction result
282
+ */
283
+ removeTag(tagName: string): Promise<TransactionResult>;
284
+ /**
285
+ * Get all Tags for the current domain
286
+ * @returns Array of Tags with name and value
287
+ */
288
+ getAllTags(): Promise<Array<{
289
+ name: string;
290
+ value: any;
291
+ }>>;
292
+ /**
293
+ * Get all Tag type names defined by the current domain
294
+ * @returns Array of Tag names
295
+ */
296
+ getDefinedTags(): Promise<string[]>;
297
+ }
298
+ export declare function ipv4ToBytes4(ipv4: string): string;
299
+ export declare function bytes4ToIpv4(bytes4Hex: string): string;
300
+ export declare function pemToDer(pem: string): string;
301
+ export declare function derToPem(derHex: string): string;
302
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AAI3C,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,EA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