Giter Club home page Giter Club logo

Comments (1)

Arlodotexe avatar Arlodotexe commented on July 17, 2024

I've re-identified this issue in Ipfs.Core where the peer id (libp2p-key) for Ipns addresses don't work for Cidv1. This was added to libp2p in 2019 in (see RFC 0001), after Richard (the original developer) stepped away from the project, so it hasn't been added.

When we add support for the libp2p-key MultiCodec (0x72), we'll be able to differentiate between these implicitly using Cidv1.

As a workaround, if you'd still like to store the IKey.Id multihash representing an IPNS key as a normal Cid, you can inline it with:

var ipnsPeerCid = new Cid { Hash = key.Id };

When resolving, you'd need to use the .Hash instead of the Cid itself:

var ipnsResResult = await client.Name.ResolveAsync($"/ipns/{ipnsPeerCid.Hash}", recursive: true, cancel: cancellationToken);

For now you'll need to manually differentiate between immutable Cids and mutable Ipns Cids, but generally it's future-safe to use Cid to represent either one in your data models.
Additional information: https://discuss.ipfs.tech/t/solved-how-do-i-get-the-cidv1-peer-id-of-a-key-pair/11707/2

from net-ipfs-core.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.