Skip to content
This repository was archived by the owner on Aug 24, 2021. It is now read-only.

Commit caf6eb0

Browse files
committed
fix: multihashes does not export default lengths any more
Since multiformats/js-multihash#76 was released the `multihashes` module does not export default hash lengths any more. For reasons that are unclear it went out as a patch release which means `ipld-git` is currently broken. This PR hard codes the hash length as it is known, and also removes the `multihashes` dep as we can use the one exported from `multihashing-async` and updates other deps. Ref: multiformats/js-multihash#76 (comment)
1 parent e5f2209 commit caf6eb0

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@
3636
},
3737
"homepage": "https://github.com/ipld/js-ipld-git",
3838
"dependencies": {
39-
"cids": "~0.8.0",
40-
"multicodec": "^1.0.0",
41-
"multihashes": "~0.4.14",
42-
"multihashing-async": "~0.8.0",
43-
"smart-buffer": "^4.0.2",
44-
"strftime": "~0.10.0"
39+
"cids": "^0.8.2",
40+
"multicodec": "^1.0.2",
41+
"multihashing-async": "^0.8.1",
42+
"smart-buffer": "^4.1.0",
43+
"strftime": "^0.10.0"
4544
},
4645
"devDependencies": {
47-
"aegir": "^22.0.0",
46+
"aegir": "^23.0.0",
4847
"chai": "^4.2.0",
4948
"chai-as-promised": "^7.1.1",
5049
"dirty-chai": "^2.0.1"

src/util/util.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
'use strict'
22

3-
const multihashes = require('multihashes/src/constants')
4-
const multihash = require('multihashes')
3+
const multihash = require('multihashing-async').multihash
54
const CID = require('cids')
65
const strftime = require('strftime')
76

87
exports = module.exports
98

10-
exports.SHA1_LENGTH = multihashes.defaultLengths[multihashes.names.sha1]
9+
exports.SHA1_LENGTH = 20
1110

1211
exports.find = (buf, byte) => {
1312
for (let i = 0; i < buf.length; i++) {

test/util.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ chai.use(chaiAsProised)
99
chai.use(dirtyChai)
1010
const ipldGit = require('../src')
1111
const multicodec = require('multicodec')
12-
const multihash = require('multihashes')
12+
const multihash = require('multihashing-async').multihash
1313
const CID = require('cids')
1414

1515
describe('IPLD format util', () => {

0 commit comments

Comments
 (0)