nip05: move NIP05Result to the bottom, add another test

This commit is contained in:
Alex Gleason
2023-05-07 10:43:43 -05:00
committed by fiatjaf_
parent d2a9af2586
commit 341ccc5ac5
2 changed files with 24 additions and 10 deletions

View File

@@ -34,16 +34,6 @@ export async function searchDomain(
}
}
/** nostr.json result. */
export interface NIP05Result {
names: {
[name: string]: string
}
relays?: {
[pubkey: string]: string[]
}
}
export async function queryProfile(fullname: string): Promise<ProfilePointer | null> {
const match = fullname.match(NIP05_REGEX)
if (!match) return null
@@ -61,6 +51,16 @@ export async function queryProfile(fullname: string): Promise<ProfilePointer | n
}
}
/** nostr.json result. */
export interface NIP05Result {
names: {
[name: string]: string
}
relays?: {
[pubkey: string]: string[]
}
}
/** Parse the nostr.json and throw if it's not valid. */
function parseNIP05Result(json: any): NIP05Result {
const result: NIP05Result = {