multiformats / js-cid

CID implementation in JavaScript
MIT License
97 stars 39 forks source link

CIDs with dag-cbor formats as V0 addresses #35

Closed vmatekole closed 6 years ago

vmatekole commented 7 years ago

I'm trying to retrieve a DAG persisted with the following options via webui. As I understand it, to do so I have to convert to a V0 address as per — https://github.com/ipld/js-cid/blob/38e5dd0f5e89a750d9f20efefdaa00d38b287739/test/index.spec.js#L81 : const dagOpts = { format: 'dag-cbor', hashAlg: 'sha3-512' };

I have the following code that results in an error — 'Cannot convert a non dag-pb CID to CIDv0' :

      let cid  = new CID("zdpuAypJXbmGCLweJBL6R1iBpDGJyP8LU1BwZjzRjwNxohzvE");
     console.log(cid.toV0());

Is it possible at all to access objects of format dag-cbor type from webui or IPFS cli?

daviddias commented 7 years ago

CIDv0 is dag-pb, sha2-256 and base58 only. CIDv0 is "pre CID era", to use dag-cbor, any other hash func or any other base you need to use CIDv1 or above. See: https://github.com/ipld/cid

I bet that probably what you need is for the HTTP API to support the DAG API properly. Please see:

daviddias commented 7 years ago

@vmatekole did the above answer your question?

vmatekole commented 7 years ago

Hi @diasdavid, only just got your response. Will take a look and respond at my earliest.

daviddias commented 6 years ago

Closing for now, @vmatekole if you have any other questions.