Skip to content

Commit

Permalink
Feature/pid1558 new circuit v3 (#359)
Browse files Browse the repository at this point in the history
* feat(circuits V3): new circuits import

Imported witness calculator v3 library for Android and iOS

* chore(circuits V3): adapting code to new circuit

created new enum type to be able to support the new circuit

* feat(circuits download): support multiple circuits

modified the download circuits feature to be able to download multiple circuits from different buckets

* fix(circuits download): adapt example app

adapting example app to download multiple circuits

* feat(circuits V3 onchain): implementation of circuit v3 onchain

added methods for using circuits V3 for onchain proof request

* chore(proof type filter):

we need to filter by proof type if requested on query

* feat(circuits V3):

implementation of circuits v3 new logic for proof request query

* feat(circuits V3): libraries update

updated libpolygonid containing fix for selective disclosure

* chore(circuitsV3): inputs

added transactionData, verifierID, linkNonce and scope request params as inputs for atomic query inputs calculator

* chore:

Format utils, snake_case to camelCase

* test:

added test for format utils and atomic query inputs param

* fix(circuitsV3): libraries update

updated libraries that fixed a missing value on c-lib side

* Added capability to download only missing circuits to download_circuits_use_case.dart.

* Added V3 circuits support, added beta circuits capability.

* Added credential caching.

* Added config fetch from environment for credential caching.

* chore(formatting):

formatted files

---------

Co-authored-by: emuroni <[email protected]>
  • Loading branch information
5eeman and emuroni authored Jan 10, 2024
1 parent 6453892 commit bde879e
Show file tree
Hide file tree
Showing 76 changed files with 2,856 additions and 981 deletions.
12 changes: 12 additions & 0 deletions android/src/main/jniLibs/arm64-v8a/libpolygonid.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,19 @@ extern GoUint8 PLGNAtomicQuerySigV2OnChainInputs(char** jsonResponse, char* in,
// }
//
extern GoUint8 PLGNAtomicQueryMtpV2OnChainInputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

// PLGNAtomicQueryV3Inputs returns the inputs for the credentialAtomicQueryV3
// circuit with optional selective disclosure.
//
extern GoUint8 PLGNAtomicQueryV3Inputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

// PLGNAtomicQueryV3OnChainInputs returns the inputs for the
// credentialAtomicQueryV3OnChain circuit with optional selective disclosure.
//
extern GoUint8 PLGNAtomicQueryV3OnChainInputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);
extern void PLGNFreeStatus(PLGNStatus* status);
extern GoUint8 PLGNCleanCache(PLGNStatus** status);
extern GoUint8 PLGNCacheCredentials(char* in, char* cfg, PLGNStatus** status);

#ifdef __cplusplus
}
Expand Down
Binary file modified android/src/main/jniLibs/arm64-v8a/libpolygonid.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef WITNESSCALC_CREDENTIALATOMICQUERYV3_H
#define WITNESSCALC_CREDENTIALATOMICQUERYV3_H


#ifdef __cplusplus
extern "C" {
#endif

#define WITNESSCALC_OK 0x0
#define WITNESSCALC_ERROR 0x1
#define WITNESSCALC_ERROR_SHORT_BUFFER 0x2

/**
*
* @return error code:
* WITNESSCALC_OK - in case of success.
* WITNESSCALC_ERROR - in case of an error.
*
* On success wtns_buffer is filled with witness data and
* wtns_size contains the number bytes copied to wtns_buffer.
*
* If wtns_buffer is too small then the function returns WITNESSCALC_ERROR_SHORT_BUFFER
* and the minimum size for wtns_buffer in wtns_size.
*
*/

int
witnesscalc_credentialAtomicQueryV3(
const char *circuit_buffer, unsigned long circuit_size,
const char *json_buffer, unsigned long json_size,
char *wtns_buffer, unsigned long *wtns_size,
char *error_msg, unsigned long error_msg_maxsize);

#ifdef __cplusplus
}
#endif


#endif // WITNESSCALC_CREDENTIALATOMICQUERYV3_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef WITNESSCALC_CREDENTIALATOMICQUERYV3ONCHAIN_H
#define WITNESSCALC_CREDENTIALATOMICQUERYV3ONCHAIN_H


#ifdef __cplusplus
extern "C" {
#endif

#define WITNESSCALC_OK 0x0
#define WITNESSCALC_ERROR 0x1
#define WITNESSCALC_ERROR_SHORT_BUFFER 0x2

/**
*
* @return error code:
* WITNESSCALC_OK - in case of success.
* WITNESSCALC_ERROR - in case of an error.
*
* On success wtns_buffer is filled with witness data and
* wtns_size contains the number bytes copied to wtns_buffer.
*
* If wtns_buffer is too small then the function returns WITNESSCALC_ERROR_SHORT_BUFFER
* and the minimum size for wtns_buffer in wtns_size.
*
*/

int
witnesscalc_credentialAtomicQueryV3OnChain(
const char *circuit_buffer, unsigned long circuit_size,
const char *json_buffer, unsigned long json_size,
char *wtns_buffer, unsigned long *wtns_size,
char *error_msg, unsigned long error_msg_maxsize);

#ifdef __cplusplus
}
#endif


#endif // WITNESSCALC_CREDENTIALATOMICQUERYV3ONCHAIN_H
12 changes: 12 additions & 0 deletions android/src/main/jniLibs/armeabi-v7a/libpolygonid.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,19 @@ extern GoUint8 PLGNAtomicQuerySigV2OnChainInputs(char** jsonResponse, char* in,
// }
//
extern GoUint8 PLGNAtomicQueryMtpV2OnChainInputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

// PLGNAtomicQueryV3Inputs returns the inputs for the credentialAtomicQueryV3
// circuit with optional selective disclosure.
//
extern GoUint8 PLGNAtomicQueryV3Inputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);

// PLGNAtomicQueryV3OnChainInputs returns the inputs for the
// credentialAtomicQueryV3OnChain circuit with optional selective disclosure.
//
extern GoUint8 PLGNAtomicQueryV3OnChainInputs(char** jsonResponse, char* in, char* cfg, PLGNStatus** status);
extern void PLGNFreeStatus(PLGNStatus* status);
extern GoUint8 PLGNCleanCache(PLGNStatus** status);
extern GoUint8 PLGNCacheCredentials(char* in, char* cfg, PLGNStatus** status);

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit bde879e

Please sign in to comment.