Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

exportToJSON #48

Open
sneaker1 opened this issue Jan 25, 2023 · 1 comment
Open

exportToJSON #48

sneaker1 opened this issue Jan 25, 2023 · 1 comment

Comments

@sneaker1
Copy link

Hello,

Could you add a function "exportToJSON" to to libp2p-peer-id-factory?

It should return a json object that can be used with the existing createFromJSON function.

{
  id: 'Qmd9kLSkR5Ub3Pfh9y172p2E9pZa56BAFNkaqvBGhBbPXw',
  privKey: PRIVKEY,
  pubKey: PUBKEY
}
@sneaker1
Copy link
Author

sneaker1 commented Mar 8, 2023

I was just about to make a pull request for this, when i have seen there already was a PR and a discussion for this last year here #9

Persisting peerIds by exporting and importing seems like a core functionality to me.
I use it in all of my projects. The createFromJSON is also used often in the examples. Here was also a user recently who needed this libp2p/js-libp2p#1613

Is there another way to persist peer ids?

Handling uint8Arrays isnt't easy for everyone, so having this function would be nice.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant