private async Task <JArray> getCredentialsArray(string walletQuery) { try { var creds = await AnonCreds.ProverSearchCredentialsAsync( d_openWallet, walletQuery); int count = creds.TotalCount; // return "0" if there are no records for the type and query // if (count == 0) // return "0"; // get count schema's string res = await AnonCreds.ProverFetchCredentialsAsync( creds, count); // make response human readable JArray a = JArray.Parse(res); return(a); } catch (Exception e) { Console.WriteLine($"Error: {e.Message}"); return(new JArray());; } }
public async Task TestProverSearchCredentialsWorksForEmptyFilter() { var credentials = await AnonCreds.ProverSearchCredentialsAsync(wallet, "{}"); Assert.AreEqual(3, credentials.TotalCount); var credentialsArray = await credentials.NextAsync(100); var jsonArray = JArray.Parse(credentialsArray); Assert.AreEqual(3, jsonArray.Count); //TODO: Shouldn't there be an explicit close of the credential search here? }
public async Task TestProverSearchCredentialsWorksForInvalidFilterJson() { var filter = "{\"issuer_id\":1}"; var ex = await Assert.ThrowsExceptionAsync <WalletInvalidQueryException>(() => AnonCreds.ProverSearchCredentialsAsync(wallet, filter) ); }