- Add Layered() method to Go SDK for per-source-class consensus queries - Add LayeredQueryParams, LayeredResult, TierResolution types to Go SDK - Create conflict example demonstrating Skeptic and Layered endpoints - Update quickstart.md with sections 6 (conflict detection) and 7 (authority tiers) - Remove tracked Go binary and add data/ to .gitignore The new quickstart sections demonstrate Episteme's differentiating features: - Skeptic endpoint shows "Trust but Verify" conflict analysis - Layered endpoint shows per-tier resolution (Clinical vs Anecdotal) Note: Pre-existing large files flagged by pre-commit hook (technical debt from prior sessions) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.5 KiB
Rust
50 lines
1.5 KiB
Rust
//! Generate a properly signed test assertion for the validation script.
|
|
//!
|
|
//! Usage:
|
|
//! cargo run --package stemedb-api --example gen_test_assertion
|
|
//!
|
|
//! Output:
|
|
//! JSON assertion body with valid Ed25519 signature, ready for curl.
|
|
|
|
#![allow(clippy::print_stdout)]
|
|
#![allow(clippy::unwrap_used)]
|
|
|
|
use ed25519_dalek::{Signer, SigningKey};
|
|
use rand::rngs::OsRng;
|
|
|
|
fn main() {
|
|
// Generate a new keypair
|
|
let mut csprng = OsRng;
|
|
let signing_key = SigningKey::generate(&mut csprng);
|
|
let verifying_key = signing_key.verifying_key();
|
|
|
|
let subject = "StemeDB_Validation";
|
|
let predicate = "test_status";
|
|
|
|
// Sign the message (format: "{subject}:{predicate}")
|
|
let message = format!("{}:{}", subject, predicate);
|
|
let signature = signing_key.sign(message.as_bytes());
|
|
|
|
let timestamp = std::time::SystemTime::now()
|
|
.duration_since(std::time::UNIX_EPOCH)
|
|
.map(|d| d.as_secs())
|
|
.unwrap_or(0);
|
|
|
|
let json = serde_json::json!({
|
|
"subject": subject,
|
|
"predicate": predicate,
|
|
"object": {"type": "Text", "value": "working"},
|
|
"confidence": 0.99,
|
|
"source_class": "Expert",
|
|
"lifecycle": "Approved",
|
|
"signatures": [{
|
|
"agent_id": hex::encode(verifying_key.to_bytes()),
|
|
"signature": hex::encode(signature.to_bytes()),
|
|
"timestamp": timestamp
|
|
}],
|
|
"source_hash": "0".repeat(64)
|
|
});
|
|
|
|
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
|
}
|