Closed lidel closed 4 years ago
I think we'll have to wait for ed25519 IPNS keys, or do the same hackery as with CIDs.
ed25519 IPNS keys are here. However, that doesn't help. We'll have to do the same CID hackery (or just switch to using CIDs).
Let's switch to CIDs?
@kyledrake this issue should potentially be part of the base32 task force
Related discussion about PeerID in libp2p continues in https://github.com/libp2p/specs/issues/138
I believe the MVP here is a scenario where:
Qm..
PeerID (base58btc - cidv0 - dag-pb - sha2-256
)
to bafy..
(base32 - cidv1 - dag-pb - sha2-256
)
ipfs cid base32
command)/ipns/bafy..
addresses@Stebalien What would be the smallest set of changes to support this type of interop in go-ipfs? Is it something someone not deeply familiar with go-ipfs codebase could PR? If so, can you give me some pointers where to start?
base58btc(<sha2-256 multicodec><256><digest>)
(just a multihash).<base32 multibase> ++ base32(<cidv1><libp2p key multicodec><the multihash>)
.That is, we'd use an entirely new multicodec.
@Stebalien What would be the smallest set of changes to support this type of interop in go-ipfs?
That depends on how deeply we want to integrate this. If we only care about this for the subdomain feature, it would be pretty easy to redirect GATEWAY/ipns/Qm...
to b...ipns.GATEWAY/
.
There is an ongoing work to get IPNS fast (notes from today's meeting: https://github.com/ipfs/team-mgmt/pull/948).
In the short term, fast resolve of IPNS in web browser context will most likely mean custom DNS server and resolving IPNS over DNS TXT records looking like this: dnslink=/ipns/<bafy>.ipns.dweb.link
(where <bafy>
is the new format in base32)
iiuc this means the immediate needs are:
<libp2p key multicodec>
to multicodec/table.csv and related libs, to unlock IPNS representation in subdomains (for actual hosting, and IPNS-over-DNS lookups)
<bafy>.ipns.GATEWAY/
and /ipns/<bafy>
<bafy>
to old school base58btc before doing the actual resolve, but it may get confusing if ipfs name resolve /ipns/<bafy>
does not work. Would it be feasible to do the conversion there as well?I see a small UX problem around having a dedicated multicodec:
How will go-ipfs behave if codec in /ipns/{cidv1}
is different than libp2p-key
?
QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
ipfs cid base32 {cid}
or use https://cid.ipfs.io/cid base32
returns bafybeiagwnqiviaae5aet2zivwhhsorg75x2wka2pu55o7grr23ulx5kxm
which has the dag-pb
codec instead of libp2p-key
(https://github.com/multiformats/multicodec/pull/131)This issue will mostly go away when we switch to displaying PeerID in CIDv1 everywhere, but for now we need to account for the above edge case.
I believe we should support support PeerID CIDv1 with dag-pb
. If that is not feasible, then the gateway should do conversion and return HTTP 301 redirect from dag-pg
PeerID to one with libp2p-key
.
@Stebalien Thoughts?
Please consider using Tor rend spec v3 address encoding for PeerIDs Ref. https://github.com/libp2p/specs/issues/139
@Zolmeister thank you for sharing. This issue is only about adding support for wrapping existing PeerIDs in CIDv1 to unlock web uses without huge refactoring (it does not change underlying way we construct PeerID). Discussion in https://github.com/libp2p/specs/issues/139 is not blocked by this, feel free to continue it there :+1:
Back to the issue at hand:
go-cid
is the right place, as go-multicodec is deprecated/ipns/
paths to go-ipfs/js-ipfs/is-ipfs and it should be it.I've been looking at things we want to ship this in time for IPFS Camp. This one looks doable. What remains here is:
@Stebalien will this be enough for HTTP Gateway support /ipns/<cidv1-with-libp2p-key>
? If not, can you point me at places that need tweaking?
https://github.com/ipfs/go-ipfs/issues/5287#issuecomment-492163929
Sorry, completely missed this conversation. That's a valid concern and we may want to add a "hack it" redirect for now, or maybe a warning?
@Stebalien will this be enough for HTTP Gateway support /ipns/
? If not, can you point me at places that need tweaking?
Bit late but the latest status is https://github.com/libp2p/go-libp2p-core/pull/41
How will go-ipfs behave if codec in
/ipns/{cidv1}
is different thanlibp2p-key
?That's a valid concern and we may want to add a "hack it" redirect for now, or maybe a warning?
I am thinking the least amount of work/friction will be to
/ipns/{cid}
, or display a warning with a valid path ready to copy&paste)The issue will go away when we switch to CIDv1B32 everywhere, so we should not stress too much about beyond making it work.
Yeah, I guess. Just... grrr.
Tracking issue for peer IDs as cidv1b32: https://github.com/libp2p/specs/issues/216
We are in the process of adding support for PeerID encoded as CIDv1 with libp2p-key
multihash (https://github.com/libp2p/specs/issues/216).
Seems that even tho we use go-libp2p-core v0.3.0 which includes https://github.com/libp2p/go-libp2p-core/pull/41 there are still places which assume Multihash instead of CID:
$ ipfs name resolve -r /ipns/bafzbeiedwhhfhtte23hocn4k2bi4awpqay5sdhzqju7htk3y6sk63lvuae
Error: not a valid proquint string
$ ipfs resolve -r /ipns/bafzbeiedwhhfhtte23hocn4k2bi4awpqay5sdhzqju7htk3y6sk63lvuae
Error: not a valid proquint string
I'll try to track them down and fix, as it is blocking me from writing tests for #6096 :grimacing:
Update: found, will fix in #6096
This was fixed in #6096 and will ship with go-ipfs 0.5.0 (https://github.com/ipfs/go-ipfs/issues/7109) :rocket:
When used in subdomain context, the HTTP Gateway will automatically convert case-sensitive identifier to base32 and redirect to URL with correct multicodec.
Command line and RPC API provide handy error message when an invalid multicodec is used in CIDv1:
# resolve Base58 PeerID
$ ipfs name resolve -r /ipns/QmY9DNm4UJxaTBB9FrhNkXQ75GaK43D8KhZtpJjmw8P7Sz
/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
# convert PeerID to CIDv1 (with invalid multicoded, to illustrate next step)
$ ipfs cid base32 QmY9DNm4UJxaTBB9FrhNkXQ75GaK43D8KhZtpJjmw8P7Sz
bafybeieru3k6wvdzsrsjcx33jund7ebawoqlyc7jpitmn7wd4cwveunolm
# resolve CIDv1 with dag-pb multicodec
$ ipfs name resolve -r /ipns/bafybeieru3k6wvdzsrsjcx33jund7ebawoqlyc7jpitmn7wd4cwveunolm
Error: peer ID represented as CIDv1 require libp2p-key multicodec: retry with /ipns/bafzbeieru3k6wvdzsrsjcx33jund7ebawoqlyc7jpitmn7wd4cwveunolm
# resolve CIDv1 with libp2p-key multicodec suggested in previous step
$ ipfs name resolve -r /ipns/bafzbeieru3k6wvdzsrsjcx33jund7ebawoqlyc7jpitmn7wd4cwveunolm
/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
Version information:
0.4.16
Type:
bug
Description:
During the work related to https://github.com/ipfs/in-web-browsers/issues/89 and https://github.com/ipfs/ipfs/issues/337 we've identified open problem with IPNS. We are unable to use current case-sensitive IPNS identifiers in case-insensitive URL contexts, namely:
keyId
– PeerID or ID of a key generated viaipfs key gen
Not sure what would be the best way to tackle this.
Adding only a multibase prefix? Switching all
keyId
to CIDv1 ?Part of ipfs/ipfs#337 (cc @kyledrake + @alanshaw for parity in js-ipfs)
Additional References:
/ipfs/
and at some point they will want to point at/ipns/
instead of/ipfs/
, which is blocked by this issue