1
- import { onboardingProfile } from '@contexts/onboarding/stores' ;
2
- import { api } from '@core/api' ;
3
- import { SecretManager , SecretManagerType } from '@iota/sdk' ;
4
- import { USE_LEDGER_SIMULATOR } from 'shared/lib/core/ledger' ;
5
- import { getStorageDirectoryOfProfile , ProfileType } from 'shared/lib/core/profile' ;
6
- import { get , writable , Writable } from 'svelte/store' ;
1
+ import { onboardingProfile } from '@contexts/onboarding/stores'
2
+ import { api } from '@core/api'
3
+ import { SecretManager , SecretManagerType } from '@iota/sdk'
4
+ import { USE_LEDGER_SIMULATOR } from 'shared/lib/core/ledger'
5
+ import { getStorageDirectoryOfProfile , ProfileType } from 'shared/lib/core/profile'
6
+ import { get , writable , Writable } from 'svelte/store'
7
7
8
- export const onboardingProfileSecretManager : Writable < SecretManager | null > = writable ( null ) ;
8
+ export const onboardingProfileSecretManager : Writable < SecretManager | null > = writable ( null )
9
9
10
- export async function buildOnboardingSecretManager ( ) {
11
- const profile = get ( onboardingProfile ) ;
12
- if ( profile ) {
13
- const { id, type, strongholdPassword } = profile ;
10
+ export async function buildOnboardingSecretManager ( ) {
11
+ const profile = get ( onboardingProfile )
12
+ if ( profile ) {
13
+ const { id, type, strongholdPassword } = profile
14
14
15
15
const storagePath = await getStorageDirectoryOfProfile ( id )
16
16
const secretManagerOptions = getSecretManagerFromProfileType ( type , {
17
- storagePath,
18
- strongholdPassword
17
+ storagePath,
18
+ strongholdPassword,
19
19
} )
20
-
21
- const secretManager = await api . createSecretManager ( secretManagerOptions ) ;
20
+
21
+ const secretManager = await api . createSecretManager ( secretManagerOptions )
22
22
23
23
onboardingProfileSecretManager . set ( secretManager )
24
24
} else {
@@ -30,9 +30,16 @@ export function isOnboardingSecretManagerInitialized(): boolean {
30
30
return ! ! get ( onboardingProfileSecretManager )
31
31
}
32
32
33
- export function getSecretManagerFromProfileType ( type ?: ProfileType , { storagePath, strongholdPassword } : {
34
- storagePath ?: string , strongholdPassword ?: string
35
- } = { } ) : SecretManagerType {
33
+ export function getSecretManagerFromProfileType (
34
+ type ?: ProfileType ,
35
+ {
36
+ storagePath,
37
+ strongholdPassword,
38
+ } : {
39
+ storagePath ?: string
40
+ strongholdPassword ?: string
41
+ } = { }
42
+ ) : SecretManagerType {
36
43
const strongholdSecretManager = {
37
44
stronghold : { snapshotPath : `${ storagePath } /wallet.stronghold` , password : strongholdPassword } ,
38
45
}
@@ -47,4 +54,4 @@ export function getSecretManagerFromProfileType(type?: ProfileType, { storagePat
47
54
default :
48
55
return strongholdSecretManager
49
56
}
50
- }
57
+ }
0 commit comments