mirror of
https://github.com/dalek-cryptography/ed25519-dalek.git
synced 2026-01-09 19:18:00 -05:00
CI: test cargo doc build (#271)
* CI: test `cargo doc` build Ensure it's free of warnings * Fix rustdoc build
This commit is contained in:
12
.github/workflows/rust.yml
vendored
12
.github/workflows/rust.yml
vendored
@@ -9,6 +9,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
RUSTFLAGS: '-D warnings'
|
RUSTFLAGS: '-D warnings'
|
||||||
|
RUSTDOCFLAGS: '-D warnings'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -94,3 +95,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
components: clippy
|
components: clippy
|
||||||
- run: cargo clippy
|
- run: cargo clippy
|
||||||
|
|
||||||
|
doc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
profile: minimal
|
||||||
|
- run: cargo doc --all-features
|
||||||
|
|||||||
@@ -157,8 +157,8 @@
|
|||||||
//!
|
//!
|
||||||
//! - [`pkcs8::DecodePrivateKey`]: decode private keys from PKCS#8
|
//! - [`pkcs8::DecodePrivateKey`]: decode private keys from PKCS#8
|
||||||
//! - [`pkcs8::EncodePrivateKey`]: encode private keys to PKCS#8
|
//! - [`pkcs8::EncodePrivateKey`]: encode private keys to PKCS#8
|
||||||
//! - [`pkcs8::DecodeVerifyingKey`]: decode public keys from PKCS#8
|
//! - [`pkcs8::DecodePublicKey`]: decode public keys from PKCS#8
|
||||||
//! - [`pkcs8::EncodeVerifyingKey`]: encode public keys to PKCS#8
|
//! - [`pkcs8::EncodePublicKey`]: encode public keys to PKCS#8
|
||||||
//!
|
//!
|
||||||
//! #### Example
|
//! #### Example
|
||||||
//!
|
//!
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ use crate::constants::*;
|
|||||||
use crate::errors::*;
|
use crate::errors::*;
|
||||||
use crate::signature::*;
|
use crate::signature::*;
|
||||||
use crate::verifying::*;
|
use crate::verifying::*;
|
||||||
|
use crate::Signature;
|
||||||
|
|
||||||
/// ed25519 secret key as defined in [RFC8032 § 5.1.5]:
|
/// ed25519 secret key as defined in [RFC8032 § 5.1.5]:
|
||||||
///
|
///
|
||||||
@@ -301,7 +302,7 @@ impl SigningKey {
|
|||||||
&self,
|
&self,
|
||||||
prehashed_message: D,
|
prehashed_message: D,
|
||||||
context: Option<&[u8]>,
|
context: Option<&[u8]>,
|
||||||
) -> Result<ed25519::Signature, SignatureError>
|
) -> Result<Signature, SignatureError>
|
||||||
where
|
where
|
||||||
D: Digest<OutputSize = U64>,
|
D: Digest<OutputSize = U64>,
|
||||||
{
|
{
|
||||||
@@ -311,11 +312,7 @@ impl SigningKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Verify a signature on a message with this signing key's public key.
|
/// Verify a signature on a message with this signing key's public key.
|
||||||
pub fn verify(
|
pub fn verify(&self, message: &[u8], signature: &Signature) -> Result<(), SignatureError> {
|
||||||
&self,
|
|
||||||
message: &[u8],
|
|
||||||
signature: &ed25519::Signature,
|
|
||||||
) -> Result<(), SignatureError> {
|
|
||||||
self.verifying_key.verify(message, signature)
|
self.verifying_key.verify(message, signature)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,7 +385,7 @@ impl SigningKey {
|
|||||||
&self,
|
&self,
|
||||||
prehashed_message: D,
|
prehashed_message: D,
|
||||||
context: Option<&[u8]>,
|
context: Option<&[u8]>,
|
||||||
signature: &ed25519::Signature,
|
signature: &Signature,
|
||||||
) -> Result<(), SignatureError>
|
) -> Result<(), SignatureError>
|
||||||
where
|
where
|
||||||
D: Digest<OutputSize = U64>,
|
D: Digest<OutputSize = U64>,
|
||||||
@@ -463,7 +460,7 @@ impl SigningKey {
|
|||||||
pub fn verify_strict(
|
pub fn verify_strict(
|
||||||
&self,
|
&self,
|
||||||
message: &[u8],
|
message: &[u8],
|
||||||
signature: &ed25519::Signature,
|
signature: &Signature,
|
||||||
) -> Result<(), SignatureError> {
|
) -> Result<(), SignatureError> {
|
||||||
self.verifying_key.verify_strict(message, signature)
|
self.verifying_key.verify_strict(message, signature)
|
||||||
}
|
}
|
||||||
@@ -479,9 +476,9 @@ impl KeypairRef for SigningKey {
|
|||||||
type VerifyingKey = VerifyingKey;
|
type VerifyingKey = VerifyingKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Signer<ed25519::Signature> for SigningKey {
|
impl Signer<Signature> for SigningKey {
|
||||||
/// Sign a message with this signing key's secret key.
|
/// Sign a message with this signing key's secret key.
|
||||||
fn try_sign(&self, message: &[u8]) -> Result<ed25519::Signature, SignatureError> {
|
fn try_sign(&self, message: &[u8]) -> Result<Signature, SignatureError> {
|
||||||
let expanded: ExpandedSecretKey = (&self.secret_key).into();
|
let expanded: ExpandedSecretKey = (&self.secret_key).into();
|
||||||
Ok(expanded.sign(message, &self.verifying_key))
|
Ok(expanded.sign(message, &self.verifying_key))
|
||||||
}
|
}
|
||||||
@@ -489,18 +486,18 @@ impl Signer<ed25519::Signature> for SigningKey {
|
|||||||
|
|
||||||
/// Equivalent to [`SigningKey::sign_prehashed`] with `context` set to [`None`].
|
/// Equivalent to [`SigningKey::sign_prehashed`] with `context` set to [`None`].
|
||||||
#[cfg(feature = "digest")]
|
#[cfg(feature = "digest")]
|
||||||
impl<D> DigestSigner<D, ed25519::Signature> for SigningKey
|
impl<D> DigestSigner<D, Signature> for SigningKey
|
||||||
where
|
where
|
||||||
D: Digest<OutputSize = U64>,
|
D: Digest<OutputSize = U64>,
|
||||||
{
|
{
|
||||||
fn try_sign_digest(&self, msg_digest: D) -> Result<ed25519::Signature, SignatureError> {
|
fn try_sign_digest(&self, msg_digest: D) -> Result<Signature, SignatureError> {
|
||||||
self.sign_prehashed(msg_digest, None)
|
self.sign_prehashed(msg_digest, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Verifier<ed25519::Signature> for SigningKey {
|
impl Verifier<Signature> for SigningKey {
|
||||||
/// Verify a signature on a message with this signing key's public key.
|
/// Verify a signature on a message with this signing key's public key.
|
||||||
fn verify(&self, message: &[u8], signature: &ed25519::Signature) -> Result<(), SignatureError> {
|
fn verify(&self, message: &[u8], signature: &Signature) -> Result<(), SignatureError> {
|
||||||
self.verifying_key.verify(message, signature)
|
self.verifying_key.verify(message, signature)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -710,7 +707,7 @@ impl From<&SecretKey> for ExpandedSecretKey {
|
|||||||
impl ExpandedSecretKey {
|
impl ExpandedSecretKey {
|
||||||
/// Sign a message with this `ExpandedSecretKey`.
|
/// Sign a message with this `ExpandedSecretKey`.
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub(crate) fn sign(&self, message: &[u8], verifying_key: &VerifyingKey) -> ed25519::Signature {
|
pub(crate) fn sign(&self, message: &[u8], verifying_key: &VerifyingKey) -> Signature {
|
||||||
let mut h: Sha512 = Sha512::new();
|
let mut h: Sha512 = Sha512::new();
|
||||||
|
|
||||||
h.update(self.nonce);
|
h.update(self.nonce);
|
||||||
@@ -757,7 +754,7 @@ impl ExpandedSecretKey {
|
|||||||
prehashed_message: D,
|
prehashed_message: D,
|
||||||
verifying_key: &VerifyingKey,
|
verifying_key: &VerifyingKey,
|
||||||
context: Option<&'a [u8]>,
|
context: Option<&'a [u8]>,
|
||||||
) -> Result<ed25519::Signature, SignatureError>
|
) -> Result<Signature, SignatureError>
|
||||||
where
|
where
|
||||||
D: Digest<OutputSize = U64>,
|
D: Digest<OutputSize = U64>,
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user