diff --git a/project.task.yaml b/project.task.yaml index 492ad008..51a9a7cf 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -8,13 +8,11 @@ tasks: - look for "if is a new user" -- blank name - copy button for seed -- explanation for contact icons - .5 If notifications are not enabled, add message to front page with link/button to enable - record donations vs gives - make server endpoint for full English description of limits - make identicons for contacts into more-memorable faces (and maybe change project identicons, too) -- .5 add next key hash to text input field - 01 server - show all claim details when issued by the issuer - bug - got error adding on Firefox user #0 as contact for themselves diff --git a/src/db/tables/contacts.ts b/src/db/tables/contacts.ts index 2f59a417..14ad6809 100644 --- a/src/db/tables/contacts.ts +++ b/src/db/tables/contacts.ts @@ -1,7 +1,7 @@ export interface Contact { did: string; name?: string; - nextPublicKeyHashBase64?: string; // base64-encoded SHA256 hash of next public key + nextPubKeyHashB64?: string; // base64-encoded SHA256 hash of next public key publicKeyBase64?: string; seesMe?: boolean; registered?: boolean; diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index d3fed6a0..3f0530ab 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -28,7 +28,7 @@ @@ -109,9 +109,9 @@
Public Key (base 64): {{ contact.publicKeyBase64 }}
-
+
Next Public Key Hash (base 64): - {{ contact.nextPublicKeyHashBase64 }} + {{ contact.nextPubKeyHashB64 }}
@@ -497,7 +497,7 @@ export default class ContactsView extends Vue { } let did = this.contactInput; - let name, publicKeyBase64; + let name, publicKeyInput, nextPublicKeyHashInput; const commaPos1 = this.contactInput.indexOf(","); if (commaPos1 > -1) { did = this.contactInput.substring(0, commaPos1).trim(); @@ -505,15 +505,31 @@ export default class ContactsView extends Vue { const commaPos2 = this.contactInput.indexOf(",", commaPos1 + 1); if (commaPos2 > -1) { name = this.contactInput.substring(commaPos1 + 1, commaPos2).trim(); - publicKeyBase64 = this.contactInput.substring(commaPos2 + 1).trim(); + publicKeyInput = this.contactInput.substring(commaPos2 + 1).trim(); + const commaPos3 = this.contactInput.indexOf(",", commaPos2 + 1); + if (commaPos3 > -1) { + publicKeyInput = this.contactInput.substring(commaPos2 + 1, commaPos3).trim(); // eslint-disable-line prettier/prettier + nextPublicKeyHashInput = this.contactInput.substring(commaPos3 + 1).trim(); // eslint-disable-line prettier/prettier + } } } // help with potential mistakes while this sharing requires copy-and-paste + let publicKeyBase64 = publicKeyInput; if (publicKeyBase64 && /^[0-9A-Fa-f]{66}$/i.test(publicKeyBase64)) { // it must be all hex (compressed public key), so convert publicKeyBase64 = Buffer.from(publicKeyBase64, "hex").toString("base64"); } - const newContact = { did, name, publicKeyBase64 }; + let nextPubKeyHashB64 = nextPublicKeyHashInput; + if (nextPubKeyHashB64 && /^[0-9A-Fa-f]{66}$/i.test(nextPubKeyHashB64)) { + // it must be all hex (compressed public key), so convert + nextPubKeyHashB64 = Buffer.from(nextPubKeyHashB64, "hex").toString("base64"); // eslint-disable-line prettier/prettier + } + const newContact = { + did, + name, + publicKeyBase64, + nextPubKeyHashB64: nextPubKeyHashB64, + }; await this.addContact(newContact); } @@ -534,7 +550,7 @@ export default class ContactsView extends Vue { return this.addContact({ did: payload.iss, name: payload.own.name, - nextPublicKeyHashBase64: payload.own.nextPublicEncKeyHash, + nextPubKeyHashB64: payload.own.nextPublicEncKeyHash, publicKeyBase64: payload.own.publicEncKey, } as Contact); } @@ -592,7 +608,7 @@ export default class ContactsView extends Vue { title: "Contact Added", text: addedMessage, }, - 5000, + -1, // keeping it up so that the "visibility" message is seen ); }) .catch((err) => {