
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
interface-ipfs-core
Advanced tools
A test suite and interface you can use to implement a IPFS core interface.
A test suite and interface you can use to implement an IPFS core interface.
The primary goal of this module is to define and ensure that both IPFS core implementations and their respective HTTP client libraries offer the same interface, so that developers can quickly change between a local and a remote node without having to change their applications. In addition to the definition of the expected interface, this module offers a suite of tests that can be run in order to check if the interface is used as described.
The API is presented with both Node.js and Go primitives. However, there are no actual limitations keeping it from being extended for any other language, pushing forward cross compatibility and interoperability through different stacks.
Send in a PR if you find or write one!
Include this badge in your readme if you make a new module that implements interface-ipfs-core API.
[](https://github.com/ipfs/interface-ipfs-core)
In JavaScript land:
npm install interface-ipfs-core
In Go land:
# Not available
Install interface-ipfs-core
as one of the dependencies of your project and as a test file. Then, using mocha
(for Node.js) or a test runner with compatible API, do:
const tests = require('interface-ipfs-core')
// Create common setup and teardown
const createCommon = () => ({
// Do some setup common to all tests
setup (cb) {
// Must call back with an "IPFS factory", an object with a `spawnNode` method
cb(null, {
// Use ipfsd-ctl or other to spawn an IPFS node for testing
spawnNode (cb) { /* ... */ }
})
},
// Dispose of nodes created by the IPFS factory and any other teardown
teardown (cb) {
cb()
}
})
tests.block(createCommon)
tests.config(createCommon)
tests.dag(createCommon)
// ...etc. (see js/src/index.js)
tests.repo.version(createCommon)
tests.repo.gc(createCommon, { skip: true }) // pass an options object to skip these tests
// OR, at the subsystem level
// skips ALL the repo.gc tests
tests.repo(createCommon, { skip: ['gc'] })
// skips ALL the object.patch.addLink tests
tests.object(createCommon, { skip: ['patch.addLink'] })
tests.repo.gc(createCommon, { skip: ['should do a thing'] }) // named test(s) to skip
// OR, at the subsystem level
tests.repo(createCommon, { skip: ['should do a thing'] })
tests.repo.gc(createCommon, { only: true }) // pass an options object to run only these tests
// OR, at the subsystem level
// runs only ALL the repo.gc tests
tests.repo(createCommon, { only: ['gc'] })
// runs only ALL the object.patch.addLink tests
tests.object(createCommon, { only: ['patch.addLink'] })
tests.repo.gc(createCommon, { only: ['should do a thing'] }) // only run these named test(s)
// OR, at the subsystem level
tests.repo(createCommon, { only: ['should do a thing'] })
In order to be considered "valid", an IPFS core implementation must expose the API described in /SPEC. You can also use this loose spec as documentation for consuming the core APIs. Here is an outline of the contents of that directory:
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
Copyright (c) Protocol Labs, Inc. under the MIT License. See LICENSE.md for details.
FAQs
A test suite and interface you can use to implement a IPFS core interface.
The npm package interface-ipfs-core receives a total of 212 weekly downloads. As such, interface-ipfs-core popularity was classified as not popular.
We found that interface-ipfs-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.