Skip to content

Commit

Permalink
use ssi 0.10 as a single dependency
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Tate <ryan.tate@spruceid.com>
  • Loading branch information
Ryanmtate committed Dec 1, 2024
1 parent a802dfe commit c5097c9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 29 deletions.
8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ reqwest = ["oauth2/reqwest"]
[dependencies]
# TODO feature-gate
isomdl = { git = "https://github.com/spruceid/isomdl", rev = "90ce218" }

ssi-claims = "0.1.1"
ssi-dids-core = "0.1.1"
ssi-jwk = "0.3.0"
ssi = { version = "0.10.1", features = ["secp256r1"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_with = "3.3.0"
Expand All @@ -39,8 +36,5 @@ percent-encoding = "2.3.1"

[dev-dependencies]
assert-json-diff = "2.0.2"
did-jwk = "0.2.1"
did-method-key = "0.3.1"
ssi-verification-methods = "0.1.2"
tokio = { version = "1.25.0", features = ["macros"] }
oid4vci = { path = ".", features = ["reqwest"] }
4 changes: 2 additions & 2 deletions src/core/profiles/jwt_vc_json/credential_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::{CredentialSubjectClaims, Format};
pub struct CredentialConfiguration {
format: Format,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
credential_signing_alg_values_supported: Vec<ssi_jwk::Algorithm>,
credential_signing_alg_values_supported: Vec<ssi::jwk::Algorithm>,
credential_definition: CredentialDefinition,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
order: Vec<String>,
Expand All @@ -21,7 +21,7 @@ pub struct CredentialConfiguration {
impl CredentialConfiguration {
field_getters_setters![
pub self [self] ["JWT VC metadata value"] {
set_credential_signing_alg_values_supported -> credential_signing_alg_values_supported[Vec<ssi_jwk::Algorithm>],
set_credential_signing_alg_values_supported -> credential_signing_alg_values_supported[Vec<ssi::jwk::Algorithm>],
set_credential_definition -> credential_definition[CredentialDefinition],
set_order -> order[Vec<String>],
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/profiles/jwt_vc_json/credential_response.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use ssi_claims::JwsBuf;
use ssi::claims::JwsBuf;

use crate::profiles::CredentialResponseProfile;

Expand Down
2 changes: 1 addition & 1 deletion src/credential_response_encryption.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use ssi_jwk::JWK;
use ssi::jwk::JWK;

pub use crate::types::{BatchCredentialUrl, CredentialUrl, DeferredCredentialUrl, ParUrl};

Expand Down
4 changes: 2 additions & 2 deletions src/custom/profiles/vc_sd_jwt/credential_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::{Claims, Format};
pub struct CredentialConfiguration {
format: Format,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
credential_signing_alg_values_supported: Vec<ssi_jwk::Algorithm>,
credential_signing_alg_values_supported: Vec<ssi::jwk::Algorithm>,
#[serde(default, skip_serializing_if = "Option::is_none")]
claims: Option<Claims<CredentialConfigurationClaim>>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
Expand All @@ -28,7 +28,7 @@ impl CredentialConfiguration {

field_getters_setters![
pub self [self] ["VC SD-JWT metadata value"] {
set_credential_signing_alg_values_supported -> credential_signing_alg_values_supported[Vec<ssi_jwk::Algorithm>],
set_credential_signing_alg_values_supported -> credential_signing_alg_values_supported[Vec<ssi::jwk::Algorithm>],
set_order -> order[Vec<String>],
set_vct -> vct[String],
set_claims -> claims[Option<Claims<CredentialConfigurationClaim>>],
Expand Down
2 changes: 1 addition & 1 deletion src/custom/profiles/vc_sd_jwt/credential_response.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use ssi_claims::sd_jwt::SdJwtBuf;
use ssi::claims::sd_jwt::SdJwtBuf;

use crate::profiles::CredentialResponseProfile;

Expand Down
29 changes: 14 additions & 15 deletions src/proof_of_possession.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;
use ssi_claims::{
use ssi::claims::{
jws::{self, Header},
jwt,
};
use ssi_dids_core::DIDURLBuf;
use ssi_jwk::{Algorithm, JWKResolver, JWK};
use ssi::dids::DIDURLBuf;
use ssi::jwk::{Algorithm, JWKResolver, JWK};
use time::{Duration, OffsetDateTime};
use url::Url;

use crate::types::Nonce;

const JWS_TYPE: &str = "openid4vci-proof+jwt";

pub type ProofSigningAlgValuesSupported = Vec<ssi_jwk::Algorithm>;
pub type ProofSigningAlgValuesSupported = Vec<ssi::jwk::Algorithm>;

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct KeyProofTypesSupported {
#[serde(rename = "$key$")]
key: KeyProofType,
proof_signing_alg_values_supported: Vec<ssi_jwk::Algorithm>,
proof_signing_alg_values_supported: Vec<ssi::jwk::Algorithm>,
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
Expand Down Expand Up @@ -121,15 +121,15 @@ pub enum ConversionError {
#[error(transparent)]
SerializationError(#[from] serde_json::Error),
#[error(transparent)]
SigningError(#[from] ssi_claims::jws::Error),
SigningError(#[from] ssi::claims::jws::Error),
#[error("Unable to select JWT algorithm, please specify in JWK")]
MissingJWKAlg,
}

#[derive(thiserror::Error, Debug)]
pub enum ParsingError {
#[error(transparent)]
InvalidJWS(#[from] ssi_claims::jws::Error),
InvalidJWS(#[from] ssi::claims::jws::Error),
#[error("JWS type header is invalid, expected `{expected}`, found `{actual}`")]
InvalidJWSType { actual: String, expected: String },
#[error("JWS does not specify an algorithm")]
Expand All @@ -141,11 +141,11 @@ pub enum ParsingError {
#[error("Could not retrieve JWK from KID: {0}")]
KIDDereferenceError(String),
#[error(transparent)]
DIDDereferenceError(#[from] ssi_dids_core::resolution::Error),
DIDDereferenceError(#[from] ssi::dids::resolution::Error),
#[error(transparent)]
InvalidDIDURL(#[from] ssi_dids_core::InvalidDIDURL<String>),
InvalidDIDURL(#[from] ssi::dids::InvalidDIDURL<String>),
#[error(transparent)]
ProofValidationError(#[from] ssi_claims::ProofValidationError),
ProofValidationError(#[from] ssi::claims::ProofValidationError),
}

impl ProofOfPossession {
Expand Down Expand Up @@ -309,12 +309,11 @@ impl ProofOfPossession {

#[cfg(test)]
mod test {
use did_jwk::DIDJWK;
use did_method_key::DIDKey;
use serde_json::json;
use ssi_dids_core::{DIDResolver, VerificationMethodDIDResolver};
use ssi_jwk::JWK;
use ssi_verification_methods::AnyMethod;
use ssi::dids::jwk::DIDJWK;
use ssi::dids::{DIDKey, DIDResolver, VerificationMethodDIDResolver};
use ssi::jwk::JWK;
use ssi::prelude::AnyMethod;

use super::*;

Expand Down

0 comments on commit c5097c9

Please sign in to comment.