diff --git a/Cargo.toml b/Cargo.toml index cb082991..cd6dba2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,6 +33,7 @@ getset = "0.1" # TODO: Fix these dependencies once publishing to crates.io is automated. [dependencies] +oid4vc-core = { path = "oid4vc-core" } oid4vci = { path = "oid4vci" } oid4vp = { path = "oid4vp" } siopv2 = { path = "siopv2" } diff --git a/oid4vc-core/src/jwt.rs b/oid4vc-core/src/jwt.rs index 50492d1d..0e4ff0a2 100644 --- a/oid4vc-core/src/jwt.rs +++ b/oid4vc-core/src/jwt.rs @@ -79,7 +79,7 @@ where mod tests { use super::*; use crate::{ - test_utils::{MockSubject, MockVerifier}, + test_utils::{MockVerifier, TestSubject}, Verify, }; use serde_json::{json, Value}; @@ -94,7 +94,7 @@ mod tests { "iat": 1593436422, "nonce": "nonce", }); - let subject = MockSubject::new("did:mock:123".to_string(), "key_id".to_string()).unwrap(); + let subject = TestSubject::new("did:test:123".to_string(), "key_id".to_string()).unwrap(); let encoded = encode(Arc::new(subject), claims).await.unwrap(); let verifier = MockVerifier::new(); diff --git a/oid4vc-core/src/test_utils.rs b/oid4vc-core/src/test_utils.rs index 5da16a73..0e9147df 100644 --- a/oid4vc-core/src/test_utils.rs +++ b/oid4vc-core/src/test_utils.rs @@ -8,20 +8,20 @@ use rand::rngs::OsRng; // Keypair for mocking purposes. lazy_static! { - pub static ref MOCK_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); + pub static ref TEST_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); } #[derive(Derivative)] #[derivative(Default)] -pub struct MockSubject { - #[derivative(Default(value = "did_url::DID::parse(\"did:mock:123\").unwrap()"))] +pub struct TestSubject { + #[derivative(Default(value = "did_url::DID::parse(\"did:test:123\").unwrap()"))] pub did: did_url::DID, pub key_id: String, } -impl MockSubject { +impl TestSubject { pub fn new(did: String, key_id: String) -> Result { - Ok(MockSubject { + Ok(TestSubject { did: did_url::DID::parse(did)?, key_id, }) @@ -29,25 +29,25 @@ impl MockSubject { } #[async_trait] -impl Sign for MockSubject { +impl Sign for TestSubject { fn key_id(&self) -> Option { Some(self.key_id.clone()) } async fn sign(&self, message: &str) -> Result> { - let signature: Signature = MOCK_KEYPAIR.sign(message.as_bytes()); + let signature: Signature = TEST_KEYPAIR.sign(message.as_bytes()); Ok(signature.to_bytes().to_vec()) } } #[async_trait] -impl Verify for MockSubject { +impl Verify for TestSubject { async fn public_key(&self, _kid: &str) -> Result> { - Ok(MOCK_KEYPAIR.public.to_bytes().to_vec()) + Ok(TEST_KEYPAIR.public.to_bytes().to_vec()) } } -impl Subject for MockSubject { +impl Subject for TestSubject { fn identifier(&self) -> Result { Ok(self.did.to_string()) } @@ -64,6 +64,6 @@ impl MockVerifier { #[async_trait] impl Verify for MockVerifier { async fn public_key(&self, _kid: &str) -> Result> { - Ok(MOCK_KEYPAIR.public.to_bytes().to_vec()) + Ok(TEST_KEYPAIR.public.to_bytes().to_vec()) } } diff --git a/oid4vc-manager/src/managers/presentation.rs b/oid4vc-manager/src/managers/presentation.rs index dfa38108..a462bdfc 100644 --- a/oid4vc-manager/src/managers/presentation.rs +++ b/oid4vc-manager/src/managers/presentation.rs @@ -4,7 +4,8 @@ use oid4vp::{ PresentationSubmission, }; -/// Takes a [`PresentationDefinition`] and a credential and creates a [`PresentationSubmission`] from it if the credential . +/// Takes a [`PresentationDefinition`] and a credential and creates a [`PresentationSubmission`] from it if the +/// credential meets the requirements. // TODO: make VP/VC fromat agnostic. In current form only jwt_vp_json + jwt_vc_json are supported. pub fn create_presentation_submission( presentation_definition: &PresentationDefinition, diff --git a/oid4vc-manager/tests/common/mod.rs b/oid4vc-manager/tests/common/mod.rs index 04f568e1..70c2d011 100644 --- a/oid4vc-manager/tests/common/mod.rs +++ b/oid4vc-manager/tests/common/mod.rs @@ -10,20 +10,20 @@ use siopv2::{StandardClaimsRequests, StandardClaimsValues}; // Keypair for mocking purposes. lazy_static! { - pub static ref MOCK_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); + pub static ref TEST_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); } #[derive(Derivative)] #[derivative(Default)] -pub struct MockSubject { - #[derivative(Default(value = "did_url::DID::parse(\"did:mock:123\").unwrap()"))] +pub struct TestSubject { + #[derivative(Default(value = "did_url::DID::parse(\"did:test:123\").unwrap()"))] pub did: did_url::DID, pub key_id: String, } -impl MockSubject { +impl TestSubject { pub fn new(did: String, key_id: String) -> Result { - Ok(MockSubject { + Ok(TestSubject { did: did_url::DID::parse(did)?, key_id, }) @@ -31,25 +31,25 @@ impl MockSubject { } #[async_trait] -impl Sign for MockSubject { +impl Sign for TestSubject { fn key_id(&self) -> Option { Some(self.key_id.clone()) } async fn sign(&self, message: &str) -> Result> { - let signature: Signature = MOCK_KEYPAIR.sign(message.as_bytes()); + let signature: Signature = TEST_KEYPAIR.sign(message.as_bytes()); Ok(signature.to_bytes().to_vec()) } } #[async_trait] -impl Verify for MockSubject { +impl Verify for TestSubject { async fn public_key(&self, _kid: &str) -> Result> { - Ok(MOCK_KEYPAIR.public.to_bytes().to_vec()) + Ok(TEST_KEYPAIR.public.to_bytes().to_vec()) } } -impl Subject for MockSubject { +impl Subject for TestSubject { fn identifier(&self) -> Result { Ok(self.did.to_string()) } @@ -66,7 +66,7 @@ impl MockVerifier { #[async_trait] impl Verify for MockVerifier { async fn public_key(&self, _kid: &str) -> Result> { - Ok(MOCK_KEYPAIR.public.to_bytes().to_vec()) + Ok(TEST_KEYPAIR.public.to_bytes().to_vec()) } } diff --git a/oid4vc-manager/tests/siopv2/implicit.rs b/oid4vc-manager/tests/siopv2/implicit.rs index 8cc4d0e0..8404fd90 100644 --- a/oid4vc-manager/tests/siopv2/implicit.rs +++ b/oid4vc-manager/tests/siopv2/implicit.rs @@ -1,4 +1,4 @@ -use crate::common::{MemoryStorage, MockSubject, Storage}; +use crate::common::{MemoryStorage, Storage, TestSubject}; use chrono::{Duration, Utc}; use lazy_static::lazy_static; use oid4vc_core::{DidMethod, SubjectSyntaxType}; @@ -52,9 +52,9 @@ async fn test_implicit_flow() { let server_url = mock_server.uri(); // Create a new subject. - let subject = MockSubject::new( - "did:mock:relying_party".to_string(), - "did:mock:relying_party#key_id".to_string(), + let subject = TestSubject::new( + "did:test:relying_party".to_string(), + "did:test:relying_party#key_id".to_string(), ) .unwrap(); @@ -64,14 +64,14 @@ async fn test_implicit_flow() { // Create a new RequestUrl with response mode `post` for cross-device communication. let request: AuthorizationRequest = RequestUrl::builder() .response_type(ResponseType::IdToken) - .client_id("did:mock:relyingparty".to_string()) + .client_id("did:test:relyingparty".to_string()) .scope(Scope::from(vec![ScopeValue::OpenId, ScopeValue::Phone])) .redirect_uri(format!("{server_url}/redirect_uri")) .response_mode("post".to_string()) .client_metadata( ClientMetadata::default() .with_subject_syntax_types_supported(vec![SubjectSyntaxType::Did( - DidMethod::from_str("did:mock").unwrap(), + DidMethod::from_str("did:test").unwrap(), )]) .with_id_token_signing_alg_values_supported(vec!["EdDSA".to_string()]), ) @@ -111,14 +111,14 @@ async fn test_implicit_flow() { let storage = MemoryStorage::new(serde_json::from_value(USER_CLAIMS.clone()).unwrap()); // Create a new subject and validator. - let subject = MockSubject::new("did:mock:subject".to_string(), "did:mock:subject#key_id".to_string()).unwrap(); + let subject = TestSubject::new("did:test:subject".to_string(), "did:test:subject#key_id".to_string()).unwrap(); // Create a new provider manager. let provider_manager = ProviderManager::new([Arc::new(subject)]).unwrap(); // Create a new RequestUrl which includes a `request_uri` pointing to the mock server's `request_uri` endpoint. let request_url = RequestUrl::builder() - .client_id("did:mock:relyingparty".to_string()) + .client_id("did:test:relyingparty".to_string()) .request_uri(format!("{server_url}/request_uri")) .build() .unwrap(); diff --git a/oid4vp/tests/examples/credentials/jwt_vc.json b/oid4vp/tests/examples/credentials/jwt_vc.json index 42944ee0..ec364f77 100644 --- a/oid4vp/tests/examples/credentials/jwt_vc.json +++ b/oid4vp/tests/examples/credentials/jwt_vc.json @@ -24,4 +24,4 @@ } } } -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/request/pd_ac_vc.json b/oid4vp/tests/examples/request/pd_ac_vc.json index 568176f7..7a4fc26e 100644 --- a/oid4vp/tests/examples/request/pd_ac_vc.json +++ b/oid4vp/tests/examples/request/pd_ac_vc.json @@ -25,4 +25,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/request/pd_ac_vc_sd.json b/oid4vp/tests/examples/request/pd_ac_vc_sd.json index b5483360..df26db69 100644 --- a/oid4vp/tests/examples/request/pd_ac_vc_sd.json +++ b/oid4vp/tests/examples/request/pd_ac_vc_sd.json @@ -1,39 +1,39 @@ { - "id": "example_vc_ac_sd", - "input_descriptors": [ - { - "id": "id_credential", - "format": { - "ac_vc": { - "proof_type": [ - "CLSignature2019" - ] - } - }, - "constraints": { - "limit_disclosure": "required", - "fields": [ - { - "path": [ - "$.schema_id" - ], - "filter": { - "type": "string", - "const": "did:indy:idu:test:3QowxFtwciWceMFr7WbwnM:2:BasicScheme:0\\.1" - } - }, - { - "path": [ - "$.values.first_name" - ] - }, - { - "path": [ - "$.values.last_name" - ] - } - ] - } - } - ] - } \ No newline at end of file + "id": "example_vc_ac_sd", + "input_descriptors": [ + { + "id": "id_credential", + "format": { + "ac_vc": { + "proof_type": [ + "CLSignature2019" + ] + } + }, + "constraints": { + "limit_disclosure": "required", + "fields": [ + { + "path": [ + "$.schema_id" + ], + "filter": { + "type": "string", + "const": "did:indy:idu:test:3QowxFtwciWceMFr7WbwnM:2:BasicScheme:0\\.1" + } + }, + { + "path": [ + "$.values.first_name" + ] + }, + { + "path": [ + "$.values.last_name" + ] + } + ] + } + } + ] +} diff --git a/oid4vp/tests/examples/request/pd_jwt_vc.json b/oid4vp/tests/examples/request/pd_jwt_vc.json index 7492cace..2abc2fef 100644 --- a/oid4vp/tests/examples/request/pd_jwt_vc.json +++ b/oid4vp/tests/examples/request/pd_jwt_vc.json @@ -27,4 +27,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/request/pd_ldp_vc.json b/oid4vp/tests/examples/request/pd_ldp_vc.json index 9a09cb4b..ecb0702a 100644 --- a/oid4vp/tests/examples/request/pd_ldp_vc.json +++ b/oid4vp/tests/examples/request/pd_ldp_vc.json @@ -27,4 +27,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/request/pd_mdl_iso_cbor.json b/oid4vp/tests/examples/request/pd_mdl_iso_cbor.json index 5860b59c..b459f663 100644 --- a/oid4vp/tests/examples/request/pd_mdl_iso_cbor.json +++ b/oid4vp/tests/examples/request/pd_mdl_iso_cbor.json @@ -54,4 +54,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/request/vp_token_type_and_claims.json b/oid4vp/tests/examples/request/vp_token_type_and_claims.json index 4061120c..ce6b4da0 100644 --- a/oid4vp/tests/examples/request/vp_token_type_and_claims.json +++ b/oid4vp/tests/examples/request/vp_token_type_and_claims.json @@ -41,4 +41,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/request/vp_token_type_only.json b/oid4vp/tests/examples/request/vp_token_type_only.json index 11579959..f1a74b1e 100644 --- a/oid4vp/tests/examples/request/vp_token_type_only.json +++ b/oid4vp/tests/examples/request/vp_token_type_only.json @@ -25,4 +25,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/response/presentation_submission.json b/oid4vp/tests/examples/response/presentation_submission.json index f0ddfa2f..6761f279 100644 --- a/oid4vp/tests/examples/response/presentation_submission.json +++ b/oid4vp/tests/examples/response/presentation_submission.json @@ -12,4 +12,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/response/presentation_submission_multiple_vps.json b/oid4vp/tests/examples/response/presentation_submission_multiple_vps.json index 30c0128d..e9e95d36 100644 --- a/oid4vp/tests/examples/response/presentation_submission_multiple_vps.json +++ b/oid4vp/tests/examples/response/presentation_submission_multiple_vps.json @@ -21,4 +21,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/response/ps_ac_vc_sd.json b/oid4vp/tests/examples/response/ps_ac_vc_sd.json index 59eee37c..1f209413 100644 --- a/oid4vp/tests/examples/response/ps_ac_vc_sd.json +++ b/oid4vp/tests/examples/response/ps_ac_vc_sd.json @@ -12,4 +12,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/response/ps_jwt_vc.json b/oid4vp/tests/examples/response/ps_jwt_vc.json index bb16f172..fb018c8d 100644 --- a/oid4vp/tests/examples/response/ps_jwt_vc.json +++ b/oid4vp/tests/examples/response/ps_jwt_vc.json @@ -2,14 +2,14 @@ "definition_id": "example_jwt_vc", "id": "example_jwt_vc_presentation_submission", "descriptor_map": [ - { - "id": "id_credential", - "path": "$", - "format": "jwt_vp_json", - "path_nested": { - "path": "$.vp.verifiableCredential[0]", - "format": "jwt_vc_json" + { + "id": "id_credential", + "path": "$", + "format": "jwt_vp_json", + "path_nested": { + "path": "$.vp.verifiableCredential[0]", + "format": "jwt_vc_json" + } } - } ] - } \ No newline at end of file +} diff --git a/oid4vp/tests/examples/response/ps_ldp_vc.json b/oid4vp/tests/examples/response/ps_ldp_vc.json index a859d56d..40cc14f9 100644 --- a/oid4vp/tests/examples/response/ps_ldp_vc.json +++ b/oid4vp/tests/examples/response/ps_ldp_vc.json @@ -12,4 +12,4 @@ } } ] -} \ No newline at end of file +} diff --git a/oid4vp/tests/examples/response/ps_mdl_iso_cbor.json b/oid4vp/tests/examples/response/ps_mdl_iso_cbor.json index 4d0e6c8f..7435928b 100644 --- a/oid4vp/tests/examples/response/ps_mdl_iso_cbor.json +++ b/oid4vp/tests/examples/response/ps_mdl_iso_cbor.json @@ -8,4 +8,4 @@ "path": "$" } ] -} \ No newline at end of file +} diff --git a/siopv2/Cargo.toml b/siopv2/Cargo.toml index 769e52a0..0d5503ea 100644 --- a/siopv2/Cargo.toml +++ b/siopv2/Cargo.toml @@ -37,4 +37,3 @@ rand = "0.7" lazy_static = "1.4.0" derivative = "2.2.0" wiremock = "0.5.18" - diff --git a/siopv2/README.md b/siopv2/README.md index bda09d97..11eef884 100644 --- a/siopv2/README.md +++ b/siopv2/README.md @@ -42,7 +42,7 @@ use wiremock::{ }; lazy_static! { - pub static ref MOCK_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); + pub static ref TEST_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); } // A Subject type that can be ingested by a Provider @@ -66,7 +66,7 @@ impl Subject for MySubject { } async fn sign<'a>(&self, message: &'a str) -> Result> { - let signature: Signature = MOCK_KEYPAIR.sign(message.as_bytes()); + let signature: Signature = TEST_KEYPAIR.sign(message.as_bytes()); Ok(signature.to_bytes().to_vec()) } } @@ -74,7 +74,7 @@ impl Subject for MySubject { #[async_trait] impl Validator for MySubject { async fn public_key<'a>(&self, _kid: &'a str) -> Result> { - Ok(MOCK_KEYPAIR.public.to_bytes().to_vec()) + Ok(TEST_KEYPAIR.public.to_bytes().to_vec()) } } @@ -85,7 +85,7 @@ pub struct MyValidator; #[async_trait] impl Validator for MyValidator { async fn public_key<'a>(&self, _kid: &'a str) -> Result> { - Ok(MOCK_KEYPAIR.public.to_bytes().to_vec()) + Ok(TEST_KEYPAIR.public.to_bytes().to_vec()) } } diff --git a/siopv2/src/client_metadata.rs b/siopv2/src/client_metadata.rs index 132fcdd4..4001099c 100644 --- a/siopv2/src/client_metadata.rs +++ b/siopv2/src/client_metadata.rs @@ -69,7 +69,7 @@ mod tests { &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb\ &response_mode=post\ &client_metadata=%7B%22subject_syntax_types_supported%22%3A\ - %5B%22did%3Amock%22%5D%2C%0A%20%20%20%20\ + %5B%22did%3Atest%22%5D%2C%0A%20%20%20%20\ %22id_token_signing_alg_values_supported%22%3A%5B%22EdDSA%22%5D%7D\ &nonce=n-0S6_WzA2Mj\ ", diff --git a/siopv2/src/provider.rs b/siopv2/src/provider.rs index 465a264e..e81e254a 100644 --- a/siopv2/src/provider.rs +++ b/siopv2/src/provider.rs @@ -130,14 +130,14 @@ impl Provider { #[cfg(test)] mod tests { use super::*; - use crate::test_utils::MockSubject; + use crate::test_utils::TestSubject; use oid4vc_core::{SubjectSyntaxType, Validator, Validators}; use std::str::FromStr; #[tokio::test] async fn test_provider() { // Create a new subject and validator. - let subject = MockSubject::new("did:mock:123".to_string(), "key_id".to_string()).unwrap(); + let subject = TestSubject::new("did:test:123".to_string(), "key_id".to_string()).unwrap(); // Create a new provider. let provider = Provider::new(Arc::new(subject)).unwrap(); @@ -151,7 +151,7 @@ mod tests { &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb\ &response_mode=post\ &client_metadata=%7B%22subject_syntax_types_supported%22%3A\ - %5B%22did%3Amock%22%5D%2C%0A%20%20%20%20\ + %5B%22did%3Atest%22%5D%2C%0A%20%20%20%20\ %22id_token_signing_alg_values_supported%22%3A%5B%22EdDSA%22%5D%7D\ &nonce=n-0S6_WzA2Mj\ "; @@ -162,8 +162,8 @@ mod tests { request_url.parse().unwrap(), Decoder { validators: Validators::from([( - SubjectSyntaxType::from_str("did:mock").unwrap(), - Arc::new(Validator::Subject(Arc::new(MockSubject::default()) as Arc)), + SubjectSyntaxType::from_str("did:test").unwrap(), + Arc::new(Validator::Subject(Arc::new(TestSubject::default()) as Arc)), )]), }, ) diff --git a/siopv2/src/request/mod.rs b/siopv2/src/request/mod.rs index 7f32d682..7d774248 100644 --- a/siopv2/src/request/mod.rs +++ b/siopv2/src/request/mod.rs @@ -41,7 +41,7 @@ pub mod request_builder; /// &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb\ /// &response_mode=post\ /// &client_metadata=%7B%22subject_syntax_types_supported%22%3A\ -/// %5B%22did%3Amock%22%5D%2C%0A%20%20%20%20\ +/// %5B%22did%3Atest%22%5D%2C%0A%20%20%20%20\ /// %22id_token_signing_alg_values_supported%22%3A%5B%22EdDSA%22%5D%7D\ /// &nonce=n-0S6_WzA2Mj\ /// ", @@ -220,7 +220,7 @@ mod tests { &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb\ &response_mode=post\ &client_metadata=%7B%22subject_syntax_types_supported%22%3A\ - %5B%22did%3Amock%22%5D%2C%0A%20%20%20%20\ + %5B%22did%3Atest%22%5D%2C%0A%20%20%20%20\ %22id_token_signing_alg_values_supported%22%3A%5B%22EdDSA%22%5D%7D\ &nonce=n-0S6_WzA2Mj\ ", @@ -243,7 +243,7 @@ mod tests { client_metadata: Some( ClientMetadata::default() .with_subject_syntax_types_supported(vec![SubjectSyntaxType::Did( - DidMethod::from_str("did:mock").unwrap() + DidMethod::from_str("did:test").unwrap() )]) .with_id_token_signing_alg_values_supported(vec!["EdDSA".to_string()]), ), @@ -286,7 +286,7 @@ mod tests { &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb\ &response_mode=post\ &client_metadata=%7B%22subject_syntax_types_supported%22%3A\ - %5B%22did%3Amock%22%5D%2C%0A%20%20%20%20\ + %5B%22did%3Atest%22%5D%2C%0A%20%20%20%20\ %22id_token_signing_alg_values_supported%22%3A%5B%22EdDSA%22%5D%7D\ &nonce=n-0S6_WzA2Mj\ &request_uri=https://example.com/request_uri\ diff --git a/siopv2/src/test_utils.rs b/siopv2/src/test_utils.rs index 2ab82e96..6a244211 100644 --- a/siopv2/src/test_utils.rs +++ b/siopv2/src/test_utils.rs @@ -9,20 +9,20 @@ use rand::rngs::OsRng; // Keypair for mocking purposes. lazy_static! { - pub static ref MOCK_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); + pub static ref TEST_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); } #[derive(Derivative)] #[derivative(Default)] -pub struct MockSubject { - #[derivative(Default(value = "did_url::DID::parse(\"did:mock:123\").unwrap()"))] +pub struct TestSubject { + #[derivative(Default(value = "did_url::DID::parse(\"did:test:123\").unwrap()"))] pub did: did_url::DID, pub key_id: String, } -impl MockSubject { +impl TestSubject { pub fn new(did: String, key_id: String) -> Result { - Ok(MockSubject { + Ok(TestSubject { did: did_url::DID::parse(did)?, key_id, }) @@ -30,25 +30,25 @@ impl MockSubject { } #[async_trait] -impl Sign for MockSubject { +impl Sign for TestSubject { fn key_id(&self) -> Option { Some(self.key_id.clone()) } async fn sign(&self, message: &str) -> Result> { - let signature: Signature = MOCK_KEYPAIR.sign(message.as_bytes()); + let signature: Signature = TEST_KEYPAIR.sign(message.as_bytes()); Ok(signature.to_bytes().to_vec()) } } #[async_trait] -impl Verify for MockSubject { +impl Verify for TestSubject { async fn public_key(&self, _kid: &str) -> Result> { - Ok(MOCK_KEYPAIR.public.to_bytes().to_vec()) + Ok(TEST_KEYPAIR.public.to_bytes().to_vec()) } } -impl Subject for MockSubject { +impl Subject for TestSubject { fn identifier(&self) -> Result { Ok(self.did.to_string()) } @@ -65,7 +65,7 @@ impl MockVerifier { #[async_trait] impl Verify for MockVerifier { async fn public_key(&self, _kid: &str) -> Result> { - Ok(MOCK_KEYPAIR.public.to_bytes().to_vec()) + Ok(TEST_KEYPAIR.public.to_bytes().to_vec()) } } diff --git a/src/lib.rs b/src/lib.rs index 2f6abae1..2fe59b77 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ +pub use dif_presentation_exchange; +pub use oid4vc_core; pub use oid4vc_manager; pub use oid4vci; pub use oid4vp; pub use siopv2; - -pub use dif_presentation_exchange;