feat(ark): add user component
This commit is contained in:
@@ -198,13 +198,13 @@ export class Ark {
|
||||
}
|
||||
}
|
||||
|
||||
public async createContact({ pubkey }: { pubkey: string }) {
|
||||
public async createContact(pubkey: string) {
|
||||
const user = this.ndk.getUser({ pubkey: this.account.pubkey });
|
||||
const contacts = await user.follows();
|
||||
return await user.follow(new NDKUser({ pubkey: pubkey }), contacts);
|
||||
}
|
||||
|
||||
public async deleteContact({ pubkey }: { pubkey: string }) {
|
||||
public async deleteContact(pubkey: string) {
|
||||
const user = this.ndk.getUser({ pubkey: this.account.pubkey });
|
||||
const contacts = await user.follows();
|
||||
contacts.delete(new NDKUser({ pubkey: pubkey }));
|
||||
@@ -549,17 +549,12 @@ export class Ark {
|
||||
signal,
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
console.log(res);
|
||||
throw new Error(`Failed to fetch NIP-05 service: ${nip05}`);
|
||||
}
|
||||
if (!res.ok) throw new Error(`Failed to fetch NIP-05 service: ${nip05}`);
|
||||
|
||||
const data: NIP05 = await res.json();
|
||||
|
||||
if (!data.names) return false;
|
||||
if (data.names[localPath.toLowerCase()] === pubkey) return true;
|
||||
if (data.names[localPath] === pubkey) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user