hd-wallet-ui 2.0.21 → 2.0.27

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 (39) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +101 -123
  3. package/data/common-passwords-sdn-v1.source.json +12 -0
  4. package/data/common-passwords-sdn-v1.txt +10000 -0
  5. package/dist/browser/sdn-wallet-callback.js +1 -0
  6. package/dist/browser/sdn-wallet-public-client.js +1 -0
  7. package/dist/browser/wallet-callback.html +6 -0
  8. package/dist/client/asset-review.d.ts +8 -0
  9. package/dist/client/asset-review.js +1570 -0
  10. package/dist/client/callback.d.ts +13 -0
  11. package/dist/client/callback.js +29 -0
  12. package/dist/client/index.d.ts +11 -0
  13. package/dist/client/index.js +1379 -0
  14. package/dist/client/sdn.d.ts +8 -0
  15. package/dist/client/sdn.js +1542 -0
  16. package/dist/client/style.css +32 -0
  17. package/dist/client/types.d.ts +278 -0
  18. package/dist/compat/index.d.ts +26 -0
  19. package/dist/compat/index.js +62 -0
  20. package/dist/wallet-origin/index.d.ts +21 -0
  21. package/dist/wallet-origin/index.js +4607 -0
  22. package/dist/wallet-origin-host/assets/wallet-origin.43cf84e0eba17742309357ec6bc2c544736e155ffd5d76d5024408e998500a57.wasm +0 -0
  23. package/dist/wallet-origin-host/assets/wallet-origin.4c9455f1a2618948e203f720485add9d8ebf77b5542b41f933594afcfbb34361.css +1 -0
  24. package/dist/wallet-origin-host/assets/wallet-origin.aedc355452e665e16c0f72a6597602873378dbc39d4cbf6104621c07579347e0.js +12463 -0
  25. package/dist/wallet-origin-host/index.html +10 -0
  26. package/dist/wallet-origin-host/integrity.json +1 -0
  27. package/package.json +46 -18
  28. package/src/address-derivation.js +0 -514
  29. package/src/app.js +0 -6008
  30. package/src/blockchain-trust.js +0 -752
  31. package/src/clipboard.js +0 -44
  32. package/src/constants.js +0 -66
  33. package/src/hash.js +0 -9
  34. package/src/lib.js +0 -66
  35. package/src/template.js +0 -626
  36. package/src/trust-ui.js +0 -745
  37. package/src/wallet-storage.js +0 -773
  38. package/styles/main.css +0 -6220
  39. package/styles/widget.css +0 -6212
package/src/clipboard.js DELETED
@@ -1,44 +0,0 @@
1
- export async function safeCopyText(value) {
2
- const text = String(value ?? '');
3
- if (!text) return false;
4
-
5
- try {
6
- const writeText = globalThis.navigator?.clipboard?.writeText;
7
- if (typeof writeText === 'function') {
8
- await writeText.call(globalThis.navigator.clipboard, text);
9
- return true;
10
- }
11
- } catch {
12
- // Fall through to the legacy DOM copy path below.
13
- }
14
-
15
- return fallbackCopyText(text);
16
- }
17
-
18
- function fallbackCopyText(text) {
19
- const doc = globalThis.document;
20
- if (!doc?.body || typeof doc.createElement !== 'function' || typeof doc.execCommand !== 'function') {
21
- return false;
22
- }
23
-
24
- const textarea = doc.createElement('textarea');
25
- textarea.value = text;
26
- textarea.readOnly = true;
27
- textarea.setAttribute('aria-hidden', 'true');
28
- textarea.style.position = 'fixed';
29
- textarea.style.left = '-9999px';
30
- textarea.style.top = '0';
31
- textarea.style.opacity = '0';
32
-
33
- doc.body.appendChild(textarea);
34
- try {
35
- textarea.focus();
36
- textarea.select();
37
- textarea.setSelectionRange(0, textarea.value.length);
38
- return Boolean(doc.execCommand('copy'));
39
- } catch {
40
- return false;
41
- } finally {
42
- textarea.remove();
43
- }
44
- }
package/src/constants.js DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * Wallet Constants
3
- *
4
- * Coin type configurations, explorer URLs, and derivation path helpers.
5
- */
6
-
7
- // =============================================================================
8
- // Crypto Configuration
9
- // =============================================================================
10
-
11
- export const cryptoConfig = {
12
- btc: {
13
- name: 'Bitcoin',
14
- symbol: 'BTC',
15
- coinType: 0,
16
- explorer: 'https://blockstream.info/address/',
17
- balanceApi: 'https://blockstream.info/api/address/',
18
- formatBalance: (satoshis) => `${(satoshis / 100000000).toFixed(8)} BTC`,
19
- },
20
- eth: {
21
- name: 'Ethereum',
22
- symbol: 'ETH',
23
- coinType: 60,
24
- explorer: 'https://etherscan.io/address/',
25
- balanceApi: null,
26
- formatBalance: (wei) => `${(parseFloat(wei) / 1e18).toFixed(6)} ETH`,
27
- },
28
- sol: {
29
- name: 'Solana',
30
- symbol: 'SOL',
31
- coinType: 501,
32
- explorer: 'https://solscan.io/account/',
33
- balanceApi: null,
34
- formatBalance: (lamports) => `${(lamports / 1e9).toFixed(4)} SOL`,
35
- },
36
- /* Commented out — BTC/ETH/SOL only for now
37
- ltc: { name: 'Litecoin', symbol: 'LTC', coinType: 2, explorer: 'https://blockchair.com/litecoin/address/', balanceApi: null, formatBalance: (lits) => `${(lits / 100000000).toFixed(8)} LTC` },
38
- bch: { name: 'Bitcoin Cash', symbol: 'BCH', coinType: 145, explorer: 'https://blockchair.com/bitcoin-cash/address/', balanceApi: null, formatBalance: (sats) => `${(sats / 100000000).toFixed(8)} BCH` },
39
- doge: { name: 'Dogecoin', symbol: 'DOGE', coinType: 3, explorer: 'https://dogechain.info/address/', balanceApi: null, formatBalance: (sats) => `${(sats / 100000000).toFixed(4)} DOGE` },
40
- atom: { name: 'Cosmos', symbol: 'ATOM', coinType: 118, explorer: 'https://www.mintscan.io/cosmos/address/', balanceApi: null, formatBalance: (uatom) => `${(uatom / 1e6).toFixed(6)} ATOM` },
41
- algo: { name: 'Algorand', symbol: 'ALGO', coinType: 330, explorer: 'https://algoexplorer.io/address/', balanceApi: null, formatBalance: (microalgos) => `${(microalgos / 1e6).toFixed(6)} ALGO` },
42
- dot: { name: 'Polkadot', symbol: 'DOT', coinType: 354, explorer: 'https://polkascan.io/polkadot/account/', balanceApi: null, formatBalance: (planks) => `${(planks / 1e10).toFixed(4)} DOT` },
43
- ada: { name: 'Cardano', symbol: 'ADA', coinType: 1815, explorer: 'https://cardanoscan.io/address/', balanceApi: null, formatBalance: (lovelace) => `${(lovelace / 1e6).toFixed(6)} ADA` },
44
- xrp: { name: 'Ripple', symbol: 'XRP', coinType: 144, explorer: 'https://xrpscan.com/account/', balanceApi: null, formatBalance: (drops) => `${(drops / 1e6).toFixed(6)} XRP` },
45
- */
46
- };
47
-
48
- // Coin type to config mapping
49
- export const coinTypeToConfig = Object.fromEntries(
50
- Object.entries(cryptoConfig).map(([key, config]) => [config.coinType, { key, ...config }])
51
- );
52
-
53
- // =============================================================================
54
- // Derivation Path Helpers (re-exported from hd-wallet-wasm)
55
- // =============================================================================
56
-
57
- export { buildSigningPath, buildEncryptionPath, getSigningKey, getEncryptionKey, WellKnownCoinType } from 'hd-wallet-wasm';
58
-
59
- // =============================================================================
60
- // PKI Storage Key
61
- // =============================================================================
62
-
63
- export const PKI_STORAGE_KEY = 'wallet-pki-keys';
64
- export const STORED_WALLET_KEY = 'encrypted_wallet';
65
- export const PASSKEY_CREDENTIAL_KEY = 'passkey_credential';
66
- export const PASSKEY_WALLET_KEY = 'passkey_wallet';
package/src/hash.js DELETED
@@ -1,9 +0,0 @@
1
- export function normalizeTabHash(rawHash) {
2
- return String(rawHash || '')
3
- .replace(/^#+/g, '')
4
- .replace(/^\/+/g, '')
5
- .split(/[/?#]/)[0]
6
- .replace(/[^a-z0-9_-]/gi, '')
7
- .replace(/-tab$/i, '')
8
- .toLowerCase();
9
- }
package/src/lib.js DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * HD Wallet UI — Pure Library
3
- *
4
- * Re-exports all pure (non-DOM) modules for programmatic use.
5
- * No UI or DOM dependencies.
6
- */
7
-
8
- // Constants & configuration
9
- export {
10
- cryptoConfig,
11
- coinTypeToConfig,
12
- buildSigningPath,
13
- buildEncryptionPath,
14
- getSigningKey,
15
- getEncryptionKey,
16
- WellKnownCoinType,
17
- PKI_STORAGE_KEY,
18
- STORED_WALLET_KEY,
19
- PASSKEY_CREDENTIAL_KEY,
20
- PASSKEY_WALLET_KEY,
21
- } from './constants.js';
22
-
23
- // Address derivation & utilities
24
- export {
25
- toHexCompact,
26
- toHex,
27
- hexToBytes,
28
- ensureUint8Array,
29
- generateBtcAddress,
30
- generateEthAddress,
31
- generateSolAddress,
32
- generateXrpAddress,
33
- deriveEthAddress,
34
- deriveSuiAddress,
35
- deriveMonadAddress,
36
- deriveCardanoAddress,
37
- generateAddresses,
38
- generateAddressForCoin,
39
- truncateAddress,
40
- fetchBtcBalance,
41
- fetchEthBalance,
42
- fetchSolBalance,
43
- fetchSuiBalance,
44
- fetchMonadBalance,
45
- fetchAdaBalance,
46
- fetchXrpBalance,
47
- } from './address-derivation.js';
48
-
49
- // Wallet storage & encryption
50
- export {
51
- default as WalletStorage,
52
- StorageMethod,
53
- isPasskeySupported,
54
- isPRFLikelySupported,
55
- registerPasskey,
56
- authenticatePasskey,
57
- getStorageMetadata,
58
- hasStoredWallet,
59
- getStorageMethod,
60
- storeWithPIN,
61
- retrieveWithPIN,
62
- storeWithPasskey,
63
- retrieveWithPasskey,
64
- clearStorage,
65
- migrateStorage,
66
- } from './wallet-storage.js';