pub struct EdgeCredentials { /* private fields */ }Expand description
One edge’s transport bearer plus its ed25519 envelope-signing key.
Built from the edge’s own configuration (POLYCHROME_EDGE_ID,
POLYCHROME_EDGE_BEARER_KEY, POLYCHROME_EDGE_SIGNING_KEY_HEX — see the
edge-auth redesign doc) via EdgeCredentials::from_parts, then passed to
crate::AgentDialer::with_credentials. Held by the dialer behind an
Arc, so cloning a dialer never re-derives or duplicates the key.
Implementations§
Source§impl EdgeCredentials
impl EdgeCredentials
Sourcepub fn from_parts(
edge_id: String,
bearer: String,
signing_key_hex: &str,
) -> Result<Self, CredentialError>
pub fn from_parts( edge_id: String, bearer: String, signing_key_hex: &str, ) -> Result<Self, CredentialError>
Build credentials from an edge’s id, transport bearer token, and hex-encoded 32-byte ed25519 private key.
§Errors
Returns CredentialError::InvalidHex if signing_key_hex isn’t
valid hex, or CredentialError::InvalidSigningKey if the decoded
bytes aren’t a valid ed25519 private key.
Sourcepub fn edge_id(&self) -> &str
pub fn edge_id(&self) -> &str
This edge’s registry id — carried as AssertedAttribution::edge_id
on every envelope this credential signs.
Sourcepub fn bearer(&self) -> &str
pub fn bearer(&self) -> &str
The transport bearer token, ridden as Authorization: Bearer <token>
on every call a dialer built with these credentials makes.
Sourcepub fn sign_assertion(&self, a: &mut AssertedAttribution)
pub fn sign_assertion(&self, a: &mut AssertedAttribution)
Sign a in place: fills its signature_hex over the envelope’s
canonical bytes (mirrors
polyc_crypto::edge_identity::sign_edge_assertion_into, which this
delegates to).
Sourcepub fn attach_approval_assertion(
&self,
request: &mut ApprovalResponseRequest,
responder: ExternalIdentity,
)
pub fn attach_approval_assertion( &self, request: &mut ApprovalResponseRequest, responder: ExternalIdentity, )
Assert responder as the human who resolved request, and sign it in
place (#1553).
Puts an AssertedApproval naming this edge and responder on
request, then signs the whole request under the approval-assertion
domain — the same ed25519 identity key Self::sign_assertion uses
for turn dispatch, since an edge has exactly one identity to assert
with.
request must already be FINAL. The signature covers every other
field of it — the decision, an approve’s modified arguments, the
resolve_token — so a field set after this call invalidates the
signature it was meant to be covered by. See
polyc_crypto::approval_assertion, which this delegates to.
Auto Trait Implementations§
impl Freeze for EdgeCredentials
impl RefUnwindSafe for EdgeCredentials
impl Send for EdgeCredentials
impl Sync for EdgeCredentials
impl Unpin for EdgeCredentials
impl UnsafeUnpin for EdgeCredentials
impl UnwindSafe for EdgeCredentials
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request