add Claim view for details about a specific server record

This commit is contained in:
2023-12-08 11:40:09 -07:00
parent 6045975b79
commit 098ef3c644
12 changed files with 2727 additions and 56 deletions

View File

@@ -12,6 +12,8 @@ export const SERVICE_ID = "endorser.ch";
export const CONTACT_URL_PREFIX = "https://endorser.ch";
// the suffix for the contact URL
export const ENDORSER_JWT_URL_LOCATION = "/contact?jwt=";
// the prefix for handle IDs, the permanent ID for claims on Endorser
export const ENDORSER_CH_HANDLE_PREFIX = "https://endorser.ch/entity/";
export interface AgreeVerifiableCredential {
"@context": string;
@@ -42,10 +44,18 @@ export interface GenericClaim {
"@context": string;
"@type": string;
issuedAt: string;
issuer: string;
// "any" because arbitrary objects can be subject of agreement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
claim: Record<any, any>;
}
export const BLANK_GENERIC_CLAIM: GenericClaim = {
"@context": SCHEMA_ORG_CONTEXT,
"@type": "",
issuedAt: "",
issuer: "",
claim: {},
};
export interface GiveServerRecord {
agentDid: string;
@@ -143,6 +153,14 @@ export function isHiddenDid(did: string) {
return did === HIDDEN_DID;
}
export function stripEndorserPrefix(claimId: string) {
if (claimId && claimId.startsWith(ENDORSER_CH_HANDLE_PREFIX)) {
return claimId.substring(ENDORSER_CH_HANDLE_PREFIX.length);
} else {
return claimId;
}
}
/**
always returns text, maybe UNNAMED_VISIBLE or UNKNOWN_ENTITY
@@ -163,8 +181,8 @@ export function didInfo(
return contact
? contact.name || "Contact With No Name"
: isHiddenDid(did)
? "Someone Not In Network"
: "Someone Not In Contacts";
? "Someone Not In Network"
: "Someone Not In Contacts";
}
export interface ResultWithType {