diff --git a/src/core/authorization_request/parameters.rs b/src/core/authorization_request/parameters.rs index 568f1e4..a733156 100644 --- a/src/core/authorization_request/parameters.rs +++ b/src/core/authorization_request/parameters.rs @@ -1,12 +1,9 @@ use std::{fmt, ops::Deref}; use crate::core::{ - metadata::parameters::{ - verifier::{JWKs, VpFormats}, - wallet::{ - AuthorizationEncryptedResponseAlg, AuthorizationEncryptedResponseEnc, - AuthorizationSignedResponseAlg, - }, + metadata::parameters::verifier::{ + AuthorizationEncryptedResponseAlg, AuthorizationEncryptedResponseEnc, + AuthorizationSignedResponseAlg, JWKs, VpFormats, }, object::{ParsingErrorContext, TypedParameter, UntypedObject}, presentation_definition::PresentationDefinition as PresentationDefinitionParsed, diff --git a/src/core/metadata/parameters/verifier.rs b/src/core/metadata/parameters/verifier.rs index 99dc127..b5550ee 100644 --- a/src/core/metadata/parameters/verifier.rs +++ b/src/core/metadata/parameters/verifier.rs @@ -146,6 +146,27 @@ impl From for Json { } } +#[derive(Debug, Clone)] +pub struct AuthorizationSignedResponseAlg(pub ssi::crypto::Algorithm); + +impl TypedParameter for AuthorizationSignedResponseAlg { + const KEY: &'static str = "authorization_signed_response_alg"; +} + +impl TryFrom for AuthorizationSignedResponseAlg { + type Error = Error; + + fn try_from(value: Json) -> Result { + Ok(Self(serde_json::from_value(value)?)) + } +} + +impl From for Json { + fn from(value: AuthorizationSignedResponseAlg) -> Json { + Json::String(value.0.to_string()) + } +} + #[cfg(test)] mod test { use serde_json::json; diff --git a/src/core/metadata/parameters/wallet.rs b/src/core/metadata/parameters/wallet.rs index fce2db1..c48be6d 100644 --- a/src/core/metadata/parameters/wallet.rs +++ b/src/core/metadata/parameters/wallet.rs @@ -205,73 +205,6 @@ impl From for Json { } } -#[derive(Debug, Clone)] -pub struct AuthorizationSignedResponseAlg(pub ssi::crypto::Algorithm); - -impl TypedParameter for AuthorizationSignedResponseAlg { - const KEY: &'static str = "authorization_signed_response_alg"; -} - -impl TryFrom for AuthorizationSignedResponseAlg { - type Error = Error; - - fn try_from(value: Json) -> Result { - Ok(Self(serde_json::from_value(value)?)) - } -} - -impl From for Json { - fn from(value: AuthorizationSignedResponseAlg) -> Json { - Json::String(value.0.to_string()) - } -} - -#[derive(Debug, Clone)] -pub struct AuthorizationEncryptedResponseAlg(pub ssi::crypto::Algorithm); - -impl TypedParameter for AuthorizationEncryptedResponseAlg { - const KEY: &'static str = "authorization_encrypted_response_alg"; -} - -impl TryFrom for AuthorizationEncryptedResponseAlg { - type Error = Error; - - fn try_from(value: Json) -> Result { - Ok(Self(serde_json::from_value(value)?)) - } -} - -impl From for Json { - fn from(value: AuthorizationEncryptedResponseAlg) -> Json { - Json::String(value.0.to_string()) - } -} - -// TODO: ssi::crypto lacks an encryption algorithm enum type, -// which we may want to create for use cases like this one. -// -// Using a string type here in the interim. -#[derive(Debug, Clone)] -pub struct AuthorizationEncryptedResponseEnc(pub String); - -impl TypedParameter for AuthorizationEncryptedResponseEnc { - const KEY: &'static str = "authorization_encrypted_response_enc"; -} - -impl TryFrom for AuthorizationEncryptedResponseEnc { - type Error = Error; - - fn try_from(value: Json) -> Result { - Ok(Self(serde_json::from_value(value)?)) - } -} - -impl From for Json { - fn from(value: AuthorizationEncryptedResponseEnc) -> Json { - Json::String(value.0) - } -} - #[cfg(test)] mod test { use serde_json::json;