-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bring `eddsa-2022` back for back-compatibility.
- Loading branch information
1 parent
3f2b1d3
commit 5c47f16
Showing
4 changed files
with
59 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_rdfc_2022.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} | ||
} |