Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Latest commit

 

History

History

examples

Examples

There are two separate files for both the on- and off-chain examples dealing with the complete issuance and verification process for either a single or a combined proof: exampleSingle.ts / exampleSingle.chain.ts and exampleCombined.ts / exampleCombined.chain.ts. These should give you a good idea how to the library can be used with and without the chain.

We split both types of examples into the following three processes:

Off-chain processes

  1. actorProcess - Creation of claimer, attester(s) and accumulator(s)
  2. issuanceProcess - Issuance of the credential (claimer and attester)
  3. verificationProcessSingle / 3_verificationProcessCombined - Verification of the credential w/ and w/o revocation (claimer and verifier)

On-chain processes

You are required to have an active substrate blockchain implementing the portablegabi-pallet. You could clone and set up this portablegabi-node basic substrate template implementing the portablegabi-pallet.

  1. actorProcess - Creation of claimer, attester(s) and accumulator retrieval of chain or storage if missing
  2. issuanceProcess - See off-chain (nothing on-chain happens here)
  3. verificationProcessSingle / 3_verificationProcessCombined - Verification of the credential w/ and w/o revocation (claimer and verifier)

Note that we are using Alice and Bob nodes in the examples to retrieve and store accumulators on the chain. Depending on your chain, you might have to swap the URI to nodes with balance in the example config, otherwise you can only retrieve them.

Run in the browser

It is also possible to use the Portablegabi API in the browser, see here for more details.

Where can I find negative examples?

Please note, that the examples displayed here are mainly positive. For negative ones please have a look at the following tests. Most notably are the ones within GabiVerifier.spec.ts

Remarks

We are aware that the key generation GabiAttester.create() takes about more than 10 monutes due to finding huge prime numbers in a single threat being very slow in WASM. Therefore, all examples and tests use pre-generated keys in Go. We are currently working on this issue.