commit 20c86010b7a6179f0c93401acf2335b38abffe8b
parent 44636b68a03f55bc095bbd97b86c77677eab10e8
Author: triesap <tyson@radroots.org>
Date: Sun, 14 Jun 2026 00:52:35 -0700
authority: add actor signing crate
- add the radroots_authority workspace crate
- expose actor, signer, and authority error modules
- keep the initial dependency surface limited to radroots_events
- validate with cargo fmt, check, and tests for radroots_authority
Diffstat:
7 files changed, 101 insertions(+), 0 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -3962,6 +3962,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
[[package]]
+name = "radroots_authority"
+version = "0.1.0-alpha.2"
+dependencies = [
+ "radroots_events",
+ "thiserror 1.0.69",
+]
+
+[[package]]
name = "radroots_core"
version = "0.1.0-alpha.2"
dependencies = [
diff --git a/Cargo.toml b/Cargo.toml
@@ -5,6 +5,7 @@ members = [
"crates/event_store",
"crates/events_codec",
"crates/events_indexed",
+ "crates/authority",
"crates/geocoder",
"crates/identity",
"crates/local_events",
@@ -62,6 +63,7 @@ radroots_events = { path = "crates/events", version = "0.1.0-alpha.2", default-f
radroots_event_store = { path = "crates/event_store", version = "0.1.0-alpha.2", default-features = false }
radroots_events_codec = { path = "crates/events_codec", version = "0.1.0-alpha.2", default-features = false }
radroots_events_indexed = { path = "crates/events_indexed", version = "0.1.0-alpha.2", default-features = false }
+radroots_authority = { path = "crates/authority", version = "0.1.0-alpha.2", default-features = false }
radroots_geocoder = { path = "crates/geocoder", version = "0.1.0-alpha.2" }
radroots_identity = { path = "crates/identity", version = "0.1.0-alpha.2", default-features = false }
radroots_local_events = { path = "crates/local_events", version = "0.1.0-alpha.2", default-features = false }
diff --git a/crates/authority/Cargo.toml b/crates/authority/Cargo.toml
@@ -0,0 +1,23 @@
+[package]
+name = "radroots_authority"
+publish = ["crates-io"]
+version = "0.1.0-alpha.2"
+edition.workspace = true
+authors = ["Tyson Lupul <tyson@radroots.org>"]
+rust-version.workspace = true
+license.workspace = true
+description = "Actor and signer authority primitives for Radroots events"
+repository.workspace = true
+homepage.workspace = true
+documentation = "https://docs.rs/radroots_authority"
+
+[features]
+default = ["std"]
+std = ["radroots_events/std"]
+
+[dependencies]
+radroots_events = { workspace = true, default-features = false }
+thiserror = { workspace = true }
+
+[lints.rust]
+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }
diff --git a/crates/authority/src/actor.rs b/crates/authority/src/actor.rs
@@ -0,0 +1,21 @@
+#![forbid(unsafe_code)]
+
+use crate::RadrootsAuthorityError;
+use radroots_events::ids::RadrootsPublicKey;
+
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub struct RadrootsActorContext {
+ pub pubkey: RadrootsPublicKey,
+}
+
+impl RadrootsActorContext {
+ pub fn new(pubkey: impl AsRef<str>) -> Result<Self, RadrootsAuthorityError> {
+ let pubkey = RadrootsPublicKey::parse(pubkey.as_ref())
+ .map_err(|_| RadrootsAuthorityError::InvalidActorPubkey)?;
+ Ok(Self { pubkey })
+ }
+
+ pub fn pubkey(&self) -> &RadrootsPublicKey {
+ &self.pubkey
+ }
+}
diff --git a/crates/authority/src/error.rs b/crates/authority/src/error.rs
@@ -0,0 +1,12 @@
+#![forbid(unsafe_code)]
+
+use thiserror::Error;
+
+#[derive(Debug, Error, PartialEq, Eq)]
+pub enum RadrootsAuthorityError {
+ #[error("invalid actor public key")]
+ InvalidActorPubkey,
+
+ #[error("invalid signer public key")]
+ InvalidSignerPubkey,
+}
diff --git a/crates/authority/src/lib.rs b/crates/authority/src/lib.rs
@@ -0,0 +1,14 @@
+#![cfg_attr(not(feature = "std"), no_std)]
+#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
+#![forbid(unsafe_code)]
+
+#[cfg(not(feature = "std"))]
+extern crate alloc;
+
+pub mod actor;
+pub mod error;
+pub mod signer;
+
+pub use actor::RadrootsActorContext;
+pub use error::RadrootsAuthorityError;
+pub use signer::RadrootsSignerIdentity;
diff --git a/crates/authority/src/signer.rs b/crates/authority/src/signer.rs
@@ -0,0 +1,21 @@
+#![forbid(unsafe_code)]
+
+use crate::RadrootsAuthorityError;
+use radroots_events::ids::RadrootsPublicKey;
+
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub struct RadrootsSignerIdentity {
+ pub pubkey: RadrootsPublicKey,
+}
+
+impl RadrootsSignerIdentity {
+ pub fn new(pubkey: impl AsRef<str>) -> Result<Self, RadrootsAuthorityError> {
+ let pubkey = RadrootsPublicKey::parse(pubkey.as_ref())
+ .map_err(|_| RadrootsAuthorityError::InvalidSignerPubkey)?;
+ Ok(Self { pubkey })
+ }
+
+ pub fn pubkey(&self) -> &RadrootsPublicKey {
+ &self.pubkey
+ }
+}