Skip to content

Commit

Permalink
remove extraneous verifier metadata implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Tate <[email protected]>
  • Loading branch information
Ryanmtate committed Dec 2, 2024
1 parent 5083071 commit 204fc40
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 73 deletions.
9 changes: 3 additions & 6 deletions src/core/authorization_request/parameters.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
21 changes: 21 additions & 0 deletions src/core/metadata/parameters/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,27 @@ impl From<AuthorizationEncryptedResponseEnc> 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<Json> for AuthorizationSignedResponseAlg {
type Error = Error;

fn try_from(value: Json) -> Result<Self, Self::Error> {
Ok(Self(serde_json::from_value(value)?))
}
}

impl From<AuthorizationSignedResponseAlg> for Json {
fn from(value: AuthorizationSignedResponseAlg) -> Json {
Json::String(value.0.to_string())
}
}

#[cfg(test)]
mod test {
use serde_json::json;
Expand Down
67 changes: 0 additions & 67 deletions src/core/metadata/parameters/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,73 +205,6 @@ impl From<AuthorizationEncryptionEncValuesSupported> 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<Json> for AuthorizationSignedResponseAlg {
type Error = Error;

fn try_from(value: Json) -> Result<Self, Self::Error> {
Ok(Self(serde_json::from_value(value)?))
}
}

impl From<AuthorizationSignedResponseAlg> 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<Json> for AuthorizationEncryptedResponseAlg {
type Error = Error;

fn try_from(value: Json) -> Result<Self, Self::Error> {
Ok(Self(serde_json::from_value(value)?))
}
}

impl From<AuthorizationEncryptedResponseAlg> 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<Json> for AuthorizationEncryptedResponseEnc {
type Error = Error;

fn try_from(value: Json) -> Result<Self, Self::Error> {
Ok(Self(serde_json::from_value(value)?))
}
}

impl From<AuthorizationEncryptedResponseEnc> for Json {
fn from(value: AuthorizationEncryptedResponseEnc) -> Json {
Json::String(value.0)
}
}

#[cfg(test)]
mod test {
use serde_json::json;
Expand Down

0 comments on commit 204fc40

Please sign in to comment.