feat: update create account flow

This commit is contained in:
2024-01-07 16:39:05 +07:00
parent 7554a35c31
commit 87099c6388
14 changed files with 486 additions and 833 deletions

View File

@@ -1,7 +1,6 @@
import { LumeStorage } from "@lume/storage";
import { type NDKEventWithReplies, type NIP05 } from "@lume/types";
import NDK, {
NDKAppHandlerEvent,
NDKEvent,
NDKFilter,
NDKKind,
@@ -513,7 +512,6 @@ export class Ark {
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;
@@ -542,4 +540,28 @@ export class Ark {
return null;
}
public async getOAuthServices() {
const trusted: NDKEvent[] = [];
const services = await this.ndk.fetchEvents({
kinds: [NDKKind.AppHandler],
"#k": ["24133"],
});
for (const service of services) {
const nip05 = JSON.parse(service.content).nip05 as string;
try {
const validate = await this.validateNIP05({
pubkey: service.pubkey,
nip05,
});
if (validate) trusted.push(service);
} catch (e) {
console.log(e);
}
}
return trusted;
}
}