Skip to content

What to do with multibase prefixed cid v0 string #240

Description

@olizilla

I can get the mutltibase for a block that isn't dag-pb, and then prefix it with the multibase z for base58btc and CID.parse is happy with it, but per the CID spec, but its not CID V0 string as mutlibase prefix is explicitly provided

the multibase of the string representation is always base58btc and implicit (not written)
– https://github.com/multiformats/cid#versions

nor a CID v1 as cid version and and multicodec are not provided

$ ipfs add --cid-version=1 olizilla.png
added bafkreiawm5lgdgchgrhep4kxo2g4tptewtpcnfzusyfcopytpuj2fnzf2m olizilla.png

$ ipfs cid format bafkreiawm5lgdgchgrhep4kxo2g4tptewtpcnfzusyfcopytpuj2fnzf2m -f %m -b z
zQmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ

$ node
Welcome to Node.js v18.12.1.
Type ".help" for more information.
> const CID = (await import('multiformats/cid')).CID
undefined
> CID.parse('zQmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ')
CID(zQmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bug in existing code (including security flaws)need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions