forked from jsnbuchanan/crowd-funder-for-time-pwa
refactor DB organization (prepping for more tables)
This commit is contained in:
@@ -56,7 +56,7 @@ export default class ImportAccountView extends Vue {
|
||||
address = "";
|
||||
privateHex = "";
|
||||
publicHex = "";
|
||||
UPORT_ROOT_DERIVATION_PATH = "";
|
||||
derivationPath = "";
|
||||
|
||||
public onCancelClick() {
|
||||
this.$router.back();
|
||||
@@ -65,30 +65,26 @@ export default class ImportAccountView extends Vue {
|
||||
public async from_mnemonic() {
|
||||
const mne: string = this.mnemonic.trim().toLowerCase();
|
||||
if (this.mnemonic.trim().length > 0) {
|
||||
[
|
||||
this.address,
|
||||
this.privateHex,
|
||||
this.publicHex,
|
||||
this.UPORT_ROOT_DERIVATION_PATH,
|
||||
] = deriveAddress(mne);
|
||||
[this.address, this.privateHex, this.publicHex, this.derivationPath] =
|
||||
deriveAddress(mne);
|
||||
|
||||
const newId = newIdentifier(
|
||||
this.address,
|
||||
this.publicHex,
|
||||
this.privateHex,
|
||||
this.UPORT_ROOT_DERIVATION_PATH
|
||||
this.derivationPath
|
||||
);
|
||||
|
||||
try {
|
||||
await db.open();
|
||||
const num_accounts = await db.accounts.count();
|
||||
if (num_accounts === 0) {
|
||||
console.log("...");
|
||||
await db.accounts.add({
|
||||
publicKey: newId.keys[0].publicKeyHex,
|
||||
mnemonic: mne,
|
||||
dateCreated: new Date(),
|
||||
derivationPath: this.derivationPath,
|
||||
identity: JSON.stringify(newId),
|
||||
dateCreated: new Date().getTime(),
|
||||
mnemonic: mne,
|
||||
publicKeyHex: newId.keys[0].publicKeyHex,
|
||||
});
|
||||
}
|
||||
useAppStore().setCondition("registered");
|
||||
|
||||
Reference in New Issue
Block a user