Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support advanced wallet query #831

Conversation

TimoGlastra
Copy link
Contributor

Adds support for some of the most important wallet query features as defined by the indy-sdk (and aries-askar). https://hyperledger-indy.readthedocs.io/projects/sdk/en/latest/docs/design/011-wallet-query-language/README.html

Currently only added support for $and, $or and $not, which is enough for most use cases. We need this in particular for querying credentials based on a DIF presentation definition.

Fixes #739

@blu3beri I just used the default syntax for this, so you'd use it like this:

const query: Query<TheRecord> = {
  $and: [
	{ $or: [{ expandedTypes: 'https://url1.com' }, { context: 'https://url1.com' }] },
	{ $or: [{ expandedTypes: 'https://url2.com' }, { context: 'https://url2.com' }] },
  ]
}

We can look at a builder, but not sure what that would look like exactly?

@NB-PrasadKatkar this should unblock you for the presentation exchange work

Signed-off-by: Timo Glastra <timo@animo.id>
@TimoGlastra TimoGlastra requested a review from a team as a code owner June 2, 2022 16:30
Copy link
Contributor

@karimStekelenburg karimStekelenburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT. However, may I ask why we're not implementing all operators in one go? Are the others more work or something?

I can see these cover most use cases, but I can also think of some use cases where $gt and $lt are useful for example.

@karimStekelenburg karimStekelenburg merged commit 28e0ffa into openwallet-foundation:main Jun 2, 2022
@TimoGlastra
Copy link
Contributor Author

The $gt and $lt only work on unencrypted tags in indy and askar, but we only support encrypted tags in afj. Would like to keep it minimal so it's easier for new storage methods to implement, especially if we aren't using some features

@berendsliedrecht
Copy link
Contributor

Why is inMemory storage not supported for querying?

@TimoGlastra
Copy link
Contributor Author

TimoGlastra commented Jun 3, 2022

In memory is currently only exposed in tests (not part of core because it was a really quick implementation without tests itself). Adding this to in memory storage would require more work, and I mostly wanted to unblock prasad in his work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Complex storage queries (Wallet Query Language (WQL))
3 participants