Skip to content

Commit 125884f

Browse files
committed
Corrected documentation
Signed-off-by: artem.ivanov <[email protected]>
1 parent b334ae5 commit 125884f

File tree

14 files changed

+114
-87
lines changed

14 files changed

+114
-87
lines changed

doc/design/002-anoncreds/README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -480,27 +480,34 @@ pub extern fn indy_prover_get_credential(command_handle: i32,
480480
```Rust
481481
/// Gets human readable credentials according to the filter.
482482
/// If filter is NULL, then all credentials are returned.
483-
/// Credentials can be filtered by tags created during saving of credential.
483+
/// Credentials can be filtered by Issuer, credential_def and/or Schema.
484484
///
485-
/// NOTE: This method is deprecated because immediately returns all fetched credentials.
485+
/// NOTE: This method is deprecated because immediately returns all fetched credentials.
486486
/// Use <indy_prover_search_credentials> to fetch records by small batches.
487-
///
487+
///
488488
/// #Params
489489
/// wallet_handle: wallet handler (created by open_wallet).
490-
/// filter_json: Wql style filter for credentials searching based on tags.
491-
/// where wql query: indy-sdk/doc/design/011-wallet-query-language/README.md
490+
/// filter_json: filter for credentials
491+
/// {
492+
/// "schema_id": string, (Optional)
493+
/// "schema_issuer_did": string, (Optional)
494+
/// "schema_name": string, (Optional)
495+
/// "schema_version": string, (Optional)
496+
/// "issuer_did": string, (Optional)
497+
/// "cred_def_id": string, (Optional)
498+
/// }
492499
/// cb: Callback that takes command result as parameter.
493500
///
494501
/// #Returns
495-
/// credentials json
496-
/// [{
497-
/// "referent": string, // cred_id in the wallet
498-
/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"},
499-
/// "schema_id": string,
500-
/// "cred_def_id": string,
501-
/// "rev_reg_id": Optional<string>,
502-
/// "cred_rev_id": Optional<string>
503-
/// }]
502+
/// credentials json
503+
/// [{
504+
/// "referent": string, // cred_id in the wallet
505+
/// "attrs": {"key1":"raw_value1", "key2":"raw_value2"},
506+
/// "schema_id": string,
507+
/// "cred_def_id": string,
508+
/// "rev_reg_id": Optional<string>,
509+
/// "cred_rev_id": Optional<string>
510+
/// }]
504511
///
505512
/// #Errors
506513
/// Annoncreds*
@@ -525,7 +532,7 @@ pub extern fn indy_prover_get_credentials(command_handle: i32,
525532
///
526533
/// #Params
527534
/// wallet_handle: wallet handler (created by open_wallet).
528-
/// filter_json: Wql style filter for credentials searching based on tags.
535+
/// query_json: Wql style filter for credentials searching based on tags.
529536
/// where wql query: indy-sdk/doc/design/011-wallet-query-language/README.md
530537
/// cb: Callback that takes command result as parameter.
531538
///
@@ -540,7 +547,7 @@ pub extern fn indy_prover_get_credentials(command_handle: i32,
540547
#[no_mangle]
541548
pub extern fn indy_prover_search_credentials(command_handle: i32,
542549
wallet_handle: i32,
543-
filter_json: *const c_char,
550+
query_json: *const c_char,
544551
cb: Option<extern fn(
545552
xcommand_handle: i32, err: ErrorCode,
546553
search_handle: i32,
@@ -595,9 +602,9 @@ pub extern fn indy_prover_close_credentials_search(command_handle: i32,
595602

596603
/// Gets human readable credentials matching the given proof request.
597604
///
598-
/// NOTE: This method is deprecated because immediately returns all fetched credentials.
605+
/// NOTE: This method is deprecated because immediately returns all fetched credentials.
599606
/// Use <indy_prover_search_credentials_for_proof_req> to fetch records by small batches.
600-
///
607+
///
601608
/// #Params
602609
/// wallet_handle: wallet handler (created by open_wallet).
603610
/// proof_request_json: proof request json
@@ -618,20 +625,14 @@ pub extern fn indy_prover_close_credentials_search(command_handle: i32,
618625
/// // for date in this interval for each attribute
619626
/// // (can be overridden on attribute level)
620627
/// }
621-
/// extra_query_json:(Optional) List of extra queries that will be applied to correspondent attribute/predicate:
622-
/// {
623-
/// "<attr_referent>": <wql query>,
624-
/// "<predicate_referent>": <wql query>,
625-
/// }
626628
/// cb: Callback that takes command result as parameter.
627629
///
628630
/// where
629-
/// where wql query: indy-sdk/doc/design/011-wallet-query-language/README.md
630631
/// attr_referent: Proof-request local identifier of requested attribute
631632
/// attr_info: Describes requested attribute
632633
/// {
633634
/// "name": string, // attribute name, (case insensitive and ignore spaces)
634-
/// "restrictions": Optional<wql query>,
635+
/// "restrictions": Optional<filter_json>, // see above
635636
/// "non_revoked": Optional<<non_revoc_interval>>, // see below,
636637
/// // If specified prover must proof non-revocation
637638
/// // for date in this interval this attribute
@@ -643,7 +644,7 @@ pub extern fn indy_prover_close_credentials_search(command_handle: i32,
643644
/// "name": attribute name, (case insensitive and ignore spaces)
644645
/// "p_type": predicate type (Currently ">=" only)
645646
/// "p_value": int predicate value
646-
/// "restrictions": Optional<wql query>,
647+
/// "restrictions": Optional<filter_json>, // see above
647648
/// "non_revoked": Optional<<non_revoc_interval>>, // see below,
648649
/// // If specified prover must proof non-revocation
649650
/// // for date in this interval this attribute
@@ -684,7 +685,6 @@ pub extern fn indy_prover_close_credentials_search(command_handle: i32,
684685
pub extern fn indy_prover_get_credentials_for_proof_req(command_handle: i32,
685686
wallet_handle: i32,
686687
proof_request_json: *const c_char,
687-
extra_query_json: *const c_char,
688688
cb: Option<extern fn(
689689
xcommand_handle: i32, err: ErrorCode,
690690
credentials_json: *const c_char)>) -> ErrorCode

libindy/include/indy_anoncreds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ extern "C" {
159159

160160
extern indy_error_t indy_prover_search_credentials(indy_handle_t command_handle,
161161
indy_handle_t wallet_handle,
162-
const char * filter_json,
162+
const char * query_json,
163163

164164
void (*cb)(indy_handle_t xcommand_handle,
165165
indy_error_t err,

libindy/src/api/anoncreds.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -854,15 +854,22 @@ pub extern fn indy_prover_get_credential(command_handle: i32,
854854

855855
/// Gets human readable credentials according to the filter.
856856
/// If filter is NULL, then all credentials are returned.
857-
/// Credentials can be filtered by tags created during saving of credential.
857+
/// Credentials can be filtered by Issuer, credential_def and/or Schema.
858858
///
859859
/// NOTE: This method is deprecated because immediately returns all fetched credentials.
860860
/// Use <indy_prover_search_credentials> to fetch records by small batches.
861861
///
862862
/// #Params
863863
/// wallet_handle: wallet handler (created by open_wallet).
864-
/// filter_json: Wql style query for credentials searching based on tags.
865-
/// where query: indy-sdk/doc/design/011-wallet-query-language/README.md
864+
/// filter_json: filter for credentials
865+
/// {
866+
/// "schema_id": string, (Optional)
867+
/// "schema_issuer_did": string, (Optional)
868+
/// "schema_name": string, (Optional)
869+
/// "schema_version": string, (Optional)
870+
/// "issuer_did": string, (Optional)
871+
/// "cred_def_id": string, (Optional)
872+
/// }
866873
/// cb: Callback that takes command result as parameter.
867874
///
868875
/// #Returns
@@ -924,7 +931,7 @@ pub extern fn indy_prover_get_credentials(command_handle: i32,
924931
///
925932
/// #Params
926933
/// wallet_handle: wallet handler (created by open_wallet).
927-
/// filter_json: Wql query filter for credentials searching based on tags.
934+
/// query_json: Wql query filter for credentials searching based on tags.
928935
/// where query: indy-sdk/doc/design/011-wallet-query-language/README.md
929936
/// cb: Callback that takes command result as parameter.
930937
///
@@ -939,24 +946,24 @@ pub extern fn indy_prover_get_credentials(command_handle: i32,
939946
#[no_mangle]
940947
pub extern fn indy_prover_search_credentials(command_handle: i32,
941948
wallet_handle: i32,
942-
filter_json: *const c_char,
949+
query_json: *const c_char,
943950
cb: Option<extern fn(
944951
xcommand_handle: i32, err: ErrorCode,
945952
search_handle: i32,
946953
total_count: usize)>) -> ErrorCode {
947-
trace!("indy_prover_search_credentials: >>> wallet_handle: {:?}, filter_json: {:?}", wallet_handle, filter_json);
954+
trace!("indy_prover_search_credentials: >>> wallet_handle: {:?}, query_json: {:?}", wallet_handle, query_json);
948955

949-
check_useful_opt_c_str!(filter_json, ErrorCode::CommonInvalidParam3);
956+
check_useful_opt_c_str!(query_json, ErrorCode::CommonInvalidParam3);
950957
check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4);
951958

952-
trace!("indy_prover_search_credentials: entities >>> wallet_handle: {:?}, filter_json: {:?}", wallet_handle, filter_json);
959+
trace!("indy_prover_search_credentials: entities >>> wallet_handle: {:?}, query_json: {:?}", wallet_handle, query_json);
953960

954961
let result = CommandExecutor::instance()
955962
.send(Command::Anoncreds(
956963
AnoncredsCommand::Prover(
957964
ProverCommand::SearchCredentials(
958965
wallet_handle,
959-
filter_json,
966+
query_json,
960967
Box::new(move |result| {
961968
let (err, handle, total_count) = result_to_err_code_2!(result, 0, 0);
962969
cb(command_handle, err, handle, total_count)
@@ -1092,12 +1099,11 @@ pub extern fn indy_prover_close_credentials_search(command_handle: i32,
10921099
/// cb: Callback that takes command result as parameter.
10931100
///
10941101
/// where
1095-
/// where wql query: indy-sdk/doc/design/011-wallet-query-language/README.md
10961102
/// attr_referent: Proof-request local identifier of requested attribute
10971103
/// attr_info: Describes requested attribute
10981104
/// {
10991105
/// "name": string, // attribute name, (case insensitive and ignore spaces)
1100-
/// "restrictions": Optional<wql query>.
1106+
/// "restrictions": Optional<filter_json>, // see above
11011107
/// "non_revoked": Optional<<non_revoc_interval>>, // see below,
11021108
/// // If specified prover must proof non-revocation
11031109
/// // for date in this interval this attribute
@@ -1109,7 +1115,7 @@ pub extern fn indy_prover_close_credentials_search(command_handle: i32,
11091115
/// "name": attribute name, (case insensitive and ignore spaces)
11101116
/// "p_type": predicate type (Currently ">=" only)
11111117
/// "p_value": int predicate value
1112-
/// "restrictions": Optional<wql query> .
1118+
/// "restrictions": Optional<filter_json>, // see above
11131119
/// "non_revoked": Optional<<non_revoc_interval>>, // see below,
11141120
/// // If specified prover must proof non-revocation
11151121
/// // for date in this interval this attribute

libindy/src/commands/anoncreds/prover.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub enum ProverCommand {
6464
Box<Fn(Result<String, IndyError>) + Send>),
6565
SearchCredentials(
6666
i32, // wallet handle
67-
Option<String>, // filter json
67+
Option<String>, // query json
6868
Box<Fn(Result<(i32, usize), IndyError>) + Send>),
6969
FetchCredentials(
7070
i32, // search handle
@@ -184,9 +184,9 @@ impl ProverCommandExecutor {
184184
info!(target: "prover_command_executor", "GetCredential command received");
185185
cb(self.get_credential(wallet_handle, &cred_id));
186186
}
187-
ProverCommand::SearchCredentials(wallet_handle, filter_json, cb) => {
187+
ProverCommand::SearchCredentials(wallet_handle, query_json, cb) => {
188188
info!(target: "prover_command_executor", "SearchCredentials command received");
189-
cb(self.search_credentials(wallet_handle, filter_json.as_ref().map(String::as_str)));
189+
cb(self.search_credentials(wallet_handle, query_json.as_ref().map(String::as_str)));
190190
}
191191
ProverCommand::FetchCredentials(search_handle, count, cb) => {
192192
info!(target: "prover_command_executor", "FetchCredentials command received");
@@ -396,11 +396,11 @@ impl ProverCommandExecutor {
396396

397397
fn search_credentials(&self,
398398
wallet_handle: i32,
399-
filter_json: Option<&str>) -> Result<(i32, usize), IndyError> {
400-
debug!("search_credentials >>> wallet_handle: {:?}, filter_json: {:?}", wallet_handle, filter_json);
399+
query_json: Option<&str>) -> Result<(i32, usize), IndyError> {
400+
debug!("search_credentials >>> wallet_handle: {:?}, query_json: {:?}", wallet_handle, query_json);
401401

402402
let credentials_search =
403-
self.wallet_service.search_indy_records::<Credential>(wallet_handle, filter_json.unwrap_or("{}"), &SearchOptions::id_value())?;
403+
self.wallet_service.search_indy_records::<Credential>(wallet_handle, query_json.unwrap_or("{}"), &SearchOptions::id_value())?;
404404

405405
let total_count = credentials_search.get_total_count()?.unwrap_or(0);
406406

wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Anoncreds/AnoncredsHighCases.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,11 @@ - (void)testProverCredentialSearchWorks {
428428
// 2. get credentials
429429
IndyHandle searchHandle;
430430
NSNumber *totalCount;
431-
ret = [[AnoncredsUtils sharedInstance] proverSearchCredentialsForFilter:@"{}"
431+
ret = [[AnoncredsUtils sharedInstance] proverSearchCredentialsForQuery:@"{}"
432432
walletHandle:walletHandle
433433
searchHandle:&searchHandle
434434
totalCount:&totalCount];
435-
XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverSearchCredentialsForFilter failed");
435+
XCTAssertEqual(ret.code, Success, @"AnoncredsUtils::proverSearchCredentialsForQuery failed");
436436

437437
XCTAssertEqual([totalCount intValue], 3, @"credentials count != 3");
438438

wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
walletHandle:(IndyHandle)walletHandle
124124
credentilsJson:(NSString **)credentialsJson;
125125

126-
- (NSError *)proverSearchCredentialsForFilter:(NSString *)filterJSON
126+
- (NSError *)proverSearchCredentialsForQuery:(NSString *)queryJSON
127127
walletHandle:(IndyHandle)walletHandle
128128
searchHandle:(IndyHandle *)searchHandle
129129
totalCount:(NSNumber **)totalCount;

wrappers/ios/libindy-pod/Indy-demoTests/Test Utils/AnoncredsUtils.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ - (NSError *)proverGetCredentialsForFilter:(NSString *)filterJSON
586586
return err;
587587
}
588588

589-
- (NSError *)proverSearchCredentialsForFilter:(NSString *)filterJSON
589+
- (NSError *)proverSearchCredentialsForQuery:(NSString *)queryJSON
590590
walletHandle:(IndyHandle)walletHandle
591591
searchHandle:(IndyHandle *)searchHandle
592592
totalCount:(NSNumber **)totalCount {
@@ -595,7 +595,7 @@ - (NSError *)proverSearchCredentialsForFilter:(NSString *)filterJSON
595595

596596
completionExpectation = [[XCTestExpectation alloc] initWithDescription:@"completion finished"];
597597

598-
[IndyAnoncreds proverSearchCredentialsForFilter:filterJSON
598+
[IndyAnoncreds proverSearchCredentialsForQuery:queryJSON
599599
walletHandle:walletHandle
600600
completion:^(NSError *error, IndyHandle outSearchHandle, NSNumber *outTotalCount) {
601601
err = error;

wrappers/ios/libindy-pod/Indy/Wrapper/IndyAnoncreds.h

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,17 @@
332332
Credentials can be filtered by tags created during saving of credential.
333333
334334
NOTE: This method is deprecated because immediately returns all fetched credentials.
335-
Use <proverSearchCredentialsForFilter> to fetch records by small batches.
335+
Use <proverSearchCredentialsForQuery> to fetch records by small batches.
336336
337-
@param filterJSON: Wql style filter for credentials searching based on tags.
338-
(indy-sdk/doc/design/011-wallet-query-language/README.md)
337+
@param filterJSON: filter for credentials
338+
{
339+
"schema_id": string, (Optional)
340+
"schema_issuer_did": string, (Optional)
341+
"schema_name": string, (Optional)
342+
"schema_version": string, (Optional)
343+
"issuer_did": string, (Optional)
344+
"cred_def_id": string, (Optional)
345+
}
339346
@param walletHandle Wallet handler (created by IndyWallet::openWalletWithName).
340347
@param completion Callback that takes command result as parameter.
341348
Returns credentials json.
@@ -362,22 +369,22 @@
362369
to fetch records by small batches (with proverFetchCredentialsWithSearchHandle).
363370
364371
@param walletHandle Wallet handler (created by IndyWallet::openWalletWithName).
365-
@param filterJson Wql style filter for credentials searching based on tags.
372+
@param queryJSON Wql style filter for credentials searching based on tags.
366373
(indy-sdk/doc/design/011-wallet-query-language/README.md)
367374
@param completion Callback that takes command result as parameter.
368375
Returns
369376
searchHandle: Search handle that can be used later to fetch records by small batches (with proverFetchCredentialsWithSearchHandle)
370377
totalCount: Total count of records
371378
372379
*/
373-
+ (void)proverSearchCredentialsForFilter:(NSString *)filterJSON
380+
+ (void)proverSearchCredentialsForQuery:(NSString *)queryJSON
374381
walletHandle:(IndyHandle)walletHandle
375382
completion:(void (^)(NSError *error, IndyHandle searchHandle, NSNumber *totalCount))completion;
376383

377384
/**
378385
Fetch next credentials for search.
379386
380-
@param searchHandle Search handle (created by proverSearchCredentialsForFilter).
387+
@param searchHandle Search handle (created by proverSearchCredentialsForQuery).
381388
@param count Count of credentials to fetch
382389
@param completion Callback that takes command result as parameter.
383390
Returns
@@ -400,7 +407,7 @@
400407
/**
401408
Close credentials search (make search handle invalid)
402409
403-
@param searchHandle Search handle (created by proverSearchCredentialsForFilter).
410+
@param searchHandle Search handle (created by proverSearchCredentialsForQuery).
404411
Returns no result
405412
406413
*/
@@ -432,12 +439,11 @@
432439
// (can be overridden on attribute level)
433440
}
434441
where
435-
wql query: indy-sdk/doc/design/011-wallet-query-language/README.md
436442
attr_referent: Proof-request local identifier of requested attribute
437443
attr_info: Describes requested attribute
438444
{
439445
"name": string, // attribute name, (case insensitive and ignore spaces)
440-
"restrictions": Optional<wql query>,
446+
"restrictions": Optional<filterJSON>, // see above
441447
"non_revoked": Optional<<non_revoc_interval>>, // see below,
442448
// If specified prover must proof non-revocation
443449
// for date in this interval this attribute
@@ -449,7 +455,7 @@
449455
"name": attribute name, (case insensitive and ignore spaces)
450456
"p_type": predicate type (Currently ">=" only)
451457
"p_value": int predicate value
452-
"restrictions": Optional<wql query>,
458+
"restrictions": Optional<filterJSON>, // see above,
453459
"non_revoked": Optional<<non_revoc_interval>>, // see below,
454460
// If specified prover must proof non-revocation
455461
// for date in this interval this attribute

0 commit comments

Comments
 (0)