pub struct Keypair { /* private fields */ }Expand description
Ed25519 keypair for signing.
This is the default Chio signing identity. For FIPS-capable signing, see
SigningBackend and its implementations.
Implementations§
Source§impl Keypair
impl Keypair
Sourcepub fn from_seed_hex(hex_str: &str) -> Result<Keypair, Error>
pub fn from_seed_hex(hex_str: &str) -> Result<Keypair, Error>
Create from hex-encoded seed bytes (with optional 0x prefix).
pub fn public_key(&self) -> PublicKey
pub fn sign(&self, message: &[u8]) -> Signature
Sourcepub fn sign_canonical<T>(
&self,
value: &T,
) -> Result<(Signature, Vec<u8>), Error>where
T: Serialize,
pub fn sign_canonical<T>(
&self,
value: &T,
) -> Result<(Signature, Vec<u8>), Error>where
T: Serialize,
Sign a serializable value by converting it to canonical JSON first.
Returns the signature and the canonical bytes that were signed, so the caller can store or transmit them alongside the signature.
pub fn seed_bytes(&self) -> [u8; 32]
pub fn seed_hex(&self) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Keypair
impl RefUnwindSafe for Keypair
impl Send for Keypair
impl Sync for Keypair
impl Unpin for Keypair
impl UnsafeUnpin for Keypair
impl UnwindSafe for Keypair
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