Added Dixie class and cryptography. Need to figure out generating password, storing, and boot sequence.

This commit is contained in:
Matthew Aaron Raymer
2022-12-12 18:35:20 +08:00
parent e0a3f92211
commit 571fd241aa
3 changed files with 76 additions and 0 deletions

27
src/libs/db/index.ts Normal file
View 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();