chaincraft 0.3.2

A high-performance Rust-based platform for blockchain education and prototyping
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use ed25519_dalek::Signature as Ed25519Signature;
use crate::error::{ChainCraftError, CryptoError, Result};

// Workaround for signature creation
pub fn create_ed25519_signature(bytes: &[u8; 64]) -> Result<Ed25519Signature> {
    // The documentation says this should return a Signature, but the compiler
    // thinks it's returning a Result<Signature, _>. This is likely a version mismatch
    // or API change in the library.
    
    // Use a more direct approach by importing the signature type
    match Ed25519Signature::from_bytes(bytes) {
        Ok(sig) => Ok(sig),
        Err(_) => Err(ChainCraftError::Crypto(CryptoError::InvalidSignature)),
    }
}