New structure

This commit is contained in:
Matthew Aaron Raymer
2022-12-14 17:06:16 +08:00
parent 0fa0936c59
commit c239906a96
12 changed files with 140 additions and 39 deletions

View File

@@ -1,27 +0,0 @@
import Dexie, { Table } from "dexie";
import { encrypted } from "@pvermeer/dexie-encrypted-addon";
export interface Account {
id?: number;
did: string;
kid: string;
kms: string;
meta: string;
privateKeyHex: string;
publicKeyHex: string;
type: string;
}
export class AccountsDb extends Dexie {
accounts!: Table<Account>;
constructor(secret?: string) {
super("KickStartDb");
encrypted(this, { secretKey: secret });
this.version(1).stores({
accounts: "++id, privateKeyHex, publicKeyHex", // Primary key and indexed props
});
}
}
export const db = new AccountsDb();