diff --git a/README.md b/README.md index 72965aa..d692f22 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ npm run lint ### Clear data & restart -Clear cache for localhost, then go to http://localhost:8080/start (because it'll regenerate if you start on the `/account` page). +Clear cache for localhost, then go to http://localhost:8080/start +(because it'll generate a new one automatically if you start on the `/account` page). ### Test key contents @@ -30,7 +31,8 @@ See [this page](openssl_signing_console.rst) ### Register new user on test server -New users require registration. This can be done with a claim payload like this by an existing user: +New users require registration. This can be done with a claim payload like this +by an existing user: ``` const vcClaim = { @@ -42,18 +44,23 @@ New users require registration. This can be done with a claim payload like this }; ``` -On the test server, User #0 has rights to register others, so you can start playing one of two ways: +On the test server, User #0 has rights to register others, so you can start +playing one of two ways: - Import the keys for the test User `did:ethr:0x000Ee5654b9742f6Fe18ea970e32b97ee2247B51` by importing this seed phrase: `seminar accuse mystery assist delay law thing deal image undo guard initial shallow wrestle list fragile borrow velvet tomorrow awake explain test offer control` + (Other test users are found [here](https://github.com/trentlarson/endorser-ch/blob/master/test/util.js).) -- Alternatively, register someone else under User #0 on the `/account` page: +- Alternatively, register someone else under User #0 automatically: * In the `src/views/AccountViewView.vue` file, uncomment the lines referring to "testServerRegisterUser". * Visit the `/account` page. +### Create multiple identifiers +Go to /import-account and import a new one. Then switch identifiers on the +bottom of the Your Identity page. ### Create keys with alternate tools diff --git a/project.yaml b/project.yaml index 7560ea2..8da70d7 100644 --- a/project.yaml +++ b/project.yaml @@ -12,15 +12,16 @@ - replace user-affecting console.logs with error messages (eg. catches) - contacts v1 : - - test confirmed vs unconfirmed amounts - - remove 'copy' until it works - - switch to prod server - - 01 show gives with confirmations + - .1 change "confirmed" flag to "amountConfirmed" on gives + - .2 warn about amounts when you cannot see them + - .1 remove 'copy' until it works + - .5 switch to prod server - .5 Add page to show seed. - 01 Provide a way to import the non-sensitive data. - 01 Provide way to share your contact info. - .2 move all "identity" references to temporary account access - - get 'copy' to work on account page + - .5 make deploy for give-only features + - .5 get 'copy' to work on account page - contacts v+ : - .5 make advanced "show/hide amounts" button into a nice UI toggle @@ -29,8 +30,10 @@ - refactor UI : - .5 Alerts show at the top and can be missed, eg. account data download + - 01 Change alerts into a component (to cut down duplicate code) - 01 Code for "nav" tabs across the bottom is duplicated on each page. - .2 Add "copied" feedback when they click "copy" on /account + - .5 Fix how icons show on top of bottom bar on ContactAmounts page - commit screen diff --git a/src/constants/app.ts b/src/constants/app.ts index 719735b..60be120 100644 --- a/src/constants/app.ts +++ b/src/constants/app.ts @@ -2,7 +2,7 @@ * Generic strings that could be used throughout the app. */ export enum AppString { - APP_NAME = "Kickstart for time", + APP_NAME = "KickStart with Time", VERSION = "0.1", DEFAULT_ENDORSER_API_SERVER = "https://test.endorser.ch:8000", //DEFAULT_ENDORSER_API_SERVER = "http://localhost:3000", diff --git a/src/db/tables/accounts.ts b/src/db/tables/accounts.ts index 9602439..b42e55a 100644 --- a/src/db/tables/accounts.ts +++ b/src/db/tables/accounts.ts @@ -2,6 +2,7 @@ export type Account = { id?: number; // auto-generated by Dexie dateCreated: string; derivationPath: string; + did: string; identity: string; publicKeyHex: string; mnemonic: string; @@ -11,5 +12,5 @@ export type Account = { // 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", + "++id, dateCreated, derivationPath, did, $identity, $mnemonic, publicKeyHex", }; diff --git a/src/db/tables/settings.ts b/src/db/tables/settings.ts index 1da602a..a2233ec 100644 --- a/src/db/tables/settings.ts +++ b/src/db/tables/settings.ts @@ -1,6 +1,7 @@ // a singleton export type Settings = { - id: number; + id: number; // there's only one entry: MASTER_SETTINGS_KEY + activeDid?: string; firstName?: string; lastName?: string; showContactGivesInline?: boolean; diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts new file mode 100644 index 0000000..2fefe73 --- /dev/null +++ b/src/libs/endorserServer.ts @@ -0,0 +1,40 @@ +export const SCHEMA_ORG_CONTEXT = "https://schema.org"; +export const SERVICE_ID = "endorser.ch"; + +export interface AgreeVerifiableCredential { + "@context": string; + "@type": string; + // "any" because arbitrary objects can be subject of agreement + // eslint-disable-next-line @typescript-eslint/no-explicit-any + object: Record; +} + +export interface GiveServerRecord { + agentDid: string; + amount: number; + amountConfirmed: number; + description: string; + fullClaim: GiveVerifiableCredential; + handleId: string; + issuedAt: string; + recipientDid: string; + unit: string; +} + +export interface GiveVerifiableCredential { + "@context"?: string; // optional when embedded, eg. in an Agree + "@type": string; + agent: { identifier: string }; + description?: string; + identifier?: string; + object: { amountOfThisGood: number; unitCode: string }; + recipient: { identifier: string }; +} + +export interface RegisterVerifiableCredential { + "@context": string; + "@type": string; + agent: { identifier: string }; + object: string; + recipient: { identifier: string }; +} diff --git a/src/main.ts b/src/main.ts index 88dbedb..cdb751d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,6 +12,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faCalendar, faChevronLeft, + faCircle, faCircleCheck, faCircleQuestion, faCircleUser, @@ -19,9 +20,12 @@ import { faEllipsisVertical, faEye, faEyeSlash, + faFileLines, faFolderOpen, faHand, faHouseChimney, + faLongArrowAltLeft, + faLongArrowAltRight, faMagnifyingGlass, faPen, faPersonCircleCheck, @@ -40,6 +44,7 @@ import { library.add( faCalendar, faChevronLeft, + faCircle, faCircleCheck, faCircleQuestion, faCircleUser, @@ -47,9 +52,12 @@ library.add( faEllipsisVertical, faEye, faEyeSlash, + faFileLines, faFolderOpen, faHand, faHouseChimney, + faLongArrowAltLeft, + faLongArrowAltRight, faMagnifyingGlass, faPen, faPersonCircleCheck, diff --git a/src/router/index.ts b/src/router/index.ts index bc4b683..f9f5f82 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -23,12 +23,6 @@ const routes: Array = [ component: () => import(/* webpackChunkName: "about" */ "../views/AboutView.vue"), }, - { - path: "/start", - name: "start", - component: () => - import(/* webpackChunkName: "start" */ "../views/StartView.vue"), - }, { path: "/account", name: "account", @@ -43,6 +37,14 @@ const routes: Array = [ /* webpackChunkName: "confirm-contact" */ "../views/ConfirmContactView.vue" ), }, + { + path: "/contact-amounts", + name: "contact-amounts", + component: () => + import( + /* webpackChunkName: "contact-amounts" */ "../views/ContactAmountsView.vue" + ), + }, { path: "/contacts", name: "contacts", @@ -93,12 +95,6 @@ const routes: Array = [ /* webpackChunkName: "new-edit-commitment" */ "../views/NewEditCommitmentView.vue" ), }, - { - path: "/project", - name: "project", - component: () => - import(/* webpackChunkName: "project" */ "../views/ProjectViewView.vue"), - }, { path: "/new-edit-project", name: "new-edit-project", @@ -107,6 +103,12 @@ const routes: Array = [ /* webpackChunkName: "new-edit-project" */ "../views/NewEditProjectView.vue" ), }, + { + path: "/project", + name: "project", + component: () => + import(/* webpackChunkName: "project" */ "../views/ProjectViewView.vue"), + }, { path: "/projects", name: "projects", @@ -114,12 +116,10 @@ const routes: Array = [ import(/* webpackChunkName: "projects" */ "../views/ProjectsView.vue"), }, { - path: "/commitments", - name: "commitments", + path: "/start", + name: "start", component: () => - import( - /* webpackChunkName: "commitments" */ "../views/CommitmentsView.vue" - ), + import(/* webpackChunkName: "start" */ "../views/StartView.vue"), }, ]; diff --git a/src/test/index.ts b/src/test/index.ts index fe593da..2403a9f 100644 --- a/src/test/index.ts +++ b/src/test/index.ts @@ -1,9 +1,10 @@ import axios from "axios"; import * as didJwt from "did-jwt"; import { AppString } from "@/constants/app"; -import { accountsDB } from "../db"; +import { db } from "../db"; import { SERVICE_ID } from "../libs/veramo/setup"; import { deriveAddress, newIdentifier } from "../libs/crypto"; +import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; export async function testServerRegisterUser() { const testUser0Mnem = @@ -13,9 +14,8 @@ export async function testServerRegisterUser() { const identity0 = newIdentifier(addr, publicHex, privateHex, deriPath); - await accountsDB.open(); - const accounts = await accountsDB.accounts.toArray(); - const thisIdentity = JSON.parse(accounts[0].identity); + await db.open(); + const settings = await db.settings.get(MASTER_SETTINGS_KEY); // Make a claim const vcClaim = { @@ -23,7 +23,7 @@ export async function testServerRegisterUser() { "@type": "RegisterAction", agent: { did: identity0.did }, object: SERVICE_ID, - participant: { did: thisIdentity.did }, + participant: { did: settings?.activeDid }, }; // Make a payload for the claim const vcPayload = { @@ -56,5 +56,5 @@ export async function testServerRegisterUser() { }; const resp = await axios.post(url, payload, { headers }); - console.log("Result:", resp); + console.log("User registration result:", resp); } diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 243cc46..5135253 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -91,8 +91,8 @@ class="text-sm text-slate-500 flex justify-between items-center mb-1" > {{ address }} - @@ -202,11 +202,8 @@ -
-
@@ -225,6 +222,15 @@
+
+ Switch Account + + + +
+
@@ -139,7 +139,7 @@
- by: + from: {{ /* eslint-disable prettier/prettier */ this.showGiveTotals @@ -188,21 +188,32 @@ /* eslint-enable prettier/prettier */ }} - {{ givenToMeDescriptions[contact.did] }} + {{ givenToMeDescriptions[contact.did] || "Nothing" }}
+ + + See All Given Activity + +