# Publish to IPNS in Go

**URL:** <https://discuss.ipfs.tech/t/publish-to-ipns-in-go/13269>\
**Category:** Help\
**Tags:** go-ipfs, ipns\
**Created:** [January 26, 2022, 7:01pm UTC](https://discuss.ipfs.tech/t/publish-to-ipns-in-go/13269 "2022-01-26T19:01:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrodriguez3313](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/mrodriguez3313/32/5759_2.png) [@mrodriguez3313](https://discuss.ipfs.tech/u/mrodriguez3313)\
**Post date:** [January 26, 2022, 7:01pm UTC](https://discuss.ipfs.tech/t/publish-to-ipns-in-go/13269/1 "2022-01-26T19:01:23Z")

</div>

So I am using the go-ipfs & go-ipns libraries. This question is an extension of this topic [Keypairs-for-publishing-to-ipns](https://discuss.ipfs.tech/t/keypairs-for-publishing-to-ipns/13220). So, I have been able to generate keys, create IPNS entries [Go-ipns example](https://github.com/ipfs/go-ipns), and embed the public key [Embed-Public-key](https://github.com/ipfs/go-ipns/blob/4e818387e69c0724f4f166a9357674e8e2d0ae03/examples/embed.go#L15). 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](https://github.com/ipfs/go-ipfs-api/blob/21de539766f792068d1407f7fe08e8e2ebd2b907/ipns.go#L26)? 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

---

<div class="post-metadata">

**Author:** ![mrodriguez3313](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/mrodriguez3313/32/5759_2.png) [@mrodriguez3313](https://discuss.ipfs.tech/u/mrodriguez3313)\
**Post date:** [January 27, 2022, 6:52pm UTC](https://discuss.ipfs.tech/t/publish-to-ipns-in-go/13269/2 "2022-01-27T18:52:43Z")

</div>

So I keep getting this error when using [PublishWithDetails](https://github.com/ipfs/go-ipfs-api/blob/21de539766f792068d1407f7fe08e8e2ebd2b907/ipns.go#L26) 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?

---

<div class="post-metadata">

**Author:** ![mrodriguez3313](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/mrodriguez3313/32/5759_2.png) [@mrodriguez3313](https://discuss.ipfs.tech/u/mrodriguez3313)\
**Post date:** [January 28, 2022, 7:34pm UTC](https://discuss.ipfs.tech/t/publish-to-ipns-in-go/13269/3 "2022-01-28T19:34:06Z")

</div>

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?**
