From 9dea4066c9c23c2869446f26c996e468b70cf2a9 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 15 Jan 2024 19:40:38 -0700 Subject: [PATCH] add ability to confirm give directly from a project --- README.md | 14 ++-- project.task.yaml | 5 +- src/libs/endorserServer.ts | 1 + src/libs/util.ts | 18 ++++++ src/views/ClaimView.vue | 24 ++----- src/views/ContactsView.vue | 4 +- src/views/ProjectViewView.vue | 117 ++++++++++++++++++++++++++++------ 7 files changed, 135 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 94203c9..773d26f 100644 --- a/README.md +++ b/README.md @@ -81,19 +81,21 @@ To add an icon, add to main.ts and reference with `fa` element and `icon` attrib - Check the feed without names. - Copy the contact URL. - On the discovery page, check that they can see projects, and set a search area to see projects nearby. +- Switch to "no identifier" to see that things look OK without any ID. - As User #0 in another browser on the test API, add a give & a project. (See User #0 details above.) - With the new user on the home page, see the feed that shows User #0 in network but without the name. - As the new user on the contacts page, add User #0 as a contact. - On the home page, see the feed that shows User #0 with a name. -- Generate an ID. - - On the home page, check that it now prompts them to get registered. +- Switch back to the generated identifier. - On the account page, check that they see messages on limits. -- Register the ID from User #0. - - As the new user on the home page, check that they can now record a gift. - - On the contacts page, check that they cannot register someone else yet. +- As User #0, register the ID. +- As the new user on the home page, check that they can now record a gift. +- On the contacts page, check that they cannot register someone else yet. - Walk through the functions on each page. -- Test the mobile view. +- Test the notifications. - Test export & import. +- Offer, deliver a give, and confirm. Create a third user and test connections. +- Test the mobile view. (Note that Firefox mobile doesn't always show bottom icons.) diff --git a/project.task.yaml b/project.task.yaml index 76f1e7b..c4863b1 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -1,11 +1,11 @@ tasks: -- choose an agent via a contact chooser (not just copy-paste a DID) -- make the "give" on contact screen work like other give (allowing donation vs current blank) - make give action executable right from an offer - make a confirmation action executable right from a give - link to the project claim from the project screen +- choose an agent via a contact chooser (not just copy-paste a DID) +- make the "give" on contact screen work like other give (allowing donation vs current blank) - check that 'show more contacts' from the contact-give-list on the project screen includes project ID - on ClaimView, the "ask someone" should refer to "visible" IDs, or to confirmations only if confirmations are visible - give feedback when import is completed @@ -36,7 +36,6 @@ tasks: - bug (that is hard to reproduce) - back-and-forth on discovery & project pages led to "You need an identity to load your projects." error on product page when I had an identity - bug (that is hard to reproduce) - in Chrome, install app then delete app and try from Chrome browser and see log errors "Uncaught TypeError: self.appendDailyLog is not a function" - bug (that is hard to reproduce) - on the second 'give' recorded on prod it showed me as the agent -- 01 send visibility signal as a VC and store it - 04 remove 'rowid' references (that are sqlite-specific); may involve server - 04 look at other examples for better UI, eg friend.tech - .5 Add inactive flag / end date, start date to project diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index 19fa43e..117ca7c 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -68,6 +68,7 @@ export interface GiveServerRecord { fullClaim: GiveVerifiableCredential; handleId: string; issuedAt: string; + jwtId: string; recipientDid: string; unit: string; } diff --git a/src/libs/util.ts b/src/libs/util.ts index 52e48e7..61f49ce 100644 --- a/src/libs/util.ts +++ b/src/libs/util.ts @@ -6,6 +6,7 @@ import { DEFAULT_PUSH_SERVER } from "@/constants/app"; import { accountsDB, db } from "@/db/index"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { deriveAddress, generateSeed, newIdentifier } from "@/libs/crypto"; +import { GenericServerRecord, containsHiddenDid } from "@/libs/endorserServer"; // eslint-disable-next-line @typescript-eslint/no-var-requires const Buffer = require("buffer/").Buffer; @@ -19,6 +20,23 @@ export const isGlobalUri = (uri: string) => { export const ONBOARD_MESSAGE = "1) Check that they have entered their name on the profile page in their device. 2) Add them to your Contacts by scanning with the QR icon that is by the input box. 3) Click the person icon to register them. 4) Have them go to their Contact page and scan your QR to add you to their list."; +export const isConfirmable = (veriClaim: GenericServerRecord) => { + return veriClaim.claimType === "GiveAction"; +}; + +export const userCanConfirm = ( + veriClaim: GenericServerRecord, + activeDid: string, + confirmerIdList: string[] = [], +) => { + return ( + isConfirmable(veriClaim) && + !confirmerIdList.includes(activeDid) && + veriClaim.issuer !== activeDid && + !containsHiddenDid(veriClaim.claim) + ); +}; + /** * Generates a new identity, saves it to the database, and sets it as the active identity. * @return {Promise} with the DID of the new identity diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue index 36ef914..b65294d 100644 --- a/src/views/ClaimView.vue +++ b/src/views/ClaimView.vue @@ -47,7 +47,7 @@