From b621ac506aaa36df5980f843dd429f56715dc862 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Mon, 30 Sep 2019 15:32:41 +0200 Subject: [PATCH] peer-ids.md: be explicit about supporting CID v0&v1 License: MIT Signed-off-by: Marcin Rataj --- peer-ids/peer-ids.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/peer-ids/peer-ids.md b/peer-ids/peer-ids.md index 13d4e9694..4df38e30d 100644 --- a/peer-ids/peer-ids.md +++ b/peer-ids/peer-ids.md @@ -133,14 +133,17 @@ behavior. Peer Ids are [multihashes][multihash] canonically represented with [CIDs](https://github.com/ipld/cid) when encoded into strings. -CID is a multihash with a prefix that specifies things like base encoding, cid version and the type of data behind it: +Encoding and decoding of string representation MUST follow [CID specification][cid-decoding]. + +Implementations parsing IDs from text MUST support both base58 CIDv0 and CIDv1 in base32, and they MUST generate base32-encoded CIDv1 by default. Generating CIDv0 is allowed as an opt-in (behind a flag). + +CIDv0 is a multihash encoded in Base58. +CIDv1 is a multihash with a prefix that specifies things like base encoding, cid version and the type of data behind it: ``` ::= ``` -Encoding and decoding of string representation must follow [CID spec][cid-decoding]. - #### libp2p-key CID The canonical string representation of a Peer Id is a CID v1