-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
5 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
// TODO: Logic specific to secp256k1 will most likely be handled by core in the future. | ||
use crate::ContractError; | ||
|
||
const ECDSA_SIGNATURE_LEN: usize = 64; | ||
const ED25519_SIGNATURE_LEN: usize = 64; | ||
|
||
pub fn ed25519_verify(msg_hash: &[u8], sig: &[u8], pub_key: &[u8]) -> Result<bool, ContractError> { | ||
cosmwasm_crypto::ed25519_verify(msg_hash, &sig[0..ECDSA_SIGNATURE_LEN], pub_key).map_err(|e| { | ||
ContractError::SignatureVerificationFailed { | ||
cosmwasm_crypto::ed25519_verify(msg_hash, &sig[0..ED25519_SIGNATURE_LEN], pub_key).map_err( | ||
|e| ContractError::SignatureVerificationFailed { | ||
reason: e.to_string(), | ||
} | ||
}) | ||
}, | ||
) | ||
} |