-
Notifications
You must be signed in to change notification settings - Fork 0
State Types - NodeState struct definitions #36
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
State Types - NodeState struct definitions #36
Conversation
Part 2 of the Foundation stage for objects-node daemon. ## Changes Implements configuration loading and validation: - ConfigError enum with proper error types (IO, Parse, Validation) - from_env() - Load configuration from environment variables only - load_or_create() - Load from TOML file or create with defaults - load() and save() - TOML file I/O with parent directory creation - validate() - Comprehensive validation: - API port in valid range (1024-65535) - Valid IP address for bind address - HTTPS-only relay URLs - RFC-002 compliant discovery topic format - Environment variable overrides with proper precedence ## Testing Uses temp-env for safe environment variable testing (no unsafe blocks): - Config file creation and loading - Environment variable override tests - Validation error cases (invalid port, IP, URL, topic) - Round-trip serialization ## Dependencies - Added temp-env for safe test environment manipulation - Added tempfile for temporary test directories Part of the Foundation stage (2/4). Builds on: #34. Next: State Types (#36). Pull Request: #39
Part 4 of the Foundation stage for objects-node daemon. ## Changes Implements state persistence with secure file I/O: - StateError enum with proper error handling (IO, Parse, Permission errors) - load_or_create() - Load from file or generate new keypair if missing - load() and save() - JSON file I/O with secure permissions - generate_new() - Cryptographically secure keypair generation using rand::rng() - ensure_permissions() - Parent directory creation and validation - Unix file permissions enforced (600) on state files ## Security - State files automatically created with 600 permissions (owner read/write only) - Parent directories created recursively as needed - Validation prevents writing to invalid paths (e.g., when parent is a file) - Uses cryptographically secure random number generation ## Testing Comprehensive test coverage: - File creation and loading - Round-trip serialization with and without identity - Unix file permission verification (600) - Parent directory creation - Error cases (missing files, invalid paths) ## Dependencies - Added rand to main dependencies for secure key generation Part of the Foundation stage (4/4). Builds on: #36. Foundation stage complete\! Config and state management fully implemented with 22 passing tests.
2dd8728 to
2fcb887
Compare
f3b3890 to
005b091
Compare
2fcb887 to
4daee81
Compare
005b091 to
f6abbbc
Compare
Code ReviewFound 2 issues: Issue 1: CLAUDE.md compliance - Use shared test utilityFile: The tests should use Per CLAUDE.md:
The Suggested fix: let node_key = transport::secret_key();Issue 2: Missing
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
f6abbbc to
b73bee5
Compare
4daee81 to
399db79
Compare
b73bee5 to
18552c0
Compare
399db79 to
6650f30
Compare
Pull Request: #46
Part 3 of the Foundation stage for objects-node daemon. ## Changes Adds state type definitions for persistent node state: - NodeState - Persistent state with node keypair and optional identity - Uses SecretKey from objects-transport (Iroh Ed25519 key) - Optional IdentityInfo for registered OBJECTS identities - IdentityInfo - RFC-001 identity linking: - Identity ID (obj_ + base58 hash) - Registered handle - 8-byte nonce for ID derivation - Signer type (Passkey or Wallet) ## Security Comprehensive documentation on security requirements: - State files must use 600 permissions (owner read/write only) - Node key must be kept secure and never committed to version control - Supports anonymous mode (no identity) for nodes that don't publish assets ## Testing - Serialization round-trip tests - Identity persistence tests - Both Passkey and Wallet signer types validated
6650f30 to
531e040
Compare
18552c0 to
42eff09
Compare
Part 3 of the Foundation stage for objects-node daemon.
Changes
Adds state type definitions for persistent node state:
NodeState- Persistent state with node keypair and optional identitySecretKeyfrom objects-transport (Iroh Ed25519 key)IdentityInfofor registered OBJECTS identitiesIdentityInfo- RFC-001 identity linking:obj_+ base58 hash)Security
Comprehensive documentation on security requirements:
Testing
Part of the Foundation stage (3/4). Builds on: #47. Next: State Persistence (#37).