Can you convert CIDV0 into a CIDV1 BASE32?


I just noticed that infura updated its ipfs to use CID v1 base 32 instead of CIDv0, it seem that the redirection from CIDv0 to CIDv1 is available on their gateway but will be discontinued in future.
My question is how do you/ can you convert a CIDv0 to CIDV1 base32? In my case i stored immutable cidv0 on blockchain, i can switch to v1 from now on but will needs to be able to still access previous files with v0, i can check CID and identify v0 (46 length and start with Qm right?) But can i convert it too?

Thanks in advance

Thanks a lot for the answer, will check if can convert it from client side javascript then, look pike there is several js cid lib.

If it can help anyone:

const ipfsClient = require("ipfs-http-client");
let CIDv0 = "Qm..."
let CIDv1 = new ipfsClient.CID(CIDv0).toV1()

I do have a question, is v1 becoming the new standard? should we already use v1 to store CID by default even if library (here js ipfs) still use v0 by default? or we should continue store v0 and convert to v1 on display? (since i use a pinning gateway that switched to v1). In short will v1 become the new standard?

1 Like

Hopefully one day. New applications should preferably stick with V1. js-ipfs and go-ipfs keep v0 around to avoid breaking things by changing behaviour, but V1 should have first-class support.

1 Like

Ok i see, thanks, will go fo v1 in my new app then.