Skip to content

Commit 866f7b3

Browse files
author
Sergey Kudryashov
committed
PR fixes
1 parent f2ba5a7 commit 866f7b3

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ map = "0.0.0"
1313
serde = { version = "1.0", features = ["derive"] }
1414

1515
[dev-dependencies]
16-
assert-json-diff = "2.0.2"
16+
assert-json-diff = "2.0.2"

core/src/credential.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ struct CredentialSubject {
3333

3434
#[derive(Debug, Serialize, Deserialize, Clone)]
3535
#[serde(bound(deserialize = "'de: 'static"))]
36-
pub struct Credential {
36+
pub struct VerifiableCredential {
3737
#[serde(flatten)]
38-
verifiable_credential:VerifiableCredential,
38+
credential:Credential,
3939
proof: IntegrityProof,
4040
}
4141

4242
#[derive(Debug, Serialize, Deserialize, Clone)]
4343
#[serde(bound(deserialize = "'de: 'static"))]
44-
pub struct VerifiableCredential {
44+
pub struct Credential {
4545
#[serde(rename = "@context")]
4646
context: VerificationContext,
4747
#[serde(rename = "@id")]
@@ -66,14 +66,14 @@ pub struct IntegrityProof {
6666
proof_value: String,
6767
}
6868

69-
impl VerifiableCredential {
69+
impl Credential {
7070
pub fn new (
7171
context: VerificationContext,
7272
cred_type: String,
7373
cred_subject: HashMap<String, Value>,
7474
property_set: HashMap<String, Value>, id: &str)
75-
-> VerifiableCredential {
76-
let vc = VerifiableCredential {
75+
-> Credential {
76+
let vc = Credential {
7777
context: context,
7878
id: id.to_string(),
7979
cred_type: cred_type.to_string(),

core/src/lib.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ pub trait DocumentBuilder {
3838
cred_subject: HashMap<String, Value>,
3939
property_set: HashMap<String, Value>,
4040
id: &str
41-
) -> Result<VerifiableCredential, Box<dyn std::error::Error>> {
42-
let vc = VerifiableCredential::new(CONTEXT_CREDENTIALS,
41+
) -> Result<Credential, Box<dyn std::error::Error>> {
42+
let vc = Credential::new(CONTEXT_CREDENTIALS,
4343
cred_type,
4444
cred_subject,
4545
property_set,
@@ -148,7 +148,6 @@ mod tests {
148148
},
149149
});
150150

151-
// let vc = serde_json::to_string("VerifiableCredential").unwrap();
152151
let type_rs = serde_json::to_value(["VerifiableCredential".to_string(), "PermanentResidentCard".to_string()]);
153152
if type_rs.is_ok() {
154153
kv_body.entry("type".to_string()).or_insert(type_rs.unwrap());
@@ -189,4 +188,4 @@ mod tests {
189188
assert_json_eq!(_expect, vc.unwrap());
190189
Ok(())
191190
}
192-
}
191+
}

0 commit comments

Comments
 (0)