zkPass
zkPass Developer's Guide
zkPass Developer's Guide
  • â›Šī¸Introduction
  • ZKPASS OVERVIEW
    • đŸ›ī¸Architecture
    • 🧱zkPass Components
    • 🤝Trust Models
    • 🚚Deployment
      • Public-Cloud Hosting
      • Private-Cloud Hosting
      • On-Premise Hosting
    • đŸŽ¯SDK Objectives
    • 🔑API Key
  • zkPass Modules
    • â˜ī¸DVR
      • đŸ—ģHigh Level View
      • đŸ—ī¸Key Concepts
        • User Data
        • DVR Info
        • zkPass Proof
      • đŸ‘ĨDVR Client Roles
        • Data Issuer
          • Providing User Data Retrieval API
        • Data Holder
          • 1. Retrieving the DVR
          • 2. Retrieving the User Data
          • 3. Generating the Proof
          • 4. Verifying the Proof
        • Proof Verifier
          • 1. Providing DVR Retrieval API
          • 2. Providing Proof Verification API
      • 🔎DVR Query
        • Building Query Engine
        • Processing Query
        • Query Grammar
      • đŸ—ī¸Integration Guidelines
      • 🌊DVR Workflows
  • SDK Tutorial
    • Typescript
      • Running Code
      • Code Snippet
      • Directory Structure
    • Rust
      • Running Code
      • Code Snippet
      • Directory Structure
  • API Reference
    • Typescript
      • Classes
        • Class: DvrModuleClient
      • Functions
        • Functions: ffiHelper
        • Functions: jwtHelper
        • Functions: publicKeyOptionUtils
      • Type Aliases
        • Types
        • Types: ffiType
      • Interfaces
        • Interfaces
      • Constants
        • Constants
        • Enums
      • Errors
    • Rust
      • Building Rust doc
    • RESTful API
      • Overview
      • Endpoints
        • Generate Proof
      • Utilities
        • Generate Key Pair
        • Sign User Data and DVR
        • Encrypt User Data and DVR
      • Errors
  • Glossary
    • DVR
    • User Data
    • ZKP
Powered by GitBook
On this page
  • Data Types
  • Operators
  • Variable and Literals
  • Grammar BNF
  • Query Example
Export as PDF
  1. zkPass Modules
  2. DVR
  3. DVR Query

Query Grammar

Data Types

The following are the supported basic data types by the DVR Query language:

  • Integer A signed 64-bit integer data type. Example: 10, -12

  • String A sequence of characters. Example: "Hello, world!"

  • Boolean A binary value that can be either true or false

Operators

The list of supported operators:

  • Boolean Operators:

    • or

    • and

  • Relational Operators: >, >=, <, <=

    • Applies to integer

  • Equality Operators

    • Equality operator: == Applies to boolean, integer, and string. In the case of a string, this is a case-sensitive comparison.

    • Inequality operator: != Applies to boolean, integer, string

    • String-specific Relational Operations

      • ~!= Case-insensitive inequality operation on a string

      • ~== Case-insensitive equality operation on string

Variable and Literals

The zkPass Query language also defines the following concepts:

  • Variable The variable corresponds to the key name of the key/value json element in the query data. To reference nested elements in the json data, delimiter “.” is used as the path separator. The variable must appear on the left-hand side of a relational expression.

  • Literal (Constant) The constant value is compared to the variable's value. The literal must appear on the right-hand side of a relational expression. The data type of the literal must match that of the variable.

Grammar BNF

<query> ::= <boolean-expression>

<boolean-expression> ::= "{" <logical-operator> ": [" <expression-list> "] "}"

<logical-operator> ::= "and" | "or"

<expression-list> ::= <expression> | <expression> "," <expression-list>
<expression> ::= <relational-expression> | <boolean-expression>

<relational-expression> ::= "{" <relational-operator> ": [" <variable> "," <literal> "] "}"

<relational-operator> ::= "==" | "!=" | ">" | ">=" | "<" | "<=" | "~==" | "~!="

<variable> ::= <string>

<literal> ::= <integer> | <string> | <boolean>

<integer> ::= ["-"] <digit>+

<string> ::= """ <characters> """

<boolean> ::= "true" | "false"

<characters> ::= <character>*
<character> ::= <letter> | <digit> | <special-character> | " "

<special-character> ::= "!" | "@" | "#" | "$" | "%" | "^" | "&" | "*" | "(" | ")" | "-" | "+" | "=" | "[" | "]" | "{" | "}" | "|" | ":" | ";" | "'" | "<" | ">" | "," | "." | "/" | "?" | "~"

<letter> ::= "a" ... "z" | "A" ... "Z"
<digit> ::= "0" ... "9"

Query Example

[
  {
    assign: {
      account_holder: {
        and: [
          { "==": [{ dvar: "bcaDocID" }, "DOC897923CP"] },
          { "~==": [{ dvar: "personalInfo.firstName" }, "Ramana"] },
          { "~==": [{ dvar: "personalInfo.lastName" }, "Maharshi"] },
          {
            "~==": [{ dvar: "personalInfo.driverLicenseNumber" }, "DL77108108"],
          },
          {
            ">=": [{ dvar: "financialInfo.creditRatings.pefindo" }, 650],
          },
          {
            ">=": [
              { dvar: "financialInfo.accounts.savings.balance" },
              55000000,
            ],
          },
        ],
      },
    },
  },
  { output: { result: { lvar: "account_holder" } } },
]
PreviousProcessing QueryNextIntegration Guidelines

Last updated 11 months ago

â˜ī¸
🔎