This repository was archived by the owner on Sep 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -37,16 +37,15 @@ class Keystore {
37
37
}
38
38
39
39
async open ( ) {
40
- if ( this . _store ) {
41
- await this . _store . open ( )
42
- return Promise . resolve ( )
40
+ if ( ! this . _store ) {
41
+ throw new Error ( 'Keystore: No store found to open' )
43
42
}
44
- return Promise . reject ( new Error ( 'Keystore: No store found to open' ) )
43
+ await this . _store . open ( )
45
44
}
46
45
47
46
async close ( ) {
48
47
if ( ! this . _store ) return
49
- await this . _upgraded
48
+ await this . _upgrade ( )
50
49
await this . _store . close ( )
51
50
}
52
51
@@ -83,7 +82,7 @@ class Keystore {
83
82
throw new Error ( 'id needed to check a key' )
84
83
}
85
84
if ( this . _store . status && this . _store . status !== 'open' ) {
86
- return Promise . resolve ( null )
85
+ return null
87
86
}
88
87
if ( ! this . _upgraded ) {
89
88
await this . _upgrade ( )
@@ -106,7 +105,7 @@ class Keystore {
106
105
throw new Error ( 'id needed to create a key' )
107
106
}
108
107
if ( this . _store . status && this . _store . status !== 'open' ) {
109
- return Promise . resolve ( null )
108
+ return null
110
109
}
111
110
if ( ! this . _upgraded ) {
112
111
await this . _upgrade ( )
@@ -139,7 +138,7 @@ class Keystore {
139
138
await this . open ( )
140
139
}
141
140
if ( this . _store . status && this . _store . status !== 'open' ) {
142
- return Promise . resolve ( null )
141
+ return null
143
142
}
144
143
if ( ! this . _upgraded ) {
145
144
await this . _upgrade ( )
You can’t perform that action at this time.
0 commit comments