veramo icon indicating copy to clipboard operation
veramo copied to clipboard

[proposal] add JSONPath credential query plugin interface

Open mirceanis opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. There are some credential interaction protocols (like presentation-exchange and credential-manifest) that rely on JSONPath to match credentials and their properties.

Veramo needs a definition for this query capability, so that plugins that implement these exchange protocols can use a predictable API.

Describe the solution you'd like There should be a plugin interface defined in @veramo/core that describes how a user would can use a JSONPath expression to filter credentials.

This interface can then be implemented either by the @veramo/data-store and @veramo/data-store-json plugins directly, or be built on top of the existing IDataStoreORM query results with a very broad ORM filter, but with additional performance penalty.

export type JSONPathExpression = string;

export interface IDataQueryJsonPath {

  async dataStoreCredentialQuery(args: { query: JSONPathExpression }): Promise<VerifiableCredential[]>

  async dataStorePresentationQuery(args: { query: JSONPathExpression }): Promise<VerifiablePresentation[]>

  /* optional? */
  async dataStoreMessageQuery(args: { query: JSONPathExpression }): Promise<IMessage[]>
}

Additional context relates to #267 and #268

mirceanis avatar Mar 17 '22 13:03 mirceanis