Skip to content

Commit

Permalink
fix: set as not onboarded if reset (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsobries authored Feb 29, 2024
1 parent 17e7716 commit f1cacf4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import browser from 'webextension-polyfill';
import { Services } from '@ardenthq/sdk';
import { Contracts } from '@ardenthq/sdk-profiles';
import { UUID } from '@ardenthq/sdk-cryptography';
import { BACKGROUND_EVENT_LISTENERS_HANDLERS } from './lib/background/eventListenerHandlers';
import { AutoLockTimer, setLocalValue } from './lib/utils/localStorage';
import initAutoLock from './lib/background/initAutoLock';
Expand All @@ -7,12 +10,9 @@ import { ExtensionEvents } from './lib/events';
import { importWallets } from './background.helpers';
import { createTestProfile, isDev } from './dev/utils/dev';
import { ProfileData } from './lib/background/contracts';
import { Services } from '@ardenthq/sdk';
import { SendTransferInput } from './lib/background/extension.wallet';
import { Extension } from './lib/background/extension';
import { Contracts } from '@ardenthq/sdk-profiles';
import { SessionEntries } from './lib/store/session';
import { UUID } from '@ardenthq/sdk-cryptography';

const initialPassword = UUID.random();

Expand Down Expand Up @@ -82,7 +82,7 @@ const initRuntimeEventListener = () => {

if (request.type === 'IMPORT_WALLETS') {
try {
if (!!request.data.password) {
if (request.data.password) {
await extension.reset(request.data.password, request.data);
}

Expand Down Expand Up @@ -249,6 +249,8 @@ const initRuntimeEventListener = () => {
return Promise.resolve({ error });
}
} else if (request.type === 'RESET') {
setLocalValue('hasOnboarded', false);

extension.reset(initialPassword);
} else if (request.type === 'REMOVE_WALLETS') {
if (extension.profile()?.password().get() !== request.data.password) {
Expand Down

0 comments on commit f1cacf4

Please sign in to comment.