Skip to content

Commit

Permalink
Merge pull request #177 from alan-turing-institute/175-qr-code
Browse files Browse the repository at this point in the history
Update QR code data model (#175)
  • Loading branch information
sgreenbury authored Apr 24, 2024
2 parents 070a91a + 1c649f9 commit 8ffe5f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions trustchain-http/src/issuer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ impl TrustchainIssuerHTTPHandler {
let qr_code_str = if http_config().verifiable_endpoints.unwrap_or(true) {
serde_json::to_string(&DIDQRCode {
did,
route: "/vc/issuer/".to_string(),
id,
service: "TrustchainHTTP".to_string(),
relative_ref: Some(format!("/vc/issuer/{id}")),
})
.unwrap()
} else {
Expand Down Expand Up @@ -174,8 +174,8 @@ impl TrustchainIssuerHTTPHandler {
let qr_code_str = if http_config().verifiable_endpoints.unwrap_or(true) {
serde_json::to_string(&DIDQRCode {
did,
route: "/vc_rss/issuer/".to_string(),
id,
service: "TrustchainHTTP".to_string(),
relative_ref: Some(format!("/vc_rss/issuer/{id}")),
})
.unwrap()
} else {
Expand Down
10 changes: 5 additions & 5 deletions trustchain-http/src/qrcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use serde::{Deserialize, Serialize};
#[serde(rename_all = "camelCase")]
/// QR code JSON type of verifiable content.
pub(crate) struct DIDQRCode {
/// DID for issuance and/or verifier endpoint resolution.
/// DID
pub did: String,
/// HTTP route for making issuer or verifer requests.
pub route: String,
/// ID for identifying credential offer or presentation request.
pub id: String,
/// DID `service` parameter (see [W3C spec](https://www.w3.org/TR/did-core/#did-parameters)).
pub service: String,
/// DID `relativeRef` parameter (see [W3C spec](https://www.w3.org/TR/did-core/#did-parameters)).
pub relative_ref: Option<String>,
}

pub fn image_to_base64_string(image: &DynamicImage) -> String {
Expand Down
4 changes: 2 additions & 2 deletions trustchain-http/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ impl TrustchainVerifierHTTPHandler {
let qr_code_str = if http_config().verifiable_endpoints.unwrap_or(true) {
serde_json::to_string(&DIDQRCode {
did: app_state.config.server_did.as_ref().unwrap().to_owned(),
route: "/vc/verifier/".to_string(),
id: uid.to_owned(),
service: "TrustchainHTTP".to_string(),
relative_ref: Some(format!("/vc/verifier/{uid}")),
})
.unwrap()
} else {
Expand Down

0 comments on commit 8ffe5f5

Please sign in to comment.