Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
fix(3box): link-address logic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oed committed Aug 17, 2019
1 parent 22c509f commit 84bb77c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/3box.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ class Box {
const item = Object.assign({}, entry)
item.linkId = item.entry.hash
delete item.entry
return item
list.push(item)
return list
}, [])
}

Expand Down Expand Up @@ -621,6 +622,10 @@ class Box {
}

await this._writeAddressLink(linkData)
} else {
// Send consentSignature to 3box-address-server to link profile with ethereum address
// _writeAddressLink already does this if the other conditional is called
utils.fetchJson(this._serverUrl + '/link', linkData).catch(console.error)
}

// Ensure we self-published our did
Expand All @@ -629,12 +634,11 @@ class Box {
await this.public.set('proof_did', await this._3id.signJWT(), { noLink: true })
}

// Send consentSignature to 3box-address-server to link profile with ethereum address
utils.fetchJson(this._serverUrl + '/link', linkData).catch(console.error)
}

async _writeAddressLink (proof) {
const data = (await this._ipfs.dag.put(proof)).toBaseEncodedString()
utils.fetchJson(this._serverUrl + '/link', proof).catch(console.error)
const linkExist = await this._linkCIDExists(data)
if (linkExist) return
const link = {
Expand Down

0 comments on commit 84bb77c

Please sign in to comment.