mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-13 10:28:51 +00:00
nip05: move NIP05Result to the bottom, add another test
This commit is contained in:
20
nip05.ts
20
nip05.ts
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user