# Accessing Public and Private Keys Programmatically in JS-IPFS

**URL:** <https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393>\
**Category:** js-ipfs\
**Tags:** js-ipfs\
**Created:** [July 13, 2018, 2:52pm UTC](https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393 "2018-07-13T14:52:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![owenauch](https://avatars.discourse-cdn.com/v4/letter/o/898d66/32.png) [@owenauch](https://discuss.ipfs.tech/u/owenauch)\
**Post date:** [July 13, 2018, 2:52pm UTC](https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393/1 "2018-07-13T14:52:53Z")

</div>

Hello, I was trying to access the IPFS public and private keys programmatically within JS-IPFS in Node. When I ran `ipfs.key.list()` however, I got the error of `Error: Key management requires '--pass ...' option`. I didn’t provide a password when the keys were generated, and moreover, I’m not even asking for access to the keys, just to list them. Has anyone else experienced this?

---

<div class="post-metadata">

**Author:** ![josselinchevalay](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/josselinchevalay/32/3078_2.png) [@josselinchevalay](https://discuss.ipfs.tech/u/josselinchevalay)\
**Post date:** [July 13, 2018, 3:06pm UTC](https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393/2 "2018-07-13T15:06:23Z")

</div>

hello

do try into browser or into nodejs ?

if nodejs could share node version ?

Regards

---

<div class="post-metadata">

**Author:** ![owenauch](https://avatars.discourse-cdn.com/v4/letter/o/898d66/32.png) [@owenauch](https://discuss.ipfs.tech/u/owenauch)\
**Post date:** [July 13, 2018, 3:15pm UTC](https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393/3 "2018-07-13T15:15:16Z")

</div>

I’m in node and my version is `v8.11.2`.

---

<div class="post-metadata">

**Author:** ![josselinchevalay](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/josselinchevalay/32/3078_2.png) [@josselinchevalay](https://discuss.ipfs.tech/u/josselinchevalay)\
**Post date:** [July 16, 2018, 8:24am UTC](https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393/4 "2018-07-16T08:24:24Z")

</div>

@daviddias did you have any idea about that into js-ipfs ?

---

<div class="post-metadata">

**Author:** ![owenauch](https://avatars.discourse-cdn.com/v4/letter/o/898d66/32.png) [@owenauch](https://discuss.ipfs.tech/u/owenauch)\
**Post date:** [July 17, 2018, 5:39pm UTC](https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393/5 "2018-07-17T17:39:12Z")

</div>

Any idea about this?

---

<div class="post-metadata">

**Author:** ![josselinchevalay](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/josselinchevalay/32/3078_2.png) [@josselinchevalay](https://discuss.ipfs.tech/u/josselinchevalay)\
**Post date:** [July 18, 2018, 6:27am UTC](https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393/6 "2018-07-18T06:27:44Z")

</div>

Hi owenauch,

do you see and check this issue : [https://github.com/ipfs/js-ipfs/issues/1135](https://github.com/ipfs/js-ipfs/issues/1135)

Regards

---

<div class="post-metadata">

**Author:** ![ddahl](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ddahl/32/2397_2.png) [@ddahl](https://discuss.ipfs.tech/u/ddahl)\
**Post date:** [October 8, 2018, 7:35pm UTC](https://discuss.ipfs.tech/t/accessing-public-and-private-keys-programmatically-in-js-ipfs/3393/7 "2018-10-08T19:35:28Z")

</div>

I am using the IPFS node’s keypair to sign data like so:

`myIPFSNode._peerInfo.id._privKey.sign(buffer, (err, signature) => { console.log(err, signature) callback(err, signature) })`

Hope that helps!

- David
