libp2p / js-peer-id

peer-id implementation in JavaScript. Deprecated; use https://github.com/libp2p/js-libp2p-peer-id instead.
https://github.com/libp2p/js-libp2p-peer-id
MIT License
81 stars 44 forks source link

feat: support Peer ID represented as CID #105

Closed lidel closed 4 years ago

lidel commented 5 years ago

Motivation

This PR implements Stage 1: Parse CIDs as peer ID from https://github.com/libp2p/specs/issues/216.

TL;DR This PR does not change the default text representation of Peer IDs, all we do in Stage 1 is adding support for creating PeerId objects from CIDs.

For a wider context see libp2p/specs/RFC/0001-text-peerid-cid.md, short story is that CID support will enable IPFS project to support /ipns/{cid} in Base32 (https://github.com/ipfs/ipfs/issues/337), enabling things like http://{libp2p-key-as-cidv1b32}.ipns.dweb.link

Changes

This PR adds two functions:

Next

cc https://github.com/ipfs/ipfs/issues/337, https://github.com/libp2p/specs/issues/216, https://github.com/libp2p/specs/pull/209, https://github.com/ipfs/go-ipfs/issues/5287

lidel commented 4 years ago

ping @vasco-santos

vasco-santos commented 4 years ago

@alanshaw any other feedback that you want to provide here? I think we can go with this