@hsuite/native-connect-types 1.0.0
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/README.md +50 -0
- package/dist/address-avatar.d.ts +67 -0
- package/dist/address-avatar.d.ts.map +1 -0
- package/dist/address-avatar.js +130 -0
- package/dist/address-avatar.js.map +1 -0
- package/dist/addressbook.d.ts +289 -0
- package/dist/addressbook.d.ts.map +1 -0
- package/dist/addressbook.js +82 -0
- package/dist/addressbook.js.map +1 -0
- package/dist/enrichment.d.ts +88 -0
- package/dist/enrichment.d.ts.map +1 -0
- package/dist/enrichment.js +47 -0
- package/dist/enrichment.js.map +1 -0
- package/dist/hedera-system-accounts.d.ts +49 -0
- package/dist/hedera-system-accounts.d.ts.map +1 -0
- package/dist/hedera-system-accounts.js +56 -0
- package/dist/hedera-system-accounts.js.map +1 -0
- package/dist/identity.d.ts +94 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +190 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger.d.ts +848 -0
- package/dist/ledger.d.ts.map +1 -0
- package/dist/ledger.js +152 -0
- package/dist/ledger.js.map +1 -0
- package/dist/messages.d.ts +726 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +252 -0
- package/dist/messages.js.map +1 -0
- package/dist/multisig-account.d.ts +419 -0
- package/dist/multisig-account.d.ts.map +1 -0
- package/dist/multisig-account.js +201 -0
- package/dist/multisig-account.js.map +1 -0
- package/dist/private-key-export.d.ts +112 -0
- package/dist/private-key-export.d.ts.map +1 -0
- package/dist/private-key-export.js +11 -0
- package/dist/private-key-export.js.map +1 -0
- package/dist/rpc.d.ts +872 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +143 -0
- package/dist/rpc.js.map +1 -0
- package/dist/transaction-approval.d.ts +895 -0
- package/dist/transaction-approval.d.ts.map +1 -0
- package/dist/transaction-approval.js +11 -0
- package/dist/transaction-approval.js.map +1 -0
- package/dist/transaction-parser.d.ts +93 -0
- package/dist/transaction-parser.d.ts.map +1 -0
- package/dist/transaction-parser.js +11 -0
- package/dist/transaction-parser.js.map +1 -0
- package/dist/vault.d.ts +673 -0
- package/dist/vault.d.ts.map +1 -0
- package/dist/vault.js +188 -0
- package/dist/vault.js.map +1 -0
- package/dist/widget.types.d.ts +323 -0
- package/dist/widget.types.d.ts.map +1 -0
- package/dist/widget.types.js +140 -0
- package/dist/widget.types.js.map +1 -0
- package/package.json +43 -0
- package/src/address-avatar.ts +181 -0
- package/src/addressbook.spec.ts +220 -0
- package/src/addressbook.ts +115 -0
- package/src/enrichment.ts +97 -0
- package/src/hedera-system-accounts.ts +60 -0
- package/src/identity.spec.ts +243 -0
- package/src/identity.ts +244 -0
- package/src/index.ts +197 -0
- package/src/ledger.spec.ts +366 -0
- package/src/ledger.ts +567 -0
- package/src/messages.ts +381 -0
- package/src/multisig-account.spec.ts +362 -0
- package/src/multisig-account.ts +310 -0
- package/src/private-key-export.ts +117 -0
- package/src/rpc.spec.ts +396 -0
- package/src/rpc.ts +257 -0
- package/src/transaction-approval.ts +1033 -0
- package/src/transaction-parser.ts +98 -0
- package/src/vault.spec.ts +268 -0
- package/src/vault.ts +256 -0
- package/src/widget.types.spec.ts +337 -0
- package/src/widget.types.ts +501 -0
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +11 -0
- package/vitest.config.ts +36 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multisig-account.d.ts","sourceRoot":"","sources":["../src/multisig-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,UAAU,C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AAE,OAAO,CAAC,GAAG,OAAO,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,GAAG,SAAS,CAK5F;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,qBAAqB,EAC7B,kBAAkB,CAAC,EAAE,MAAM,GAC1B,sBAAsB,CAaxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACrD,cAAc,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAC/E,kBAAkB,CAAC,EAAE,MAAM,GAC1B,sBAAsB,CAgBxB"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HSuite Native Connect
|
|
3
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
6
|
+
*
|
|
7
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
8
|
+
* visit https://hsuite.finance/licensing
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @fileoverview Unified account management for singlesig and multisig accounts.
|
|
12
|
+
*
|
|
13
|
+
* This module provides a unified data model where both singlesig and multisig
|
|
14
|
+
* accounts are stored together in the KeyVault. This design enables:
|
|
15
|
+
*
|
|
16
|
+
* - **Single source of truth** - All accounts in one storage layer
|
|
17
|
+
* - **Seamless transformation** - Singlesig to multisig upgrade (especially XRPL)
|
|
18
|
+
* - **Unified history** - Transaction history across all account types
|
|
19
|
+
* - **Consistent UI** - Same treatment for all accounts
|
|
20
|
+
*
|
|
21
|
+
* Account Type Discrimination:
|
|
22
|
+
* - Check `metadata.accountType` for 'singlesig' or 'multisig'
|
|
23
|
+
* - Use {@link isMultisigAccount} for type-safe checking
|
|
24
|
+
* - Use {@link getMultisigInfo} to extract multisig configuration
|
|
25
|
+
*
|
|
26
|
+
* @module types/multisig-account
|
|
27
|
+
*
|
|
28
|
+
* Type definitions for unified account management (singlesig and multisig).
|
|
29
|
+
*
|
|
30
|
+
* This module provides a unified account model where both singlesig and multisig
|
|
31
|
+
* accounts are stored in the same storage layer (KeyVault). This enables:
|
|
32
|
+
* - Single source of truth for all account data
|
|
33
|
+
* - Seamless singlesig→multisig transformation (especially for XRPL)
|
|
34
|
+
* - Unified transaction history across all account types
|
|
35
|
+
* - Consistent UI treatment for all accounts
|
|
36
|
+
*/
|
|
37
|
+
import { z } from 'zod';
|
|
38
|
+
/**
|
|
39
|
+
* AccountTypeSchema
|
|
40
|
+
*
|
|
41
|
+
* Zod schema for AccountType validation.
|
|
42
|
+
*/
|
|
43
|
+
export const AccountTypeSchema = z.enum(['singlesig', 'multisig']);
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Multisig Signer
|
|
46
|
+
// ============================================================================
|
|
47
|
+
/**
|
|
48
|
+
* MultisigSigner
|
|
49
|
+
*
|
|
50
|
+
* Represents a single signer in a multisig account configuration.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* MultisigSignerSchema
|
|
54
|
+
*
|
|
55
|
+
* Zod schema for MultisigSigner validation.
|
|
56
|
+
*/
|
|
57
|
+
export const MultisigSignerSchema = z.object({
|
|
58
|
+
/** Human-readable label for this signer */
|
|
59
|
+
label: z.string().min(1),
|
|
60
|
+
/** Public key in hex or base64 format (ledger-specific) */
|
|
61
|
+
publicKey: z.string().min(1),
|
|
62
|
+
/** On-chain account address for this signer (if applicable) */
|
|
63
|
+
accountAddress: z.string().optional(),
|
|
64
|
+
/** Optional weight for weighted multisig (default: 1) */
|
|
65
|
+
weight: z.number().positive().default(1),
|
|
66
|
+
/** Whether this signer is "self" (controlled by this wallet instance) */
|
|
67
|
+
isSelf: z.boolean().optional(),
|
|
68
|
+
});
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// Unified Account Metadata Extensions
|
|
71
|
+
// ============================================================================
|
|
72
|
+
/**
|
|
73
|
+
* MultisigInfoSchema
|
|
74
|
+
*
|
|
75
|
+
* Zod schema for multisig configuration stored in VaultKey.metadata.
|
|
76
|
+
* This allows singlesig accounts to be "upgraded" to multisig without
|
|
77
|
+
* moving them to a separate storage system.
|
|
78
|
+
*/
|
|
79
|
+
export const MultisigInfoSchema = z.object({
|
|
80
|
+
/** Number of signatures required to execute transactions */
|
|
81
|
+
threshold: z.number().int().positive(),
|
|
82
|
+
/** List of all signers (including self) */
|
|
83
|
+
signers: z.array(MultisigSignerSchema),
|
|
84
|
+
/** The address of the local signer (this wallet's signing account) */
|
|
85
|
+
localSignerAddress: z.string().optional(),
|
|
86
|
+
/** Name for this multisig configuration (e.g., "Treasury 2-of-3") */
|
|
87
|
+
name: z.string().optional(),
|
|
88
|
+
/** ID of the original MultisigAccountConfig */
|
|
89
|
+
originalConfigId: z.string().optional(),
|
|
90
|
+
/** When this account was converted to multisig */
|
|
91
|
+
convertedAt: z.number().optional(),
|
|
92
|
+
/** The singlesig account address that was converted (for XRPL transformation) */
|
|
93
|
+
originalSinglesigAddress: z.string().optional(),
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* UnifiedAccountMetadataSchema
|
|
97
|
+
*
|
|
98
|
+
* Schema for account metadata that supports both singlesig and multisig accounts.
|
|
99
|
+
* Stored in VaultKey.metadata for unified account management.
|
|
100
|
+
*/
|
|
101
|
+
export const UnifiedAccountMetadataSchema = z.object({
|
|
102
|
+
/** Account type discriminator */
|
|
103
|
+
accountType: AccountTypeSchema.default('singlesig'),
|
|
104
|
+
/** Multisig configuration (only present for multisig accounts) */
|
|
105
|
+
multisig: MultisigInfoSchema.optional(),
|
|
106
|
+
/** User-defined label for the account */
|
|
107
|
+
label: z.string().optional(),
|
|
108
|
+
/** Whether this is an imported account (not derived from seed) */
|
|
109
|
+
imported: z.boolean().optional(),
|
|
110
|
+
/** Whether the account has been activated on-chain (for Hedera) */
|
|
111
|
+
activated: z.boolean().optional(),
|
|
112
|
+
/** Whether this account is hidden from the UI */
|
|
113
|
+
hidden: z.boolean().optional(),
|
|
114
|
+
/** Tags for organization */
|
|
115
|
+
tags: z.array(z.string()).optional(),
|
|
116
|
+
/** Notes about this account */
|
|
117
|
+
notes: z.string().optional(),
|
|
118
|
+
/** When the account was created in this wallet */
|
|
119
|
+
createdAt: z.number().optional(),
|
|
120
|
+
/** Last time the account was used for signing */
|
|
121
|
+
lastUsedAt: z.number().optional(),
|
|
122
|
+
});
|
|
123
|
+
// ============================================================================
|
|
124
|
+
// Utility Functions
|
|
125
|
+
// ============================================================================
|
|
126
|
+
/**
|
|
127
|
+
* isMultisigAccount
|
|
128
|
+
*
|
|
129
|
+
* Type guard to check if an account is a multisig account.
|
|
130
|
+
*
|
|
131
|
+
* @param metadata - Account metadata to check
|
|
132
|
+
* @returns true if the account is multisig
|
|
133
|
+
*/
|
|
134
|
+
export function isMultisigAccount(metadata) {
|
|
135
|
+
return metadata?.['accountType'] === 'multisig' && !!metadata?.['multisig'];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* getMultisigInfo
|
|
139
|
+
*
|
|
140
|
+
* Extract MultisigInfo from account metadata.
|
|
141
|
+
*
|
|
142
|
+
* @param metadata - Account metadata
|
|
143
|
+
* @returns MultisigInfo if present, undefined otherwise
|
|
144
|
+
*/
|
|
145
|
+
export function getMultisigInfo(metadata) {
|
|
146
|
+
if (!isMultisigAccount(metadata)) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
return metadata?.['multisig'];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* createMultisigMetadata
|
|
153
|
+
*
|
|
154
|
+
* Create unified account metadata for a multisig account.
|
|
155
|
+
*
|
|
156
|
+
* @param config - MultisigAccountConfig to convert
|
|
157
|
+
* @param localSignerAddress - Address of the local signer
|
|
158
|
+
* @returns UnifiedAccountMetadata for storage in VaultKey
|
|
159
|
+
*/
|
|
160
|
+
export function createMultisigMetadata(config, localSignerAddress) {
|
|
161
|
+
return {
|
|
162
|
+
accountType: 'multisig',
|
|
163
|
+
multisig: {
|
|
164
|
+
threshold: config.threshold,
|
|
165
|
+
signers: config.signers,
|
|
166
|
+
localSignerAddress,
|
|
167
|
+
name: config.name,
|
|
168
|
+
originalConfigId: config.id,
|
|
169
|
+
},
|
|
170
|
+
label: config.name,
|
|
171
|
+
createdAt: config.createdAt,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* convertSinglesigToMultisig
|
|
176
|
+
*
|
|
177
|
+
* Update account metadata to convert a singlesig account to multisig.
|
|
178
|
+
* Used when an XRPL account is converted to multisig on-chain.
|
|
179
|
+
*
|
|
180
|
+
* @param existingMetadata - Current account metadata
|
|
181
|
+
* @param multisigConfig - Multisig configuration to apply
|
|
182
|
+
* @param localSignerAddress - Address of the local signer
|
|
183
|
+
* @returns Updated metadata with multisig configuration
|
|
184
|
+
*/
|
|
185
|
+
export function convertSinglesigToMultisig(existingMetadata, multisigConfig, localSignerAddress) {
|
|
186
|
+
const originalAddress = existingMetadata?.['address'] || undefined;
|
|
187
|
+
return {
|
|
188
|
+
...existingMetadata,
|
|
189
|
+
accountType: 'multisig',
|
|
190
|
+
multisig: {
|
|
191
|
+
threshold: multisigConfig.threshold,
|
|
192
|
+
signers: multisigConfig.signers,
|
|
193
|
+
localSignerAddress,
|
|
194
|
+
name: multisigConfig.name,
|
|
195
|
+
convertedAt: Date.now(),
|
|
196
|
+
originalSinglesigAddress: originalAddress,
|
|
197
|
+
},
|
|
198
|
+
label: multisigConfig.name || existingMetadata?.['label'],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=multisig-account.js.map
|
|
@@ -0,0 +1 @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AAI,CAAC,GAAG,EAAE;YACvB,wBAAwB,EAAE,eAAe;SAC1C;QACD,KAAK,EAAE,cAAc,CAAC,IAAI,IAAK,gBAAgB,EAAE,CAAC,OAAO,CAAY;KACtE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HSuite Native Connect
|
|
3
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
6
|
+
*
|
|
7
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
8
|
+
* visit https://hsuite.finance/licensing
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @file Private key export types for secure key extraction workflows.
|
|
12
|
+
*
|
|
13
|
+
* This module defines the type system for private key export functionality,
|
|
14
|
+
* enabling users to export their private keys in various formats while
|
|
15
|
+
* maintaining comprehensive audit trails for SOC2 compliance.
|
|
16
|
+
*
|
|
17
|
+
* Key Types:
|
|
18
|
+
* - {@link PrivateKeyExportFormat} - Supported export formats (hex, base64, der, familySeed)
|
|
19
|
+
* - {@link PrivateKeyExportRequest} - Request to export a private key
|
|
20
|
+
* - {@link PrivateKeyExportResult} - Result containing exported key in various formats
|
|
21
|
+
* - {@link PrivateKeyExportAuditEvent} - Audit event for compliance logging
|
|
22
|
+
*
|
|
23
|
+
* Export Flow:
|
|
24
|
+
* 1. User selects account and initiates export
|
|
25
|
+
* 2. User acknowledges security risks
|
|
26
|
+
* 3. System verifies authentication (PIN/biometric)
|
|
27
|
+
* 4. Private key exported in requested formats
|
|
28
|
+
* 5. Audit event logged for compliance
|
|
29
|
+
*
|
|
30
|
+
* @module types/private-key-export
|
|
31
|
+
* @security SOC2-CC7.1 - Audit logging for sensitive operations
|
|
32
|
+
*
|
|
33
|
+
* Type definitions for private key export system supporting Hedera and XRPL accounts.
|
|
34
|
+
* Used by the wallet to export keys with full audit trail for SOC2 compliance.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Supported private key export formats
|
|
38
|
+
* - `hex` - Raw hexadecimal string (always available)
|
|
39
|
+
* - `base64` - Base64 encoded (always available)
|
|
40
|
+
* - `der` - DER-encoded PKCS#8 format (Hedera only)
|
|
41
|
+
* - `familySeed` - sXXX... format (XRPL only)
|
|
42
|
+
*/
|
|
43
|
+
export type PrivateKeyExportFormat = 'hex' | 'base64' | 'der' | 'familySeed';
|
|
44
|
+
/**
|
|
45
|
+
* Request to export a private key
|
|
46
|
+
* Contains the identifiers needed to locate and export a key,
|
|
47
|
+
* along with acknowledgement of security risks.
|
|
48
|
+
*/
|
|
49
|
+
export interface PrivateKeyExportRequest {
|
|
50
|
+
/** VaultKey ID */
|
|
51
|
+
keyId: string;
|
|
52
|
+
/** Parent seed ID */
|
|
53
|
+
seedId: string;
|
|
54
|
+
/** User has acknowledged the security risks */
|
|
55
|
+
acknowledgedRisk: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Private key in various formats (ledger-dependent)
|
|
59
|
+
* Contains the private key encoded in multiple formats.
|
|
60
|
+
* Some formats are ledger-specific and will be undefined for other ledgers.
|
|
61
|
+
*/
|
|
62
|
+
export interface PrivateKeyExportFormats {
|
|
63
|
+
/** Raw hex string (always available) */
|
|
64
|
+
hex: string;
|
|
65
|
+
/** Base64 encoded (always available) */
|
|
66
|
+
base64: string;
|
|
67
|
+
/** DER-encoded PKCS#8 (Hedera only) */
|
|
68
|
+
der?: string;
|
|
69
|
+
/** Family seed sXXX... format (XRPL only) */
|
|
70
|
+
familySeed?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Result of a private key export operation
|
|
74
|
+
* Contains the exported key in various formats along with
|
|
75
|
+
* account metadata for display purposes.
|
|
76
|
+
*/
|
|
77
|
+
export interface PrivateKeyExportResult {
|
|
78
|
+
/** Account address */
|
|
79
|
+
address: string;
|
|
80
|
+
/** Public key (hex) */
|
|
81
|
+
publicKey: string;
|
|
82
|
+
/** Ledger identifier */
|
|
83
|
+
ledgerId: string;
|
|
84
|
+
/** Network identifier */
|
|
85
|
+
networkId: string;
|
|
86
|
+
/** Optional account label */
|
|
87
|
+
label?: string;
|
|
88
|
+
/** Exported key in various formats */
|
|
89
|
+
formats: PrivateKeyExportFormats;
|
|
90
|
+
/** Export timestamp (ms since epoch) */
|
|
91
|
+
exportedAt: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Audit event for private key export (SOC2 CC7.1)
|
|
95
|
+
* Logged when a private key is exported for compliance and security monitoring.
|
|
96
|
+
* Does not contain the actual private key material.
|
|
97
|
+
*/
|
|
98
|
+
export interface PrivateKeyExportAuditEvent {
|
|
99
|
+
/** Event type identifier */
|
|
100
|
+
type: 'private_key_exported';
|
|
101
|
+
/** VaultKey ID that was exported */
|
|
102
|
+
keyId: string;
|
|
103
|
+
/** Account address */
|
|
104
|
+
address: string;
|
|
105
|
+
/** Ledger identifier */
|
|
106
|
+
ledgerId: string;
|
|
107
|
+
/** Formats in which the key was exported */
|
|
108
|
+
formats: PrivateKeyExportFormat[];
|
|
109
|
+
/** Export timestamp (ms since epoch) */
|
|
110
|
+
timestamp: number;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=private-key-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key-export.d.ts","sourceRoot":"","sources":["../src/private-key-export.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,YAAY,CAAC;AAE7E;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,OAAO,EAAE,uBAAuB,CAAC;IACjC,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,4BAA4B;IAC5B,IAAI,EAAE,sBAAsB,CAAC;IAC7B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAClC,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HSuite Native Connect
|
|
3
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
6
|
+
*
|
|
7
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
8
|
+
* visit https://hsuite.finance/licensing
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=private-key-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key-export.js","sourceRoot":"","sources":["../src/private-key-export.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|