Browse Source
Reviewed-on: https://gitea.anomalistdesign.com/trent_larson/kick-starter-for-time-pwa/pulls/12kb/add-usage-guide
trentlarson
2 years ago
15 changed files with 247 additions and 159 deletions
@ -1 +0,0 @@ |
|||||
nodejs 16.18.0 |
|
@ -1,12 +0,0 @@ |
|||||
export type Account = { |
|
||||
id?: number; |
|
||||
publicKey: string; |
|
||||
mnemonic: string; |
|
||||
identity: string; |
|
||||
dateCreated: number; |
|
||||
}; |
|
||||
|
|
||||
// mark encrypted field by starting with a $ character
|
|
||||
export const accountsSchema = { |
|
||||
accounts: "++id, publicKey, $mnemonic, $identity, dateCreated", |
|
||||
}; |
|
@ -1,12 +0,0 @@ |
|||||
export interface Contact { |
|
||||
did: string; |
|
||||
name?: string; |
|
||||
publicKeyBase64?: string; |
|
||||
seesMe?: boolean; |
|
||||
registered?: boolean; |
|
||||
} |
|
||||
|
|
||||
// mark encrypted field by starting with a $ character
|
|
||||
export const contactsSchema = { |
|
||||
contacts: "++did, name, publicKeyBase64, seesMe, registered", |
|
||||
}; |
|
@ -0,0 +1,41 @@ |
|||||
|
export type Account = { |
||||
|
id?: number; // auto-generated by Dexie
|
||||
|
dateCreated: string; |
||||
|
derivationPath: string; |
||||
|
identity: string; |
||||
|
publicKeyHex: string; |
||||
|
mnemonic: string; |
||||
|
}; |
||||
|
|
||||
|
// mark encrypted field by starting with a $ character
|
||||
|
// see https://github.com/PVermeer/dexie-addon-suite-monorepo/tree/master/packages/dexie-encrypted-addon
|
||||
|
export const AccountsSchema = { |
||||
|
accounts: |
||||
|
"++id, dateCreated, derivationPath, $identity, $mnemonic, publicKeyHex", |
||||
|
}; |
||||
|
|
||||
|
export interface Contact { |
||||
|
did: string; |
||||
|
name?: string; |
||||
|
publicKeyBase64?: string; |
||||
|
seesMe?: boolean; |
||||
|
registered?: boolean; |
||||
|
} |
||||
|
|
||||
|
export const ContactsSchema = { |
||||
|
contacts: "++did, name, publicKeyBase64, registered, seesMe", |
||||
|
}; |
||||
|
|
||||
|
// a singleton
|
||||
|
export type Settings = { |
||||
|
id: number; |
||||
|
firstName?: string; |
||||
|
lastName?: string; |
||||
|
showContactGivesInline?: boolean; |
||||
|
}; |
||||
|
|
||||
|
export const SettingsSchema = { |
||||
|
settings: "id", |
||||
|
}; |
||||
|
|
||||
|
export const MASTER_SETTINGS = 1; |
@ -1,22 +0,0 @@ |
|||||
// @ts-check
|
|
||||
import { defineStore } from "pinia"; |
|
||||
|
|
||||
export const useAccountStore = defineStore({ |
|
||||
id: "account", |
|
||||
state: () => ({ |
|
||||
account: JSON.parse( |
|
||||
typeof localStorage["account"] == "undefined" |
|
||||
? null |
|
||||
: localStorage["account"] |
|
||||
), |
|
||||
}), |
|
||||
getters: { |
|
||||
firstName: (state) => state.account.firstName, |
|
||||
lastName: (state) => state.account.lastName, |
|
||||
}, |
|
||||
actions: { |
|
||||
reset() { |
|
||||
localStorage.removeItem("account"); |
|
||||
}, |
|
||||
}, |
|
||||
}); |
|
Loading…
Reference in new issue