File tree 3 files changed +10
-11
lines changed
3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ map = "0.0.0"
13
13
serde = { version = " 1.0" , features = [" derive" ] }
14
14
15
15
[dev-dependencies ]
16
- assert-json-diff = " 2.0.2"
16
+ assert-json-diff = " 2.0.2"
Original file line number Diff line number Diff line change @@ -33,15 +33,15 @@ struct CredentialSubject {
33
33
34
34
#[ derive( Debug , Serialize , Deserialize , Clone ) ]
35
35
#[ serde( bound( deserialize = "'de: 'static" ) ) ]
36
- pub struct Credential {
36
+ pub struct VerifiableCredential {
37
37
#[ serde( flatten) ]
38
- verifiable_credential : VerifiableCredential ,
38
+ credential : Credential ,
39
39
proof : IntegrityProof ,
40
40
}
41
41
42
42
#[ derive( Debug , Serialize , Deserialize , Clone ) ]
43
43
#[ serde( bound( deserialize = "'de: 'static" ) ) ]
44
- pub struct VerifiableCredential {
44
+ pub struct Credential {
45
45
#[ serde( rename = "@context" ) ]
46
46
context : VerificationContext ,
47
47
#[ serde( rename = "@id" ) ]
@@ -66,14 +66,14 @@ pub struct IntegrityProof {
66
66
proof_value : String ,
67
67
}
68
68
69
- impl VerifiableCredential {
69
+ impl Credential {
70
70
pub fn new (
71
71
context : VerificationContext ,
72
72
cred_type : String ,
73
73
cred_subject : HashMap < String , Value > ,
74
74
property_set : HashMap < String , Value > , id : & str )
75
- -> VerifiableCredential {
76
- let vc = VerifiableCredential {
75
+ -> Credential {
76
+ let vc = Credential {
77
77
context : context,
78
78
id : id. to_string ( ) ,
79
79
cred_type : cred_type. to_string ( ) ,
Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ pub trait DocumentBuilder {
38
38
cred_subject : HashMap < String , Value > ,
39
39
property_set : HashMap < String , Value > ,
40
40
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 ,
43
43
cred_type,
44
44
cred_subject,
45
45
property_set,
@@ -148,7 +148,6 @@ mod tests {
148
148
} ,
149
149
} ) ;
150
150
151
- // let vc = serde_json::to_string("VerifiableCredential").unwrap();
152
151
let type_rs = serde_json:: to_value ( [ "VerifiableCredential" . to_string ( ) , "PermanentResidentCard" . to_string ( ) ] ) ;
153
152
if type_rs. is_ok ( ) {
154
153
kv_body. entry ( "type" . to_string ( ) ) . or_insert ( type_rs. unwrap ( ) ) ;
@@ -189,4 +188,4 @@ mod tests {
189
188
assert_json_eq ! ( _expect, vc. unwrap( ) ) ;
190
189
Ok ( ( ) )
191
190
}
192
- }
191
+ }
You can’t perform that action at this time.
0 commit comments