pub struct AgentIdentity {
pub name: String,
pub email: String,
pub signing_key: Option<String>,
pub public_key: Option<String>,
pub github_app: Option<GithubApp>,
pub tokens: BTreeMap<String, SecretRef>,
}Expand description
A newt-based agent’s commit identity.
Resolved with the same precedence as .newt/config.toml. See the module
docs for the secrets-by-reference rule: this struct carries no raw key or
token material, only the public name/email and paths to / references
for secrets.
Fields§
§name: StringGit author/committer name (public). Default: newt-agent[bot].
email: StringGit author/committer email (public). Default: the [bot] noreply
address for newt-agent[bot].
signing_key: Option<String>Filesystem path to the agent’s signing key PEM (tilde-expanded),
the agent_mesh_protocol::UserKey that roots the §6 writer
fingerprint and the mesh AgentKey. A path, never inline key
material. None → no commit signing / no mesh-rooted identity.
public_key: Option<String>Filesystem path to the matching public key (tilde-expanded). A path, never inline key material. Optional.
github_app: Option<GithubApp>GitHub App coordinates for a later autonomous-push path. None by
default — newt never mints a token unless this is set (and even then,
minting is out of scope for the foundation).
tokens: BTreeMap<String, SecretRef>Named token references ([agent-identity.tokens]). Each value is a
SecretRef ({env|file|cmd}) — the NAME is config, the VALUE is
resolved on demand and never stored here. Empty by default.
Implementations§
Source§impl AgentIdentity
impl AgentIdentity
Sourcepub fn from_toml_str(text: &str) -> Result<Self>
pub fn from_toml_str(text: &str) -> Result<Self>
Parse an identity config from a TOML string.
The file’s top-level table is [agent-identity], so we read that
sub-table and deserialize it over the compiled-in default (any omitted
field inherits the newt-agent[bot] base).
Sourcepub fn resolve() -> Result<Self>
pub fn resolve() -> Result<Self>
Resolve the agent identity using the same precedence as
.newt/config.toml:
- workspace
.newt/agent-identity.toml(walk-up from cwd, stopping before$HOME), ~/.newt/agent-identity.toml,/etc/newt/agent-identity.toml,- the compiled-in
AgentIdentity::default(newt-agent[bot]).
First file found wins; no file → the default. This never requires any file to exist.
Sourcepub fn resolve_with_source() -> Result<(Self, IdentitySource)>
pub fn resolve_with_source() -> Result<(Self, IdentitySource)>
Like AgentIdentity::resolve but also reports which layer it came
from (for newt identity).
(name, email) for the git author/committer.
A Co-Authored-By: trailer line for commit messages.
Sourcepub fn signing_key_path(&self) -> Option<PathBuf>
pub fn signing_key_path(&self) -> Option<PathBuf>
The configured signing-key path, tilde-expanded. None when unset
(the default identity mints nothing).
Sourcepub fn public_key_path(&self) -> Option<PathBuf>
pub fn public_key_path(&self) -> Option<PathBuf>
The configured public-key path, tilde-expanded. None when unset.
Sourcepub fn token(&self, name: &str) -> Result<Option<Secret>>
pub fn token(&self, name: &str) -> Result<Option<Secret>>
Resolve a named token reference to its Secret. Ok(None) when no
token of that name is configured (or its source is empty); Err only
when a configured cmd token fails. The value is never stored on the
struct.
Sourcepub fn github_app(&self) -> Option<&GithubApp>
pub fn github_app(&self) -> Option<&GithubApp>
The GitHub App config, if any. Token-minting is deferred; this only surfaces the (public) coordinates + the private-key path.
Trait Implementations§
Source§impl Clone for AgentIdentity
impl Clone for AgentIdentity
Source§fn clone(&self) -> AgentIdentity
fn clone(&self) -> AgentIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentIdentity
impl Debug for AgentIdentity
Source§impl Default for AgentIdentity
impl Default for AgentIdentity
Source§impl<'de> Deserialize<'de> for AgentIdentity
impl<'de> Deserialize<'de> for AgentIdentity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AgentIdentity
Source§impl PartialEq for AgentIdentity
impl PartialEq for AgentIdentity
Source§fn eq(&self, other: &AgentIdentity) -> bool
fn eq(&self, other: &AgentIdentity) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for AgentIdentity
impl Serialize for AgentIdentity
impl StructuralPartialEq for AgentIdentity
Auto Trait Implementations§
impl Freeze for AgentIdentity
impl RefUnwindSafe for AgentIdentity
impl Send for AgentIdentity
impl Sync for AgentIdentity
impl Unpin for AgentIdentity
impl UnsafeUnpin for AgentIdentity
impl UnwindSafe for AgentIdentity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more