Spec
specs/peer-ids/peer-ids.md, String Representation / Decoding.
Implementations MUST parse both legacy raw base58btc multihashes and multibase-encoded CIDv1 peer IDs. CID peer IDs must use the libp2p-key codec (0x72).
Current state
parsePeerId recognizes only the lowercase base32 multibase prefix b as a CID. Every other input is passed to the legacy raw-base58 decoder. Valid CIDv1 representations using another multibase encoding, such as base58btc (z) or base32upper (B), are therefore rejected.
Issue #117 added base32lower CID support but did not implement the spec's general multibase decoding requirement.
Scope
- Dispatch legacy raw peer IDs only for their defined
1... and Qm... forms.
- Decode CIDv1 using its multibase prefix rather than assuming base32lower.
- Require CID version 1 and multicodec
libp2p-key (0x72).
- Validate the extracted multihash with the existing peer-ID constraints.
- Keep
toCIDv1 base32lower as the default output format.
- Reject unknown prefixes, CIDv0-as-CID, wrong codecs, trailing bytes, and non-canonical varints.
Acceptance tests
- The same PeerId parses from base32lower (
b), base32upper (B), and base58btc CIDv1 (z).
- Legacy
1... and Qm... forms still parse.
- An arbitrary base58 string is not silently treated as a legacy peer ID unless it has a valid legacy form.
- Wrong CID version/codec and malformed multibase inputs fail cleanly.
Spec
specs/peer-ids/peer-ids.md, String Representation / Decoding.Implementations MUST parse both legacy raw base58btc multihashes and multibase-encoded CIDv1 peer IDs. CID peer IDs must use the
libp2p-keycodec (0x72).Current state
parsePeerIdrecognizes only the lowercase base32 multibase prefixbas a CID. Every other input is passed to the legacy raw-base58 decoder. Valid CIDv1 representations using another multibase encoding, such as base58btc (z) or base32upper (B), are therefore rejected.Issue #117 added base32lower CID support but did not implement the spec's general multibase decoding requirement.
Scope
1...andQm...forms.libp2p-key(0x72).toCIDv1base32lower as the default output format.Acceptance tests
b), base32upper (B), and base58btc CIDv1 (z).1...andQm...forms still parse.