forked from jsnbuchanan/crowd-funder-for-time-pwa
change all copied contact URLs to contact-import, and handle multiples & singles separately
This commit is contained in:
@@ -93,7 +93,6 @@ import { AxiosError } from "axios";
|
||||
import QRCodeVue3 from "qr-code-generator-vue3";
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { QrcodeStream } from "vue-qrcode-reader";
|
||||
import { Router } from "vue-router";
|
||||
import { useClipboard } from "@vueuse/core";
|
||||
|
||||
import QuickNav from "@/components/QuickNav.vue";
|
||||
@@ -102,14 +101,14 @@ import { NotificationIface } from "@/constants/app";
|
||||
import { db, retrieveSettingsForActiveAccount } from "@/db/index";
|
||||
import { Contact } from "@/db/tables/contacts";
|
||||
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
|
||||
import { getContactPayloadFromJwtUrl } from "@/libs/crypto";
|
||||
import { getContactJwtFromJwtUrl } from "@/libs/crypto";
|
||||
import {
|
||||
generateEndorserJwtUrlForAccount,
|
||||
isDid,
|
||||
register,
|
||||
setVisibilityUtil,
|
||||
} from "@/libs/endorserServer";
|
||||
import { ETHR_DID_PREFIX } from "@/libs/crypto/vc";
|
||||
import { decodeEndorserJwt, ETHR_DID_PREFIX } from "@/libs/crypto/vc";
|
||||
import { retrieveAccountMetadata } from "@/libs/util";
|
||||
|
||||
@Component({
|
||||
@@ -180,8 +179,8 @@ export default class ContactQRScanShow extends Vue {
|
||||
if (url) {
|
||||
let newContact: Contact;
|
||||
try {
|
||||
const payload = getContactPayloadFromJwtUrl(url);
|
||||
if (!payload) {
|
||||
const jwt = getContactJwtFromJwtUrl(url);
|
||||
if (!jwt) {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -193,15 +192,9 @@ export default class ContactQRScanShow extends Vue {
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(payload.contacts)) {
|
||||
// reroute to the ContactsImport
|
||||
(this.$router as Router).push({
|
||||
path: "/contact-import/" + url.substring(url.lastIndexOf("/") + 1),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { payload } = decodeEndorserJwt(jwt);
|
||||
newContact = {
|
||||
did: payload.iss as string,
|
||||
did: payload.own.did || payload.iss, // ".own.did" is reliable as of v 0.3.49
|
||||
name: payload.own.name,
|
||||
nextPubKeyHashB64: payload.own.nextPublicEncKeyHash,
|
||||
profileImageUrl: payload.own.profileImageUrl,
|
||||
|
||||
Reference in New Issue
Block a user