-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Status field to Issuance Offer and Credential
- Loading branch information
1 parent
129b6b2
commit f62388e
Showing
19 changed files
with
124 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ pub mod command; | |
pub mod entity; | ||
pub mod error; | ||
pub mod event; | ||
pub mod queries; | ||
pub mod views; |
2 changes: 1 addition & 1 deletion
2
...src/credential/queries/all_credentials.rs → ...e/src/credential/views/all_credentials.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ pub mod command; | |
pub mod error; | ||
pub mod event; | ||
pub mod queries; | ||
pub mod views; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,2 @@ | ||
pub mod access_token; | ||
pub mod all_offers; | ||
pub mod pre_authorized_code; | ||
|
||
use super::event::OfferEvent; | ||
use crate::offer::aggregate::Offer; | ||
use cqrs_es::{persist::ViewRepository, EventEnvelope, View}; | ||
use oid4vci::{ | ||
credential_offer::CredentialOffer, credential_response::CredentialResponse, token_response::TokenResponse, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Default, Serialize, Deserialize, Clone)] | ||
pub struct OfferView { | ||
pub credential_offer: Option<CredentialOffer>, | ||
pub subject_id: Option<String>, | ||
pub credential_ids: Vec<String>, | ||
pub pre_authorized_code: String, | ||
pub access_token: String, | ||
pub form_url_encoded_credential_offer: String, | ||
pub token_response: Option<TokenResponse>, | ||
pub credential_response: Option<CredentialResponse>, | ||
} | ||
|
||
impl View<Offer> for OfferView { | ||
fn update(&mut self, event: &EventEnvelope<Offer>) { | ||
use crate::offer::event::OfferEvent::*; | ||
|
||
match &event.payload { | ||
CredentialOfferCreated { | ||
pre_authorized_code, | ||
access_token, | ||
.. | ||
} => { | ||
self.pre_authorized_code.clone_from(pre_authorized_code); | ||
self.access_token.clone_from(access_token) | ||
} | ||
CredentialsAdded { | ||
credential_ids: credential_id, | ||
.. | ||
} => { | ||
self.credential_ids.clone_from(credential_id); | ||
} | ||
FormUrlEncodedCredentialOfferCreated { | ||
form_url_encoded_credential_offer, | ||
.. | ||
} => self | ||
.form_url_encoded_credential_offer | ||
.clone_from(form_url_encoded_credential_offer), | ||
CredentialOfferSent { .. } => {} | ||
CredentialRequestVerified { subject_id, .. } => { | ||
self.subject_id.replace(subject_id.clone()); | ||
} | ||
TokenResponseCreated { token_response, .. } => { | ||
self.token_response.replace(token_response.clone()); | ||
} | ||
CredentialResponseCreated { | ||
credential_response, .. | ||
} => { | ||
self.credential_response.replace(credential_response.clone()); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.