feat: aka without the at://

This commit is contained in:
Julien Calixte
2026-02-10 21:31:36 +01:00
parent fa2526bdc6
commit c638914f56
5 changed files with 17 additions and 29 deletions

View File

@@ -1,11 +1,22 @@
const correspondanceCache = new Map<string, string>()
export const getAka = async (dids: Set<string>) => {
const correspondance = await Promise.all(
[...dids].map(async (did) => {
if (correspondanceCache.has(did)) {
return [did, correspondanceCache.get(did)!] as [string, string]
}
const response = await fetch(`https://plc.directory/${did}`)
const {
alsoKnownAs: [aka],
} = await response.json()
return [did, aka] as [string, string]
const alias = aka.replace("at://", "")
correspondanceCache.set(did, alias)
return [did, alias] as [string, string]
}),
)