an attempt to make a lightweight, easily self-hostable, scoped bluesky appview
at main 991 B view raw
1// type "both" should not be used 2export function didDocument( 3 type: "view" | "index" | "both", 4 did: string, 5 endpoint: string, 6 publicKeyMultibase: string, 7) { 8 const services = [ 9 (type === "view" || type === "both") && { 10 id: "#bsky_appview", 11 type: "BskyAppView", 12 serviceEndpoint: endpoint, 13 }, 14 (type === "view" || type === "both") && { 15 id: "#bsky_notif", 16 type: "BskyNotificationService", 17 serviceEndpoint: endpoint, 18 }, 19 (type === "index" || type === "both") && { 20 id: "#skylite_index", 21 type: "SkyliteIndexServer", 22 serviceEndpoint: endpoint, 23 }, 24 ].filter(Boolean); 25 26 return { 27 "@context": [ 28 "https://www.w3.org/ns/did/v1", 29 "https://w3id.org/security/multikey/v1", 30 ], 31 id: did, 32 verificationMethod: [ 33 { 34 id: `${did}#atproto`, 35 type: "Multikey", 36 controller: did, 37 publicKeyMultibase: publicKeyMultibase, 38 }, 39 ], 40 service: services, 41 }; 42}