Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add native or local node support for Android #14771

Open
bbondy opened this issue Mar 17, 2021 · 9 comments
Open

Add native or local node support for Android #14771

bbondy opened this issue Mar 17, 2021 · 9 comments

Comments

@bbondy
Copy link
Member

bbondy commented Mar 17, 2021

Android support for gateway was recently added.
This is a placeholder to add support without a gateway to Android too.

Perhaps using go-mobile-ipfs, it has Swift and Kotlin bindings

@bbondy bbondy added this to Untriaged in IPFS via automation Mar 17, 2021
@bbondy bbondy moved this from Untriaged to Backlog in IPFS Mar 23, 2021
@lidel
Copy link

lidel commented Apr 13, 2021

Afaik we don't have official builds/ for Android, but there is relevant work in the IPFS community.

@gfanton do you know how the gateway situation looks like on Android?
(Brave uses it as the backend for handling ipfs:// and ipns:// on Desktop, wondering what our options are on mobile)

@gfanton
Copy link

gfanton commented Apr 16, 2021

Hey @lidel,
gomobile-ipfs can handle both ipfs:// and ipns:// protocols, it's basically a "desktop" IPFS node with some wrapper and binding for iOS/Android platforms.

The main question is: how do you plan to interact with the gateway? Thinking quickly, we have several approaches in mind:

  • We can make the gateway listen on localhost so you will be able to interact with it as you probably do it on desktop. But the main issue with this approach is that every other applications on the device will be able to access the gateway as well (one workaround could be to setup an authentication mecanism, but this would probably be a pain to implement).
  • We can make the gateway listen on an Unix Domain Socket, so only your process will be able to access the gateway. This approach is the most secure one (and easy to implement on our side), but might make the implementation more complicated for you since it's not classic TPC/IP anymore. From our experience, we were not able to interact with the gateway through a UDS using React-Native webviews (which itself uses native Android and iOS webviews).
  • We can bind a native method to any go-ipfs method (iOS/Android -> Golang), so you could be able to interact with the node directly without any network request involved. This is the same kind of thing we do with the IPFS API using the RequestBuilder: (https://ipfs-shipyard.github.io/gomobile-ipfs/android/ipfs/gomobile/android/RequestBuilder.html). We can probably do something similar for the gateway (?)

What do you think about it?

@lidel
Copy link

lidel commented May 5, 2021

Somehow related: #13500 (comment) includes an example which is how thin clients could work on mobile (use public gateways instead of libp2p transports to save battery).

@spylogsster
Copy link

@gfanton I think the localhost gateway would be fine for now to create the first version. it allows us to reuse core codebase from desktop and check how it would work. do you have any ready-to-use library or some roadmap when it can be used by us?

cc: @bbondy

@spylogsster spylogsster moved this from Backlog to In Progress in IPFS Jun 24, 2021
@spylogsster spylogsster self-assigned this Jun 25, 2021
@gfanton
Copy link

gfanton commented Jun 25, 2021

I think the localhost gateway would be fine for now to create the first version. it allows us to reuse core codebase from desktop and check how it would work

You should be fine then 😄

do you have any ready-to-use library or some roadmap when it can be used by us

  • We originally used Bintray to release our different packages (Core/Bridge for iOS/Android), unfortunately the service has been shutdown and we need to switch to another service.
  • We have a roadmap on gomobile-ipfs readme: https://github.com/ipfs-shipyard/gomobile-ipfs#roadmap, but the remaining points seems not relevant for your use case.
  • The only thing we need to do is to add a TCP listener for the localhost gateway. It could be done quickly since we already have a listener for the API. If you plan to use it, we can add this feature next week.

@spylogsster
Copy link

@gfanton would be great, we want to try this

@spylogsster spylogsster moved this from In Progress to Backlog in IPFS Jun 27, 2021
@spylogsster
Copy link

waiting ipfs-shipyard/gomobile-ipfs#70

@spylogsster spylogsster removed their assignment Jun 24, 2022
@lidel
Copy link

lidel commented Aug 12, 2022

Kubo 0.13 introduced verifiable gateway responses.

This means Brave Mobile does not need to run full libp2p stack anymore, it could take a list of HTTP gateways and fetch content-addressed data over HTTP and still keep ipfs:// in address bar.

Demo / PoC

MVP verifiable retrieval with curl and ipfs-car utility (decodes CAR stream and unpacks files and directories in UnifFS format):

$ npm i -g ipfs-car
$ curl "https://ipfs.io/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q?format=car" | ipfs-car
$ ls ./bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q/
1007 - Sustainable - alt.txt
1007 - Sustainable - transcript.txt
1007 - Sustainable.png

Ref.

@micahscopes
Copy link

Any progress on this? I'm running around in circles trying to find a browser that supports IPFS on a local network and also runs on older (<11) versions of Android. Seems like Brave is very close to allowing this and it'd be amazing if this option was available.

What would need to be done to enable this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
IPFS
  
Backlog
Development

No branches or pull requests

5 participants