Commit e251265
feat(dashnote): preview identity + key-type fitness on WIF paste (#75)
* feat(dashnote): accept WIF private key login with auto-detected secret shape
Login form now accepts either a BIP39 mnemonic or a WIF private key in a single field, dispatching by whitespace presence. WIF flow looks up the identity via byPublicKeyHash, validates the matched key is an AUTHENTICATION key at HIGH or CRITICAL level (rejecting MASTER which can't sign documents), and rejects disabled keys. Failed logins no longer clobber prior session state — they restore the prior status, or fall back to browsing if a remembered identity exists.
Co-Authored-By: Claude Opus 4.7 (1M context)
* feat(dashnote): preview identity + key-type fitness on WIF paste
Eagerly resolve the identity (and DPNS name) for a pasted WIF once it
passes a cheap structural gate (length 51/52, base58 charset) plus a
400ms debounce. Surface "wrong key type" / "key disabled" warnings
pre-submit so users see the issue before clicking Login. Splits a
signer-free `resolveIdentityFromWif` out of `loginWithPrivateKey` for
shared use; wrong-purpose errors now also carry the security-level name
so MASTER auth keys read distinctly from purpose mismatches.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(dashnote): clarify login secret label and surface key-type requirement
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* perf(dashnote): defer loginWithPrivateKey to keep SDK out of app shell
The eager-preview hook and SessionContext were statically importing
loginWithPrivateKey, which transitively pulls @dashevo/evo-sdk (~8MB
WASM) into the entry chunk and defeats the lazy-load strategy.
Switch both to dynamic imports gated behind the post-debounce timer
(hook) and the WIF login branch (context); rename SessionValue.login's
parameter mnemonic→secret to match the implementation since the prior
WIF-login PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(dashnote): tighten secret retention and session-recovery semantics
- Drop the module-scoped previewCache in useWifPreview: cached raw WIFs
survived modal close/reopen for the page lifetime, extending secret
retention beyond the form. Resolution state is now strictly
component-local.
- Move the loadLoginModule() await inside the try in useWifPreview so a
chunk-fetch failure collapses to idle instead of stranding the
preview on "checking".
- Restore the active session in SessionContext's login catch path when
priorStatus is "authenticated": typing a bad secret while signed in
no longer demotes the user to browsing, even when a remembered
identity is on disk. Switch flows already logout() before login()
and are unaffected.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8f0fb0a commit e251265
12 files changed
Lines changed: 1921 additions & 55 deletions
File tree
- example-apps/dashnote
- src
- components
- dash
- hooks
- lib
- session
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | | - | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
29 | 42 | | |
30 | 43 | | |
31 | 44 | | |
| |||
36 | 49 | | |
37 | 50 | | |
38 | 51 | | |
39 | | - | |
| 52 | + | |
40 | 53 | | |
41 | 54 | | |
42 | 55 | | |
| |||
69 | 82 | | |
70 | 83 | | |
71 | 84 | | |
72 | | - | |
| 85 | + | |
73 | 86 | | |
74 | 87 | | |
75 | 88 | | |
76 | | - | |
| 89 | + | |
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
| |||
240 | 253 | | |
241 | 254 | | |
242 | 255 | | |
243 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
244 | 259 | | |
245 | 260 | | |
246 | 261 | | |
| |||
260 | 275 | | |
261 | 276 | | |
262 | 277 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
270 | 281 | | |
271 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
272 | 330 | | |
273 | 331 | | |
274 | 332 | | |
| |||
320 | 378 | | |
321 | 379 | | |
322 | 380 | | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
335 | 395 | | |
336 | 396 | | |
337 | 397 | | |
| |||
363 | 423 | | |
364 | 424 | | |
365 | 425 | | |
366 | | - | |
367 | | - | |
368 | | - | |
| 426 | + | |
| 427 | + | |
369 | 428 | | |
370 | 429 | | |
371 | 430 | | |
372 | 431 | | |
373 | 432 | | |
374 | | - | |
| 433 | + | |
375 | 434 | | |
376 | 435 | | |
377 | 436 | | |
| |||
0 commit comments