load feed of give records on home screen

This commit is contained in:
2023-06-11 20:37:34 -06:00
parent d5336dbf1b
commit 6daa515d19
9 changed files with 285 additions and 23 deletions

View File

@@ -47,3 +47,33 @@ export interface RegisterVerifiableCredential {
object: string;
recipient: { identifier: string };
}
// This is used to check for hidden info.
// See https://github.com/trentlarson/endorser-ch/blob/0cb626f803028e7d9c67f095858a9fc8542e3dbd/server/api/services/util.js#L6
const HIDDEN_DID = "did:none:HIDDEN";
const UNKNOWN_ENTITY = "Someone Unknown";
const UNKNOWN_VISIBLE = "Someone Unnamed";
export function isHiddenDid(did) {
return did === HIDDEN_DID;
}
/**
always returns text, maybe UNNAMED_VISIBLE or UNKNOWN_ENTITY
**/
export function didInfo(did, identifiers, contacts) {
const myId = R.find((i) => i.did === did, identifiers);
if (myId) {
return "You";
} else {
const contact = R.find((c) => c.did === did, contacts);
if (contact) {
return contact.name || "(no name)";
} else if (isHiddenDid(did)) {
return UNKNOWN_ENTITY;
} else {
return UNKNOWN_VISIBLE;
}
}
}