@@ -2,7 +2,10 @@ use serde_json;
2
2
use serde_json:: Value ;
3
3
4
4
use error:: prelude:: * ;
5
- use messages:: proofs:: proof_message:: { CredInfo , get_credential_info} ;
5
+ use messages:: proofs:: proof_message:: {
6
+ CredInfoVerifier ,
7
+ get_credential_info
8
+ } ;
6
9
use object_cache:: ObjectCache ;
7
10
use settings;
8
11
use settings:: get_config_value;
@@ -37,7 +40,7 @@ fn validate_proof_revealed_attributes(proof_json: &str) -> VcxResult<()> {
37
40
Ok ( ( ) )
38
41
}
39
42
40
- fn build_credential_defs_json ( credential_data : & Vec < CredInfo > ) -> VcxResult < String > {
43
+ fn build_cred_defs_json_verifier ( credential_data : & Vec < CredInfoVerifier > ) -> VcxResult < String > {
41
44
debug ! ( "building credential_def_json for proof validation" ) ;
42
45
let mut credential_json = json ! ( { } ) ;
43
46
@@ -55,7 +58,7 @@ fn build_credential_defs_json(credential_data: &Vec<CredInfo>) -> VcxResult<Stri
55
58
Ok ( credential_json. to_string ( ) )
56
59
}
57
60
58
- fn build_schemas_json ( credential_data : & Vec < CredInfo > ) -> VcxResult < String > {
61
+ fn build_schemas_json_verifier ( credential_data : & Vec < CredInfoVerifier > ) -> VcxResult < String > {
59
62
debug ! ( "building schemas json for proof validation" ) ;
60
63
61
64
let mut schemas_json = json ! ( { } ) ;
@@ -75,7 +78,7 @@ fn build_schemas_json(credential_data: &Vec<CredInfo>) -> VcxResult<String> {
75
78
Ok ( schemas_json. to_string ( ) )
76
79
}
77
80
78
- fn build_rev_reg_defs_json ( credential_data : & Vec < CredInfo > ) -> VcxResult < String > {
81
+ fn build_rev_reg_defs_json ( credential_data : & Vec < CredInfoVerifier > ) -> VcxResult < String > {
79
82
debug ! ( "building rev_reg_def_json for proof validation" ) ;
80
83
81
84
let mut rev_reg_defs_json = json ! ( { } ) ;
@@ -100,7 +103,7 @@ fn build_rev_reg_defs_json(credential_data: &Vec<CredInfo>) -> VcxResult<String>
100
103
Ok ( rev_reg_defs_json. to_string ( ) )
101
104
}
102
105
103
- fn build_rev_reg_json ( credential_data : & Vec < CredInfo > ) -> VcxResult < String > {
106
+ fn build_rev_reg_json ( credential_data : & Vec < CredInfoVerifier > ) -> VcxResult < String > {
104
107
debug ! ( "building rev_reg_json for proof validation" ) ;
105
108
106
109
let mut rev_regs_json = json ! ( { } ) ;
@@ -140,9 +143,9 @@ pub fn validate_indy_proof(proof_json: &str, proof_req_json: &str) -> VcxResult<
140
143
141
144
let credential_data = get_credential_info ( & proof_json) ?;
142
145
143
- let credential_defs_json = build_credential_defs_json ( & credential_data)
146
+ let credential_defs_json = build_cred_defs_json_verifier ( & credential_data)
144
147
. unwrap_or ( json ! ( { } ) . to_string ( ) ) ;
145
- let schemas_json = build_schemas_json ( & credential_data)
148
+ let schemas_json = build_schemas_json_verifier ( & credential_data)
146
149
. unwrap_or ( json ! ( { } ) . to_string ( ) ) ;
147
150
let rev_reg_defs_json = build_rev_reg_defs_json ( & credential_data)
148
151
. unwrap_or ( json ! ( { } ) . to_string ( ) ) ;
@@ -178,23 +181,23 @@ pub mod tests {
178
181
179
182
#[ test]
180
183
#[ cfg( feature = "general_test" ) ]
181
- fn test_build_credential_defs_json_with_multiple_credentials ( ) {
184
+ fn test_build_cred_defs_json_verifier_with_multiple_credentials ( ) {
182
185
let _setup = SetupStrictAriesMocks :: init ( ) ;
183
186
184
- let cred1 = CredInfo {
187
+ let cred1 = CredInfoVerifier {
185
188
schema_id : "schema_key1" . to_string ( ) ,
186
189
cred_def_id : "cred_def_key1" . to_string ( ) ,
187
190
rev_reg_id : None ,
188
191
timestamp : None ,
189
192
} ;
190
- let cred2 = CredInfo {
193
+ let cred2 = CredInfoVerifier {
191
194
schema_id : "schema_key2" . to_string ( ) ,
192
195
cred_def_id : "cred_def_key2" . to_string ( ) ,
193
196
rev_reg_id : None ,
194
197
timestamp : None ,
195
198
} ;
196
199
let credentials = vec ! [ cred1, cred2] ;
197
- let credential_json = build_credential_defs_json ( & credentials) . unwrap ( ) ;
200
+ let credential_json = build_cred_defs_json_verifier ( & credentials) . unwrap ( ) ;
198
201
199
202
let json: Value = serde_json:: from_str ( CRED_DEF_JSON ) . unwrap ( ) ;
200
203
let expected = json ! ( { CRED_DEF_ID : json} ) . to_string ( ) ;
@@ -203,23 +206,23 @@ pub mod tests {
203
206
204
207
#[ test]
205
208
#[ cfg( feature = "general_test" ) ]
206
- fn test_build_schemas_json_with_multiple_schemas ( ) {
209
+ fn test_build_schemas_json_verifier_with_multiple_schemas ( ) {
207
210
let _setup = SetupStrictAriesMocks :: init ( ) ;
208
211
209
- let cred1 = CredInfo {
212
+ let cred1 = CredInfoVerifier {
210
213
schema_id : "schema_key1" . to_string ( ) ,
211
214
cred_def_id : "cred_def_key1" . to_string ( ) ,
212
215
rev_reg_id : None ,
213
216
timestamp : None ,
214
217
} ;
215
- let cred2 = CredInfo {
218
+ let cred2 = CredInfoVerifier {
216
219
schema_id : "schema_key2" . to_string ( ) ,
217
220
cred_def_id : "cred_def_key2" . to_string ( ) ,
218
221
rev_reg_id : None ,
219
222
timestamp : None ,
220
223
} ;
221
224
let credentials = vec ! [ cred1, cred2] ;
222
- let schema_json = build_schemas_json ( & credentials) . unwrap ( ) ;
225
+ let schema_json = build_schemas_json_verifier ( & credentials) . unwrap ( ) ;
223
226
224
227
let json: Value = serde_json:: from_str ( SCHEMA_JSON ) . unwrap ( ) ;
225
228
let expected = json ! ( { SCHEMA_ID : json} ) . to_string ( ) ;
@@ -231,13 +234,13 @@ pub mod tests {
231
234
fn test_build_rev_reg_defs_json ( ) {
232
235
let _setup = SetupStrictAriesMocks :: init ( ) ;
233
236
234
- let cred1 = CredInfo {
237
+ let cred1 = CredInfoVerifier {
235
238
schema_id : "schema_key1" . to_string ( ) ,
236
239
cred_def_id : "cred_def_key1" . to_string ( ) ,
237
240
rev_reg_id : Some ( "id1" . to_string ( ) ) ,
238
241
timestamp : None ,
239
242
} ;
240
- let cred2 = CredInfo {
243
+ let cred2 = CredInfoVerifier {
241
244
schema_id : "schema_key2" . to_string ( ) ,
242
245
cred_def_id : "cred_def_key2" . to_string ( ) ,
243
246
rev_reg_id : Some ( "id2" . to_string ( ) ) ,
@@ -256,13 +259,13 @@ pub mod tests {
256
259
fn test_build_rev_reg_json ( ) {
257
260
let _setup = SetupStrictAriesMocks :: init ( ) ;
258
261
259
- let cred1 = CredInfo {
262
+ let cred1 = CredInfoVerifier {
260
263
schema_id : "schema_key1" . to_string ( ) ,
261
264
cred_def_id : "cred_def_key1" . to_string ( ) ,
262
265
rev_reg_id : Some ( "id1" . to_string ( ) ) ,
263
266
timestamp : Some ( 1 ) ,
264
267
} ;
265
- let cred2 = CredInfo {
268
+ let cred2 = CredInfoVerifier {
266
269
schema_id : "schema_key2" . to_string ( ) ,
267
270
cred_def_id : "cred_def_key2" . to_string ( ) ,
268
271
rev_reg_id : Some ( "id2" . to_string ( ) ) ,
0 commit comments