ipld / js-ipld

The JavaScript Implementation of IPLD
https://ipld.io
MIT License
119 stars 37 forks source link

Deprecate passing a CID to `ipld.put`? #175

Closed achingbrain closed 5 years ago

achingbrain commented 6 years ago

It seems weird to me that you can do this sort of thing, where there's no guarentee that the passed CID has any relation to the node we're trying to store:

const cid = new CID('QmTmxQfEHbQzntsXPTU4ae2ZgBGwseBmS12AkZnKCkuf2G')

resolver.put(Buffer.from('Hello world'), {
  cid
}, cb)

How about deprecating/removing the cid argument in favour of requiring version, hashAlg and format and letting the resolvers decide on the CID used?

Maybe also accept codec in place of format too in order to be more consistent with other terminology around ipld?

vmx commented 5 years ago

That's the case with the newest release of js-ipld 0.23.