ipfs / go-cid

Content ID v1 implemented in go
MIT License
157 stars 47 forks source link

WIP: Store multibase prefix with CID #66

Closed kevina closed 6 years ago

kevina commented 6 years ago

The CID spec defines the multibase as part of the CID, yet we do not store it anywhere.

This fixes that, It also creates a variable to change the default base for CIDv1.

This should make preserving the base of a CID a lot less painful for command like ipfs resolve and ipfs pin add or any command that takes a CID from the user.

Simplifier version of #64.

Stebalien commented 6 years ago

So, CIDs always use a multibase in text. The spec has always been a bit unclear on this subject but I'd be strongly against any attempt to carry the multibase along with a CID. That mixes data with representation a bit too much for my tastes.

Ideally, on the command line, we'd:

  1. Accept any multibase.
  2. Return the multibase requested by the user.
kevina commented 6 years ago

@Stebalien this doesn't need to go in right away. Can we hold off on making a quick judgement. I will write a full proposal (with several alternatives) on how to handle multibases later today.

kevina commented 6 years ago

See https://github.com/ipfs/go-ipfs/issues/5349 solution 2 for the motivation for this change.