encrypted: buffer.toHex(encrypted),
iv: iv.hex
}
- storage.setItem(name, JSON.stringify(record))
+ await new Promise<void>((resolve, reject) => {
+ try {
+ storage.setItem(name, JSON.stringify(record))
+ resolve()
+ } catch (err) {
+ reject(err)
+ }
+ })
passkey = ''
} catch (err) {
throw new Error(ERR_MSG)
return null
}
- const item = storage.getItem(name)
+ const item = await new Promise<string | null>(resolve => {
+ resolve(storage.getItem(name))
+ })
if (item == null) {
return null
}