diff --git a/CHANGELOG.md b/CHANGELOG.md index eae402cd..6551fef9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ + +# [0.94.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.93.0...v0.94.0) (2018-12-16) + + + # [0.93.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.92.0...v0.93.0) (2018-12-14) diff --git a/SPEC/MISCELLANEOUS.md b/SPEC/MISCELLANEOUS.md index 91fe5884..ec2e9a27 100644 --- a/SPEC/MISCELLANEOUS.md +++ b/SPEC/MISCELLANEOUS.md @@ -256,6 +256,7 @@ Where: - `name` (string): The name to resolve - `options` is an optional object that might include the following properties: - `recursive` (boolean, default false): Resolve until the result is an IPFS name + - `cidBase` (string): Multibase codec name the CID in the resolved path will be encoded with `callback` must follow `function (err, res) {}` signature, where `err` is an error if the operation was not successful. `res` is a string, the resolved name. diff --git a/js/src/dht/findpeer.js b/js/src/dht/find-peer.js similarity index 100% rename from js/src/dht/findpeer.js rename to js/src/dht/find-peer.js diff --git a/js/src/dht/findprovs.js b/js/src/dht/find-provs.js similarity index 100% rename from js/src/dht/findprovs.js rename to js/src/dht/find-provs.js diff --git a/js/src/dht/index.js b/js/src/dht/index.js index 07f5f68d..c9099fad 100644 --- a/js/src/dht/index.js +++ b/js/src/dht/index.js @@ -4,9 +4,9 @@ const { createSuite } = require('../utils/suite') const tests = { get: require('./get'), put: require('./put'), - findpeer: require('./findpeer'), + findPeer: require('./find-peer'), provide: require('./provide'), - findprovs: require('./findprovs'), + findProvs: require('./find-provs'), query: require('./query') } diff --git a/js/src/miscellaneous/resolve.js b/js/src/miscellaneous/resolve.js index 2cdace53..8122d7a6 100644 --- a/js/src/miscellaneous/resolve.js +++ b/js/src/miscellaneous/resolve.js @@ -5,6 +5,7 @@ const isIpfs = require('is-ipfs') const loadFixture = require('aegir/fixtures') const hat = require('hat') const waterfall = require('async/waterfall') +const multibase = require('multibase') const { spawnNodeWithId } = require('../utils/spawn') const { connect } = require('../utils/swarm') const { getDescribe, getIt, expect } = require('../utils/mocha') @@ -53,6 +54,21 @@ module.exports = (createCommon, options) => { }) }) + it('should resolve an IPFS hash and return a base64url encoded CID in path', (done) => { + const content = Buffer.from('TEST' + Date.now()) + + ipfs.add(content, (err, res) => { + expect(err).to.not.exist() + + ipfs.resolve(`/ipfs/${res[0].hash}`, { cidBase: 'base64url' }, (err, path) => { + expect(err).to.not.exist() + const cid = path.split('/')[2] + expect(multibase.isEncoded(cid)).to.equal('base64url') + done() + }) + }) + }) + // Test resolve turns /ipfs/QmRootHash/path/to/file into /ipfs/QmFileHash it('should resolve an IPFS path link', (done) => { const path = '/path/to/testfile.txt' diff --git a/package.json b/package.json index b839ee07..b0c0bafe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interface-ipfs-core", - "version": "0.93.0", + "version": "0.94.0", "description": "A test suite and interface you can use to implement a IPFS core interface.", "leadMaintainer": "Alan Shaw ", "main": "js/src/index.js",