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

WIP: IPFS extension #425

Closed
wants to merge 7 commits into from
Closed

WIP: IPFS extension #425

wants to merge 7 commits into from

Conversation

drbh
Copy link
Contributor

@drbh drbh commented Sep 8, 2018

Fixes brave/brave-browser#1042

PR based on work done on Tor like: #316

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.
  • Add appropriate QA labels (QA/Needed or QA/No-QA-Needed) to include the closed issue in milestone

Test Plan:

  • Extension download and

    • installation
    • Start with a clean profile
    • Launch Brave
    • Visit chrome://components
    • Verify that Ipfs Client Updater is listed and version number is not 0.0.0.0
    • Verify that name of component contains platform identifier (Windows/Mac/Linux)
    • Command-line switch to disable extension
  • Start with a clean profile

    • Launch Brave with --disable-ipfs-client-updater-extension
    • Visit chrome://components and verify that Ipfs Client Updater is not listed

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

@drbh
Copy link
Contributor Author

drbh commented Sep 8, 2018

@emerick follow up on brave/brave-core-crx-packager#23

browser/extensions/BUILD.gn Show resolved Hide resolved

#if defined(OS_WIN)
const std::string kIpfsClientComponentName("Brave Ipfs Client Updater (Windows)");
const std::string kIpfsClientComponentId("client-component");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The should be the actual component ID, as listed in chrome://extensions.


#elif defined(OS_MACOSX)
const std::string kIpfsClientComponentName("Brave Ipfs Client Updater (Mac)");
const std::string kIpfsClientComponentId("client-component");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.


#elif defined(OS_LINUX)
const std::string kIpfsClientComponentName("Brave Ipfs Client Updater (Linux)");
const std::string kIpfsClientComponentId("client-component");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double-checking: the PEM files used for tests should be unique and not used in any production code. Can you confirm? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the private key I used is a copy of the private key used in the Tor test implementation at https://github.com/brave/brave-core/blob/master/test/data/tor-client-updater/tor-client-updater-mac.pem


using extensions::ExtensionBrowserTest;

const std::string kIpfsClientUpdaterComponentTestId("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test extension's component ID should be here, as listed in chrome://extensions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not include any component ID since I wasn't sure if I built them from a private key that I generated (not the official one) they would resolve to a different id...

the private key I used is a copy of the private key used in the Tor test implementation at https://github.com/brave/brave-core/blob/master/test/data/tor-client-updater/tor-client-updater-mac.pem

// Brave Ipfs Client Updater (Mac)
" - - - - - - - - - - - - - - - - - - ",
"ngicbhhaldfdgmjhilmnleppfpmkgbbk",
Copy link
Contributor

@emerick emerick Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same ID as the Tor Client Updater. Typo?

@@ -98,7 +98,7 @@ bool BraveExtensionProvider::IsVetted(const Extension* extension) {
// Test ID: Brave Tor Client Updater
"ngicbhhaldfdgmjhilmnleppfpmkgbbk"
// Test ID: Brave Ipfs Client Updater
" - - - - - - - - - - - - - - - - - - "
"ngicbhhaldfdgmjhilmnleppfpmkgbbk"
Copy link
Contributor

@emerick emerick Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same ID as the Tor Client Updater. Typo?

@emerick emerick requested a review from bbondy September 10, 2018 14:37
@bbondy bbondy changed the title Ipfs ext WIP: Ipfs ext Sep 29, 2018
@drbh
Copy link
Contributor Author

drbh commented Oct 10, 2018

@emerick or @bbondy could someone help me sort out the private key issue and figure out the correct component ids in browser/extensions/brave_extension_provider.cc.

I'm confused about what keys I should use, and how to generate the component ID for the extension aside from the test case.

@bbondy
Copy link
Member

bbondy commented Oct 14, 2018

@drbh in a bit of a crunch since we're releasing the first version on release channel this coming week. But @emerick will get to this after that. Sorry for the delay.

@drbh drbh changed the title WIP: Ipfs ext WIP: IPFS extension Nov 27, 2018
@drbh
Copy link
Contributor Author

drbh commented Dec 1, 2018

bump.

Is there still interest in integrating IPFS natively into Brave - if there is more dev work I can help with for this PR please let me know.

@bbondy
Copy link
Member

bbondy commented Dec 4, 2018

Thanks for your patience, we need to decide how we want to offer the feature, but we will re-use this work. We'll take a look soon. I think we want to package a daemon like we do with Tor but not have it enabled by default. We could prompt to enable it if the user does a certain action like trying to load ipfs:// for example.

@bbondy
Copy link
Member

bbondy commented Dec 4, 2018

We also want to manage the daemon process like we do for Tor.

@drbh
Copy link
Contributor Author

drbh commented Dec 8, 2018

@bbondy as to packaging the daemon there is already CRX support in the crx packager repo here: https://github.com/brave/brave-core-crx-packager/tree/master/scripts

How do we go about managing the daemon process like Tor?

Is the process managed solely by the files located here:
https://github.com/brave/brave-core/tree/master/browser/tor

I agree we should not enable IPFS by default but only when a user requests it's service with ipfs://

@bbondy
Copy link
Member

bbondy commented Dec 10, 2018

@darkdh would you mind sharing some wisdom / guidance?

@darkdh
Copy link
Member

darkdh commented Dec 10, 2018

as we discussed in slack DM, see
a3d7571

@bbondy
Copy link
Member

bbondy commented Dec 11, 2018

@drbh is this something you'd be interested in working on?

@drbh
Copy link
Contributor Author

drbh commented Dec 11, 2018

@bbondy yes I would love to! I undoubtedly will need help down the line, but I can for sure get this started! 😄

@bbondy
Copy link
Member

bbondy commented Apr 18, 2019

Closing this since I think this is handled by feature detection within the Chrome extension now.

@bbondy bbondy closed this Apr 18, 2019
@lidel
Copy link
Contributor

lidel commented Apr 19, 2019

Context for drive-by readers:

We are parking work on embedding go-ipfs binary for now, and focus on shipping embedded js-ipfs as noted in brave/brave-browser#819 (comment)

Details about chrome.sockets feature-detection can be tracked in ipfs/ipfs-companion#664

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

Successfully merging this pull request may close these issues.

Update Ipfs client via component extension
5 participants