diff --git a/crates/claims/crates/data-integrity/suites/src/suites.rs b/crates/claims/crates/data-integrity/suites/src/suites.rs index ceec168fc..afda1736d 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites.rs @@ -25,3 +25,33 @@ mod unspecified; ))] #[allow(unused_imports)] pub use unspecified::*; + +#[allow(unused_macros)] +macro_rules! try_from_type { + { + $( + $(#[cfg($($t:tt)*)])? + $suite:ident + ),* + } => { + $( + $(#[cfg($($t)*)])? + impl TryFrom for $suite { + type Error = ssi_data_integrity_core::UnsupportedProofSuite; + + fn try_from(value: ssi_data_integrity_core::Type) -> Result { + let suite = $suite; + + if value == <$suite as ssi_data_integrity_core::StandardCryptographicSuite>::type_(&suite) { + Ok($suite) + } else { + Err(ssi_data_integrity_core::UnsupportedProofSuite::Compact(value)) + } + } + } + )* + }; +} + +#[allow(unused_imports)] +pub(crate) use try_from_type; diff --git a/crates/claims/crates/data-integrity/suites/src/suites/dif/ecdsa_secp256k1_recovery_signature_2020.rs b/crates/claims/crates/data-integrity/suites/src/suites/dif/ecdsa_secp256k1_recovery_signature_2020.rs index a28cef70e..75d0c010b 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/dif/ecdsa_secp256k1_recovery_signature_2020.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/dif/ecdsa_secp256k1_recovery_signature_2020.rs @@ -9,6 +9,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::EcdsaSecp256k1RecoveryMethod2020; use static_iref::iri; +use crate::try_from_type; + /// `EcdsaSecp256k1RecoverySignature2020`. /// /// See: @@ -39,6 +41,8 @@ impl StandardCryptographicSuite for EcdsaSecp256k1RecoverySignature2020 { } } +try_from_type!(EcdsaSecp256k1RecoverySignature2020); + #[derive(Default)] pub struct Secp256k1Recovery2020v2Context; diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/aleo_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/aleo_signature_2021.rs index 2db151907..e0b7f308c 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/aleo_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/aleo_signature_2021.rs @@ -16,6 +16,8 @@ use ssi_verification_methods::{ }; use static_iref::iri; +use crate::try_from_type; + /// Aleo Signature 2021 /// /// Linked data signature suite using Aleo. @@ -86,6 +88,8 @@ impl StandardCryptographicSuite for AleoSignature2021 { } } +try_from_type!(AleoSignature2021); + pub struct AleoSignatureAlgorithm; impl SignatureAndVerificationAlgorithm for AleoSignatureAlgorithm { diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/eip712_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/eip712_signature_2021.rs index de30b24c3..6b7b30556 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/eip712_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/eip712_signature_2021.rs @@ -1,5 +1,8 @@ //! EIP-712 Signature 2021 implementation. -use crate::eip712::{Eip712Hashing, Eip712Signature}; +use crate::{ + eip712::{Eip712Hashing, Eip712Signature}, + try_from_type, +}; use rdf_types::{LexicalQuad, Quad}; use ssi_claims_core::{ProofValidationError, ProofValidity, SignatureError}; use ssi_data_integrity_core::{ @@ -97,6 +100,8 @@ impl StandardCryptographicSuite for Eip712Signature2021 { } } +try_from_type!(Eip712Signature2021); + pub struct Eip712Transformation; impl TransformationAlgorithm for Eip712Transformation { diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/ethereum_personal_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/ethereum_personal_signature_2021.rs index a2bbf6e65..e863acdaf 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/ethereum_personal_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/ethereum_personal_signature_2021.rs @@ -18,6 +18,8 @@ use ssi_verification_methods::{ }; use static_iref::iri; +use crate::try_from_type; + mod v0_1; pub use v0_1::*; @@ -59,6 +61,8 @@ impl StandardCryptographicSuite for EthereumPersonalSignature2021 { } } +try_from_type!(EthereumPersonalSignature2021); + #[derive(Default)] pub struct EthereumPersonalSignature2021Context; diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/ethereum_personal_signature_2021/v0_1.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/ethereum_personal_signature_2021/v0_1.rs index a74101c86..265f3d47c 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/ethereum_personal_signature_2021/v0_1.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/ethereum_personal_signature_2021/v0_1.rs @@ -6,6 +6,8 @@ use ssi_data_integrity_core::{ }; use static_iref::iri; +use crate::try_from_type; + #[derive(Debug, Default, Clone, Copy)] pub struct EthereumPersonalSignature2021v0_1; @@ -34,6 +36,8 @@ impl StandardCryptographicSuite for EthereumPersonalSignature2021v0_1 { } } +try_from_type!(EthereumPersonalSignature2021v0_1); + #[derive(Default)] pub struct EthereumPersonalSignature2021v0_1Context; diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/solana_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/solana_signature_2021.rs index eb8b66def..624e929dc 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/solana_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/solana_signature_2021.rs @@ -15,6 +15,8 @@ use ssi_verification_methods::{ }; use static_iref::iri; +use crate::try_from_type; + /// Solana Signature 2021 /// /// Linked data signature suite using Solana. @@ -68,6 +70,8 @@ impl StandardCryptographicSuite for SolanaSignature2021 { } } +try_from_type!(SolanaSignature2021); + // pub fn wallet_sign(message: &[u8], key: &JWK) -> Result, MessageSignatureError> { // let tx = LocalSolanaTransaction::with_message(message); // let bytes = tx.to_bytes(); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/ed25519_blake2b_digest_size20_base58_check_encoded_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/ed25519_blake2b_digest_size20_base58_check_encoded_signature_2021.rs index 3fdddf38c..13ed0802b 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/ed25519_blake2b_digest_size20_base58_check_encoded_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/ed25519_blake2b_digest_size20_base58_check_encoded_signature_2021.rs @@ -10,6 +10,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::Ed25519PublicKeyBLAKE2BDigestSize20Base58CheckEncoded2021; use static_iref::iri; +use crate::try_from_type; + /// Proof type used with [did:tz](https://github.com/spruceid/did-tezos/) `tz1` addresses. #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Ed25519BLAKE2BDigestSize20Base58CheckEncodedSignature2021; @@ -38,3 +40,5 @@ impl StandardCryptographicSuite for Ed25519BLAKE2BDigestSize20Base58CheckEncoded TypeRef::Other(Self::NAME) } } + +try_from_type!(Ed25519BLAKE2BDigestSize20Base58CheckEncodedSignature2021); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/p256_blake2b_digest_size20_base58_check_encoded_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/p256_blake2b_digest_size20_base58_check_encoded_signature_2021.rs index b0dd287d7..cba3bf43e 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/p256_blake2b_digest_size20_base58_check_encoded_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/p256_blake2b_digest_size20_base58_check_encoded_signature_2021.rs @@ -10,6 +10,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::P256PublicKeyBLAKE2BDigestSize20Base58CheckEncoded2021; use static_iref::iri; +use crate::try_from_type; + /// Proof type used with [did:tz](https://github.com/spruceid/did-tezos/) `tz3` addresses. #[derive(Debug, Default, Clone, Copy)] pub struct P256BLAKE2BDigestSize20Base58CheckEncodedSignature2021; @@ -38,3 +40,5 @@ impl StandardCryptographicSuite for P256BLAKE2BDigestSize20Base58CheckEncodedSig TypeRef::Other(Self::NAME) } } + +try_from_type!(P256BLAKE2BDigestSize20Base58CheckEncodedSignature2021); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/tezos_jcs_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/tezos_jcs_signature_2021.rs index 05d516c07..2a4409175 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/tezos_jcs_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/tezos_jcs_signature_2021.rs @@ -18,7 +18,7 @@ use ssi_tzkey::EncodeTezosSignedMessageError; use ssi_verification_methods::{protocol::WithProtocol, MessageSigner, TezosMethod2021}; use static_iref::iri; -use crate::{TezosJcsVmV1Context, TezosWallet}; +use crate::{try_from_type, TezosJcsVmV1Context, TezosWallet}; use super::decode_jwk_from_multibase; pub use super::{Signature, TZJCSVM_CONTEXT}; @@ -85,6 +85,8 @@ impl StandardCryptographicSuite for TezosJcsSignature2021 { } } +try_from_type!(TezosJcsSignature2021); + #[derive( Debug, Clone, diff --git a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/tezos_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/tezos_signature_2021.rs index 1d48a8975..cd6af3278 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/tezos_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/unspecified/tezos/tezos_signature_2021.rs @@ -1,4 +1,4 @@ -use crate::TezosWallet; +use crate::{try_from_type, TezosWallet}; use ssi_claims_core::{ProofValidationError, ProofValidity, SignatureError}; use ssi_crypto::algorithm::AnyBlake2b; use ssi_data_integrity_core::{ @@ -69,6 +69,8 @@ impl StandardCryptographicSuite for TezosSignature2021 { } } +try_from_type!(TezosSignature2021); + pub struct EncodeTezosMessage; impl HashingAlgorithm for EncodeTezosMessage { diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/bbs_2023/mod.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/bbs_2023/mod.rs index 3de5d8b1c..ea1d0ab1b 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/bbs_2023/mod.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/bbs_2023/mod.rs @@ -8,14 +8,16 @@ use ssi_data_integrity_core::{ ConfigurationAlgorithm, ConfigurationError, CryptographicSuiteSelect, InputProofOptions, SelectionError, SelectiveCryptographicSuite, }, - CryptosuiteStr, DataIntegrity, ProofConfiguration, ProofRef, StandardCryptographicSuite, Type, - TypeRef, UnsupportedProofSuite, + CryptosuiteStr, DataIntegrity, ProofConfiguration, ProofRef, StandardCryptographicSuite, + TypeRef, }; use ssi_di_sd_primitives::{HmacSha256Key, JsonPointerBuf}; use ssi_json_ld::{Expandable, ExpandedDocument, JsonLdLoaderProvider, JsonLdNodeObject}; use ssi_rdf::LexicalInterpretation; use ssi_verification_methods::{Multikey, VerificationMethodResolver}; +use crate::try_from_type; + pub(crate) mod transformation; pub use transformation::{Bbs2023Transformation, Bbs2023TransformationOptions, Transformed}; @@ -90,16 +92,7 @@ impl StandardCryptographicSuite for Bbs2023 { } } -impl TryFrom for Bbs2023 { - type Error = UnsupportedProofSuite; - - fn try_from(value: Type) -> Result { - match value { - Type::DataIntegrityProof(c) if c == "bbs-2023" => Ok(Self), - ty => Err(UnsupportedProofSuite::Compact(ty)), - } - } -} +try_from_type!(Bbs2023); #[derive(Debug, Default, Clone)] pub struct Bbs2023SignatureOptions { diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_rdfc_2019.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_rdfc_2019.rs index cd843cf19..1afa013ca 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_rdfc_2019.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_rdfc_2019.rs @@ -17,6 +17,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::{multikey::DecodedMultikey, Multikey}; use static_iref::iri; +use crate::try_from_type; + /// The `ecdsa-rdfc-2019` cryptosuite. /// /// See: @@ -47,6 +49,8 @@ impl StandardCryptographicSuite for EcdsaRdfc2019 { } } +try_from_type!(EcdsaRdfc2019); + pub struct EcdsaRdfc2019HashingAlgorithm; impl HashingAlgorithm for EcdsaRdfc2019HashingAlgorithm { diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_sd_2023/mod.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_sd_2023/mod.rs index d6296b6af..a3561360f 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_sd_2023/mod.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_sd_2023/mod.rs @@ -1,10 +1,11 @@ use serde::Serialize; use ssi_data_integrity_core::{ suite::{CryptographicSuiteSelect, SelectionError, SelectiveCryptographicSuite}, - CryptosuiteStr, DataIntegrity, ProofRef, StandardCryptographicSuite, Type, TypeRef, - UnsupportedProofSuite, + CryptosuiteStr, DataIntegrity, ProofRef, StandardCryptographicSuite, TypeRef, }; +use crate::try_from_type; + mod configuration; pub use configuration::*; @@ -72,13 +73,4 @@ where } } -impl TryFrom for EcdsaSd2023 { - type Error = UnsupportedProofSuite; - - fn try_from(value: Type) -> Result { - match value { - Type::DataIntegrityProof(c) if c == "ecdsa-sd-2023" => Ok(Self), - ty => Err(UnsupportedProofSuite::Compact(ty)), - } - } -} +try_from_type!(EcdsaSd2023); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_secp256k1_signature_2019.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_secp256k1_signature_2019.rs index 6ff4767ca..c1ebdf61e 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_secp256k1_signature_2019.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_secp256k1_signature_2019.rs @@ -8,6 +8,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::EcdsaSecp256k1VerificationKey2019; use static_iref::iri; +use crate::try_from_type; + /// Ecdsa Secp256k1 Signature 2019. /// /// See: @@ -38,3 +40,5 @@ impl StandardCryptographicSuite for EcdsaSecp256k1Signature2019 { TypeRef::Other(Self::NAME) } } + +try_from_type!(EcdsaSecp256k1Signature2019); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_secp256r1_signature_2019.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_secp256r1_signature_2019.rs index a978aa728..216096cff 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_secp256r1_signature_2019.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ecdsa_secp256r1_signature_2019.rs @@ -8,6 +8,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::EcdsaSecp256r1VerificationKey2019; use static_iref::iri; +use crate::try_from_type; + /// ECDSA Cryptosuite v2019 `EcdsaSecp256r1Signature2019`. /// /// See: @@ -38,3 +40,5 @@ impl StandardCryptographicSuite for EcdsaSecp256r1Signature2019 { TypeRef::Other(Self::NAME) } } + +try_from_type!(EcdsaSecp256r1Signature2019); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ed25519_signature_2018.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ed25519_signature_2018.rs index 09a3ab277..1231d3e31 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ed25519_signature_2018.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ed25519_signature_2018.rs @@ -8,6 +8,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::Ed25519VerificationKey2018; use static_iref::iri; +use crate::try_from_type; + /// Ed25519 Signature 2018. /// /// See: @@ -37,3 +39,5 @@ impl StandardCryptographicSuite for Ed25519Signature2018 { TypeRef::Other(Self::NAME) } } + +try_from_type!(Ed25519Signature2018); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ed25519_signature_2020.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ed25519_signature_2020.rs index c2db8949f..4d24374da 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ed25519_signature_2020.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ed25519_signature_2020.rs @@ -15,6 +15,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::Ed25519VerificationKey2020; use static_iref::{iri, iri_ref}; +use crate::try_from_type; + lazy_static! { static ref PROOF_CONTEXT: ssi_json_ld::syntax::ContextEntry = { ssi_json_ld::syntax::ContextEntry::IriRef( @@ -64,3 +66,5 @@ impl StandardCryptographicSuite for Ed25519Signature2020 { TypeRef::Other(Self::NAME) } } + +try_from_type!(Ed25519Signature2020); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_2022.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_2022.rs index e94ac94a9..aee519061 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_2022.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_2022.rs @@ -8,6 +8,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::Multikey; use static_iref::iri; +use crate::try_from_type; + /// The `eddsa-2022` cryptosuite, a draft version of the `eddsa-rdfc-2022` /// cryptosuite. /// @@ -41,3 +43,5 @@ impl StandardCryptographicSuite for EdDsa2022 { TypeRef::DataIntegrityProof(CryptosuiteStr::new("eddsa-2022").unwrap()) } } + +try_from_type!(EdDsa2022); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_rdfc_2022.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_rdfc_2022.rs index 2b3aa0efc..d57e629a5 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_rdfc_2022.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/eddsa_rdfc_2022.rs @@ -8,6 +8,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::Multikey; use static_iref::iri; +use crate::try_from_type; + /// The `eddsa-rdfc-2022` cryptosuite. /// /// See: @@ -37,3 +39,5 @@ impl StandardCryptographicSuite for EdDsaRdfc2022 { TypeRef::DataIntegrityProof(CryptosuiteStr::new("eddsa-rdfc-2022").unwrap()) } } + +try_from_type!(EdDsaRdfc2022); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ethereum_eip712_signature_2021.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ethereum_eip712_signature_2021.rs index a763c333a..0ce3b20b1 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ethereum_eip712_signature_2021.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ethereum_eip712_signature_2021.rs @@ -27,7 +27,10 @@ use static_iref::{iri, iri_ref}; pub mod v0_1; pub use v0_1::EthereumEip712Signature2021v0_1; -use crate::eip712::{Eip712Hashing, Eip712Signature, Input, TypesOrURI}; +use crate::{ + eip712::{Eip712Hashing, Eip712Signature, Input, TypesOrURI}, + try_from_type, +}; lazy_static! { static ref PROOF_CONTEXT: ssi_json_ld::syntax::ContextEntry = { @@ -113,6 +116,8 @@ impl StandardCryptographicSuite for EthereumEip712Signature2021 { } } +try_from_type!(EthereumEip712Signature2021); + #[derive( Debug, serde::Serialize, diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ethereum_eip712_signature_2021/v0_1.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ethereum_eip712_signature_2021/v0_1.rs index 80198247a..2f6f8b998 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/ethereum_eip712_signature_2021/v0_1.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/ethereum_eip712_signature_2021/v0_1.rs @@ -3,7 +3,10 @@ use ssi_data_integrity_core::{suite::AddProofContext, StandardCryptographicSuite use ssi_eip712::Value; use static_iref::{iri, iri_ref}; -use crate::eip712::{Eip712Hashing, TypesOrURI}; +use crate::{ + eip712::{Eip712Hashing, TypesOrURI}, + try_from_type, +}; use super::{ AnyEip712Options, EthereumEip712SignatureAlgorithm, EthereumEip712Transformation, @@ -132,3 +135,5 @@ impl StandardCryptographicSuite for EthereumEip712Signature2021v0_1 { TypeRef::Other(Self::NAME) } } + +try_from_type!(EthereumEip712Signature2021v0_1); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/json_web_signature_2020.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/json_web_signature_2020.rs index b815f0448..84fd690e0 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/json_web_signature_2020.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/json_web_signature_2020.rs @@ -9,6 +9,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::JsonWebKey2020; use static_iref::{iri, iri_ref}; +use crate::try_from_type; + lazy_static! { static ref W3ID_JWS2020_V1_CONTEXT: ssi_json_ld::syntax::ContextEntry = { ssi_json_ld::syntax::ContextEntry::IriRef( @@ -55,3 +57,5 @@ impl StandardCryptographicSuite for JsonWebSignature2020 { TypeRef::Other(Self::NAME) } } + +try_from_type!(JsonWebSignature2020); diff --git a/crates/claims/crates/data-integrity/suites/src/suites/w3c/rsa_signature_2018.rs b/crates/claims/crates/data-integrity/suites/src/suites/w3c/rsa_signature_2018.rs index 1c72556ef..3f592e2f3 100644 --- a/crates/claims/crates/data-integrity/suites/src/suites/w3c/rsa_signature_2018.rs +++ b/crates/claims/crates/data-integrity/suites/src/suites/w3c/rsa_signature_2018.rs @@ -12,6 +12,8 @@ use ssi_data_integrity_core::{ use ssi_verification_methods::{MessageSigner, RsaVerificationKey2018}; use static_iref::iri; +use crate::try_from_type; + /// RSA Signature Suite 2018. /// /// See: @@ -42,6 +44,8 @@ impl StandardCryptographicSuite for RsaSignature2018 { } } +try_from_type!(RsaSignature2018); + /// Signature type. #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")]