pub struct ConstitutionKeypair { /* private fields */ }Expand description
An Ed25519 keypair for constitution signing.
Implementations§
Source§impl ConstitutionKeypair
impl ConstitutionKeypair
Sourcepub fn from_base64(key_b64: &str) -> Result<Self, ConstitutionError>
pub fn from_base64(key_b64: &str) -> Result<Self, ConstitutionError>
Load a keypair from a base64-encoded private key.
Sourcepub fn private_key_base64(&self) -> String
pub fn private_key_base64(&self) -> String
Export the private key as base64.
Sourcepub fn public_key_base64(&self) -> String
pub fn public_key_base64(&self) -> String
Export the public key as base64.
Sourcepub fn sign_file(
&self,
path: &Path,
) -> Result<SignatureResult, ConstitutionError>
pub fn sign_file( &self, path: &Path, ) -> Result<SignatureResult, ConstitutionError>
Sign a constitution file. Returns the checksum and signature.
The signing process:
- Read the file content
- Extract the signable content (everything except identity checksum/signature fields)
- Compute SHA-256 of the signable content
- Sign the checksum with Ed25519
Sourcepub fn sign_content(
&self,
content: &str,
) -> Result<SignatureResult, ConstitutionError>
pub fn sign_content( &self, content: &str, ) -> Result<SignatureResult, ConstitutionError>
Sign constitution content directly (useful for testing).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConstitutionKeypair
impl RefUnwindSafe for ConstitutionKeypair
impl Send for ConstitutionKeypair
impl Sync for ConstitutionKeypair
impl Unpin for ConstitutionKeypair
impl UnsafeUnpin for ConstitutionKeypair
impl UnwindSafe for ConstitutionKeypair
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
Mutably borrows from an owned value. Read more