Closed
Description
About APIs
Chromium OS exposes chrome.sockets.*
for its apps:
We can access those APIs in Brave by adding ipfs-companion (beta+stable) as blessed_extension
in brave-core/../_api_features.json (suggested by @bbondy)
See also my notes on bringing IPFS to Brave in 2019: brave/brave-browser#819 (comment)
Potential use
- Exposing HTTP Gateway to embedded js-ipfs node
- Making js-ipfs basically as useful as go-ipfs for regular user
- I imagine we want to detect Brave in js-ipfs/.../config-browser.js#L8
- Local Discovery and UDP/TCP Transports
(similar to @alanshaw's libdweb experiments on Firefox)
Relevant libraries
Created for and used in webtorrent:
- https://github.com/feross/chrome-net follows Node.js net (TCP) API
- https://github.com/feross/chrome-dgram follows Node.js dgram (UDP) API
- Use with browserify: webtorrent/package.json#L28-L30
MVP: Exposing HTTP Gateway
Quick notes about first steps:
- Create Brave build that exposes
chrome.sockets.*
APIs to temporary extensions- Check it it works by default. If not, find Brave build instructions here: https://github.com/brave/brave-browser/wiki and whitelist rules are around brave-core/../_api_features.json
- Detect js-ipfs is running in Brave and enable Gateway by providing a valid multiaddr instead of empty string
- Try building ipfs-companion/js-ipfs with
chrome-net
andchrome-ngram
as replacements for Node APIs in browser contexts - Start ipfs-companion in Brave, switch to embedded js-ipfs node
- did it start and open Gateway on TCP port specified in step 2? is HTTP Gateway working as expected?
- if yes, then we are lucky and this it! :)
- if not, then we need to write additional code for exposing Gateway over
chrome.sockets.*
- did it start and open Gateway on TCP port specified in step 2? is HTTP Gateway working as expected?
- Continue in Embedded JS-IPFS in Brave (experiment) #716
cc #312