File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
apps/browser-extension-wallet/src Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,12 @@ import Success from '../../../assets/icons/success-staking.svg';
66import styles from './Layout.module.scss' ;
77import { useAnalyticsContext } from '@providers' ;
88import { TX_CREATION_TYPE_KEY , TxCreationType } from '@providers/AnalyticsProvider/analyticsTracker' ;
9+ import { useWalletManager } from '@hooks' ;
910
1011export const DappTransactionSuccess = ( ) : React . ReactElement => {
1112 const analytics = useAnalyticsContext ( ) ;
1213 const { t } = useTranslation ( ) ;
14+ const { clearPassword } = useWalletManager ( ) ;
1315
1416 const onClose = async ( ) => {
1517 await analytics ?. sendEventToPostHog ( PostHogAction . SendAllDoneCloseClick , {
@@ -18,6 +20,10 @@ export const DappTransactionSuccess = (): React.ReactElement => {
1820 window . close ( ) ;
1921 } ;
2022
23+ useEffect ( ( ) => {
24+ clearPassword ( ) ;
25+ } , [ clearPassword ] ) ;
26+
2127 useEffect ( ( ) => {
2228 analytics ?. sendEventToPostHog ( PostHogAction . SendAllDoneView , {
2329 [ TX_CREATION_TYPE_KEY ] : TxCreationType . External
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ export interface UseWalletManager {
6060 saveHardwareWallet : ( wallet : Wallet . CardanoWalletByChain , chainName ?: Wallet . ChainName ) => Promise < void > ;
6161 deleteWallet : ( isForgotPasswordFlow ?: boolean ) => Promise < void > ;
6262 executeWithPassword : < T > ( password : string , promiseFn : ( ) => Promise < T > , cleanPassword ?: boolean ) => Promise < T > ;
63+ clearPassword : ( ) => void ;
6364 switchNetwork : ( chainName : Wallet . ChainName ) => Promise < void > ;
6465 updateAddresses : ( args : {
6566 addresses : Wallet . KeyManagement . GroupedAddress [ ] ;
@@ -144,6 +145,13 @@ export const useWalletManager = (): UseWalletManager => {
144145 [ backgroundService ]
145146 ) ;
146147
148+ /**
149+ * Clears the wallet password
150+ */
151+ const clearPassword = useCallback ( ( ) => {
152+ backgroundService . setWalletPassword ( ) ;
153+ } , [ backgroundService ] ) ;
154+
147155 /**
148156 * Deletes wallet info in storage, which should be stored encrypted with the wallet password as lock
149157 */
@@ -481,6 +489,7 @@ export const useWalletManager = (): UseWalletManager => {
481489 saveHardwareWallet,
482490 deleteWallet,
483491 executeWithPassword,
492+ clearPassword,
484493 switchNetwork,
485494 updateAddresses
486495 } ;
You can’t perform that action at this time.
0 commit comments