Skip to content

feat: add persistent peer id example to helia-101 #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

2color
Copy link
Contributor

@2color 2color commented Jun 20, 2025

No description provided.

@2color 2color requested review from Copilot and achingbrain June 20, 2025 09:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new example demonstrating how to create a Helia node with a persistent peer ID.

  • Introduces 202-persistent-peer example script with filesystem-backed key persistence
  • Updates package.json, test suite, and README.md to include and validate the new example

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
examples/helia-101/test/index.spec.js Added test for the persistent-peer example output
examples/helia-101/package.json Registered new 202-persistent-peer script
examples/helia-101/README.md Documented the new persistent peer ID example
examples/helia-101/202-persisent-peer.js New example showing how to persist peer ID using FsDatastore
Comments suppressed due to low confidence (3)

examples/helia-101/202-persisent-peer.js:1

  • The filename 202-persisent-peer.js is misspelled. Rename it to 202-persistent-peer.js to match the script name and README references.
/* eslint-disable no-console */

examples/helia-101/README.md:165

  • There's an extra period after the link before is. Remove or reposition it to improve readability.
The [datastore](https://www.npmjs.com/package/interface-datastore). is used to store Helia and libp2p state, such as IPNS names, MFS root CID, pin metadata, kad-dht routing table, and peer store data including WebRTC certificates.

examples/helia-101/test/index.spec.js:15

  • [nitpick] The test only asserts the output prefix. Consider validating that a non-empty or expected peer ID is printed to ensure persistence behavior.
await waitForOutput('Started Helia node with Peer ID:', 'node', [path.resolve(__dirname, '../202-persisent-peer.js')])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant