|
|
@ -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 { |
|
|
|
APP_SERVER, |
|
|
|
DEFAULT_IMAGE_API_SERVER, |
|
|
|
NotificationIface, |
|
|
|
} from "@/constants/app"; |
|
|
|
import { Contact } from "@/db/tables/contacts"; |
|
|
|
import { accessToken, deriveAddress, nextDerivationPath } from "@/libs/crypto"; |
|
|
|
import { logConsoleAndDb, NonsensitiveDexie } from "@/db/index"; |
|
|
@ -22,10 +26,14 @@ export const SCHEMA_ORG_CONTEXT = "https://schema.org"; |
|
|
|
export const SERVICE_ID = "endorser.ch"; |
|
|
|
// the header line for contacts exported via Endorser Mobile
|
|
|
|
export const CONTACT_CSV_HEADER = "name,did,pubKeyBase64,seesMe,registered"; |
|
|
|
// the prefix for the contact URL
|
|
|
|
export const CONTACT_URL_PREFIX = "https://endorser.ch"; |
|
|
|
// the suffix for the contact URL
|
|
|
|
export const ENDORSER_JWT_URL_LOCATION = "/contact?jwt="; |
|
|
|
// the suffix for the contact URL in this app where they are confirmed before import
|
|
|
|
export const CONTACT_IMPORT_CONFIRM_URL_PATH_TIME_SAFARI = "/contact-import/"; |
|
|
|
// the suffix for the contact URL in this app where a single one gets imported automatically
|
|
|
|
export const CONTACT_IMPORT_ONE_URL_PATH_TIME_SAFARI = "/contacts?contactJwt="; |
|
|
|
// the suffix for the old contact URL -- deprecated Jan 2025, though "endorser.ch/contact?jwt=" shows data on endorser.ch server
|
|
|
|
export const CONTACT_URL_PATH_ENDORSER_CH_OLD = "/contact?jwt="; |
|
|
|
// unused now that we match on the URL path; just note that it was used for a while to create URLs that showed at endorser.ch
|
|
|
|
//export const CONTACT_URL_PREFIX_ENDORSER_CH_OLD = "https://endorser.ch";
|
|
|
|
// the prefix for handle IDs, the permanent ID for claims on Endorser
|
|
|
|
export const ENDORSER_CH_HANDLE_PREFIX = "https://endorser.ch/entity/"; |
|
|
|
|
|
|
@ -692,7 +700,6 @@ export async function getNewOffersToUser( |
|
|
|
url += "&beforeId=" + beforeOfferJwtId; |
|
|
|
} |
|
|
|
const headers = await getHeaders(activeDid); |
|
|
|
console.log("Using headers: ", headers); |
|
|
|
const response = await axios.get(url, { headers }); |
|
|
|
return response.data; |
|
|
|
} |
|
|
@ -1090,7 +1097,7 @@ export async function createAndSubmitClaim( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export async function generateEndorserJwtForAccount( |
|
|
|
export async function generateEndorserJwtUrlForAccount( |
|
|
|
account: Account, |
|
|
|
isRegistered?: boolean, |
|
|
|
name?: string, |
|
|
@ -1130,7 +1137,7 @@ export async function generateEndorserJwtForAccount( |
|
|
|
|
|
|
|
const vcJwt = await createEndorserJwtForDid(account.did, contactInfo); |
|
|
|
|
|
|
|
const viewPrefix = CONTACT_URL_PREFIX + ENDORSER_JWT_URL_LOCATION; |
|
|
|
const viewPrefix = APP_SERVER + CONTACT_IMPORT_ONE_URL_PATH_TIME_SAFARI; |
|
|
|
return viewPrefix + vcJwt; |
|
|
|
} |
|
|
|
|
|
|
|