|
|
@ -19,17 +19,14 @@ const schema = Object.assign({}, accountsSchema); |
|
|
|
* Needed to enable a special webpack setting to allow *await* below: |
|
|
|
* https://stackoverflow.com/questions/72474803/error-the-top-level-await-experiment-is-not-enabled-set-experiments-toplevelaw
|
|
|
|
*/ |
|
|
|
// if db already made, skip creation
|
|
|
|
const exists = await BaseDexie.exists("kickStarter"); |
|
|
|
if (exists == false) { |
|
|
|
// create password and place password in localStorage
|
|
|
|
const secret = |
|
|
|
localStorage.getItem("secret") || Encryption.createRandomEncryptionKey(); |
|
|
|
|
|
|
|
if (localStorage.getItem("secret") == null) { |
|
|
|
localStorage.setItem("secret", secret); |
|
|
|
} |
|
|
|
console.log(secret); |
|
|
|
encrypted(db, { secretKey: secret }); |
|
|
|
db.version(1).stores(schema); |
|
|
|
// create password and place password in localStorage
|
|
|
|
const secret = |
|
|
|
localStorage.getItem("secret") || Encryption.createRandomEncryptionKey(); |
|
|
|
|
|
|
|
if (localStorage.getItem("secret") == null) { |
|
|
|
localStorage.setItem("secret", secret); |
|
|
|
} |
|
|
|
console.log(secret); |
|
|
|
encrypted(db, { secretKey: secret }); |
|
|
|
db.version(1).stores(schema); |
|
|
|