// type "both" should not be used export function didDocument( type: "view" | "index" | "both", did: string, endpoint: string, publicKeyMultibase: string, ) { const services = [ (type === "view" || type === "both") && { id: "#bsky_appview", type: "BskyAppView", serviceEndpoint: endpoint, }, (type === "view" || type === "both") && { id: "#bsky_notif", type: "BskyNotificationService", serviceEndpoint: endpoint, }, (type === "index" || type === "both") && { id: "#skylite_index", type: "SkyliteIndexServer", serviceEndpoint: endpoint, }, ].filter(Boolean); return { "@context": [ "https://www.w3.org/ns/did/v1", "https://w3id.org/security/multikey/v1", ], id: did, verificationMethod: [ { id: `${did}#atproto`, type: "Multikey", controller: did, publicKeyMultibase: publicKeyMultibase, }, ], service: services, }; }