Browse Source

Fixes for APP_SERVER definition issue

split_build_process
Matthew Raymer 1 week ago
parent
commit
5f2d6388c9
  1. 22
      src/libs/endorserServer.ts
  2. 6
      src/views/ShareMyContactInfoView.vue

22
src/libs/endorserServer.ts

@ -4,7 +4,11 @@ import { sha256 } from "ethereum-cryptography/sha256";
import { LRUCache } from "lru-cache";
import * as R from "ramda";
import { DEFAULT_IMAGE_API_SERVER, NotificationIface } from "../constants/app";
import {
DEFAULT_IMAGE_API_SERVER,
NotificationIface,
APP_SERVER,
} from "../constants/app";
import { Contact } from "../db/tables/contacts";
import { accessToken, deriveAddress, nextDerivationPath } from "../libs/crypto";
import { logConsoleAndDb, NonsensitiveDexie } from "../db/index";
@ -16,7 +20,6 @@ import {
GiverReceiverInputInfo,
} from "../libs/util";
import { createEndorserJwtForKey, KeyMeta } from "../libs/crypto/vc";
import { Account } from "../db/tables/accounts";
export const SCHEMA_ORG_CONTEXT = "https://schema.org";
// the object in RegisterAction claims
@ -1110,12 +1113,11 @@ export async function createAndSubmitClaim(
}
export async function generateEndorserJwtUrlForAccount(
account: Account,
isRegistered?: boolean,
name?: string,
profileImageUrl?: string,
// note that including the next key pushes QR codes to the next resolution smaller
includeNextKeyIfDerived?: boolean,
account: KeyMeta,
isRegistered: boolean,
givenName: string,
profileImageUrl: string,
isContact: boolean,
) {
const publicKeyHex = account.publicKeyHex;
const publicEncKey = Buffer.from(publicKeyHex, "hex").toString("base64");
@ -1125,7 +1127,7 @@ export async function generateEndorserJwtUrlForAccount(
iss: account.did,
own: {
did: account.did,
name: name ?? "",
name: givenName ?? "",
publicEncKey,
registered: !!isRegistered,
} as UserInfo,
@ -1135,7 +1137,7 @@ export async function generateEndorserJwtUrlForAccount(
}
// Add the next key -- not recommended for the QR code for such a high resolution
if (includeNextKeyIfDerived && account?.mnemonic && account?.derivationPath) {
if (isContact && account?.mnemonic && account?.derivationPath) {
const newDerivPath = nextDerivationPath(account.derivationPath as string);
const nextPublicHex = deriveAddress(
account.mnemonic as string,

6
src/views/ShareMyContactInfoView.vue

@ -46,7 +46,7 @@ import { Router } from "vue-router";
import { useClipboard } from "@vueuse/core";
import QuickNav from "../components/QuickNav.vue";
import TopMessage from "../components/TopMessage.vue";
import { NotificationIface } from "../constants/app";
import { NotificationIface, APP_SERVER } from "../constants/app";
import { db, retrieveSettingsForActiveAccount } from "../db/index";
import { retrieveAccountMetadata } from "../libs/util";
import { generateEndorserJwtUrlForAccount } from "../libs/endorserServer";
@ -57,6 +57,10 @@ import { generateEndorserJwtUrlForAccount } from "../libs/endorserServer";
export default class ShareMyContactInfoView extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void;
mounted() {
console.log("APP_SERVER in mounted:", APP_SERVER);
}
async onClickShare() {
const settings = await retrieveSettingsForActiveAccount();
const activeDid = settings.activeDid || "";

Loading…
Cancel
Save