Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

feat: js-ipfs support of CIDs in /ipns/ content paths #2566

Merged
merged 3 commits into from
Nov 6, 2019

Conversation

lidel
Copy link
Member

@lidel lidel commented Oct 25, 2019

Motivation

We want root identifiers of content paths to be usable in case-insensitive contexts such as subdomains.
While we can use CIDv1 encoded in Base32 in /ipfs/ namespace, Identifiers in /ipns/ are still hardcoded to Base58btc,

Libp2p approved RFC 0001: Text Peer Ids as CIDs recently, and we need to implement it in js-ipfs.

Changes

This PR implements Stage 1: Parse CIDs as peer ID from libp2p/specs#216. It makes /ipns/{cidv1} work without waiting for PeerId.createFromCID from libp2p/js-peer-id#105, which means we can merge this before async refactor is done.

This PR does not change the default PeerID representation,
all it does is to allow use of CIDs in /ipns/ paths and add tests.

cc https://github.com/ipfs/ipfs/issues/337, libp2p/specs#216, libp2p/specs#209, ipfs/kubo#5287

This adds support for resolving PeerIDs as CIDs in /ipns/ paths.
See libp2p/specs#216 for full context.

License: MIT
Signed-off-by: Marcin Rataj <[email protected]>
@lidel lidel force-pushed the feat/support-cidv1b32-ipns branch from 86bb92b to bc1a355 Compare November 4, 2019 12:52
@lidel lidel marked this pull request as ready for review November 4, 2019 17:36
@lidel lidel requested review from hugomrdias and alanshaw November 4, 2019 17:36
@lidel
Copy link
Member Author

lidel commented Nov 4, 2019

@alanshaw this PR does not have any external dependencies,
do you think it could included in v0.40.0?

Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look fine. Can the core test move to interface-ipfs-core please 🙏 so we can run it in ipfs-http-client too.

test/core/name.spec.js Show resolved Hide resolved
@lidel
Copy link
Member Author

lidel commented Nov 5, 2019

@alanshaw i believe those are unit tests of js-ipfs code and should stay
(for example, name.spec.js#L359-L364 tests if resolvePath(/ipfs/..) is idempotent).

I've added name.resolve test in ipfs-inactive/interface-js-ipfs-core#553.

See also open question in ipfs-inactive/js-ipfs-http-client#1145

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
@alanshaw
Copy link
Member

alanshaw commented Nov 6, 2019

@lidel I've just updated the interface-ipfs-core dep (to github branch) to check the tests pass. Will release a new version and update again if all is good!

@achingbrain achingbrain mentioned this pull request Nov 6, 2019
52 tasks
@alanshaw alanshaw merged commit 4fa39fb into master Nov 6, 2019
@alanshaw alanshaw deleted the feat/support-cidv1b32-ipns branch November 6, 2019 13:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants