So I am using the go-ipfs & go-ipns libraries. This question is an extension of this topic Keypairs-for-publishing-to-ipns. So, I have been able to generate keys, create IPNS entries Go-ipns example, and embed the public key Embed-Public-key. Now I need to publish it using ipfs.
As I understand it, since I don’t want to use my key from the local node I can not use the standard Publish method from the API. What I want to do is publish the IPNS entry using the new key that was just generated. I found that there is this method I can use to solve that PublishWithDetails? Im confused on the key argument because it accepts a key as a string
and not crypto.PrivKey
(which is the type for the newly generated key). What do I have to do to publish it correctly and not have problems down the road? And by “correctly”, I mean so that it is discoverable by anyone and adhere to a standard?
@adin
So I keep getting this error when using PublishWithDetails and providing the PeerID as the key: name/publish: no key by the given name or PeerID was found
. Through a day of research, I believe its not able to publish because that PeerID was generated out of the PublicKey and its not a Peer that is technically online. So unless I am able to spin up another node (probably with docker) at the time of publishing, with the new key I generated, then I won’t be able to publish to ipfs the new record? Thoughts?
I have pivoted the Docker idea, with storing the newly generated key to a new keystore, from there I should be able to publish a newly created entry to ipfs using Shell in Go. My thought process is roughly:
`tdir, err := ioutil.TempDir("", “keystore-test”) // create temp directory
newkeystore, err := keystore.NewFSKeystore(tdir) //store keystore at that directory
sk, _, err := ic.GenereateKeyPair(ed25519, 256) //generate secret/private key
newkeystore.put(sk, “temp_key”) // store key in new keystore
ipns.create(sk, ipfsPathByteArray, 1, eol, 0) //create IPNS entry signed with key
sh.PublishWithDetails(ipfsPath, “temp_key”, time.Second, time.Second, false) //publish IPNS entry signed by key
newkeystore.rm(“temp_key”)
`
Im confused on a couple parts: how does it know which entry to send if Im only passing in the ipfs/qm…? Is it possible to not save the key to my node and still be able to publish?