huskies: merge 727_story_ed25519_node_identity_keypair_generation_persistence_and_identity_endpoint
This commit is contained in:
@@ -234,6 +234,24 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
log_buffer::global().set_log_file(log_dir.join("server.log"));
|
||||
}
|
||||
|
||||
// Initialise the node's Ed25519 identity keypair (file-based, mode 0600).
|
||||
// The key is stored at .huskies/node_identity.key and persisted across
|
||||
// restarts. The public key is exposed via GET /identity.
|
||||
{
|
||||
let key_path = app_state
|
||||
.project_root
|
||||
.lock()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.map(|root| root.join(".huskies").join("node_identity.key"))
|
||||
.unwrap_or_else(|| cwd.join(".huskies").join("node_identity.key"));
|
||||
if let Err(e) = node_identity::init_identity(&key_path) {
|
||||
slog!("[identity] Failed to initialise node identity keypair: {e}");
|
||||
} else if let Some(id) = node_identity::get_identity() {
|
||||
slog!("[identity] Node ID: {}", id.node_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise the SQLite pipeline shadow-write database and CRDT state layer.
|
||||
// Clone the path out before the await so we don't hold the MutexGuard across
|
||||
// an await point.
|
||||
|
||||
Reference in New Issue
Block a user