Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Fix doc for CryptoStore::ecdsa_sign_prehashed() (paritytech#8876)
Browse files Browse the repository at this point in the history
* fix ecdsa_sign_prehashed() doc

* document both instances
  • Loading branch information
adoerr authored and nazar-pc committed Aug 8, 2021
1 parent ad8eb04 commit f1e1fd3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion primitives/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl From<LogLevel> for log::Level {

/// Log level filter that expresses which log levels should be filtered.
///
/// This enum matches the [`log::LogLevelFilter`] enum.
/// This enum matches the [`log::LevelFilter`] enum.
#[derive(Encode, Decode, PassByEnum, Copy, Clone)]
pub enum LogLevelFilter {
/// `Off` log level filter.
Expand Down
34 changes: 22 additions & 12 deletions primitives/keystore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,18 @@ pub trait CryptoStore: Send + Sync {
transcript_data: VRFTranscriptData,
) -> Result<Option<VRFSignature>, Error>;

/// Sign pre-hashed
///
/// Signs a pre-hashed message with the private key that matches
/// the ECDSA public key passed.
///
/// Returns the SCALE encoded signature if key is found and supported,
/// `None` if the key doesn't exist or an error when something failed.
/// Generate an ECDSA signature for a given pre-hashed message.
///
/// Receives [`KeyTypeId`] and an [`ecdsa::Public`] key to be able to map
/// them to a private key that exists in the keystore. This private key is,
/// in turn, used for signing the provided pre-hashed message.
///
/// The `msg` argument provided should be a hashed message for which an
/// ECDSA signature should be generated.
///
/// Returns an [`ecdsa::Signature`] or `None` in case the given `id` and
/// `public` combination doesn't exist in the keystore. An `Err` will be
/// returned if generating the signature itself failed.
async fn ecdsa_sign_prehashed(
&self,
id: KeyTypeId,
Expand Down Expand Up @@ -368,13 +373,18 @@ pub trait SyncCryptoStore: CryptoStore + Send + Sync {
transcript_data: VRFTranscriptData,
) -> Result<Option<VRFSignature>, Error>;

/// Sign pre-hashed
/// Generate an ECDSA signature for a given pre-hashed message.
///
/// Signs a pre-hashed message with the private key that matches
/// the ECDSA public key passed.
/// Receives [`KeyTypeId`] and an [`ecdsa::Public`] key to be able to map
/// them to a private key that exists in the keystore. This private key is,
/// in turn, used for signing the provided pre-hashed message.
///
/// Returns the SCALE encoded signature if key is found and supported,
/// `None` if the key doesn't exist or an error when something failed.
/// The `msg` argument provided should be a hashed message for which an
/// ECDSA signature should be generated.
///
/// Returns an [`ecdsa::Signature`] or `None` in case the given `id` and
/// `public` combination doesn't exist in the keystore. An `Err` will be
/// returned if generating the signature itself failed.
fn ecdsa_sign_prehashed(
&self,
id: KeyTypeId,
Expand Down

0 comments on commit f1e1fd3

Please sign in to comment.