Skip to main content

SigningKey

Struct SigningKey 

Source
pub struct SigningKey(/* private fields */);
Expand description

An Ed25519 signing key. Private bytes are zeroed on drop.

Implementations§

Source§

impl SigningKey

Source

pub fn from_bytes(bytes: &[u8; 32]) -> Self

Construct from a 32-byte raw private key seed.

Source

pub fn from_slice(bytes: &[u8]) -> Result<Self, AcdpError>

Try to construct from a slice. Returns an error if the length is wrong.

Source

pub fn generate() -> Self

Generate a fresh Ed25519 key pair using the operating system RNG.

Recommended for production callers; from_bytes is for loading previously-stored key material. Do not persist the raw 32-byte seed in cleartext — use a key vault or HSM.

Source

pub fn sign_content_hash(&self, hash: &ContentHash) -> String

Sign the ASCII bytes of the full content_hash string per §5.8.

Returns the signature as standard base64 (88 chars including padding for Ed25519).

Source

pub fn verifying_key_bytes(&self) -> [u8; 32]

Raw public key bytes (32 bytes).

Source

pub fn seed_bytes(&self) -> [u8; 32]

Return the 32-byte raw private-key seed.

Used by language bindings that need to store the key across FFI calls (the FFI surface holds a [u8; 32] and reconstructs the SigningKey per call, since SigningKey is ZeroizeOnDrop and not Clone).

The seed is private-key material — treat it as a secret and route persistence through a key vault or HSM. The round-trip SigningKey::from_bytes(&key.seed_bytes()) reconstructs an identical signing key.

Source

pub fn sign_string(&self, input: &str) -> String

Sign the UTF-8 bytes of an arbitrary string. Returns the signature as standard base64 (88 chars including padding).

Distinct from Self::sign_content_hash, which signs the ASCII bytes of the "sha256:<hex>" content_hash envelope per RFC-ACDP-0001 §5.8. Use this method when the protocol’s signing input is not a ContentHash value — most notably the ACDP registry’s bearer-token challenge flow, whose signing input is the namespaced ASCII string "acdp-registry-auth:v1:{nonce}:{agent_id}:{authority}:{expires_at}". The registry verifies with crate::verify::verify_ed25519(&pub_bytes, &sig, &input).

Trait Implementations§

Source§

impl Debug for SigningKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for SigningKey

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl From<SigningKey> for AcdpSigningKey

Source§

fn from(k: SigningKey) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.