hd-wallet-ui 2.0.16 → 2.0.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hd-wallet-ui",
3
- "version": "2.0.16",
3
+ "version": "2.0.19",
4
4
  "description": "HD Wallet modal UI — login, keys, identity, trust map, and security bond. Attach to any button in your app.",
5
5
  "type": "module",
6
6
  "main": "src/app.js",
@@ -40,7 +40,7 @@
40
40
  "buffer": "^6.0.3",
41
41
  "flatbuffers": "^25.9.23",
42
42
  "flatc-wasm": "^26.1.32",
43
- "hd-wallet-wasm": "^2.0.16",
43
+ "hd-wallet-wasm": "^2.0.19",
44
44
  "qrcode": "^1.5.3",
45
45
  "spacedatastandards.org": "^1.93.3",
46
46
  "vcard-cryptoperson": "^1.1.11"
package/src/app.js CHANGED
@@ -2596,6 +2596,36 @@ async function generatePKIKeyPairs() {
2596
2596
  // Login / Logout
2597
2597
  // =============================================================================
2598
2598
 
2599
+ function hideStoredWalletLoginUI() {
2600
+ const storedTab = $('stored-tab');
2601
+ if (storedTab) storedTab.style.display = 'none';
2602
+
2603
+ const pinSect = $('stored-pin-section');
2604
+ if (pinSect) pinSect.style.display = 'block';
2605
+
2606
+ const psSect = $('stored-passkey-section');
2607
+ if (psSect) psSect.style.display = 'none';
2608
+
2609
+ const divider = $('stored-divider');
2610
+ if (divider) divider.style.display = 'none';
2611
+
2612
+ const dateEl = $('stored-wallet-date');
2613
+ if (dateEl) dateEl.textContent = '';
2614
+
2615
+ const unlockPin = $('pin-input-unlock');
2616
+ if (unlockPin) unlockPin.value = '';
2617
+
2618
+ const unlockBtn = $('unlock-stored-wallet');
2619
+ if (unlockBtn) unlockBtn.disabled = true;
2620
+
2621
+ $qa('.method-tab').forEach(t => t.classList.remove('active'));
2622
+ $qa('.method-content').forEach(c => c.classList.remove('active'));
2623
+ const pwMethod = $('password-method');
2624
+ if (pwMethod) pwMethod.classList.add('active');
2625
+ const pwTab = $q('.method-tab[data-method="password"]');
2626
+ if (pwTab) pwTab.classList.add('active');
2627
+ }
2628
+
2599
2629
  function login(keys) {
2600
2630
  state.loggedIn = true;
2601
2631
  state.wallet = keys;
@@ -2786,7 +2816,10 @@ function logout() {
2786
2816
  state.masterSeed = null;
2787
2817
  state.hdRoot = null;
2788
2818
  state.mnemonic = null;
2819
+ state.addresses = { btc: null, eth: null, sol: null };
2789
2820
 
2821
+ WalletStorage.clearStorage();
2822
+ hideStoredWalletLoginUI();
2790
2823
  localStorage.removeItem(PKI_STORAGE_KEY);
2791
2824
 
2792
2825
  // Update hero stats
@@ -2823,6 +2856,9 @@ function logout() {
2823
2856
  // Clear HD wallet UI
2824
2857
  const derivedResult = $('derived-result');
2825
2858
  if (derivedResult) derivedResult.style.display = 'none';
2859
+
2860
+ $('login-modal')?.classList.remove('active');
2861
+ $('keys-modal')?.classList.remove('active');
2826
2862
  }
2827
2863
 
2828
2864
  // =============================================================================
@@ -3836,8 +3872,8 @@ function isPasskeySupported() {
3836
3872
 
3837
3873
  // Track selected remember method (pin or passkey) for each login type
3838
3874
  const rememberMethod = {
3839
- password: 'passkey',
3840
- seed: 'passkey'
3875
+ password: 'pin',
3876
+ seed: 'pin'
3841
3877
  };
3842
3878
 
3843
3879
  function setupLoginHandlers() {
@@ -4272,7 +4308,6 @@ function setupMainAppHandlers() {
4272
4308
  $('login-modal')?.classList.add('active');
4273
4309
  });
4274
4310
  $('nav-logout')?.addEventListener('click', logout);
4275
- $('account-logout')?.addEventListener('click', logout);
4276
4311
  $('nav-keys')?.addEventListener('click', async () => {
4277
4312
  $('keys-modal')?.classList.add('active');
4278
4313
  if (state.loggedIn) {
@@ -6042,6 +6077,10 @@ export async function createWalletUI(rootElement, options = {}) {
6042
6077
  const modal = document.getElementById('keys-modal');
6043
6078
  if (modal) modal.classList.add('active');
6044
6079
  },
6080
+ /** Clear the wallet session; host applications own any visible logout control */
6081
+ logout() {
6082
+ logout();
6083
+ },
6045
6084
  /** Remove all injected wallet UI elements from the DOM */
6046
6085
  destroy() {
6047
6086
  const container = document.getElementById('hd-wallet-ui-container');
package/src/template.js CHANGED
@@ -3,7 +3,7 @@ export function getModalHTML() {
3
3
  <!-- Keys Modal -->
4
4
  <div id="keys-modal" class="modal">
5
5
  <div class="modal-glass modal-wide">
6
- <div class="modal-header account-modal-header"><div class="account-header-info"><div class="account-wallet-row"><select id="account-wallet-select" class="glass-input compact account-wallet-select" aria-label="Select wallet"></select></div><div class="account-wallet-summary"><div class="account-wallet-balance-line"><div class="ph-portfolio-value" id="wallet-bond-value">$0.00</div><div class="ph-portfolio-label">Bond</div></div></div></div><div class="account-header-actions"><button id="account-logout" class="account-logout-btn" type="button" aria-label="Logout" title="Logout"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg></button><button class="modal-close account-modal-close" type="button" aria-label="Close"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button></div></div>
6
+ <div class="modal-header account-modal-header"><div class="account-header-info"><div class="account-wallet-row"><select id="account-wallet-select" class="glass-input compact account-wallet-select" aria-label="Select wallet"></select></div><div class="account-wallet-summary"><div class="account-wallet-balance-line"><div class="ph-portfolio-value" id="wallet-bond-value">$0.00</div><div class="ph-portfolio-label">Bond</div></div></div></div><button class="modal-close account-modal-close" type="button" aria-label="Close"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button></div>
7
7
  <div class="modal-tabs">
8
8
  <button class="modal-tab active" data-modal-tab="vcard-tab-content">Identity</button>
9
9
  <button class="modal-tab" data-modal-tab="trust-tab-content">Trust Map</button>
@@ -562,11 +562,11 @@ export function getModalHTML() {
562
562
  <span class="entropy-label"><span id="entropy-bits">0</span> bits entropy</span>
563
563
  </div>
564
564
  <div class="remember-wallet-group">
565
- <label class="glass-checkbox"><input type="checkbox" id="remember-wallet-password"><span class="checkmark"></span><span>Remember wallet</span></label>
566
- <div class="remember-options" id="remember-options-password" style="display: none;">
567
- <div class="remember-method-selector"><button type="button" class="remember-method-btn" data-method="pin" data-target="password">PIN</button><button type="button" class="remember-method-btn active" data-method="passkey" data-target="password" id="passkey-btn-password">Passkey</button></div>
568
- <div class="pin-input-group" id="pin-group-password" style="display: none;"><input type="password" id="pin-input-password" class="glass-input pin-input" placeholder="6-digit PIN" maxlength="6" inputmode="numeric" pattern="[0-9]*"></div>
569
- <div class="passkey-info" id="passkey-info-password"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a5 5 0 0 1 5 5v3H7V7a5 5 0 0 1 5-5z"/><rect x="3" y="10" width="18" height="12" rx="2"/><circle cx="12" cy="16" r="1"/></svg><span>Use Face ID, Touch ID, or device PIN</span></div>
565
+ <label class="glass-checkbox"><input type="checkbox" id="remember-wallet-password" checked><span class="checkmark"></span><span>Remember wallet</span></label>
566
+ <div class="remember-options" id="remember-options-password">
567
+ <div class="remember-method-selector"><button type="button" class="remember-method-btn active" data-method="pin" data-target="password">PIN</button><button type="button" class="remember-method-btn" data-method="passkey" data-target="password" id="passkey-btn-password">Passkey</button></div>
568
+ <div class="pin-input-group" id="pin-group-password"><input type="password" id="pin-input-password" class="glass-input pin-input" placeholder="6-digit PIN" maxlength="6" inputmode="numeric" pattern="[0-9]*"></div>
569
+ <div class="passkey-info" id="passkey-info-password" style="display: none;"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a5 5 0 0 1 5 5v3H7V7a5 5 0 0 1 5-5z"/><rect x="3" y="10" width="18" height="12" rx="2"/><circle cx="12" cy="16" r="1"/></svg><span>Use Face ID, Touch ID, or device PIN</span></div>
570
570
  </div>
571
571
  </div>
572
572
  <button id="derive-from-password" class="glass-btn primary full-width" disabled type="button">Login</button>
@@ -574,11 +574,11 @@ export function getModalHTML() {
574
574
  <div id="seed-method" class="method-content">
575
575
  <div class="glass-input-group"><textarea id="seed-phrase" class="glass-input glass-textarea" rows="3" placeholder="Enter 12 or 24 word seed phrase..."></textarea><div class="seed-actions"><button id="generate-seed" class="glass-btn small">Generate</button><button id="validate-seed" class="glass-btn small">Validate</button></div></div>
576
576
  <div class="remember-wallet-group">
577
- <label class="glass-checkbox"><input type="checkbox" id="remember-wallet-seed"><span class="checkmark"></span><span>Remember wallet</span></label>
578
- <div class="remember-options" id="remember-options-seed" style="display: none;">
579
- <div class="remember-method-selector"><button type="button" class="remember-method-btn" data-method="pin" data-target="seed">PIN</button><button type="button" class="remember-method-btn active" data-method="passkey" data-target="seed" id="passkey-btn-seed">Passkey</button></div>
580
- <div class="pin-input-group" id="pin-group-seed" style="display: none;"><input type="password" id="pin-input-seed" class="glass-input pin-input" placeholder="6-digit PIN" maxlength="6" inputmode="numeric" pattern="[0-9]*"></div>
581
- <div class="passkey-info" id="passkey-info-seed"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a5 5 0 0 1 5 5v3H7V7a5 5 0 0 1 5-5z"/><rect x="3" y="10" width="18" height="12" rx="2"/><circle cx="12" cy="16" r="1"/></svg><span>Use Face ID, Touch ID, or device PIN</span></div>
577
+ <label class="glass-checkbox"><input type="checkbox" id="remember-wallet-seed" checked><span class="checkmark"></span><span>Remember wallet</span></label>
578
+ <div class="remember-options" id="remember-options-seed">
579
+ <div class="remember-method-selector"><button type="button" class="remember-method-btn active" data-method="pin" data-target="seed">PIN</button><button type="button" class="remember-method-btn" data-method="passkey" data-target="seed" id="passkey-btn-seed">Passkey</button></div>
580
+ <div class="pin-input-group" id="pin-group-seed"><input type="password" id="pin-input-seed" class="glass-input pin-input" placeholder="6-digit PIN" maxlength="6" inputmode="numeric" pattern="[0-9]*"></div>
581
+ <div class="passkey-info" id="passkey-info-seed" style="display: none;"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a5 5 0 0 1 5 5v3H7V7a5 5 0 0 1 5-5z"/><rect x="3" y="10" width="18" height="12" rx="2"/><circle cx="12" cy="16" r="1"/></svg><span>Use Face ID, Touch ID, or device PIN</span></div>
582
582
  </div>
583
583
  </div>
584
584
  <button id="derive-from-seed" class="glass-btn primary full-width" disabled>Login</button>
@@ -695,6 +695,9 @@ export function clearStorage() {
695
695
  localStorage.removeItem(METADATA_KEY);
696
696
  localStorage.removeItem(ENCRYPTED_DATA_KEY);
697
697
  localStorage.removeItem(PASSKEY_CREDENTIAL_KEY);
698
+ localStorage.removeItem('encrypted_wallet');
699
+ localStorage.removeItem('passkey_credential');
700
+ localStorage.removeItem('passkey_wallet');
698
701
  }
699
702
 
700
703
  /**
package/styles/main.css CHANGED
@@ -1205,35 +1205,7 @@ body:has(.modal.active) .nav-bar {
1205
1205
  position: relative;
1206
1206
  align-items: center;
1207
1207
  min-height: 118px;
1208
- padding-right: 92px;
1209
- }
1210
-
1211
- .account-header-actions {
1212
- position: absolute;
1213
- top: 12px;
1214
- right: 14px;
1215
- display: flex;
1216
- align-items: center;
1217
- gap: 4px;
1218
- }
1219
-
1220
- .account-logout-btn {
1221
- width: 32px;
1222
- height: 32px;
1223
- display: inline-flex;
1224
- align-items: center;
1225
- justify-content: center;
1226
- background: transparent;
1227
- border: none;
1228
- color: var(--white);
1229
- cursor: pointer;
1230
- padding: 0;
1231
- transition: color 0.2s, opacity 0.2s;
1232
- }
1233
-
1234
- .account-logout-btn:hover {
1235
- color: var(--white-80);
1236
- opacity: 0.9;
1208
+ padding-right: 56px;
1237
1209
  }
1238
1210
 
1239
1211
  .account-wallet-row {
@@ -1269,11 +1241,12 @@ body:has(.modal.active) .nav-bar {
1269
1241
  .account-wallet-balance-line {
1270
1242
  display: flex;
1271
1243
  align-items: center;
1272
- gap: 8px;
1244
+ gap: 16px;
1273
1245
  }
1274
1246
 
1275
1247
  .account-wallet-summary .ph-portfolio-value {
1276
1248
  color: #4ade80;
1249
+ font-size: 25px;
1277
1250
  }
1278
1251
 
1279
1252
  .account-wallet-summary .ph-portfolio-label {
@@ -1320,7 +1293,9 @@ body:has(.modal.active) .nav-bar {
1320
1293
  }
1321
1294
 
1322
1295
  .account-modal-close {
1323
- position: static;
1296
+ position: absolute;
1297
+ top: 12px;
1298
+ right: 14px;
1324
1299
  }
1325
1300
 
1326
1301
  .modal-body {
package/styles/widget.css CHANGED
@@ -1207,35 +1207,7 @@ body:has(#hd-wallet-ui-container .modal.active) #hd-wallet-ui-container .nav-bar
1207
1207
  position: relative;
1208
1208
  align-items: center;
1209
1209
  min-height: 118px;
1210
- padding-right: 92px;
1211
- }
1212
-
1213
- #hd-wallet-ui-container .account-header-actions {
1214
- position: absolute;
1215
- top: 12px;
1216
- right: 14px;
1217
- display: flex;
1218
- align-items: center;
1219
- gap: 4px;
1220
- }
1221
-
1222
- #hd-wallet-ui-container .account-logout-btn {
1223
- width: 32px;
1224
- height: 32px;
1225
- display: inline-flex;
1226
- align-items: center;
1227
- justify-content: center;
1228
- background: transparent;
1229
- border: none;
1230
- color: var(--white);
1231
- cursor: pointer;
1232
- padding: 0;
1233
- transition: color 0.2s, opacity 0.2s;
1234
- }
1235
-
1236
- #hd-wallet-ui-container .account-logout-btn:hover {
1237
- color: var(--white-80);
1238
- opacity: 0.9;
1210
+ padding-right: 56px;
1239
1211
  }
1240
1212
 
1241
1213
  #hd-wallet-ui-container .account-wallet-row {
@@ -1271,11 +1243,12 @@ body:has(#hd-wallet-ui-container .modal.active) #hd-wallet-ui-container .nav-bar
1271
1243
  #hd-wallet-ui-container .account-wallet-balance-line {
1272
1244
  display: flex;
1273
1245
  align-items: center;
1274
- gap: 8px;
1246
+ gap: 16px;
1275
1247
  }
1276
1248
 
1277
1249
  #hd-wallet-ui-container .account-wallet-summary .ph-portfolio-value {
1278
1250
  color: #4ade80;
1251
+ font-size: 25px;
1279
1252
  }
1280
1253
 
1281
1254
  #hd-wallet-ui-container .account-wallet-summary .ph-portfolio-label {
@@ -1322,7 +1295,9 @@ body:has(#hd-wallet-ui-container .modal.active) #hd-wallet-ui-container .nav-bar
1322
1295
  }
1323
1296
 
1324
1297
  #hd-wallet-ui-container .account-modal-close {
1325
- position: static;
1298
+ position: absolute;
1299
+ top: 12px;
1300
+ right: 14px;
1326
1301
  }
1327
1302
 
1328
1303
  #hd-wallet-ui-container .modal-body {