You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
493 B
21 lines
493 B
// nip39.ts |
|
var _fetch; |
|
try { |
|
_fetch = fetch; |
|
} catch { |
|
} |
|
function useFetchImplementation(fetchImplementation) { |
|
_fetch = fetchImplementation; |
|
} |
|
async function validateGithub(pubkey, username, proof) { |
|
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; |
|
} |
|
} |
|
export { |
|
useFetchImplementation, |
|
validateGithub |
|
};
|
|
|