How to use zknotary-verifier
This directory contains a Node.js example application that demonstrates how to use the zknotary-verify
npm package.
Prerequisites
Node.js
npm
File Structure
index.js
: This is the main application file.package.json
: This file contains the list of npm dependencies for the application. Among these dependencies we havezknotary-verifier
andzknotary-parsers
.
Setup
Install the dependencies:
Run the application
Usage
This application demonstrates how to use the zknotary-verifier
npm package in a Node.js application.
It takes two inputs:
A generic proof of notarization generated by TLSNotary in JSON format.
The Notary's public key as a pem file.
First, we need to import the zknotary-verifier
package which contains the WebAssembly code that does the actual verification of the proof. We also import the zknotary-parsers
package, which provides a utility to parse the text output of the verifier according to specific rules depending on the nature of the notarization. In this particular example, the sample proof corresponds to the notarization of a session with the Twitter API, so we import the Twitter parser.
To learn more about the zknotary-parsers
package, please refer to its README file.
Then, we read both the sample proof in JSON format as well as the Notary's public key:
Finally we execute the verify()
function passing as arguments the proof and the public key. We then send to the console the result of the parsing:
Contributing
Contributions are welcome. Please submit a pull request or create an issue to discuss the changes you want to make.
License
Apache
Last updated