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

Rename eddsa-2022 into eddsa-rdfc-2022. #581

Merged
merged 2 commits into from
Jul 15, 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
13 changes: 10 additions & 3 deletions crates/claims/crates/data-integrity/src/any/suite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ macros::crypto_suites! {
#[cfg(all(feature = "w3c", feature = "ed25519"))]
ed25519_signature_2020: Ed25519Signature2020,

/// W3C EdDSA Cryptosuite v2022.
/// W3C `eddsa-2022` cryptosuite, a draft version of the `eddsa-rdfc-2022`
/// cryptosuite.
///
/// See: <https://w3c.github.io/vc-di-eddsa/>
/// See: <https://www.w3.org/TR/2023/WD-vc-di-eddsa-20230714/#eddsa-2022>
#[cfg(all(feature = "w3c", feature = "ed25519"))]
ed_dsa_2022: EdDsa2022,
eddsa_2022: EdDsa2022,

/// W3C `eddsa-rdfc-2022` cryptosuite.
///
/// See: <https://w3c.github.io/vc-di-eddsa/#eddsa-rdfc-2022>
#[cfg(all(feature = "w3c", feature = "ed25519"))]
eddsa_rdfc_2022: EdDsaRdfc2022,

/// W3C Ecdsa Secp256k1 Signature 2019.
///
Expand Down
5 changes: 5 additions & 0 deletions crates/claims/crates/data-integrity/suites/src/suites/w3c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ pub mod eddsa_2022;
#[cfg(feature = "ed25519")]
pub use eddsa_2022::EdDsa2022;

#[cfg(feature = "ed25519")]
pub mod eddsa_rdfc_2022;
#[cfg(feature = "ed25519")]
pub use eddsa_rdfc_2022::EdDsaRdfc2022;

#[cfg(feature = "secp256k1")]
pub mod ecdsa_secp256k1_signature_2019;
#[cfg(feature = "secp256k1")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
//! EdDSA Cryptosuite v2022 implementation.
//!
//! This is the successor of the EdDSA Cryptosuite v2020.
//!
//! See: <https://w3c.github.io/vc-di-eddsa/>
use k256::sha2::Sha256;
use ssi_data_integrity_core::{
canonicalization::{CanonicalizeClaimsAndConfiguration, HashCanonicalClaimsAndConfiguration},
Expand All @@ -13,12 +8,13 @@ use ssi_data_integrity_core::{
use ssi_verification_methods::Multikey;
use static_iref::iri;

/// EdDSA Cryptosuite v2020.
/// The `eddsa-2022` cryptosuite, a draft version of the `eddsa-rdfc-2022`
/// cryptosuite.
///
/// This is a legacy cryptographic suite for the usage of the EdDSA algorithm
/// and Curve25519. It is recommended to use `edssa-2022` instead.
/// This is only provided for compatibility with applications based on the
/// EDDSA cryptosuite draft.
///
/// See: <https://w3c.github.io/vc-di-eddsa/#the-ed25519signature2020-suite>
/// See: <https://www.w3.org/TR/2023/WD-vc-di-eddsa-20230714/#eddsa-2022>
#[derive(Debug, Default, Clone, Copy)]
pub struct EdDsa2022;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use k256::sha2::Sha256;
use ssi_data_integrity_core::{
canonicalization::{CanonicalizeClaimsAndConfiguration, HashCanonicalClaimsAndConfiguration},
signing::{Base58Btc, MultibaseSigning},
suite::NoConfiguration,
CryptosuiteStr, StandardCryptographicSuite, TypeRef,
};
use ssi_verification_methods::Multikey;
use static_iref::iri;

/// The `eddsa-rdfc-2022` cryptosuite.
///
/// See: <https://w3c.github.io/vc-di-eddsa/#eddsa-rdfc-2022>
#[derive(Debug, Default, Clone, Copy)]
pub struct EdDsaRdfc2022;

impl EdDsaRdfc2022 {
pub const NAME: &'static str = "DataIntegrityProof";

pub const IRI: &'static iref::Iri = iri!("https://w3id.org/security#DataIntegrityProof");
}

impl StandardCryptographicSuite for EdDsaRdfc2022 {
type Configuration = NoConfiguration;

type Transformation = CanonicalizeClaimsAndConfiguration;

type Hashing = HashCanonicalClaimsAndConfiguration<Sha256>;

type VerificationMethod = Multikey;

type SignatureAlgorithm = MultibaseSigning<ssi_crypto::algorithm::EdDSA, Base58Btc>;

type ProofOptions = ();

fn type_(&self) -> TypeRef {
TypeRef::DataIntegrityProof(CryptosuiteStr::new("eddsa-rdfc-2022").unwrap())
}
}