feat: aka without the at://
This commit is contained in:
@@ -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]
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user