Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rustdocs broken links and add check in CI #590

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"
steps:
- name: Checkout SSI Library
uses: actions/checkout@v4
Expand Down Expand Up @@ -53,6 +54,9 @@ jobs:
run: |
cargo test --examples

- name: Doc
run: cargo doc --no-deps --workspace --all-features

test-each-feature:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
Expand Down
21 changes: 15 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ssi"
version = "0.8.0"
version = "0.8.1"
authors = ["Spruce Systems, Inc."]
edition = "2021"
license = "Apache-2.0"
Expand All @@ -19,7 +19,7 @@ members = [
"crates/claims/core",
"crates/claims/crates/*",
"crates/claims/crates/data-integrity/core",
"crates/claims/crates/data-integrity/suites"
"crates/claims/crates/data-integrity/suites",
]

[workspace.dependencies]
Expand Down Expand Up @@ -76,7 +76,7 @@ blake2 = "0.10"
sha2 = "0.10.0"
sha3 = "0.10.8"
rsa = "0.6"
zkryptium = "0.2.2" # BBS
zkryptium = "0.2.2" # BBS

# other common dependencies
log = "0.4.21"
Expand Down Expand Up @@ -112,7 +112,15 @@ indexmap = "2.0.0"
uuid = "1.9"

[features]
default = ["w3c", "rsa", "ed25519", "secp256k1", "secp256r1", "ripemd-160", "eip712"]
default = [
"w3c",
"rsa",
"ed25519",
"secp256k1",
"secp256r1",
"ripemd-160",
"eip712",
]

## Signature suites specified by the W3C.
##
Expand Down Expand Up @@ -233,7 +241,7 @@ ssi-zcap-ld.workspace = true
ssi-multicodec.workspace = true
ssi-ssh.workspace = true
ssi-bbs = { workspace = true, optional = true }
xsd-types.workspace = true # public reexport
xsd-types.workspace = true # public reexport
document-features = "0.2"

[dev-dependencies]
Expand All @@ -255,4 +263,5 @@ rustdoc-args = ["--cfg", "docsrs"]
sign-tag = true
tag-prefix = "{{crate_name}}/"
tag-message = "Release {{crate_name}} version {{version}}."
pre-release-commit-message = "Release"
pre-release-commit-message = "Release"

5 changes: 3 additions & 2 deletions crates/claims/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ssi-claims-core"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
authors = ["Spruce Systems, Inc."]
license = "Apache-2.0"
Expand Down Expand Up @@ -35,4 +35,5 @@ ssi-json-ld.workspace = true
ssi-eip712.workspace = true

serde = { workspace = true, optional = true }
linked-data = { workspace = true, optional = true }
linked-data = { workspace = true, optional = true }

2 changes: 2 additions & 0 deletions crates/claims/core/src/verification/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use ssi_json_ld::JsonLdLoaderProvider;
///
/// This type provides this subset of parameters. In most cases, this will be
/// sufficient to verify all your secured claims.
///
/// [`VerifiableClaims::verify`]: super::VerifiableClaims::verify
#[derive(Debug, Default, Clone, Copy)]
pub struct VerificationParameters<R, L1 = ssi_json_ld::ContextLoader, L2 = ()> {
/// Public key resolver.
Expand Down
2 changes: 1 addition & 1 deletion crates/claims/crates/data-integrity/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ssi-data-integrity-core"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
authors = ["Spruce Systems, Inc."]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/claims/crates/data-integrity/core/src/suite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub trait CryptographicSuite: Clone {
/// Signature type.
///
/// For cryptographic suites conforming to the most recent iteration of
/// the Data-Integrity specification, this will be [`ProofValue`].
/// the Data-Integrity specification, this will be `proofValue`.
type Signature: AsRef<str>;

/// Returns the cryptographic suite type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl<S: StandardCryptographicSuite> CryptographicSuite for S {
/// Signature type.
///
/// For cryptographic suites conforming to the most recent iteration of
/// the Data-Integrity specification, this will be [`ProofValue`].
/// the Data-Integrity specification, this will be `proofValue`.
type Signature = <S::SignatureAlgorithm as SignatureAndVerificationAlgorithm>::Signature;

/// Returns the cryptographic suite type.
Expand Down
22 changes: 18 additions & 4 deletions crates/claims/crates/data-integrity/suites/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ssi-data-integrity-suites"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
authors = ["Spruce Systems, Inc."]
license = "Apache-2.0"
Expand Down Expand Up @@ -48,13 +48,21 @@ secp256k1 = ["ssi-verification-methods/secp256k1", "k256"]
## This includes:
## - `EcdsaSecp256r1Signature2019` (requires `w3c`)
## - `EcdsaRdfc2019` (requires `w3c`)
secp256r1 = ["ssi-data-integrity-core/secp256r1", "ssi-verification-methods/secp256r1", "p256"]
secp256r1 = [
"ssi-data-integrity-core/secp256r1",
"ssi-verification-methods/secp256r1",
"p256",
]

## Signature suites based on secp384r1.
##
## This includes:
## - `EcdsaRdfc2019` (requires `w3c`)
secp384r1 = ["ssi-data-integrity-core/secp384r1", "ssi-verification-methods/secp384r1", "p384"]
secp384r1 = [
"ssi-data-integrity-core/secp384r1",
"ssi-verification-methods/secp384r1",
"p384",
]

## Signature suites based on RSA.
##
Expand All @@ -69,7 +77,13 @@ rsa = ["ssi-verification-methods/rsa"]
## - `TezosSignature2021`
## - `Ed25519BLAKE2BDigestSize20Base58CheckEncodedSignature2021` (requires `ed25519`)
## - `P256BLAKE2BDigestSize20Base58CheckEncodedSignature2021` (requires `secp256r1`)
tezos = ["serde_json", "serde_jcs", "ssi-tzkey", "bs58", "ssi-verification-methods/tezos"]
tezos = [
"serde_json",
"serde_jcs",
"ssi-tzkey",
"bs58",
"ssi-verification-methods/tezos",
]

## Enables `AleoSignature2021`.
aleo = ["ssi-jwk/aleo", "ssi-verification-methods/aleo", "k256"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use static_iref::iri;

/// Aleo Signature 2021
///
/// Linked data signature suite using [Aleo](crate::aleo).
/// Linked data signature suite using Aleo.
///
/// Only verification is supported.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use static_iref::iri;
///
/// # Signature protocol
///
/// The [`SolanaWallet`] protocol is used.
/// The [`SolanaSignatureAlgorithm`] protocol is used.
#[derive(Debug, Default, Clone, Copy)]
pub struct SolanaSignature2021;

Expand Down
14 changes: 11 additions & 3 deletions crates/claims/crates/jws/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ssi-jws"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
authors = ["Spruce Systems, Inc."]
license = "Apache-2.0"
Expand All @@ -12,7 +12,14 @@ documentation = "https://docs.rs/ssi-jws/"
default = ["secp256k1", "secp256r1", "ed25519", "rsa"]

## Enable secp256k1 signatures.
secp256k1 = ["ssi-jwk/secp256k1", "k256", "ssi-crypto/secp256k1", "blake2", "dep:sha2", "dep:sha3"]
secp256k1 = [
"ssi-jwk/secp256k1",
"k256",
"ssi-crypto/secp256k1",
"blake2",
"dep:sha2",
"dep:sha3",
]

## Enable secp256r1 (p256) signatures.
secp256r1 = ["ssi-jwk/secp256r1", "p256", "blake2"]
Expand Down Expand Up @@ -72,4 +79,5 @@ clear_on_drop = { version = "0.2.4", features = ["no_cc"] }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

5 changes: 2 additions & 3 deletions crates/claims/crates/jws/src/compact/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ impl CompactJWS {
/// payload. For instance if the payload is a set of JWT claims, those
/// claims will not be validated.
///
/// To perform a more precise verification, first decode the JWS with]
/// [`Self::to_decoded`], then parse the payload manually before using
/// [`ssi_claims_core::Verifiable`] to actually perform the verification.
/// To perform a more precise verification, specify use a specialized `T`
/// instead of the default [`Vec<u8>`]
///
/// The `params` argument provides all the verification parameters required
/// to validate the claims and proof.
Expand Down
8 changes: 3 additions & 5 deletions crates/claims/crates/jws/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@
//! ```
//!
//! Internally [`CompactJWS::verify`] uses [`CompactJWS::to_decoded`] to decode
//! the JWS, [`VerifiableClaims::into_verifiable`] to separate the payload from
//! the signature then [`Verifiable::verify`] to validate the signature.
//! the JWS, then [`DecodedJWS::verify`] to validate the signature.
//!
//! [`VerifiableClaims::into_verifiable`]: ssi_claims_core::VerifiableClaims::into_verifiable
//! [`Verifiable::verify`]: ssi_claims_core::Verifiable::verify
//! [`DecodedJWS::verify`]: DecodedJWS::verify
//!
//! ```ignore
//! let decoded_jws = jws.to_decoded().unwrap();
Expand Down Expand Up @@ -206,7 +204,7 @@ impl<T> DecodedJWS<T> {
/// - [`VerificationParameters`](ssi_claims_core::VerificationParameters):
/// A good default providing many other common verification parameters that
/// are not necessary here.
/// - [`JWK`](ssi_jwk::JWK): allows you to put a JWK as `params`, which
/// - [`JWK`]: allows you to put a JWK as `params`, which
/// will resolve into itself. Can be useful if you don't need key resolution
/// because you know in advance what key was used to sign the JWS.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/claims/crates/jwt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ssi-jwt"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
authors = ["Spruce Systems, Inc."]
license = "Apache-2.0"
Expand Down
6 changes: 2 additions & 4 deletions crates/claims/crates/jwt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@
//!
//! Internally [`ToDecodedJWT::verify_jwt`] uses
//! [`ToDecodedJWT::to_decoded_jwt`] to decode the JWT,
//! [`VerifiableClaims::into_verifiable`] to separate the payload from the
//! signature then [`Verifiable::verify`] to validate the signature and
//! then [`DecodedJWS::verify`] to validate the signature and
//! registered claims.
//!
//! [`VerifiableClaims::into_verifiable`]: ssi_claims_core::VerifiableClaims::into_verifiable
//! [`Verifiable::verify`]: ssi_claims_core::Verifiable::verify
//! [`DecodedJWS::verify`]: ssi_jws::DecodedJWS::verify
//!
//! ## Signature
//!
Expand Down
13 changes: 11 additions & 2 deletions crates/jwk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ssi-jwk"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
authors = ["Spruce Systems, Inc."]
license = "Apache-2.0"
Expand Down Expand Up @@ -29,7 +29,16 @@ rsa = ["dep:rsa"]
## Enable aleo ecosystem keys.
##
## Not compatible with WASM targets.
aleo = ["rand", "blake2", "snarkvm-dpc", "snarkvm-algorithms", "snarkvm-curves", "snarkvm-utilities", "snarkvm-parameters", "bs58"]
aleo = [
"rand",
"blake2",
"snarkvm-dpc",
"snarkvm-algorithms",
"snarkvm-curves",
"snarkvm-utilities",
"snarkvm-parameters",
"bs58",
]

## enable ripemd-160 hashing for keys, e.g. for bitcoin.
ripemd-160 = ["ssi-crypto/ripemd-160", "secp256k1"]
Expand Down
14 changes: 7 additions & 7 deletions crates/jwk/src/aleo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! [Aleo]: https://developer.aleo.org/testnet/getting_started/overview#the-network
//!
//! This module provides [sign] and [verify] functions for Aleo signatures
//! using static parameters ([COM_PARAMS], [ENC_PARAMS], [SIG_PARAMS])
//! using static parameters ([struct@COM_PARAMS], [struct@ENC_PARAMS], [struct@SIG_PARAMS])
//! and a [JWK-based keypair representation](OKP_CURVE).

use crate::{Base64urlUInt, OctetParams, Params, JWK};
Expand Down Expand Up @@ -150,16 +150,16 @@ lazy_static::lazy_static! {
///
/// An Aleo private key JWK is expected to contain an account address in the public key ("x")
/// parameter that corresponds to the private key ("d") parameter,
/// using [SIG_PARAMS], [COM_PARAMS] and [ENC_PARAMS].
/// using [struct@SIG_PARAMS], [struct@COM_PARAMS] and [struct@ENC_PARAMS].
///
/// An Aleo public key JWK contains the public key ("x") parameter and MUST not contain a private
/// key ("d") parameter. An Aleo public key JWK is usable for verification of signatures using
/// [ENC_PARAMS].
/// [struct@ENC_PARAMS].
pub const OKP_CURVE: &str = "AleoTestnet1Key";

/// Generate an Aleo private key in [unofficial JWK format][OKP_CURVE]. **CPU-intensive (slow)**.
///
/// Uses [SIG_PARAMS], [COM_PARAMS], and [ENC_PARAMS].
/// Uses [struct@SIG_PARAMS], [struct@COM_PARAMS], and [struct@ENC_PARAMS].
pub fn generate_private_key_jwk() -> Result<JWK, AleoGeneratePrivateKeyError> {
let mut rng = rand::rngs::OsRng {};
let sig_params = SIG_PARAMS.clone();
Expand All @@ -185,7 +185,7 @@ pub fn generate_private_key_jwk() -> Result<JWK, AleoGeneratePrivateKeyError> {

/// Convert JWK private key to Aleo private key
///
/// Uses [SIG_PARAMS], [COM_PARAMS], and [ENC_PARAMS] to compute the account address.
/// Uses [struct@SIG_PARAMS], [struct@COM_PARAMS], and [struct@ENC_PARAMS] to compute the account address.
fn aleo_jwk_to_private_key(jwk: &JWK) -> Result<PrivateKey<Components>, ParsePrivateKeyError> {
let params = match &jwk.params {
Params::OKP(ref okp_params) => {
Expand Down Expand Up @@ -242,7 +242,7 @@ fn aleo_jwk_to_address(jwk: &JWK) -> Result<Address<Components>, ParseAddressErr

/// Create an Aleo signature.
///
/// The message is signed using [ENC_PARAMS] and a View Key derived from the given JWK private key with [SIG_PARAMS] and [COM_PARAMS].
/// The message is signed using [struct@ENC_PARAMS] and a View Key derived from the given JWK private key with [struct@SIG_PARAMS] and [struct@COM_PARAMS].
///
/// The JWK private key `key` is expected to use key type `OKP` with curve according to
/// [OKP_CURVE].
Expand All @@ -265,7 +265,7 @@ pub fn sign(msg: &[u8], key: &JWK) -> Result<Vec<u8>, AleoSignError> {

/// Verify an Aleo signature by an Aleo address as a string.
///
/// Verification uses [ENC_PARAMS].
/// Verification uses [struct@ENC_PARAMS].
pub fn verify(msg: &[u8], address: &str, sig: &[u8]) -> Result<(), AleoVerifyError> {
let address =
Address::<Components>::from_str(address).map_err(AleoVerifyError::AddressFromStr)?;
Expand Down
Loading