Skip to content

Commit

Permalink
Merge pull request #13 from terra-money/fix/fetch-error
Browse files Browse the repository at this point in the history
fix: fetch error
  • Loading branch information
terran6 authored Jan 26, 2024
2 parents 6245291 + 328fd53 commit a14b903
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,22 @@ async function getLink(identity) {
var fingerprint;
var imageURL;

// Use Keybase API to request identity data which contains fingerprint information.
const identityURL = `https://keybase.io/_/api/1.0/key/fetch.json?pgp_key_ids=${identity}`;
const identityResponse = await fetch(identityURL);
const identityData = await identityResponse.json();
try {
// Use Keybase API to request identity data which contains fingerprint information.
const identityURL = `https://keybase.io/_/api/1.0/key/fetch.json?pgp_key_ids=${identity}`;
const identityResponse = await fetch(identityURL);
const identityData = await identityResponse.json();
fingerprint = identityData['keys'][0]['fingerprint'];
} catch {
console.log(`\t${identity}`);
return {'filepath': null};
}

// Use Keybase API to request fingerprint data which contains primary image url.
const fingerprintURL = `https://keybase.io/_/api/1.0/user/lookup.json?key_fingerprint=${fingerprint}`;
const fingerprintResponse = await fetch(fingerprintURL);
const fingerprintData = await fingerprintResponse.json();
try {
// Use Keybase API to request fingerprint data which contains primary image url.
const fingerprintURL = `https://keybase.io/_/api/1.0/user/lookup.json?key_fingerprint=${fingerprint}`;
const fingerprintResponse = await fetch(fingerprintURL);
const fingerprintData = await fingerprintResponse.json();
imageURL = fingerprintData['them']['0']['pictures']['primary']['url'];
} catch {
try {
Expand Down

0 comments on commit a14b903

Please sign in to comment.