mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
19 lines
488 B
TypeScript
19 lines
488 B
TypeScript
var _fetch: any
|
|
|
|
try {
|
|
_fetch = fetch
|
|
} catch {}
|
|
|
|
export function useFetchImplementation(fetchImplementation: any) {
|
|
_fetch = fetchImplementation
|
|
}
|
|
|
|
export async function validateGithub(pubkey: string, username: string, proof: string): Promise<boolean> {
|
|
try {
|
|
let res = await (await _fetch(`https://gist.github.com/${username}/${proof}/raw`)).text()
|
|
return res === `Verifying that I control the following Nostr public key: ${pubkey}`
|
|
} catch (_) {
|
|
return false
|
|
}
|
|
}
|