This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +19
-19
lines changed
Expand file tree Collapse file tree 7 files changed +19
-19
lines changed Original file line number Diff line number Diff line change 1111 "license" : " MIT" ,
1212 "devDependencies" : {
1313 "browserify" : " ^13.1.1" ,
14- "ipfs-api" : " ^24.0.0 " ,
14+ "ipfs-api" : " ../../ " ,
1515 "http-server" : " ~0.9.0"
1616 },
1717 "dependencies" : {}
Original file line number Diff line number Diff line change 1111 "devDependencies" : {
1212 "babel-core" : " ^5.4.7" ,
1313 "babel-loader" : " ^5.1.2" ,
14- "ipfs-api" : " ^11.1.0 " ,
14+ "ipfs-api" : " ../../ " ,
1515 "json-loader" : " ~0.5.3" ,
1616 "react" : " ~0.13.0" ,
1717 "react-hot-loader" : " ^1.3.0" ,
Original file line number Diff line number Diff line change 4141 "ipfs-block" : " ~0.8.0" ,
4242 "ipfs-unixfs" : " ~0.1.16" ,
4343 "ipld-dag-cbor" : " ~0.13.0" ,
44- "ipld-dag-pb" : " ~0.14.11 " ,
44+ "ipld-dag-pb" : " ~0.15.0 " ,
4545 "is-ipfs" : " ~0.4.7" ,
4646 "is-pull-stream" : " 0.0.0" ,
4747 "is-stream" : " ^1.1.0" ,
8585 "eslint-plugin-react" : " ^7.11.1" ,
8686 "go-ipfs-dep" : " ~0.4.18" ,
8787 "gulp" : " ^3.9.1" ,
88- "interface-ipfs-core" : " ~0.84.3 " ,
88+ "interface-ipfs-core" : " ~0.85.0 " ,
8989 "ipfsd-ctl" : " ~0.40.0" ,
9090 "pull-stream" : " ^3.6.9" ,
9191 "stream-equal" : " ^1.1.1"
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ module.exports = (send) => {
2626 args : [
2727 multihash ,
2828 dLink . name ,
29- cleanMultihash ( dLink . multihash )
29+ cleanMultihash ( dLink . cid . buffer )
3030 ]
3131 } , ( err , result ) => {
3232 if ( err ) {
Original file line number Diff line number Diff line change @@ -35,10 +35,6 @@ module.exports = (send) => {
3535 return callback ( err )
3636 }
3737
38- if ( node . toJSON ( ) . multihash !== result . Hash ) {
39- return callback ( new Error ( 'multihashes do not match' ) )
40- }
41-
4238 callback ( null , node )
4339 } )
4440 } )
Original file line number Diff line number Diff line change @@ -39,12 +39,12 @@ module.exports = (send) => {
3939 Links : [ ]
4040 }
4141 }
42- } else if ( obj . multihash ) {
42+ } else if ( DAGNode . isDAGNode ( obj ) ) {
4343 tmpObj = {
4444 Data : obj . data . toString ( ) ,
4545 Links : obj . links . map ( ( l ) => {
4646 const link = l . toJSON ( )
47- link . hash = link . multihash
47+ link . hash = link . cid
4848 return link
4949 } )
5050 }
@@ -82,7 +82,7 @@ module.exports = (send) => {
8282
8383 let node
8484
85- if ( obj . multihash ) {
85+ if ( DAGNode . isDAGNode ( obj ) ) {
8686 node = obj
8787 } else if ( options . enc === 'protobuf' ) {
8888 dagPB . util . deserialize ( obj , ( err , _node ) => {
@@ -106,14 +106,14 @@ module.exports = (send) => {
106106 next ( )
107107
108108 function next ( ) {
109- const nodeJSON = node . toJSON ( )
110- if ( nodeJSON . multihash !== result . Hash ) {
111- const err = new Error ( 'multihashes do not match' )
112- return callback ( err )
113- }
109+ dagPB . util . cid ( node , ( err , cid ) => {
110+ if ( err ) {
111+ return callback ( err )
112+ }
114113
115- cache . set ( result . Hash , node )
116- callback ( null , node )
114+ cache . set ( cid . toBaseEncodedString ( ) , node )
115+ callback ( null , node )
116+ } )
117117 }
118118 } )
119119 } )
Original file line number Diff line number Diff line change 11'use strict'
22
33const bs58 = require ( 'bs58' )
4+ const CID = require ( 'cids' )
45const isIPFS = require ( 'is-ipfs' )
56
67module . exports = function ( multihash ) {
78 if ( Buffer . isBuffer ( multihash ) ) {
89 multihash = bs58 . encode ( multihash )
910 }
11+ if ( CID . isCID ( multihash ) ) {
12+ multihash = multihash . toBaseEncodedString ( )
13+ }
1014 if ( typeof multihash !== 'string' ) {
1115 throw new Error ( 'unexpected multihash type: ' + typeof multihash )
1216 }
You can’t perform that action at this time.
0 commit comments