diff --git a/neps/nep-0364.md b/neps/nep-0364.md index ad300c383..ae318c6cb 100644 --- a/neps/nep-0364.md +++ b/neps/nep-0364.md @@ -146,6 +146,15 @@ This NEP aims to introduce the following host function: /// /// `input_cost(num_bytes_signature + num_bytes_message, num_bytes_public_key) + /// ed25519_verify_base + ed25519_verify_byte * (num_bytes_signature + num_bytes_message)` +/// +/// # Errors +/// +/// The signature size is fixed and equal to SIGNATURE_LENGTH (64 bytes). In case the length of signature input is not equal to +/// SIGNATURE_LENGTH, then the function returns HostError::Ed25519VerifyInvalidInput with the message "invalid signature length". +/// +/// A similar case occurs with the public key. Its size is known and its equal to PUBLIC_KEY_LENGTH (32 bytes). In case the +/// input length provided for the publc key doesn't match PUBLIC_KEY_LENGTH, the function will return the following error: +/// HostError::Ed25519VerifyInvalidInput with the message "invalid public key length". pub fn ed25519_verify( &mut self, sig_len: u64, @@ -164,6 +173,8 @@ And a `rust-sdk` possible implementation could look like this: pub fn ed25519_verify(sig: &ed25519::Signature, msg: &[u8], pub_key: &ed25519::Public) -> bool; ``` +The current implementation is imported from the crate `ed25519-dalek`, version 1. It uses no feature flags +except from the default one. This is the exact same setup used in the crate `near-crypto`. Once this NEP is approved and integrated, these functions will be available in the `near_sdk` crate in the `env` module.