switch so personal contact JWT is link to this server (not endorser.ch), make empty-did URL show user's info

This commit is contained in:
2025-01-06 08:52:10 -07:00
parent 0a7645b8e7
commit 702e44872f
13 changed files with 119 additions and 38 deletions

View File

@@ -344,7 +344,6 @@ import { getContactPayloadFromJwtUrl } from "@/libs/crypto";
import { decodeEndorserJwt } from "@/libs/crypto/vc";
import {
CONTACT_CSV_HEADER,
CONTACT_URL_PREFIX,
createEndorserJwtForDid,
errorStringForLog,
GiveSummaryRecord,
@@ -354,6 +353,9 @@ import {
setVisibilityUtil,
UserInfo,
VerifiableCredential,
CONTACT_IMPORT_CONFIRM_URL_PATH_TIME_SAFARI,
CONTACT_IMPORT_ONE_URL_PATH_TIME_SAFARI,
CONTACT_URL_PATH_ENDORSER_CH_OLD,
} from "@/libs/endorserServer";
import * as libsUtil from "@/libs/util";
import { generateSaveAndActivateIdentity } from "@/libs/util";
@@ -426,7 +428,9 @@ export default class ContactsView extends Vue {
);
// handle a contact sent via URL
// @deprecated: use /contact-import/:jwt with a JWT that has an array of contacts
//
// Prefer use of /contact-import/:jwt with a JWT that has an array of contacts
// unless you want them to import a single contact without confirmation.
const importedContactJwt = (this.$route as RouteLocationNormalizedLoaded)
.query["contactJwt"] as string;
if (importedContactJwt) {
@@ -709,7 +713,11 @@ export default class ContactsView extends Vue {
return;
}
if (contactInput.startsWith(CONTACT_URL_PREFIX)) {
if (
contactInput.includes(CONTACT_IMPORT_CONFIRM_URL_PATH_TIME_SAFARI) ||
contactInput.includes(CONTACT_IMPORT_ONE_URL_PATH_TIME_SAFARI) ||
contactInput.includes(CONTACT_URL_PATH_ENDORSER_CH_OLD)
) {
await this.addContactFromScan(contactInput);
return;
}
@@ -872,6 +880,13 @@ export default class ContactsView extends Vue {
);
return;
} else {
if (Array.isArray(payload.contacts)) {
// reroute to the ContactsImport
(this.$router as Router).push({
path: '/contacts-import/' + url.substring(url.lastIndexOf('/') + 1),
});
return;
}
return this.addContact({
did: payload.iss,
name: payload.own.name,
@@ -1278,9 +1293,25 @@ export default class ContactsView extends Vue {
this.danger("You must select contacts to copy.");
return;
}
const selectedContacts = this.contacts.filter((c) =>
const selectedContactsFull = this.contacts.filter((c) =>
this.contactsSelected.includes(c.did),
);
const selectedContacts: Array<Contact> = selectedContactsFull.map((c) => {
const contact: Contact = {
did: c.did,
name: c.name,
};
if (c.nextPubKeyHashB64) {
contact.nextPubKeyHashB64 = c.nextPubKeyHashB64;
}
if (c.profileImageUrl) {
contact.profileImageUrl = c.profileImageUrl;
}
if (c.publicKeyBase64) {
contact.publicKeyBase64 = c.publicKeyBase64;
}
return contact;
});
// console.log(
// "Array of selected contacts:",
// JSON.stringify(selectedContacts),