pub struct AgentIdentity { /* private fields */ }Implementations§
Source§impl AgentIdentity
impl AgentIdentity
Sourcepub fn save(&self, dir: &Path) -> Result<(), IdentityError>
pub fn save(&self, dir: &Path) -> Result<(), IdentityError>
Write both halves of the keypair to the given directory. Private key is mode 0600 on Unix.
Sourcepub fn load(dir: &Path) -> Result<Self, IdentityError>
pub fn load(dir: &Path) -> Result<Self, IdentityError>
Load both halves from the given directory. Prefers the private key
(since we can derive pubkey from it); but also validates that a
present identity.pub matches.
pub fn signing_key(&self) -> &SigningKey
Sourcepub fn sign_bytes(&self, msg: &[u8]) -> [u8; 64]
pub fn sign_bytes(&self, msg: &[u8]) -> [u8; 64]
Sign msg with the Ed25519 private key and return the raw 64-byte
signature. Callers that only have a &AgentIdentity (and therefore
cannot import ed25519_dalek::Signer themselves) should use this
instead of calling signing_key().sign() directly.
pub fn verifying_key(&self) -> VerifyingKey
pub fn verifying_key_bytes(&self) -> [u8; 32]
pub fn pubkey_text(&self) -> String
Sourcepub fn public_key_multibase(&self) -> String
pub fn public_key_multibase(&self) -> String
Alias for pubkey_text() — returns the verifying key as multibase
base58btc (z-prefixed string), matching the bridge_pubkey_multibase
field used in signed envelopes.
Sourcepub fn to_x25519_static_secret(&self) -> StaticSecret
pub fn to_x25519_static_secret(&self) -> StaticSecret
Derive the X25519 static secret usable by Noise XK.
Ed25519 and X25519 both use Curve25519 underneath; the Ed25519
SigningKey scalar maps directly to an X25519 StaticSecret.
ed25519-dalek 2.x exposes to_scalar_bytes() for exactly this.
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 more