()
| 2607 | } |
| 2608 | |
| 2609 | function readStoredIdentityOverride(): TestIdentity | undefined { |
| 2610 | try { |
| 2611 | const rawValue = window.localStorage.getItem( |
| 2612 | E2E_IDENTITY_OVERRIDE_STORAGE_KEY, |
| 2613 | ); |
| 2614 | if (!rawValue) { |
| 2615 | return undefined; |
| 2616 | } |
| 2617 | |
| 2618 | const parsed = JSON.parse(rawValue); |
| 2619 | if ( |
| 2620 | !parsed || |
| 2621 | typeof parsed !== "object" || |
| 2622 | typeof parsed.privateKey !== "string" || |
| 2623 | typeof parsed.pubkey !== "string" || |
| 2624 | typeof parsed.username !== "string" |
| 2625 | ) { |
| 2626 | return undefined; |
| 2627 | } |
| 2628 | |
| 2629 | return { |
| 2630 | privateKey: parsed.privateKey, |
| 2631 | pubkey: parsed.pubkey, |
| 2632 | username: parsed.username, |
| 2633 | }; |
| 2634 | } catch { |
| 2635 | return undefined; |
| 2636 | } |
| 2637 | } |
| 2638 | |
| 2639 | function writeStoredIdentityOverride(identity: TestIdentity) { |
| 2640 | window.localStorage.setItem( |
no test coverage detected