forked from jsnbuchanan/crowd-funder-for-time-pwa
add next-public-key-hash to manual input
This commit is contained in:
@@ -8,13 +8,11 @@ tasks:
|
|||||||
|
|
||||||
- look for "if is a new user" -- blank name
|
- look for "if is a new user" -- blank name
|
||||||
- copy button for seed
|
- copy button for seed
|
||||||
- explanation for contact icons
|
|
||||||
|
|
||||||
- .5 If notifications are not enabled, add message to front page with link/button to enable
|
- .5 If notifications are not enabled, add message to front page with link/button to enable
|
||||||
- record donations vs gives
|
- record donations vs gives
|
||||||
- make server endpoint for full English description of limits
|
- make server endpoint for full English description of limits
|
||||||
- make identicons for contacts into more-memorable faces (and maybe change project identicons, too)
|
- 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
|
- 01 server - show all claim details when issued by the issuer
|
||||||
- bug - got error adding on Firefox user #0 as contact for themselves
|
- bug - got error adding on Firefox user #0 as contact for themselves
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export interface Contact {
|
export interface Contact {
|
||||||
did: string;
|
did: string;
|
||||||
name?: 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;
|
publicKeyBase64?: string;
|
||||||
seesMe?: boolean;
|
seesMe?: boolean;
|
||||||
registered?: boolean;
|
registered?: boolean;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="DID, Name, Public Key (base 16 or 64)"
|
placeholder="DID, Name, Public Key, Next Public Key Hash"
|
||||||
class="block w-full rounded-l border border-r-0 border-slate-400 px-3 py-2"
|
class="block w-full rounded-l border border-r-0 border-slate-400 px-3 py-2"
|
||||||
v-model="contactInput"
|
v-model="contactInput"
|
||||||
/>
|
/>
|
||||||
@@ -109,9 +109,9 @@
|
|||||||
<div class="text-sm truncate" v-if="contact.publicKeyBase64">
|
<div class="text-sm truncate" v-if="contact.publicKeyBase64">
|
||||||
Public Key (base 64): {{ contact.publicKeyBase64 }}
|
Public Key (base 64): {{ contact.publicKeyBase64 }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm truncate" v-if="contact.nextPublicKeyHashBase64">
|
<div class="text-sm truncate" v-if="contact.nextPubKeyHashB64">
|
||||||
Next Public Key Hash (base 64):
|
Next Public Key Hash (base 64):
|
||||||
{{ contact.nextPublicKeyHashBase64 }}
|
{{ contact.nextPubKeyHashB64 }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="ContactActions" class="flex gap-1.5 mt-2">
|
<div id="ContactActions" class="flex gap-1.5 mt-2">
|
||||||
@@ -497,7 +497,7 @@ export default class ContactsView extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let did = this.contactInput;
|
let did = this.contactInput;
|
||||||
let name, publicKeyBase64;
|
let name, publicKeyInput, nextPublicKeyHashInput;
|
||||||
const commaPos1 = this.contactInput.indexOf(",");
|
const commaPos1 = this.contactInput.indexOf(",");
|
||||||
if (commaPos1 > -1) {
|
if (commaPos1 > -1) {
|
||||||
did = this.contactInput.substring(0, commaPos1).trim();
|
did = this.contactInput.substring(0, commaPos1).trim();
|
||||||
@@ -505,15 +505,31 @@ export default class ContactsView extends Vue {
|
|||||||
const commaPos2 = this.contactInput.indexOf(",", commaPos1 + 1);
|
const commaPos2 = this.contactInput.indexOf(",", commaPos1 + 1);
|
||||||
if (commaPos2 > -1) {
|
if (commaPos2 > -1) {
|
||||||
name = this.contactInput.substring(commaPos1 + 1, commaPos2).trim();
|
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
|
// help with potential mistakes while this sharing requires copy-and-paste
|
||||||
|
let publicKeyBase64 = publicKeyInput;
|
||||||
if (publicKeyBase64 && /^[0-9A-Fa-f]{66}$/i.test(publicKeyBase64)) {
|
if (publicKeyBase64 && /^[0-9A-Fa-f]{66}$/i.test(publicKeyBase64)) {
|
||||||
// it must be all hex (compressed public key), so convert
|
// it must be all hex (compressed public key), so convert
|
||||||
publicKeyBase64 = Buffer.from(publicKeyBase64, "hex").toString("base64");
|
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);
|
await this.addContact(newContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +550,7 @@ export default class ContactsView extends Vue {
|
|||||||
return this.addContact({
|
return this.addContact({
|
||||||
did: payload.iss,
|
did: payload.iss,
|
||||||
name: payload.own.name,
|
name: payload.own.name,
|
||||||
nextPublicKeyHashBase64: payload.own.nextPublicEncKeyHash,
|
nextPubKeyHashB64: payload.own.nextPublicEncKeyHash,
|
||||||
publicKeyBase64: payload.own.publicEncKey,
|
publicKeyBase64: payload.own.publicEncKey,
|
||||||
} as Contact);
|
} as Contact);
|
||||||
}
|
}
|
||||||
@@ -592,7 +608,7 @@ export default class ContactsView extends Vue {
|
|||||||
title: "Contact Added",
|
title: "Contact Added",
|
||||||
text: addedMessage,
|
text: addedMessage,
|
||||||
},
|
},
|
||||||
5000,
|
-1, // keeping it up so that the "visibility" message is seen
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user