forked from trent_larson/crowd-funder-for-time-pwa
Added Dixie class and cryptography. Need to figure out generating password, storing, and boot sequence.
This commit is contained in:
27
src/libs/db/index.ts
Normal file
27
src/libs/db/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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();
|
||||
Reference in New Issue
Block a user