pub fn sign(msg: &[u8], sk: &types::SecretKeyBytes) -> CryptoResult<types::SignatureBytes> {
    use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signer};

    let secret = SecretKey::from_bytes(sk.0.expose_secret()).map_err(|_e| {
        CryptoError::MalformedSecretKey {
            algorithm: AlgorithmId::Ed25519,
            internal_error: "dalek_ed25519::SecretKey::from_bytes failed".to_string(),
        }
    })?;
    // TODO (DFN-845): Consider storing pubkey in key store to improve performance
    let public = PublicKey::from(&secret);

    Ok(types::SignatureBytes(
        Keypair { secret, public }.sign(msg).to_bytes(),
    ))
}
/// Signs a message with an Ed25519 secret key.
///
/// # Errors
/// * `MalformedSecretKey` if the secret key is malformed
Signs a message with an Ed25519 secret key.
Signs a message with an Ed25519 secret key .
pub fn sign(msg: &[u8], sk: &types::SecretKeyBytes) -> CryptoResult<types::SignatureBytes> {
    use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signer};
    let secret = SecretKey::from_bytes(sk.0.expose_secret()).map_err(|_e| {
        CryptoError::MalformedSecretKey {
            algorithm: AlgorithmId::Ed25519,
            internal_error: "dalek_ed25519::SecretKey::from_bytes failed".to_string(),
        }
    })?;
    // TODO (DFN-845): Consider storing pubkey in key store to improve performance
    let public = PublicKey::from(&secret);
    Ok(types::SignatureBytes(
        Keypair { secret, public }.sign(msg).to_bytes(),
    ))
}
pub fn sign ( msg : & [ u8 ] , sk : & types :: SecretKeyBytes ) -> CryptoResult < types :: SignatureBytes > { use ed25519_dalek :: { Keypair , PublicKey , SecretKey , Signer } ; let secret = SecretKey :: from_bytes ( sk . 0 . expose_secret ( ) ) . map_err ( | _e | { CryptoError :: MalformedSecretKey { algorithm : AlgorithmId :: Ed25519 , internal_error : " " . to_string ( ) , } } ) ? ; // TODO (DFN-845): Consider storing pubkey in key store to improve performance let public = PublicKey :: from ( & secret ) ; Ok ( types :: SignatureBytes ( Keypair { secret , public } . sign ( msg ) . to_bytes ( ) , ) ) }
Signs a message with an Ed25519 secret key.
Signs a message with an Ed25519 secret key .
msg
&[u8]
sk
&types::SecretKeyBytes
msg
&[u8]
sk
&types::SecretKeyBytes
errors
`MalformedSecretKey` if the secret key is malformed
` MalformedSecretKey ` if the secret key is malformed