#![deny(missing_docs)]
pub mod admin;
pub mod devices;
pub mod discovery;
pub mod health;
pub mod signature;
pub mod sync;
pub mod validate;
pub use admin::{AdminStats, AdminTotals, ProjectStats};
pub use devices::{
ApproveRequest, Authkey, AuthkeyCreated, AuthkeyList, AuthkeyRequest, AuthkeyRevokeRequest,
DenyRequest, DenyResponse, Device, DeviceIdentity, DeviceList, DevicesCapability,
EnrollApproved, EnrollPending, EnrollPollRequest, EnrollPollResponse, EnrollRequest,
PendingEnrollment,
};
pub use discovery::{Discovery, DISCOVERY_PATH, PROTOCOL, PROTOCOL_HEADER};
pub use health::{ClaudeCliStatus, Health, MergeError, MergeStatus};
pub fn content_sha256(content: &str) -> String {
use sha2::{Digest, Sha256};
let digest = Sha256::digest(content.as_bytes());
digest.iter().map(|b| format!("{b:02x}")).collect()
}
#[cfg(test)]
mod hash_tests {
use super::content_sha256;
#[test]
fn content_sha256_is_plain_sha256_as_lowercase_hex() {
assert_eq!(
content_sha256(""),
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
);
assert_eq!(
content_sha256("abc"),
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
);
}
#[test]
fn a_trailing_newline_changes_the_hash() {
assert_ne!(content_sha256("a"), content_sha256("a\n"));
}
}
pub use sync::{File, PushRequest, PushResponse, SyncResponse};
pub use validate::{validate_file_path, ValidationError};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ErrorResponse {
pub error: String,
}