Skip to content

Conversation

@jamiepine
Copy link
Member

@jamiepine jamiepine commented Jan 5, 2026

This PR addresses critical network identity issues by deriving the Iroh node_id deterministically from the stable device_id (from device.json) instead of the device_key (from keyring). It also configures Iroh state persistence.

This change fixes:

  • Pairing instability caused by keyring resets.
  • Fragile network identity persistence across OS updates/migrations.
  • Lack of Iroh state persistence.

Breaking Change: All devices must re-pair after updating to this version. This is acceptable for prerelease.

Closes #XXXX


Open in Cursor Open in Web

Network identity now derives from device ID, ensuring stability and fixing pairing issues.

Co-authored-by: ijamespine <ijamespine@me.com>
@cursor
Copy link

cursor bot commented Jan 5, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@jamiepine jamiepine marked this pull request as ready for review January 5, 2026 00:49
@cursor
Copy link

cursor bot commented Jan 5, 2026

PR Summary

Breaking: Network identity now derives from device_id (not keyring device_key), stabilizing NodeId across keyring resets/OS changes and requiring re-pairing.

  • Networking: NetworkingService::new uses NetworkIdentity::from_device_id(device_id) and logs device_id/node_id
  • Persistence: creates {config_dir}/iroh/ and binds via Endpoint::builder().bind_data_dir(...)
  • State: NetworkingService stores device_id and exposes it via device_id()
  • Identity: new from_device_id HKDF-SHA256 derivation; adds tests for determinism and validity
  • Discovery/endpoint config unchanged aside from persistence hook; minor logging improvements
  • Docs: update Devices/Pairing to document identity derivation and storage paths
  • Changelog: notes breaking change and fixes for pairing instability and missing Iroh persistence

Written by Cursor Bugbot for commit b6161f9. Configure here.

@jamiepine
Copy link
Member Author

@cursor remove the changelog we use git tags

@cursor
Copy link

cursor bot commented Jan 5, 2026

Removed CHANGELOG.md from the PR.


Open in Cursor Open in Web

Learn more about Cursor Agents

Co-authored-by: ijamespine <ijamespine@me.com>

// Create Iroh data directory
let iroh_data_dir = data_dir_path.join("iroh");
std::fs::create_dir_all(&iroh_data_dir).map_err(|e| {
Copy link
Contributor

Choose a reason for hiding this comment

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

The Iroh data directory is created here but then the path is recomputed in start() at line 225. Consider storing iroh_data_dir directly instead of recomputing it from data_dir.

tembo bot and others added 7 commits January 5, 2026 00:57
Co-authored-by: ijamespine <ijamespine@me.com>
Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com>
This change introduces logic to save and load a cache of known node addresses for the Iroh networking stack. This improves reconnection reliability by pre-seeding the Iroh endpoint with previously known nodes, including their relay URLs if available. The documentation has also been updated to reflect the new storage location for this cache.

Co-authored-by: ijamespine <ijamespine@me.com>
…o tembo/refactor-network-identity-generation
…entity-generation

Refactor Network Identity Generation
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.

3 participants