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
feature: implement remote pinning API #3588
Closed
+619
−4
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
7291eab
stub out remote pin api
yusefnapora 9c9a1e7
implement remote pinning API
yusefnapora e3d9683
implement timeouts for remote pin methods
yusefnapora 93cb6ee
fix pin.remote.ls
yusefnapora bdb3d1e
add pin.remote tests to tests-interface-core.js
yusefnapora 2e232b4
fix lint issues
yusefnapora a1f7d8f
mv remote/index.js remote.js
yusefnapora a7b6e84
use commit hash for pinning client dependency
yusefnapora 0047a58
make interface-core tests pass
yusefnapora a2e9846
bump client dependency
yusefnapora cd57853
use default status "pinned" if none provided in ls
yusefnapora 2bb4779
wip - refactor code style
yusefnapora 4ce386f
wip - more refactoring
yusefnapora 2808e3e
remove pinning client dependency
yusefnapora a64118e
fix lint issues
yusefnapora 0fa8549
fix timeout for remote service stat
yusefnapora 1648b22
add Pinning.RemoteServices to IpfsConfig
yusefnapora c01fe6c
refactor class into lambda factory fn
yusefnapora 47713cc
rm unused type imports
yusefnapora da1ef9d
move serviceNamed fn outside of pin.remote.service api object
yusefnapora b8634c3
consolidate input validation
yusefnapora File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| 'use strict' | ||
|
|
||
| const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option') | ||
|
|
||
| module.exports = ({ serviceRegistry }) => { | ||
| /** | ||
| * Asks a remote pinning service to pin an IPFS object from a given path | ||
| * | ||
| * @param {string|CID} cid | ||
| * @param {AddOptions & AbortOptions} options | ||
| * @returns {Promise<Pin>} | ||
| */ | ||
| async function add (cid, options) { | ||
| const { service } = options | ||
| const svc = serviceRegistry.serviceNamed(service) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this will not handle a case when service was aded in one session and pin is added in the next one, because clients aren't populated unless add / ls / rm is called. |
||
| return svc.add(cid, options) | ||
| } | ||
|
|
||
| return withTimeoutOption(add) | ||
| } | ||
|
|
||
| /** | ||
| * @typedef {import('cids')} CID | ||
| * @typedef {import('ipfs-core-types/src/basic').AbortOptions} AbortOptions | ||
| * @typedef {import('ipfs-core-types/src/pin/remote').Pin} Pin | ||
| * @typedef {import('ipfs-core-types/src/pin/remote').AddOptions} AddOptions | ||
| */ | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go-ipfs settled on omitting endpoint keys when printing config so that they aren't easy to leak (See https://github.com/ipfs/go-ipfs/pull/7661/files#r537641281)
We should at least do the same, although @lidel suggested something smarter is needed in the long term, not sure what exactly he meant but it might be worth doing that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The smarter thing to do is to move all secrets to separate files outside the JSON config.
The only secret right now is
Identity.PrivKeythis PR adds second type of secret underPinning.RemoteServices[*].API.Key.I may be less work to move secrets outside, than to sanitize the output of
ipfs configand make sureipfs config replacedoes not forget the secrets.