Skip to content

Commit

Permalink
cleanup: remove validation from vc
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan770 committed Mar 8, 2024
1 parent da2d65f commit b880a96
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 338 deletions.
206 changes: 0 additions & 206 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 0 additions & 39 deletions crates/teddybear-js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ use wasm_bindgen::prelude::*;

use teddybear_vc::{
issue_vc, issue_vp,
validation::{
Constraint as InnerConstraint, PresentationDefinition as InnerPresentationDefinition,
},
verify_credential, verify_presentation, ContextLoader as InnerContextLoader,
};

Expand Down Expand Up @@ -493,42 +490,6 @@ impl Default for StatusListCredential {
}
}

#[wasm_bindgen]
pub struct PresentationDefinition(InnerPresentationDefinition);

#[wasm_bindgen]
impl PresentationDefinition {
/// Create a new presentation definition from the provided object.
#[wasm_bindgen(constructor)]
pub fn from_object(object: &Object) -> Result<PresentationDefinition, JsError> {
Ok(Self(serde_wasm_bindgen::from_value(object.into())?))
}

/// Validate the provided object against the presentation definition.
pub fn validate(&self, object: &Object) -> Result<bool, JsError> {
let value = serde_wasm_bindgen::from_value(object.into())?;
Ok(self.0.validate(&value))
}
}

#[wasm_bindgen]
pub struct Constraint(InnerConstraint);

#[wasm_bindgen]
impl Constraint {
/// Create a new constraint from the provided object.
#[wasm_bindgen(constructor)]
pub fn from_object(object: &Object) -> Result<Constraint, JsError> {
Ok(Self(serde_wasm_bindgen::from_value(object.into())?))
}

/// Validate the provided object against the constraint.
pub fn validate(&self, object: &Object) -> Result<bool, JsError> {
let value = serde_wasm_bindgen::from_value(object.into())?;
Ok(self.0.validate(&value))
}
}

/// Encrypt the provided payload for the provided recipient array using A256GCM algorithm.
///
/// The provided recipients array must contain only wrapped X25519 JWK values.
Expand Down
4 changes: 0 additions & 4 deletions crates/teddybear-vc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ ssi-vc = { workspace = true }
chrono = "0.4.31"
grdf = { version = "0.16.3", optional = true }
iref = { version = "2.2.3", optional = true }
jsonschema = { version = "0.17.1", default-features = false }
rdf-types = { version = "0.12.19", optional = true }
serde = { workspace = true }
serde_json = "1.0.113"
serde_json_path = { version = "0.6.4", default-features = false }
static-iref = { version = "2.0.0", optional = true }
teddybear-crypto = { workspace = true }
thiserror = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion crates/teddybear-vc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(feature = "query")]
pub mod query;
pub mod validation;

use chrono::{DateTime, FixedOffset, Utc};
use ssi_ldp::{LinkedDataProofOptions, ProofSuiteType};
Expand Down
Loading

0 comments on commit b880a96

Please sign in to comment.