mirror of
https://github.com/selfxyz/self.git
synced 2026-01-14 09:08:03 -05:00
Merge pull request #226 from zk-passport/devcon-app-release
Devcon app release
This commit is contained in:
@@ -31,6 +31,9 @@ set_target_properties(prove_rsapss_65537_sha256 PROPERTIES IMPORTED_LOCATION ${C
|
||||
# add_library(prove_ecdsa_secp256r1_sha1 SHARED IMPORTED)
|
||||
# set_target_properties(prove_ecdsa_secp256r1_sha1 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_prove_ecdsa_secp256r1_sha1.so)
|
||||
|
||||
add_library(vc_and_disclose SHARED IMPORTED)
|
||||
set_target_properties(vc_and_disclose PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_vc_and_disclose.so)
|
||||
|
||||
add_library(${CMAKE_PROJECT_NAME} SHARED
|
||||
proofofpassportapp.cpp)
|
||||
|
||||
@@ -41,4 +44,5 @@ target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
prove_rsa_65537_sha256
|
||||
prove_rsa_65537_sha1
|
||||
prove_rsapss_65537_sha256
|
||||
vc_and_disclose
|
||||
)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef WITNESSCALC_vc_and_disclose_H
|
||||
#define WITNESSCALC_vc_and_disclose_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_vc_and_disclose(
|
||||
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_vc_and_disclose_H
|
||||
BIN
app/android/app/src/main/cpp/lib/libwitnesscalc_vc_and_disclose.so
Executable file
BIN
app/android/app/src/main/cpp/lib/libwitnesscalc_vc_and_disclose.so
Executable file
Binary file not shown.
@@ -4,6 +4,7 @@
|
||||
#include "include/witnesscalc_prove_rsa_65537_sha256.h"
|
||||
#include "include/witnesscalc_prove_rsa_65537_sha1.h"
|
||||
#include "include/witnesscalc_prove_rsapss_65537_sha256.h"
|
||||
#include "include/witnesscalc_vc_and_disclose.h"
|
||||
// #include "include/witnesscalc_prove_ecdsa_secp256r1_sha256.h"
|
||||
// #include "include/witnesscalc_prove_ecdsa_secp256r1_sha1.h"
|
||||
|
||||
@@ -21,35 +22,35 @@ Java_com_proofofpassportapp_prover_ZKPTools_groth16_1prover(JNIEnv *env, jobject
|
||||
jlongArray public_size, jbyteArray error_msg,
|
||||
jlong error_msg_max_size)
|
||||
{
|
||||
const void *zkeyBuffer = env->GetByteArrayElements(zkey_buffer, nullptr);
|
||||
const void *wtnsBuffer = env->GetByteArrayElements(wtns_buffer, nullptr);
|
||||
char *proofBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(proof_buffer,
|
||||
nullptr));
|
||||
char *publicBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(public_buffer,
|
||||
nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
const void *zkeyBuffer = env->GetByteArrayElements(zkey_buffer, nullptr);
|
||||
const void *wtnsBuffer = env->GetByteArrayElements(wtns_buffer, nullptr);
|
||||
char *proofBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(proof_buffer,
|
||||
nullptr));
|
||||
char *publicBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(public_buffer,
|
||||
nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
|
||||
unsigned long proofSize = env->GetLongArrayElements(proof_size, nullptr)[0];
|
||||
unsigned long publicSize = env->GetLongArrayElements(public_size, nullptr)[0];
|
||||
unsigned long proofSize = env->GetLongArrayElements(proof_size, nullptr)[0];
|
||||
unsigned long publicSize = env->GetLongArrayElements(public_size, nullptr)[0];
|
||||
|
||||
int result = groth16_prover(zkeyBuffer, static_cast<unsigned long>(zkey_size),
|
||||
wtnsBuffer, static_cast<unsigned long>(wtns_size),
|
||||
proofBuffer, &proofSize,
|
||||
publicBuffer, &publicSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
int result = groth16_prover(zkeyBuffer, static_cast<unsigned long>(zkey_size),
|
||||
wtnsBuffer, static_cast<unsigned long>(wtns_size),
|
||||
proofBuffer, &proofSize,
|
||||
publicBuffer, &publicSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
|
||||
env->SetLongArrayRegion(proof_size, 0, 1, reinterpret_cast<const jlong *>(&proofSize));
|
||||
env->SetLongArrayRegion(public_size, 0, 1, reinterpret_cast<const jlong *>(&publicSize));
|
||||
env->SetLongArrayRegion(proof_size, 0, 1, reinterpret_cast<const jlong *>(&proofSize));
|
||||
env->SetLongArrayRegion(public_size, 0, 1, reinterpret_cast<const jlong *>(&publicSize));
|
||||
|
||||
env->ReleaseByteArrayElements(zkey_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<void *>(zkeyBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<void *>(wtnsBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(proof_buffer, reinterpret_cast<jbyte *>(proofBuffer), 0);
|
||||
env->ReleaseByteArrayElements(public_buffer, reinterpret_cast<jbyte *>(publicBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
env->ReleaseByteArrayElements(zkey_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<void *>(zkeyBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<void *>(wtnsBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(proof_buffer, reinterpret_cast<jbyte *>(proofBuffer), 0);
|
||||
env->ReleaseByteArrayElements(public_buffer, reinterpret_cast<jbyte *>(publicBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// extern "C"
|
||||
@@ -132,32 +133,32 @@ Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1prove_1rsa_165537_1sha2
|
||||
jlongArray wtns_size, jbyteArray error_msg,
|
||||
jlong error_msg_max_size)
|
||||
{
|
||||
const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
|
||||
circuit_buffer, nullptr));
|
||||
const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
|
||||
nullptr));
|
||||
char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
|
||||
circuit_buffer, nullptr));
|
||||
const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
|
||||
nullptr));
|
||||
char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
|
||||
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];
|
||||
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];
|
||||
|
||||
int result = witnesscalc_prove_rsa_65537_sha256(
|
||||
circuitBuffer, static_cast<unsigned long>(circuit_size),
|
||||
jsonBuffer, static_cast<unsigned long>(json_size),
|
||||
wtnsBuffer, &wtnsSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
int result = witnesscalc_prove_rsa_65537_sha256(
|
||||
circuitBuffer, static_cast<unsigned long>(circuit_size),
|
||||
jsonBuffer, static_cast<unsigned long>(json_size),
|
||||
wtnsBuffer, &wtnsSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
|
||||
// Set the result and release the resources
|
||||
env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));
|
||||
// Set the result and release the resources
|
||||
env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));
|
||||
|
||||
env->ReleaseByteArrayElements(circuit_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(json_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
env->ReleaseByteArrayElements(circuit_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(json_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jint JNICALL
|
||||
@@ -168,32 +169,32 @@ Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1prove_1rsa_165537_1sha1
|
||||
jlongArray wtns_size, jbyteArray error_msg,
|
||||
jlong error_msg_max_size)
|
||||
{
|
||||
const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
|
||||
circuit_buffer, nullptr));
|
||||
const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
|
||||
nullptr));
|
||||
char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
|
||||
circuit_buffer, nullptr));
|
||||
const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
|
||||
nullptr));
|
||||
char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
|
||||
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];
|
||||
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];
|
||||
|
||||
int result = witnesscalc_prove_rsa_65537_sha1(
|
||||
circuitBuffer, static_cast<unsigned long>(circuit_size),
|
||||
jsonBuffer, static_cast<unsigned long>(json_size),
|
||||
wtnsBuffer, &wtnsSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
int result = witnesscalc_prove_rsa_65537_sha1(
|
||||
circuitBuffer, static_cast<unsigned long>(circuit_size),
|
||||
jsonBuffer, static_cast<unsigned long>(json_size),
|
||||
wtnsBuffer, &wtnsSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
|
||||
// Set the result and release the resources
|
||||
env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));
|
||||
// Set the result and release the resources
|
||||
env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));
|
||||
|
||||
env->ReleaseByteArrayElements(circuit_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(json_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
env->ReleaseByteArrayElements(circuit_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(json_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jint JNICALL
|
||||
@@ -204,32 +205,32 @@ Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1prove_1rsapss_165537_1s
|
||||
jlongArray wtns_size, jbyteArray error_msg,
|
||||
jlong error_msg_max_size)
|
||||
{
|
||||
const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
|
||||
circuit_buffer, nullptr));
|
||||
const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
|
||||
nullptr));
|
||||
char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
|
||||
circuit_buffer, nullptr));
|
||||
const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
|
||||
nullptr));
|
||||
char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
|
||||
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];
|
||||
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];
|
||||
|
||||
int result = witnesscalc_prove_rsapss_65537_sha256(
|
||||
circuitBuffer, static_cast<unsigned long>(circuit_size),
|
||||
jsonBuffer, static_cast<unsigned long>(json_size),
|
||||
wtnsBuffer, &wtnsSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
int result = witnesscalc_prove_rsapss_65537_sha256(
|
||||
circuitBuffer, static_cast<unsigned long>(circuit_size),
|
||||
jsonBuffer, static_cast<unsigned long>(json_size),
|
||||
wtnsBuffer, &wtnsSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
|
||||
// Set the result and release the resources
|
||||
env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));
|
||||
// Set the result and release the resources
|
||||
env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));
|
||||
|
||||
env->ReleaseByteArrayElements(circuit_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(json_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
env->ReleaseByteArrayElements(circuit_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(json_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jint JNICALL Java_com_proofofpassportapp_prover_ZKPTools_groth16_1prover_1zkey_1file(
|
||||
@@ -240,46 +241,46 @@ extern "C" JNIEXPORT jint JNICALL Java_com_proofofpassportapp_prover_ZKPTools_gr
|
||||
jbyteArray publicBuffer, jlongArray publicSize,
|
||||
jbyteArray errorMsg, jlong errorMsgMaxSize)
|
||||
{
|
||||
// Convert jbyteArray to native types
|
||||
const char *nativeZkeyPath = env->GetStringUTFChars(zkeyPath, nullptr);
|
||||
// Convert jbyteArray to native types
|
||||
const char *nativeZkeyPath = env->GetStringUTFChars(zkeyPath, nullptr);
|
||||
|
||||
void *nativeWtnsBuffer = env->GetByteArrayElements(wtnsBuffer, nullptr);
|
||||
void *nativeWtnsBuffer = env->GetByteArrayElements(wtnsBuffer, nullptr);
|
||||
|
||||
char *nativeProofBuffer = (char *)env->GetByteArrayElements(proofBuffer, nullptr);
|
||||
char *nativePublicBuffer = (char *)env->GetByteArrayElements(publicBuffer, nullptr);
|
||||
char *nativeErrorMsg = (char *)env->GetByteArrayElements(errorMsg, nullptr);
|
||||
char *nativeProofBuffer = (char *)env->GetByteArrayElements(proofBuffer, nullptr);
|
||||
char *nativePublicBuffer = (char *)env->GetByteArrayElements(publicBuffer, nullptr);
|
||||
char *nativeErrorMsg = (char *)env->GetByteArrayElements(errorMsg, nullptr);
|
||||
|
||||
jlong *nativeProofSizeArr = env->GetLongArrayElements(proofSize, 0);
|
||||
jlong *nativePublicSizeArr = env->GetLongArrayElements(publicSize, 0);
|
||||
jlong *nativeProofSizeArr = env->GetLongArrayElements(proofSize, 0);
|
||||
jlong *nativePublicSizeArr = env->GetLongArrayElements(publicSize, 0);
|
||||
|
||||
unsigned long nativeProofSize = nativeProofSizeArr[0];
|
||||
unsigned long nativePublicSize = nativePublicSizeArr[0];
|
||||
unsigned long nativeProofSize = nativeProofSizeArr[0];
|
||||
unsigned long nativePublicSize = nativePublicSizeArr[0];
|
||||
|
||||
// Call the groth16_prover function`
|
||||
int status_code = groth16_prover_zkey_file(
|
||||
nativeZkeyPath,
|
||||
nativeWtnsBuffer, wtnsSize,
|
||||
nativeProofBuffer, &nativeProofSize,
|
||||
nativePublicBuffer, &nativePublicSize,
|
||||
nativeErrorMsg, errorMsgMaxSize);
|
||||
// Call the groth16_prover function`
|
||||
int status_code = groth16_prover_zkey_file(
|
||||
nativeZkeyPath,
|
||||
nativeWtnsBuffer, wtnsSize,
|
||||
nativeProofBuffer, &nativeProofSize,
|
||||
nativePublicBuffer, &nativePublicSize,
|
||||
nativeErrorMsg, errorMsgMaxSize);
|
||||
|
||||
// Convert the results back to JNI types
|
||||
nativeProofSizeArr[0] = nativeProofSize;
|
||||
nativePublicSizeArr[0] = nativePublicSize;
|
||||
// Convert the results back to JNI types
|
||||
nativeProofSizeArr[0] = nativeProofSize;
|
||||
nativePublicSizeArr[0] = nativePublicSize;
|
||||
|
||||
env->SetLongArrayRegion(proofSize, 0, 1, (jlong *)nativeProofSizeArr);
|
||||
env->SetLongArrayRegion(publicSize, 0, 1, (jlong *)nativePublicSizeArr);
|
||||
env->SetLongArrayRegion(proofSize, 0, 1, (jlong *)nativeProofSizeArr);
|
||||
env->SetLongArrayRegion(publicSize, 0, 1, (jlong *)nativePublicSizeArr);
|
||||
|
||||
// Release the native buffers
|
||||
env->ReleaseByteArrayElements(wtnsBuffer, (jbyte *)nativeWtnsBuffer, 0);
|
||||
env->ReleaseByteArrayElements(proofBuffer, (jbyte *)nativeProofBuffer, 0);
|
||||
env->ReleaseByteArrayElements(publicBuffer, (jbyte *)nativePublicBuffer, 0);
|
||||
env->ReleaseByteArrayElements(errorMsg, (jbyte *)nativeErrorMsg, 0);
|
||||
// Release the native buffers
|
||||
env->ReleaseByteArrayElements(wtnsBuffer, (jbyte *)nativeWtnsBuffer, 0);
|
||||
env->ReleaseByteArrayElements(proofBuffer, (jbyte *)nativeProofBuffer, 0);
|
||||
env->ReleaseByteArrayElements(publicBuffer, (jbyte *)nativePublicBuffer, 0);
|
||||
env->ReleaseByteArrayElements(errorMsg, (jbyte *)nativeErrorMsg, 0);
|
||||
|
||||
env->ReleaseLongArrayElements(proofSize, (jlong *)nativeProofSizeArr, 0);
|
||||
env->ReleaseLongArrayElements(publicSize, (jlong *)nativePublicSizeArr, 0);
|
||||
env->ReleaseLongArrayElements(proofSize, (jlong *)nativeProofSizeArr, 0);
|
||||
env->ReleaseLongArrayElements(publicSize, (jlong *)nativePublicSizeArr, 0);
|
||||
|
||||
return status_code;
|
||||
return status_code;
|
||||
}
|
||||
|
||||
// // Function for ECDSA secp256r1 with SHA-256
|
||||
@@ -356,4 +357,39 @@ extern "C" JNIEXPORT jint JNICALL Java_com_proofofpassportapp_prover_ZKPTools_gr
|
||||
// env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
|
||||
// return result;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Function for VC and Disclose
|
||||
extern "C" JNIEXPORT jint JNICALL
|
||||
Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1vc_1and_1disclose(JNIEnv *env, jobject thiz,
|
||||
jbyteArray circuit_buffer,
|
||||
jlong circuit_size, jbyteArray json_buffer,
|
||||
jlong json_size, jbyteArray wtns_buffer,
|
||||
jlongArray wtns_size, jbyteArray error_msg,
|
||||
jlong error_msg_max_size)
|
||||
{
|
||||
const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(circuit_buffer, nullptr));
|
||||
const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer, nullptr));
|
||||
char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
|
||||
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));
|
||||
|
||||
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];
|
||||
|
||||
int result = witnesscalc_vc_and_disclose(
|
||||
circuitBuffer, static_cast<unsigned long>(circuit_size),
|
||||
jsonBuffer, static_cast<unsigned long>(json_size),
|
||||
wtnsBuffer, &wtnsSize,
|
||||
errorMsg, static_cast<unsigned long>(error_msg_max_size));
|
||||
|
||||
// Set the result and release the resources
|
||||
env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));
|
||||
|
||||
env->ReleaseByteArrayElements(circuit_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(json_buffer,
|
||||
reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
|
||||
env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
|
||||
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ import com.google.gson.GsonBuilder
|
||||
|
||||
import com.proofofpassportapp.R
|
||||
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class ProverModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
||||
private val TAG = "ProverModule"
|
||||
|
||||
@@ -28,11 +32,26 @@ class ProverModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun runProveAction(zkey_path: String, witness_calculator: String, dat_file_name: String, inputs: ReadableMap, promise: Promise) {
|
||||
Log.e(TAG, "zkey_path in provePassport kotlin: " + zkey_path)
|
||||
Log.e(TAG, "witness_calculator in provePassport kotlin: " + witness_calculator)
|
||||
Log.e(TAG, "dat_file_name in provePassport kotlin: " + dat_file_name)
|
||||
Log.e(TAG, "inputs in provePassport kotlin: " + inputs.toString())
|
||||
fun runProveAction(zkey_path: String, witness_calculator: String, dat_file_path: String, inputs: ReadableMap, promise: Promise) {
|
||||
Log.e(TAG, "zkey_path in provePassport kotlin: $zkey_path")
|
||||
Log.e(TAG, "witness_calculator in provePassport kotlin: $witness_calculator")
|
||||
Log.e(TAG, "dat_file_path in provePassport kotlin: $dat_file_path")
|
||||
Log.e(TAG, "inputs in provePassport kotlin: ${inputs.toString()}")
|
||||
|
||||
// Read the dat file from the provided filesystem path
|
||||
val datFile = File(dat_file_path)
|
||||
if (!datFile.exists()) {
|
||||
Log.e(TAG, "Dat file does not exist at path: $dat_file_path")
|
||||
throw IllegalArgumentException("Dat file does not exist at path: $dat_file_path")
|
||||
}
|
||||
|
||||
val datBytes: ByteArray
|
||||
try {
|
||||
datBytes = datFile.readBytes()
|
||||
} catch (e: IOException) {
|
||||
Log.e(TAG, "Error reading dat file: ${e.message}")
|
||||
throw IllegalArgumentException("Error reading dat file: ${e.message}")
|
||||
}
|
||||
|
||||
val formattedInputs = mutableMapOf<String, Any?>()
|
||||
|
||||
@@ -67,27 +86,18 @@ class ProverModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
||||
val zkpTools = ZKPTools(reactApplicationContext)
|
||||
|
||||
val witnessCalcFunction = when (witness_calculator) {
|
||||
// "register_sha256WithRSAEncryption_65537" -> zkpTools::witnesscalc_register_sha256WithRSAEncryption_65537
|
||||
// "disclose" -> zkpTools::witnesscalc_disclose
|
||||
"prove_rsa_65537_sha256" -> zkpTools::witnesscalc_prove_rsa_65537_sha256
|
||||
"prove_rsa_65537_sha1" -> zkpTools::witnesscalc_prove_rsa_65537_sha1
|
||||
"prove_rsapss_65537_sha256" -> zkpTools::witnesscalc_prove_rsapss_65537_sha256
|
||||
// "prove_ecdsa_secp256r1_sha1" -> zkpTools::witnesscalc_prove_ecdsa_secp256r1_sha1
|
||||
// "prove_ecdsa_secp256r1_sha256" -> zkpTools::witnesscalc_prove_ecdsa_secp256r1_sha256
|
||||
"vc_and_disclose" -> zkpTools::witnesscalc_vc_and_disclose
|
||||
else -> throw IllegalArgumentException("Invalid witness calculator name")
|
||||
}
|
||||
|
||||
// Get the resource ID dynamically
|
||||
val resId = reactApplicationContext.resources.getIdentifier(dat_file_name, "raw", reactApplicationContext.packageName)
|
||||
if (resId == 0) {
|
||||
throw IllegalArgumentException("Invalid dat file name")
|
||||
}
|
||||
|
||||
val zkp: ZkProof = ZKPUseCase(reactApplicationContext).generateZKP(
|
||||
zkey_path,
|
||||
resId,
|
||||
jsonInputs,
|
||||
witnessCalcFunction
|
||||
zkey_path,
|
||||
datBytes,
|
||||
jsonInputs,
|
||||
witnessCalcFunction
|
||||
)
|
||||
|
||||
Log.e("ZKP", gson.toJson(zkp))
|
||||
@@ -164,6 +174,15 @@ class ZKPTools(val context: Context) {
|
||||
wtnsSize: LongArray,
|
||||
errorMsg: ByteArray,
|
||||
errorMsgMaxSize: Long): Int
|
||||
external fun witnesscalc_vc_and_disclose(circuitBuffer: ByteArray,
|
||||
circuitSize: Long,
|
||||
jsonBuffer: ByteArray,
|
||||
jsonSize: Long,
|
||||
wtnsBuffer: ByteArray,
|
||||
wtnsSize: LongArray,
|
||||
errorMsg: ByteArray,
|
||||
errorMsgMaxSize: Long): Int
|
||||
|
||||
// external fun witnesscalc_prove_ecdsa_secp256r1_sha1(circuitBuffer: ByteArray,
|
||||
// circuitSize: Long,
|
||||
// jsonBuffer: ByteArray,
|
||||
@@ -224,7 +243,7 @@ class ZKPUseCase(val context: Context) {
|
||||
|
||||
fun generateZKP(
|
||||
zkey_path: String,
|
||||
datId: Int,
|
||||
datBytes: ByteArray,
|
||||
inputs: ByteArray,
|
||||
proofFunction: (
|
||||
circuitBuffer: ByteArray,
|
||||
@@ -238,7 +257,7 @@ class ZKPUseCase(val context: Context) {
|
||||
) -> Int
|
||||
): ZkProof {
|
||||
val zkpTool = ZKPTools(context)
|
||||
val datFile = zkpTool.openRawResourceAsByteArray(datId)
|
||||
val datFile = datBytes
|
||||
|
||||
val msg = ByteArray(256)
|
||||
|
||||
@@ -351,3 +370,4 @@ class ZKPUseCase(val context: Context) {
|
||||
return stringArray.toList()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
37
app/ios/LottieView.swift
Normal file
37
app/ios/LottieView.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// LottieView.swift
|
||||
// FreedomTools
|
||||
//
|
||||
// Created by Ivan Lele on 27.02.2024.
|
||||
//
|
||||
import Lottie
|
||||
import SwiftUI
|
||||
struct LottieView: UIViewRepresentable {
|
||||
var animationFileName: String
|
||||
let loopMode: LottieLoopMode
|
||||
|
||||
func updateUIView(_ uiView: UIViewType, context: Context) {}
|
||||
|
||||
func makeUIView(context: Context) -> some UIView {
|
||||
let view = UIView(frame: .zero)
|
||||
|
||||
let animationView = LottieAnimationView(name: animationFileName)
|
||||
animationView.loopMode = loopMode
|
||||
animationView.contentMode = .scaleAspectFit
|
||||
animationView.play()
|
||||
|
||||
animationView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(animationView)
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
animationView.widthAnchor.constraint(equalTo: view.widthAnchor),
|
||||
animationView.heightAnchor.constraint(equalTo: view.heightAnchor)
|
||||
])
|
||||
|
||||
return view
|
||||
}
|
||||
}
|
||||
#Preview {
|
||||
LottieView(animationFileName: "passport", loopMode: .loop)
|
||||
.frame(width: 300)
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// MRZScannerModule.swift
|
||||
// OpenPassport
|
||||
// ProofOfPassport
|
||||
//
|
||||
// Created by Rémi Colin on 27/02/2024.
|
||||
//
|
||||
@@ -28,7 +28,7 @@ class MRZScannerModule: NSObject, RCTBridgeModule {
|
||||
|
||||
var hostingController: UIHostingController<ScannerWithInstructions>? = nil
|
||||
var scannerView = QKMRZScannerViewRepresentable()
|
||||
// let lottieView = LottieView(animationFileName: "passport", loopMode: .loop)
|
||||
let lottieView = LottieView(animationFileName: "passport", loopMode: .loop)
|
||||
|
||||
scannerView.onScanResult = { scanResult in
|
||||
let resultDict: [String: Any] = [
|
||||
@@ -43,8 +43,7 @@ class MRZScannerModule: NSObject, RCTBridgeModule {
|
||||
}
|
||||
|
||||
// Wrap the scanner view and instruction text in a new SwiftUI view
|
||||
// let scannerWithInstructions = ScannerWithInstructions(scannerView: scannerView, lottieView: lottieView)
|
||||
let scannerWithInstructions = ScannerWithInstructions(scannerView: scannerView)
|
||||
let scannerWithInstructions = ScannerWithInstructions(scannerView: scannerView, lottieView: lottieView)
|
||||
hostingController = UIHostingController(rootView: scannerWithInstructions)
|
||||
rootViewController.present(hostingController!, animated: true, completion: nil)
|
||||
}
|
||||
@@ -58,7 +57,7 @@ class MRZScannerModule: NSObject, RCTBridgeModule {
|
||||
// Define a new SwiftUI view that includes the scanner and instruction text
|
||||
struct ScannerWithInstructions: View {
|
||||
var scannerView: QKMRZScannerViewRepresentable
|
||||
// var lottieView: LottieView
|
||||
var lottieView: LottieView
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
@@ -71,7 +70,7 @@ struct ScannerWithInstructions: View {
|
||||
RoundedRectangle(cornerRadius: 15)
|
||||
.frame(width: 370, height: 270)
|
||||
}
|
||||
// lottieView.frame(width: 360, height: 230)
|
||||
lottieView.frame(width: 360, height: 230)
|
||||
}
|
||||
.frame(height: 320)
|
||||
Text("Hold your passport on a flat surface while scanning")
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
|
||||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||
163754792CBDD4BB008AE334 /* libwitnesscalc_vc_and_disclose.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 163754782CBDD4AB008AE334 /* libwitnesscalc_vc_and_disclose.a */; };
|
||||
1648EB782CC9564D003BEA7D /* LottieView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1648EB772CC9564D003BEA7D /* LottieView.swift */; };
|
||||
165E76BD2B8DC4A00000FA90 /* MRZScannerModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 165E76BC2B8DC4A00000FA90 /* MRZScannerModule.swift */; };
|
||||
165E76BF2B8DC53A0000FA90 /* MRZScannerModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 165E76BE2B8DC53A0000FA90 /* MRZScannerModule.m */; };
|
||||
165E76C32B8DC8370000FA90 /* ScannerHostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 165E76C22B8DC8370000FA90 /* ScannerHostingController.swift */; };
|
||||
@@ -98,6 +99,7 @@
|
||||
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = OpenPassport/Info.plist; sourceTree = "<group>"; };
|
||||
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = OpenPassport/main.m; sourceTree = "<group>"; };
|
||||
163754782CBDD4AB008AE334 /* libwitnesscalc_vc_and_disclose.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libwitnesscalc_vc_and_disclose.a; sourceTree = "<group>"; };
|
||||
1648EB772CC9564D003BEA7D /* LottieView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LottieView.swift; sourceTree = "<group>"; };
|
||||
165E76BC2B8DC4A00000FA90 /* MRZScannerModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MRZScannerModule.swift; sourceTree = "<group>"; };
|
||||
165E76BE2B8DC53A0000FA90 /* MRZScannerModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MRZScannerModule.m; sourceTree = "<group>"; };
|
||||
165E76C22B8DC8370000FA90 /* ScannerHostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScannerHostingController.swift; sourceTree = "<group>"; };
|
||||
@@ -118,7 +120,7 @@
|
||||
905B70082A729CD400AFA232 /* OpenPassport.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = OpenPassport.entitlements; path = OpenPassport/OpenPassport.entitlements; sourceTree = "<group>"; };
|
||||
A19556C626C22D40B7D18E23 /* Pods_OpenPassport.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OpenPassport.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C9DDA5F7441C6B4DEC17FCC9 /* Pods-OpenPassport.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenPassport.debug.xcconfig"; path = "Target Support Files/Pods-OpenPassport/Pods-OpenPassport.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
E56E082698598B41447667BB /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = OpenPassport/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
||||
E56E082698598B41447667BB /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = OpenPassport/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
||||
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -206,6 +208,7 @@
|
||||
1686F0DF2C500FBD00841CDE /* QRScannerBridge.m */,
|
||||
1686F0DD2C500F4F00841CDE /* QRScannerViewController.swift */,
|
||||
E56E082698598B41447667BB /* PrivacyInfo.xcprivacy */,
|
||||
1648EB772CC9564D003BEA7D /* LottieView.swift */,
|
||||
);
|
||||
name = OpenPassport;
|
||||
sourceTree = "<group>";
|
||||
@@ -459,6 +462,7 @@
|
||||
165E76BF2B8DC53A0000FA90 /* MRZScannerModule.m in Sources */,
|
||||
905B70052A72767900AFA232 /* PassportReader.swift in Sources */,
|
||||
165E76C32B8DC8370000FA90 /* ScannerHostingController.swift in Sources */,
|
||||
1648EB782CC9564D003BEA7D /* LottieView.swift in Sources */,
|
||||
05EDEDC62B52D25D00AA51AD /* Prover.m in Sources */,
|
||||
165E76BD2B8DC4A00000FA90 /* MRZScannerModule.swift in Sources */,
|
||||
);
|
||||
@@ -821,12 +825,15 @@
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
);
|
||||
INFOPLIST_KEY_NSCameraUsageDescription = "Needed to scan your passport MRZ, you can however enter it manually.";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
|
||||
@@ -912,12 +919,15 @@
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
|
||||
);
|
||||
INFOPLIST_KEY_NSCameraUsageDescription = "Needed to scan your passport MRZ, you can however enter it manually.";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
|
||||
|
||||
@@ -27,7 +27,7 @@ target 'OpenPassport' do
|
||||
pod 'NFCPassportReader', git: 'https://github.com/0xturboblitz/NFCPassportReader.git', commit: '0a8e26d56f5f85f698b67c5df5ea9ecbb53cbc45'
|
||||
pod 'QKMRZScanner'
|
||||
pod 'RNFS', :path => '../node_modules/react-native-fs'
|
||||
# pod 'lottie-ios'
|
||||
pod 'lottie-ios'
|
||||
pod 'SwiftQRScanner', :git => 'https://github.com/vinodiOS/SwiftQRScanner'
|
||||
|
||||
use_react_native!(
|
||||
|
||||
@@ -6,6 +6,7 @@ PODS:
|
||||
- FBLazyVector (0.75.4)
|
||||
- fmt (9.1.0)
|
||||
- glog (0.3.5)
|
||||
- lottie-ios (4.5.0)
|
||||
- NFCPassportReader (2.0.3):
|
||||
- OpenSSL-Universal (= 1.1.1100)
|
||||
- OpenSSL-Universal (1.1.1100)
|
||||
@@ -1497,6 +1498,7 @@ DEPENDENCIES:
|
||||
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
|
||||
- fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`)
|
||||
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
|
||||
- lottie-ios
|
||||
- NFCPassportReader (from `https://github.com/0xturboblitz/NFCPassportReader.git`, commit `0a8e26d56f5f85f698b67c5df5ea9ecbb53cbc45`)
|
||||
- QKMRZScanner
|
||||
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
|
||||
@@ -1569,6 +1571,7 @@ DEPENDENCIES:
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- lottie-ios
|
||||
- OpenSSL-Universal
|
||||
- QKMRZParser
|
||||
- QKMRZScanner
|
||||
@@ -1738,6 +1741,7 @@ SPEC CHECKSUMS:
|
||||
FBLazyVector: 430e10366de01d1e3d57374500b1b150fe482e6d
|
||||
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
|
||||
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
|
||||
lottie-ios: a881093fab623c467d3bce374367755c272bdd59
|
||||
NFCPassportReader: a160b80e3df3b5325c13902f90405f5eef7520b3
|
||||
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
|
||||
QKMRZParser: 6b419b6f07d6bff6b50429b97de10846dc902c29
|
||||
@@ -1811,6 +1815,6 @@ SPEC CHECKSUMS:
|
||||
SwiftyTesseract: 1f3d96668ae92dc2208d9842c8a59bea9fad2cbb
|
||||
Yoga: b05994d1933f507b0a28ceaa4fdb968dc18da178
|
||||
|
||||
PODFILE CHECKSUM: 1b6d277e1a07b81d6d83bd97479ddfcdc1883bd7
|
||||
PODFILE CHECKSUM: fff5f0fc97e17fb53d7fd9198944714a37fed0a6
|
||||
|
||||
COCOAPODS: 1.15.2
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
"@react-native-async-storage/async-storage": "^1.23.1",
|
||||
"@react-native-community/cli": "^14.1.1",
|
||||
"@react-native-community/netinfo": "^11.3.1",
|
||||
"@tamagui/colors": "^1.103.0",
|
||||
"@tamagui/config": "^1.103.0",
|
||||
"@tamagui/core": "^1.103.0",
|
||||
"@tamagui/lucide-icons": "^1.103.0",
|
||||
"@tamagui/toast": "^1.103.0",
|
||||
"@tamagui/types": "^1.103.0",
|
||||
"@tamagui/colors": "1.105.0",
|
||||
"@tamagui/config": "1.105.0",
|
||||
"@tamagui/core": "1.105.0",
|
||||
"@tamagui/lucide-icons": "1.105.0",
|
||||
"@tamagui/toast": "1.105.0",
|
||||
"@tamagui/types": "1.105.0",
|
||||
"@types/msgpack-lite": "^0.1.11",
|
||||
"@types/pako": "^2.0.3",
|
||||
"@zk-kit/imt": "https://gitpkg.now.sh/0xturboblitz/zk-kit/packages/imt?6d417675",
|
||||
@@ -51,7 +51,7 @@
|
||||
"react-native-svg": "13.4.0",
|
||||
"react-native-zip-archive": "^6.1.0",
|
||||
"socket.io-client": "^4.7.5",
|
||||
"tamagui": "^1.103.0",
|
||||
"tamagui": "1.105.0",
|
||||
"zustand": "^4.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -83,4 +83,4 @@
|
||||
"node": ">=18"
|
||||
},
|
||||
"packageManager": "yarn@4.5.0"
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,6 @@ export function Carousel({ images, height = 300, handleNfcScan }: CarouselProps)
|
||||
const isLastImage = imageIndex === images.length - 1
|
||||
const slideTexts = [
|
||||
{ header: "Follow this guide carefully", subtitle: "", acknowledgment: "I'm ready to start" },
|
||||
{ header: "Remove your phone case", subtitle: "If your phone does not have a case, you can skip this step.", acknowledgment: "I have removed my phone case" },
|
||||
{ header: "Open your passport to the last page", subtitle: "", acknowledgment: "I have opened my passport to the last page" },
|
||||
{ header: "Put your phone on the passport", subtitle: "Press your phone against the last page of the passport as in the image.", acknowledgment: "I have placed my phone on the passport" },
|
||||
{ header: "Start scanning", subtitle: "Press Start NFC Scan and follow the on-screen instructions.", acknowledgment: "Start scanning" },
|
||||
@@ -60,44 +59,47 @@ export function Carousel({ images, height = 300, handleNfcScan }: CarouselProps)
|
||||
const currentSlide = slideTexts[imageIndex] || { header: "No header", subtitle: "No subtitle for this slide", acknowledgment: "Continue" }
|
||||
|
||||
return (
|
||||
<YStack f={1} >
|
||||
<YStack f={1}>
|
||||
<YStack f={1} jc='space-evenly'>
|
||||
|
||||
<XStack
|
||||
overflow="hidden"
|
||||
backgroundColor="#000"
|
||||
position="relative"
|
||||
height={height}
|
||||
alignItems="center"
|
||||
borderRadius="$10"
|
||||
mt="$5"
|
||||
>
|
||||
<AnimatePresence initial={false} custom={{ going }}>
|
||||
<GalleryItem key={page} animation="medium" going={going}>
|
||||
<Image source={{ uri: images[imageIndex] }} height={height} resizeMode="contain" />
|
||||
</GalleryItem>
|
||||
</AnimatePresence>
|
||||
<Text textAlign='center' fontSize="$9" color={textBlack} >Verify your passport using <Text color={textBlack} style={{ textDecorationLine: 'underline', textDecorationColor: bgGreen }}>NFC</Text></Text>
|
||||
|
||||
<XStack
|
||||
overflow="hidden"
|
||||
backgroundColor="#000"
|
||||
position="relative"
|
||||
height={height}
|
||||
alignItems="center"
|
||||
borderRadius="$10"
|
||||
>
|
||||
<AnimatePresence initial={false} custom={{ going }}>
|
||||
<GalleryItem key={page} animation="medium" going={going}>
|
||||
<Image source={{ uri: images[imageIndex] }} height={height} resizeMode="contain" />
|
||||
</GalleryItem>
|
||||
</AnimatePresence>
|
||||
|
||||
|
||||
{imageIndex > 0 && (
|
||||
<Button
|
||||
icon={ArrowLeft}
|
||||
size="$5"
|
||||
position="absolute"
|
||||
left="$4"
|
||||
circular
|
||||
elevate
|
||||
onPress={() => paginate(-1)}
|
||||
zi={100}
|
||||
/>
|
||||
)}
|
||||
</XStack>
|
||||
{imageIndex > 0 && (
|
||||
<Button
|
||||
icon={ArrowLeft}
|
||||
size="$5"
|
||||
position="absolute"
|
||||
left="$4"
|
||||
circular
|
||||
elevate
|
||||
onPress={() => paginate(-1)}
|
||||
zi={100}
|
||||
/>
|
||||
)}
|
||||
</XStack>
|
||||
|
||||
<YStack ml="$2">
|
||||
<Text fontSize="$8" mt="$4" color={textBlack} textAlign='center'>{currentSlide.header}</Text>
|
||||
<Text color={textBlack} fontSize="$5" mt="$2" textAlign='center' style={{ opacity: 0.7 }} fontStyle='italic'>{currentSlide.subtitle}</Text>
|
||||
<YStack>
|
||||
<Text fontSize="$8" color={textBlack} textAlign='center'>{currentSlide.header}</Text>
|
||||
<Text color={textBlack} fontSize="$5" textAlign='center' style={{ opacity: 0.7 }} fontStyle='italic'>{currentSlide.subtitle}</Text>
|
||||
</YStack>
|
||||
</YStack>
|
||||
|
||||
<XStack f={1} />
|
||||
|
||||
|
||||
<CustomButton
|
||||
onPress={isLastImage ? () => handleNfcScan?.() : () => paginate(+1)}
|
||||
|
||||
@@ -15,7 +15,7 @@ interface CustomButtonProps {
|
||||
|
||||
const CustomButton: React.FC<CustomButtonProps> = ({ text, onPress, Icon, bgColor, h, isDisabled, disabledOnPress, blueVariant }) => {
|
||||
return (
|
||||
<Button bg={bgColor ? bgColor : blueVariant ? bgBlue : bgGreen} h={blueVariant ? "$8" : "$4.5"} borderRadius="$10" mx="$3" onPress={isDisabled ? disabledOnPress : onPress}>
|
||||
<Button bg={bgColor ? bgColor : blueVariant ? bgBlue : bgGreen} h={blueVariant ? "$8" : "$5"} borderRadius="$10" onPress={isDisabled ? disabledOnPress : onPress}>
|
||||
{Icon && <Button.Icon>{Icon}</Button.Icon>}
|
||||
<Text textAlign='center' fontSize={blueVariant ? "$6" : "$5"} fontWeight="bold" color={textBlack}>
|
||||
{text}
|
||||
|
||||
@@ -10,7 +10,7 @@ const StepOneStepTwo = ({ variable, step1, step2 }: StepOneStepTwoProps) => {
|
||||
const isVisible = variable === step1 || variable === step2;
|
||||
|
||||
return (
|
||||
<XStack px="$4" mt="$4" gap="$3" style={{ opacity: isVisible ? 1 : 0 }}>
|
||||
<XStack px="$6" gap="$3" style={{ opacity: isVisible ? 1 : 0 }}>
|
||||
<XStack h="$0.25" f={1} bg={textBlack} borderRadius={100} style={{ opacity: variable === step1 ? 1 : 0.2 }} />
|
||||
<XStack h="$0.25" f={1} bg={textBlack} borderRadius={100} style={{ opacity: variable === step2 ? 1 : 0.2 }} />
|
||||
</XStack>
|
||||
|
||||
BIN
app/src/images/openpassport.png
Normal file
BIN
app/src/images/openpassport.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
BIN
app/src/images/passport_drawing.png
Normal file
BIN
app/src/images/passport_drawing.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 133 KiB |
@@ -1,12 +1,12 @@
|
||||
import React from 'react';
|
||||
import { ScrollView, Text, YStack } from 'tamagui';
|
||||
import useNavigationStore from '../stores/navigationStore';
|
||||
import { ScrollView, Text, YStack, Image } from 'tamagui';
|
||||
import { XStack } from 'tamagui';
|
||||
import CustomButton from '../components/CustomButton';
|
||||
import { BadgeCheck, Binary, List, QrCode, Smartphone } from '@tamagui/lucide-icons';
|
||||
import { bgGreen, textBlack } from '../utils/colors';
|
||||
import useUserStore from '../stores/userStore';
|
||||
import { scanQRCode } from '../utils/qrCode';
|
||||
import OPENPASSPORT_LOGO from '../images/openpassport.png';
|
||||
|
||||
interface AppScreenProps {
|
||||
setSheetAppListOpen: (value: boolean) => void;
|
||||
@@ -21,73 +21,14 @@ const AppScreen: React.FC<AppScreenProps> = ({ setSheetAppListOpen, setSheetRegi
|
||||
|
||||
|
||||
return (
|
||||
<YStack f={1} pb="$3" px="$3">
|
||||
<XStack ml="$2" gap="$2" ai="center">
|
||||
{registered ?
|
||||
<XStack bg={bgGreen} px="$2.5" py="$2" borderRadius="$10">
|
||||
<Text color={textBlack} fontSize="$4">scanned</Text>
|
||||
</XStack> :
|
||||
<XStack bg={'#FFB897'} px="$2.5" py="$2" borderRadius="$10">
|
||||
<Text color={textBlack} fontSize="$4">not scanned</Text>
|
||||
</XStack>}
|
||||
|
||||
</XStack>
|
||||
<ScrollView showsVerticalScrollIndicator={true} indicatorStyle="black">
|
||||
<YStack >
|
||||
|
||||
{/* <XStack ml="$2" gap="$2" mt="$1">
|
||||
<Text fontSize="$5">userID:</Text>
|
||||
<Text color={textBlack} fontSize="$5">0x1234567890</Text>
|
||||
</XStack> */}
|
||||
</YStack>
|
||||
<YStack>
|
||||
<Text mt="$4" fontSize="$8" >How to use OpenPassport?</Text>
|
||||
<YStack>
|
||||
<XStack mt="$3" px="$5" gap="$2" >
|
||||
<QrCode size={50} color={textBlack} />
|
||||
<YStack>
|
||||
<Text fontSize="$5" mb="$1">Scan QR code</Text>
|
||||
<XStack gap="$2"><Text fontSize="$3">1</Text><Text fontSize="$3" maxWidth={220}>Find the QR code on the page of the app that asks for OpenPassport.</Text></XStack>
|
||||
<XStack mt="$1" gap="$2"><Text fontSize="$3">2</Text><Text fontSize="$3" maxWidth={220}>Scan the QR code.</Text></XStack>
|
||||
</YStack>
|
||||
</XStack>
|
||||
<XStack mt="$4" px="$5" gap="$2" >
|
||||
<BadgeCheck size={50} color={textBlack} />
|
||||
<YStack>
|
||||
<Text fontSize="$5" mb="$1">Generate a Proof</Text>
|
||||
<XStack gap="$2"><Text fontSize="$3">1</Text><Text fontSize="$3" maxWidth={220}>Generate a proof of the selected information.</Text></XStack>
|
||||
<XStack mt="$1" gap="$2"><Text fontSize="$3">2</Text><Text fontSize="$3" maxWidth={220}>Share the proof with the application.</Text></XStack>
|
||||
</YStack>
|
||||
</XStack>
|
||||
</YStack>
|
||||
</YStack>
|
||||
<YStack mb="$4">
|
||||
<Text mt="$5" fontSize="$8" >How does it work?</Text>
|
||||
<YStack>
|
||||
<XStack mt="$3" px="$5" gap="$2" >
|
||||
<Binary size={50} color={textBlack} />
|
||||
<YStack>
|
||||
<Text fontSize="$5" mb="$1">Strong cryptography</Text>
|
||||
<XStack gap="$2"><Text fontSize="$3">·</Text><Text fontSize="$3" maxWidth={220}>OpenPassport uses ZK technologies which allows you to prove a statement without revealing why it's true.</Text></XStack>
|
||||
<XStack gap="$2"><Text fontSize="$3">·</Text><Text fontSize="$3" maxWidth={220}>You are always anonymous</Text></XStack>
|
||||
</YStack>
|
||||
</XStack>
|
||||
<XStack mt="$3" px="$5" gap="$2" >
|
||||
<Smartphone size={50} color={textBlack} />
|
||||
<YStack>
|
||||
<Text fontSize="$5" mb="$1">Serverless</Text>
|
||||
<XStack gap="$2"><Text fontSize="$3">·</Text><Text fontSize="$3" maxWidth={220}>OpenPassport will never receive your data and will never know who you are.</Text></XStack>
|
||||
<XStack gap="$2"><Text fontSize="$3">·</Text><Text fontSize="$3" maxWidth={220}>Everything is achieved on your device, even the camera and NFC scanning.</Text></XStack>
|
||||
|
||||
</YStack>
|
||||
</XStack>
|
||||
</YStack>
|
||||
</YStack>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
<YStack f={1} >
|
||||
<XStack f={1} minHeight="$1" />
|
||||
|
||||
<Image alignSelf='center' src={OPENPASSPORT_LOGO} width={400} height={150} />
|
||||
<Text mt="$2.5" textAlign='center' fontSize="$9" fontWeight='bold' color={textBlack}>OpenPassport</Text>
|
||||
|
||||
<XStack f={1} minHeight="$1" />
|
||||
<Text textAlign='center' mb="$2" fontSize="$3" color={textBlack}>To use OpenPassport, scan the QR code displayed by an app.</Text>
|
||||
<YStack gap="$2.5">
|
||||
<CustomButton
|
||||
text="Scan QR Code"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React from 'react';
|
||||
import { YStack, Text, XStack } from 'tamagui';
|
||||
import { Camera, SquarePen } from '@tamagui/lucide-icons';
|
||||
import { YStack, Text, XStack, Image } from 'tamagui';
|
||||
import { Camera, ShieldCheck, SquarePen } from '@tamagui/lucide-icons';
|
||||
import { bgGreen, blueColor, textBlack } from '../utils/colors';
|
||||
import { startCameraScan } from '../utils/cameraScanner';
|
||||
import CustomButton from '../components/CustomButton';
|
||||
import useNavigationStore from '../stores/navigationStore';
|
||||
import PASSPORT_DRAWING from '../images/passport_drawing.png'
|
||||
interface CameraScreenProps {
|
||||
setSheetIsOpen: (value: boolean) => void
|
||||
}
|
||||
@@ -15,25 +16,24 @@ const CameraScreen: React.FC<CameraScreenProps> = ({ setSheetIsOpen }) => {
|
||||
} = useNavigationStore();
|
||||
|
||||
return (
|
||||
<YStack f={1} p="$3">
|
||||
<YStack f={1} mt="$10">
|
||||
<Text ml="$1" fontSize={34} color={textBlack}><Text style={{ textDecorationLine: 'underline', textDecorationColor: bgGreen }}>Scan</Text> or type your passport ID</Text>
|
||||
<Text ml="$2" mt="$8" fontSize="$8" color={textBlack}>Open your passport on the <Text style={{ textDecorationLine: 'underline', textDecorationColor: bgGreen }}>main page</Text> to scan it.</Text>
|
||||
<Text ml="$2" mt="$3" fontSize="$8" color={textBlack} style={{ opacity: 0.7 }}>Your data never leaves your device.</Text>
|
||||
<XStack f={1} />
|
||||
<YStack f={1}>
|
||||
<YStack f={1} my="$6" jc="space-evenly" ai="center">
|
||||
<Text textAlign='center' fontSize="$9" color={textBlack}><Text style={{ textDecorationLine: 'underline', textDecorationColor: bgGreen }}>Scan</Text> or type your passport ID</Text>
|
||||
<Text textAlign='center' mt="$4" fontSize="$6" color={textBlack}>Open your passport on the <Text style={{ textDecorationLine: 'underline', textDecorationColor: bgGreen }}>main page</Text> to scan it.</Text>
|
||||
<Image src={PASSPORT_DRAWING} style={{ width: 200, height: 250 }} />
|
||||
</YStack>
|
||||
<XStack p="$3" onPress={() => setSelectedTab("mock")} ai="center" jc="center">
|
||||
<Text mt="$5" fontSize="$3" alignSelf='center' w="80%" ai="center" textAlign="center" color={textBlack}>
|
||||
You can also <Text color={blueColor} style={{ textDecorationLine: 'underline', textDecorationColor: blueColor }}>use mock passport data</Text> and skip this step.
|
||||
</Text>
|
||||
</XStack>
|
||||
|
||||
<Text textAlign='center' mb="$2" fontSize="$4" color={textBlack}>The application is not taking a picture, only reading some fields.</Text>
|
||||
<YStack gap="$2.5" >
|
||||
<CustomButton text="Open Camera" onPress={startCameraScan} Icon={<Camera color={textBlack} size={24} />} />
|
||||
<CustomButton bgColor='#ffff' text="Manual Input" onPress={() => setSheetIsOpen(true)} Icon={<SquarePen color={textBlack} size={24} />} />
|
||||
</YStack>
|
||||
|
||||
</YStack>
|
||||
{/* <XStack mt="$3.5" justifyContent='center' alignItems='center' gap="$1.5">
|
||||
<ShieldCheck color={textBlack} size={12} />
|
||||
<Text color={textBlack} fontSize="$3">private and secured</Text>
|
||||
</XStack> */}
|
||||
|
||||
</YStack >
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { NativeEventEmitter, NativeModules, Linking, Modal, Platform, Pressable } from 'react-native';
|
||||
import { YStack, XStack, Text, Button, Tabs, Sheet, Label, Fieldset, Input, Switch, H2, Image, useWindowDimensions, H4, H3, View, Separator } from 'tamagui'
|
||||
import { HelpCircle, IterationCw, VenetianMask, Cog, CheckCircle2, ChevronLeft, Share, Eraser, ArrowRight, UserPlus, CalendarSearch, X } from '@tamagui/lucide-icons';
|
||||
import { HelpCircle, IterationCw, VenetianMask, Cog, CheckCircle2, ChevronLeft, Share, Eraser, ArrowRight, UserPlus, CalendarSearch, X, ShieldCheck } from '@tamagui/lucide-icons';
|
||||
import Telegram from '../images/telegram.png'
|
||||
import Github from '../images/github.png'
|
||||
import Internet from "../images/internet.png"
|
||||
@@ -27,8 +27,6 @@ import CameraScreen from './CameraScreen';
|
||||
import NextScreen from './NextScreen';
|
||||
import AppScreen from './AppScreen';
|
||||
// import constants
|
||||
import { RPC_URL, SignatureAlgorithmIndex } from '../../../common/src/constants/constants';
|
||||
import { mock_csca_sha256_rsa_4096, mock_dsc_sha256_rsa_4096 } from '../../../common/src/constants/mockCertificates';
|
||||
import DatePicker from 'react-native-date-picker'
|
||||
import StartScreen from './StartScreen';
|
||||
import CustomButton from '../components/CustomButton';
|
||||
@@ -37,6 +35,7 @@ import SplashScreen from './SplashScreen';
|
||||
import ValidProofScreen from './ValidProofScreen';
|
||||
import WrongProofScreen from './WrongProofScreen';
|
||||
import MockDataScreen from './MockDataScreen';
|
||||
import OPENPASSPORT_LOGO from '../images/openpassport.png'
|
||||
|
||||
const emitter = (Platform.OS === 'android')
|
||||
? new NativeEventEmitter(NativeModules.nativeModule)
|
||||
@@ -169,6 +168,36 @@ const MainScreen: React.FC = () => {
|
||||
// }
|
||||
// }, [modalProofStep]);
|
||||
|
||||
const decrementStep = () => {
|
||||
if (selectedTab === "scan") {
|
||||
setSelectedTab("start");
|
||||
}
|
||||
else if (selectedTab === "nfc") {
|
||||
setSelectedTab("scan");
|
||||
}
|
||||
else if (selectedTab === "mock") {
|
||||
setSelectedTab("start");
|
||||
}
|
||||
else if (selectedTab === "next") {
|
||||
if (passportData.mockUser) {
|
||||
setSelectedTab("mock");
|
||||
} else {
|
||||
setSelectedTab("nfc");
|
||||
}
|
||||
}
|
||||
else if (selectedTab === "app") {
|
||||
setSelectedTab("next");
|
||||
}
|
||||
else if (selectedTab === "prove") {
|
||||
setSelectedTab("app");
|
||||
}
|
||||
else if (selectedTab === "wrong") {
|
||||
setSelectedTab("app");
|
||||
}
|
||||
else if (selectedTab === "valid") {
|
||||
setSelectedTab("app");
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setIsFormComplete(passportNumber?.length >= 3 && dateOfBirth?.length >= 6 && dateOfExpiry?.length >= 6);
|
||||
@@ -181,36 +210,36 @@ const MainScreen: React.FC = () => {
|
||||
<YStack f={1}>
|
||||
<ToastViewport portalToRoot flexDirection="column-reverse" top={85} right={0} left={0} />
|
||||
<ToastMessage />
|
||||
<YStack f={1} mt={Platform.OS === 'ios' ? "$8" : "$0"} mb={Platform.OS === 'ios' ? "$4" : "$2"}>
|
||||
<YStack f={1} mt={Platform.OS === 'ios' ? "$8" : "$2"} mb={Platform.OS === 'ios' ? "$5" : "$2"}>
|
||||
<YStack >
|
||||
<StepOneStepTwo variable={selectedTab} step1="scan" step2="nfc" />
|
||||
{selectedTab !== ("app") && selectedTab !== ("splash") && <XStack onPress={() => setSelectedTab("app")} px="$4" py="$2" mt="$3" alignSelf='flex-end'><X size={28} color={textBlack} /></XStack>}
|
||||
{selectedTab === "app" &&
|
||||
<XStack px="$4" py="$2" mt="$0" ai="center">
|
||||
<Text fontSize="$9" >OpenPassport</Text>
|
||||
<XStack f={1} />
|
||||
|
||||
<XStack onPress={() => setHelpIsOpen(true)}><HelpCircle size={28} color={textBlack} /></XStack>
|
||||
<XStack p="$2" onPress={() => setSettingsIsOpen(true)}><Cog size={24} color={textBlack} /></XStack>
|
||||
<XStack mt="$2" h="$5" jc="space-between" ai="center" mb="$2">
|
||||
<Button
|
||||
p="$4"
|
||||
unstyled
|
||||
onPress={decrementStep}
|
||||
opacity={selectedTab !== "start" && selectedTab !== "app" ? 1 : 0}
|
||||
pointerEvents={selectedTab !== "start" && selectedTab !== "app" ? "auto" : "none"}
|
||||
>
|
||||
<ChevronLeft color={textBlack} size={24} />
|
||||
</Button>
|
||||
<XStack jc="center" ai="center">
|
||||
<Image src={OPENPASSPORT_LOGO} style={{ width: 50, height: 50 }} />
|
||||
<Text fontWeight="bold" fontSize="$5">OpenPassport</Text>
|
||||
</XStack>
|
||||
}
|
||||
<Button
|
||||
p="$4"
|
||||
unstyled
|
||||
onPress={() => setHelpIsOpen(true)}
|
||||
opacity={selectedTab === "app" ? 1 : 0}
|
||||
pointerEvents={selectedTab === "app" ? "auto" : "none"}
|
||||
>
|
||||
<HelpCircle size={28} color={textBlack} />
|
||||
</Button>
|
||||
</XStack>
|
||||
|
||||
{/* {selectedTab !== "start" && selectedTab !== "scan" && selectedTab !== "nfc" && selectedTab !== "next" && selectedTab !== "register" && (
|
||||
<YStack>
|
||||
<XStack jc="space-between" ai="center" px="$3">
|
||||
<Button p="$2" py="$3" unstyled onPress={decrementStep}><ChevronLeft color={(selectedTab === "start") ? "transparent" : "#a0a0a0"} /></Button>
|
||||
|
||||
<Text fontSize="$6" color="#a0a0a0">
|
||||
{selectedTab === "scan" ? "Scan" : (selectedTab === "app" ? "Apps" : "Prove")}
|
||||
</Text>
|
||||
<XStack>
|
||||
<Button p="$2" py="$3" unstyled onPress={() => setSettingsIsOpen(true)}><Cog color="#a0a0a0" /></Button>
|
||||
<Button p="$2" py="$3" unstyled onPress={() => setHelpIsOpen(true)}><HelpCircle color="#a0a0a0" /></Button>
|
||||
</XStack>
|
||||
</XStack>
|
||||
<Separator borderColor={separatorColor} />
|
||||
</YStack>
|
||||
)} */}
|
||||
<StepOneStepTwo variable={selectedTab} step1="scan" step2="nfc" />
|
||||
|
||||
<Sheet open={nfcSheetIsOpen} onOpenChange={setNfcSheetIsOpen} dismissOnSnapToBottom modal dismissOnOverlayPress={false} disableDrag animation="medium" snapPoints={[35]}>
|
||||
<Sheet.Overlay />
|
||||
<Sheet.Frame>
|
||||
@@ -386,15 +415,109 @@ const MainScreen: React.FC = () => {
|
||||
<H3 color={textBlack}>About ZK Proofs</H3>
|
||||
<Text color={textBlack} ml="$2" mt="$1">Zero-knowledge proofs rely on mathematical magic tricks to show the validity of some computation without revealing of all its inputs. In our case, the proof shows the passport has not been forged, but allows you to hide sensitive data.</Text>
|
||||
</YStack> */}
|
||||
<YStack gap="$1">
|
||||
<H3 color={textBlack}>FAQ</H3>
|
||||
<YStack ml="$1">
|
||||
<H4 color={textBlack}>My passport is not supported</H4>
|
||||
<Text color={textBlack} ml="$2">Please contact us on Telegram, or if you have programming skills, you can easily <Text onPress={() => Linking.openURL('https://t.me/openpassport')} color={blueColorLight} style={{ textDecorationLine: 'underline', fontStyle: 'italic' }}>contribute</Text> to the project by adding your signature algorithm.</Text>
|
||||
</YStack>
|
||||
</YStack>
|
||||
<H4 textAlign='center' color={textBlack}>My passport is not supported</H4>
|
||||
<Text textAlign='center' color={textBlack}>Please contact us on Telegram; you can also contribute your passport data to help us implement the custom signature algorithm for your country.</Text>
|
||||
<Button w="$12" mt="$4" bg="white" jc="center" borderColor={borderColor} borderWidth={1} onPress={() => setDialogContributeIsOpen(true)} alignSelf='center' >
|
||||
<Share size={16} color={textBlack} />
|
||||
<Text color={textBlack} >Contribute</Text>
|
||||
</Button>
|
||||
<Dialog.Container visible={DialogContributeIsOpen}>
|
||||
<Dialog.Title>Contribute</Dialog.Title>
|
||||
<Dialog.Description>
|
||||
By pressing yes, you accept sending your passport data.
|
||||
Passport data are encrypted and will be deleted once the signature algorithm is implemented.
|
||||
</Dialog.Description>
|
||||
<Dialog.Button onPress={() => setDialogContributeIsOpen(false)} label="Cancel" />
|
||||
<Dialog.Button onPress={() => handleContribute()} label="Contribute" />
|
||||
</Dialog.Container>
|
||||
<Separator mt="$5" borderColor={separatorColor} w="80%" alignSelf='center' />
|
||||
|
||||
|
||||
<Fieldset horizontal mt="$3" alignSelf='center'>
|
||||
<Label color={textBlack} width={225} justifyContent="flex-end" htmlFor="restart" >
|
||||
Display other options
|
||||
</Label>
|
||||
<Switch size="$3.5" checked={displayOtherOptions} onCheckedChange={() => setDisplayOtherOptions(!displayOtherOptions)}>
|
||||
<Switch.Thumb animation="bouncy" bc={bgColor} />
|
||||
</Switch>
|
||||
</Fieldset>
|
||||
|
||||
|
||||
|
||||
{displayOtherOptions && (
|
||||
<YStack gap="$2" mt="$3" ai="center">
|
||||
<Fieldset gap="$4" horizontal>
|
||||
<Label color={textBlack} width={200} justifyContent="flex-end" htmlFor="restart">
|
||||
Restart to step 1
|
||||
</Label>
|
||||
<Button bg="white" jc="center" borderColor={borderColor} borderWidth={1.2} size="$3.5" ml="$2" onPress={handleRestart}>
|
||||
<IterationCw color={textBlack} />
|
||||
</Button>
|
||||
</Fieldset>
|
||||
|
||||
<Fieldset gap="$4" mt="$1" horizontal>
|
||||
<Label color={textBlack} width={200} justifyContent="flex-end" htmlFor="skip" >
|
||||
Delete passport data
|
||||
</Label>
|
||||
<Button bg="white" jc="center" borderColor={borderColor} borderWidth={1.2} size="$3.5" ml="$2" onPress={clearPassportDataFromStorage}>
|
||||
<Eraser color={textBlack} />
|
||||
</Button>
|
||||
</Fieldset>
|
||||
|
||||
{/* <Fieldset gap="$4" mt="$1" horizontal>
|
||||
<Label color={textBlack} width={200} justifyContent="flex-end" htmlFor="skip" >
|
||||
Delete proofs
|
||||
</Label>
|
||||
<Button bg="white" jc="center" borderColor={borderColor} borderWidth={1.2} size="$3.5" ml="$2" onPress={clearProofsFromStorage}>
|
||||
<Eraser color={textBlack} />
|
||||
</Button>
|
||||
</Fieldset> */}
|
||||
|
||||
|
||||
{/* <Fieldset horizontal>
|
||||
<Label color={textBlack} width={225} justifyContent="flex-end" htmlFor="restart" >
|
||||
Private mode
|
||||
</Label>
|
||||
<Switch size="$3.5" checked={hideData} onCheckedChange={handleHideData}>
|
||||
<Switch.Thumb animation="bouncy" bc={bgColor} />
|
||||
</Switch>
|
||||
</Fieldset> */}
|
||||
|
||||
<Fieldset gap="$4" mt="$1" horizontal>
|
||||
<Label color={textBlack} width={200} justifyContent="flex-end" htmlFor="skip" >
|
||||
Delete secret (caution)
|
||||
</Label>
|
||||
<Button bg="white" jc="center" borderColor={borderColor} borderWidth={1.2} size="$3.5" ml="$2" onPress={() => setDialogDeleteSecretIsOpen(true)}>
|
||||
<Eraser color={textColor2} />
|
||||
</Button>
|
||||
</Fieldset>
|
||||
<Dialog.Container visible={dialogDeleteSecretIsOpen}>
|
||||
<Dialog.Title>Delete Secret</Dialog.Title>
|
||||
<Dialog.Description>
|
||||
You are about to delete your secret. Be careful! You will not be able to recover your identity.
|
||||
</Dialog.Description>
|
||||
<Dialog.Button onPress={() => setDialogDeleteSecretIsOpen(false)} label="Cancel" />
|
||||
<Dialog.Button onPress={() => handleDeleteSecret()} label="Delete secret" />
|
||||
</Dialog.Container>
|
||||
{/* <Fieldset gap="$4" mt="$1" horizontal>
|
||||
<Label color={textBlack} width={200} justifyContent="flex-end" htmlFor="skip" >
|
||||
registered = (!registered)
|
||||
</Label>
|
||||
<Button bg="white" jc="center" borderColor={borderColor} borderWidth={1.2} size="$3.5" ml="$2" onPress={() => setRegistered(!registered)}>
|
||||
<UserPlus color={textColor2} />
|
||||
</Button>
|
||||
</Fieldset> */}
|
||||
|
||||
|
||||
|
||||
|
||||
</YStack>
|
||||
|
||||
)}
|
||||
|
||||
|
||||
<XStack f={1} />
|
||||
|
||||
|
||||
</YStack>
|
||||
<XStack justifyContent="center" mb="$2" gap="$5" mt="$8">
|
||||
@@ -653,6 +776,7 @@ const MainScreen: React.FC = () => {
|
||||
</YStack>
|
||||
|
||||
<Tabs f={1} orientation="horizontal" flexDirection="column" defaultValue={"splash"}
|
||||
px="$5"
|
||||
value={selectedTab}
|
||||
onValueChange={(value) => updateNavigationStore({ selectedTab: value })}
|
||||
>
|
||||
@@ -698,6 +822,10 @@ const MainScreen: React.FC = () => {
|
||||
<WrongProofScreen />
|
||||
</Tabs.Content>
|
||||
</Tabs>
|
||||
<XStack mt="$2.5" justifyContent='center' alignItems='center' gap="$1.5">
|
||||
<ShieldCheck color={textBlack} size={12} />
|
||||
<Text color={textBlack} fontSize="$3">private and secured</Text>
|
||||
</XStack>
|
||||
|
||||
</YStack>
|
||||
<Sheet
|
||||
|
||||
@@ -1,36 +1,56 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { YStack, XStack, Text, Select, Adapt, Sheet, Fieldset, Button, Spinner } from 'tamagui';
|
||||
import { CalendarSearch, Check, ChevronDown, ChevronUp, Cpu } from '@tamagui/lucide-icons';
|
||||
import { bgGreen, textBlack } from '../utils/colors';
|
||||
import React, { useState, useCallback, useMemo } from 'react';
|
||||
import { YStack, XStack, Text, Select, Adapt, Sheet, Fieldset, Button, Spinner, ToggleGroup, Switch } from 'tamagui';
|
||||
import { Check, ChevronDown, ChevronUp, Cpu, Minus, Plus } from '@tamagui/lucide-icons';
|
||||
import { bgColor, bgGreen, bgGreen2, blueColor, borderColor, greenColorLight, redColorDark, textBlack } from '../utils/colors';
|
||||
import useUserStore from '../stores/userStore';
|
||||
import useNavigationStore from '../stores/navigationStore';
|
||||
import CustomButton from '../components/CustomButton';
|
||||
import DatePicker from 'react-native-date-picker';
|
||||
import { genMockPassportData } from '../../../common/src/utils/genMockPassportData';
|
||||
import { countryCodes } from '../../../common/src/constants/constants';
|
||||
import getCountryISO2 from "country-iso-3-to-2";
|
||||
import { flag } from 'country-emoji';
|
||||
|
||||
const MockDataScreen: React.FC = () => {
|
||||
const [signatureAlgorithm, setSignatureAlgorithm] = useState("rsa_sha256");
|
||||
const listOfSignatureAlgorithms = ["rsa_sha1", "rsa_sha256", "rsapss_sha256"];
|
||||
|
||||
const [dateOfBirthDatePicker, setDateOfBirthDatePicker] = useState<Date>(new Date(new Date().setFullYear(new Date().getFullYear() - 24)))
|
||||
const [dateOfExpiryDatePicker, setDateOfExpiryDatePicker] = useState<Date>(new Date(new Date().setFullYear(new Date().getFullYear() + 5)))
|
||||
const [dateOfBirthDatePickerIsOpen, setDateOfBirthDatePickerIsOpen] = useState(false)
|
||||
const [dateOfExpiryDatePickerIsOpen, setDateOfExpiryDatePickerIsOpen] = useState(false)
|
||||
const [nationality, setNationality] = useState("FRA")
|
||||
const [isGenerating, setIsGenerating] = useState(false)
|
||||
|
||||
const castDate = (date: Date) => {
|
||||
const [age, setAge] = useState(24);
|
||||
const [expiryYears, setExpiryYears] = useState(5);
|
||||
const [nationality, setNationality] = useState("FRA");
|
||||
const [isGenerating, setIsGenerating] = useState(false);
|
||||
const [isInOfacList, setIsInOfacList] = useState(false);
|
||||
const castDate = (yearsOffset: number) => {
|
||||
const date = new Date();
|
||||
date.setFullYear(date.getFullYear() + yearsOffset);
|
||||
return (date.toISOString().slice(2, 4) + date.toISOString().slice(5, 7) + date.toISOString().slice(8, 10)).toString();
|
||||
}
|
||||
const { toast } = useNavigationStore()
|
||||
};
|
||||
|
||||
const { toast } = useNavigationStore();
|
||||
|
||||
const handleGenerate = useCallback(async () => {
|
||||
setIsGenerating(true);
|
||||
|
||||
const randomPassportNumber = Math.random().toString(36).substring(2, 11).replace(/[^a-z0-9]/gi, '').toUpperCase();
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const mockPassportData = genMockPassportData(signatureAlgorithm as "rsa_sha256" | "rsa_sha1" | "rsapss_sha256", nationality as keyof typeof countryCodes, castDate(dateOfBirthDatePicker), castDate(dateOfExpiryDatePicker));
|
||||
let mockPassportData;
|
||||
if (isInOfacList) {
|
||||
mockPassportData = genMockPassportData(
|
||||
signatureAlgorithm as "rsa_sha256" | "rsa_sha1" | "rsapss_sha256",
|
||||
nationality as keyof typeof countryCodes,
|
||||
castDate(-age),
|
||||
castDate(expiryYears),
|
||||
randomPassportNumber,
|
||||
'HENAO MONTOYA',
|
||||
'ARCANGEL DE JESUS'
|
||||
);
|
||||
} else {
|
||||
mockPassportData = genMockPassportData(
|
||||
signatureAlgorithm as "rsa_sha256" | "rsa_sha1" | "rsapss_sha256",
|
||||
nationality as keyof typeof countryCodes,
|
||||
castDate(-age),
|
||||
castDate(expiryYears),
|
||||
randomPassportNumber,
|
||||
);
|
||||
}
|
||||
useUserStore.getState().registerPassportData(mockPassportData);
|
||||
useUserStore.getState().setRegistered(true);
|
||||
resolve(null);
|
||||
@@ -45,13 +65,20 @@ const MockDataScreen: React.FC = () => {
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
}, [signatureAlgorithm, nationality, dateOfBirthDatePicker, dateOfExpiryDatePicker]);
|
||||
|
||||
}, [signatureAlgorithm, nationality, age, expiryYears, isInOfacList]);
|
||||
const countryOptions = useMemo(() => {
|
||||
return Object.keys(countryCodes).map((countryCode, index) => ({
|
||||
countryCode,
|
||||
countryName: countryCodes[countryCode as keyof typeof countryCodes],
|
||||
flagEmoji: flag(getCountryISO2(countryCode)),
|
||||
index,
|
||||
}));
|
||||
}, []);
|
||||
return (
|
||||
<YStack p="$3" f={1} gap="$5">
|
||||
<Text ml="$1" fontSize={34} color={textBlack}><Text style={{ textDecorationLine: 'underline', textDecorationColor: bgGreen }}>Generate</Text> passport data</Text>
|
||||
<XStack ai="center" gap="$2" mt="$4">
|
||||
<Text f={1} miw="$12">
|
||||
<YStack f={1} gap="$4" >
|
||||
<Text my="$9" textAlign="center" fontSize="$9" color={textBlack}>Generate passport data</Text>
|
||||
<XStack ai="center" >
|
||||
<Text f={1} fontSize="$5">
|
||||
Encryption
|
||||
</Text>
|
||||
<Select
|
||||
@@ -60,7 +87,7 @@ const MockDataScreen: React.FC = () => {
|
||||
onValueChange={setSignatureAlgorithm}
|
||||
native
|
||||
>
|
||||
<Select.Trigger width={220} iconAfter={ChevronDown}>
|
||||
<Select.Trigger w="$16" iconAfter={ChevronDown}>
|
||||
<Select.Value placeholder="Select algorithm" />
|
||||
</Select.Trigger>
|
||||
|
||||
@@ -115,8 +142,8 @@ const MockDataScreen: React.FC = () => {
|
||||
</XStack>
|
||||
|
||||
|
||||
<XStack ai="center" gap="$2" mt="$4">
|
||||
<Text f={1} miw="$12">
|
||||
<XStack ai="center" gap="$2">
|
||||
<Text f={1} fontSize="$5">
|
||||
Nationality
|
||||
</Text>
|
||||
<Select
|
||||
@@ -125,7 +152,7 @@ const MockDataScreen: React.FC = () => {
|
||||
onValueChange={setNationality}
|
||||
native
|
||||
>
|
||||
<Select.Trigger width={220} iconAfter={ChevronDown}>
|
||||
<Select.Trigger width="$16" iconAfter={ChevronDown}>
|
||||
<Select.Value placeholder="Select algorithm" />
|
||||
</Select.Trigger>
|
||||
|
||||
@@ -161,9 +188,9 @@ const MockDataScreen: React.FC = () => {
|
||||
|
||||
<Select.Viewport minWidth={200}>
|
||||
<Select.Group>
|
||||
{Object.keys(countryCodes).map((countryCode, index) => (
|
||||
{countryOptions.map(({ countryCode, countryName, flagEmoji, index }) => (
|
||||
<Select.Item key={countryCode} index={index} value={countryCode}>
|
||||
<Select.ItemText>{countryCodes[countryCode as keyof typeof countryCodes]} {flag(getCountryISO2(countryCode))}</Select.ItemText>
|
||||
<Select.ItemText>{countryName} {flagEmoji}</Select.ItemText>
|
||||
<Select.ItemIndicator marginLeft="auto">
|
||||
<Check size={16} />
|
||||
</Select.ItemIndicator>
|
||||
@@ -180,63 +207,68 @@ const MockDataScreen: React.FC = () => {
|
||||
</XStack>
|
||||
|
||||
|
||||
<Fieldset gap="$4" horizontal>
|
||||
|
||||
<Fieldset mt="$2" gap="$2" horizontal>
|
||||
<Text color={textBlack} width={160} justifyContent="flex-end" fontSize="$5">
|
||||
Date of birth
|
||||
Age (🎂)
|
||||
</Text>
|
||||
<Text color={textBlack} f={1}>
|
||||
{dateOfBirthDatePicker ? dateOfBirthDatePicker.toISOString().slice(0, 10) : ''}
|
||||
</Text>
|
||||
<Button bg={bgGreen} onPress={() => setDateOfBirthDatePickerIsOpen(true)}
|
||||
borderRadius={"$10"}
|
||||
>
|
||||
<CalendarSearch />
|
||||
<XStack f={1} />
|
||||
|
||||
<Button h="$3.5" w="$3.5" bg="white" jc="center" borderColor={borderColor} borderWidth={1} borderRadius="$10" onPress={() => setAge(age - 1)} disabled={age <= 0}>
|
||||
<Minus />
|
||||
</Button>
|
||||
<DatePicker
|
||||
modal
|
||||
mode='date'
|
||||
open={dateOfBirthDatePickerIsOpen}
|
||||
date={dateOfBirthDatePicker || new Date()}
|
||||
onConfirm={(date) => {
|
||||
setDateOfBirthDatePickerIsOpen(false)
|
||||
setDateOfBirthDatePicker(date)
|
||||
}}
|
||||
onCancel={() => {
|
||||
setDateOfBirthDatePickerIsOpen(false)
|
||||
}}
|
||||
/>
|
||||
</Fieldset>
|
||||
<Fieldset gap="$4" horizontal>
|
||||
<Text color={textBlack} width={160} justifyContent="flex-end" fontSize="$5">
|
||||
Date of expiry
|
||||
<Text textAlign='center' w="$6" color={textBlack} fontSize="$5">
|
||||
{age} yo
|
||||
</Text>
|
||||
<Text color={textBlack} f={1}>
|
||||
{dateOfExpiryDatePicker ? dateOfExpiryDatePicker.toISOString().slice(0, 10) : ''}
|
||||
</Text>
|
||||
<Button bg={bgGreen} onPress={() => setDateOfExpiryDatePickerIsOpen(true)}
|
||||
borderRadius="$10"
|
||||
>
|
||||
<CalendarSearch />
|
||||
<Button h="$3.5" w="$3.5" bg="white" jc="center" borderColor={borderColor} borderWidth={1} borderRadius="$10" onPress={() => setAge(age + 1)}>
|
||||
<Plus />
|
||||
</Button>
|
||||
<DatePicker
|
||||
modal
|
||||
mode='date'
|
||||
open={dateOfExpiryDatePickerIsOpen}
|
||||
date={dateOfExpiryDatePicker || new Date()}
|
||||
onConfirm={(date) => {
|
||||
setDateOfExpiryDatePickerIsOpen(false)
|
||||
setDateOfExpiryDatePicker(date)
|
||||
}}
|
||||
onCancel={() => {
|
||||
setDateOfExpiryDatePickerIsOpen(false)
|
||||
}}
|
||||
/>
|
||||
</Fieldset>
|
||||
|
||||
<Fieldset gap="$2" horizontal>
|
||||
<Text color={textBlack} width={160} justifyContent="flex-end" fontSize="$5">
|
||||
Passport expires in
|
||||
</Text>
|
||||
<XStack f={1} />
|
||||
|
||||
<Button h="$3.5" w="$3.5" bg="white" jc="center" borderColor={borderColor} borderWidth={1} borderRadius="$10" onPress={() => setExpiryYears(expiryYears - 1)} disabled={expiryYears <= 0}>
|
||||
<Minus />
|
||||
</Button>
|
||||
<Text textAlign='center' w="$6" color={textBlack} fontSize="$5">
|
||||
{expiryYears} years
|
||||
</Text>
|
||||
<Button h="$3.5" w="$3.5" bg="white" jc="center" borderColor={borderColor} borderWidth={1} borderRadius="$10" onPress={() => setExpiryYears(expiryYears + 1)}>
|
||||
<Plus />
|
||||
</Button>
|
||||
</Fieldset>
|
||||
|
||||
<YStack >
|
||||
<Fieldset mt="$2" gap="$2" horizontal>
|
||||
<Text color={textBlack} width={160} justifyContent="flex-end" fontSize="$5">
|
||||
Is in OFAC list
|
||||
</Text>
|
||||
<XStack f={1} />
|
||||
<Switch size="$3.5" checked={isInOfacList} onCheckedChange={() => setIsInOfacList(!isInOfacList)} bg={isInOfacList ? "$green7Light" : "$gray4"}>
|
||||
<Switch.Thumb animation="quick" bc="white" />
|
||||
</Switch>
|
||||
|
||||
|
||||
</Fieldset>
|
||||
<Text mt="$2" color="$red10" justifyContent="flex-end" fontSize="$3" style={{ opacity: isInOfacList ? 1 : 0 }}>
|
||||
OFAC list is a list of people who are suspected of being involved in terrorism or other illegal activities.
|
||||
</Text>
|
||||
</YStack>
|
||||
|
||||
<YStack f={1} />
|
||||
<CustomButton onPress={handleGenerate} text="Generate passport data" Icon={isGenerating ? <Spinner /> : <Cpu color={textBlack} />} isDisabled={isGenerating} />
|
||||
|
||||
<YStack >
|
||||
<Text mb="$2" textAlign="center" fontSize="$4" color={textBlack}>
|
||||
These passport data are only for testing purposes.
|
||||
</Text>
|
||||
<CustomButton onPress={handleGenerate} text="Generate passport data" Icon={isGenerating ? <Spinner /> : <Cpu color={textBlack} />} isDisabled={isGenerating} />
|
||||
</YStack>
|
||||
</YStack>
|
||||
);
|
||||
};
|
||||
|
||||
export default MockDataScreen;
|
||||
export default MockDataScreen;
|
||||
|
||||
@@ -5,7 +5,6 @@ import { getFirstName, maskString } from '../utils/utils';
|
||||
import { attributeToPosition } from '../../../common/src/constants/constants';
|
||||
import USER_PROFILE from '../images/user_profile.png'
|
||||
import { bgGreen, borderColor, componentBgColor, textBlack, textColor1, textColor2 } from '../utils/colors';
|
||||
import { Platform } from 'react-native';
|
||||
import { formatAttribute } from '../utils/utils';
|
||||
import useUserStore from '../stores/userStore';
|
||||
import useNavigationStore from '../stores/navigationStore';
|
||||
@@ -37,7 +36,7 @@ const NextScreen: React.FC = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<YStack p="$3" f={1}>
|
||||
<YStack f={1}>
|
||||
<YStack alignSelf='center' my="$3">
|
||||
{hideData
|
||||
? <Image
|
||||
@@ -49,30 +48,29 @@ const NextScreen: React.FC = () => {
|
||||
}}
|
||||
/>
|
||||
: <Image
|
||||
w={height > 750 ? 150 : 110}
|
||||
w={height > 750 ? 190 : 130}
|
||||
h={height > 750 ? 190 : 130}
|
||||
borderRadius={height > 750 ? "$7" : "$6"}
|
||||
|
||||
source={{
|
||||
uri: passportData.mockUser ? USER_PROFILE : passportData.photoBase64 ?? USER_PROFILE,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
</YStack>
|
||||
<Text color={textBlack} fontSize="$8" mt="$8" ml="$2">
|
||||
<Text color={textBlack} fontSize="$9" mt="$8" >
|
||||
Hi{" "}
|
||||
<Text color={textBlack} fontSize="$8" style={{
|
||||
<Text color={textBlack} fontSize="$9" style={{
|
||||
textDecorationLine: "underline", textDecorationColor: bgGreen
|
||||
}}>{
|
||||
passportData.mockUser
|
||||
? "Anon"
|
||||
: hideData
|
||||
? maskString(getFirstName(passportData.mrz))
|
||||
: getFirstName(passportData.mrz)
|
||||
hideData
|
||||
? maskString(getFirstName(passportData.mrz))
|
||||
: getFirstName(passportData.mrz)
|
||||
}</Text>
|
||||
{" "}👋
|
||||
|
||||
</Text>
|
||||
|
||||
<YStack gap="$2" mt="$4" mx="$3">
|
||||
<YStack gap="$2.5" mt="$6">
|
||||
{Object.keys(disclosureOptions).map((key) => {
|
||||
const key_ = key;
|
||||
const indexes = attributeToPosition[key_ as keyof typeof attributeToPosition];
|
||||
@@ -82,14 +80,14 @@ const NextScreen: React.FC = () => {
|
||||
|
||||
return (
|
||||
<Fieldset horizontal key={key} gap="$3" alignItems='center'>
|
||||
<Text color={textBlack} w="$10" justifyContent="flex-end" fontSize="$5" style={{
|
||||
<Text color={textBlack} w="$14" justifyContent="flex-end" fontSize="$6" style={{
|
||||
opacity: 0.7
|
||||
}}>
|
||||
{keyFormatted}:
|
||||
</Text>
|
||||
<Text
|
||||
color={textBlack}
|
||||
fontSize="$5"
|
||||
fontSize="$6"
|
||||
|
||||
>
|
||||
{hideData ? maskString(mrzAttributeFormatted) : mrzAttributeFormatted}
|
||||
@@ -102,10 +100,6 @@ const NextScreen: React.FC = () => {
|
||||
|
||||
<YStack f={1} />
|
||||
|
||||
<XStack bg="#ffff" borderRadius={100} py="$2.5" px="$3.5" gap="$2" mx="$3">
|
||||
<Info alignSelf='center' size={24} color={textBlack} />
|
||||
<Text pr="$6" fontSize="$2" color={textBlack}>Your information will remain confidential and will not be used or shared without your explicit consent.</Text>
|
||||
</XStack >
|
||||
|
||||
<YStack f={1} />
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ const NfcScreen: React.FC<NfcScreenProps> = ({ handleNFCScan }) => {
|
||||
const [dialogVisible, setDialogVisible] = useState(false);
|
||||
const [dialogMessage, setDialogMessage] = useState('');
|
||||
const [isNfcSupported, setIsNfcSupported] = useState(true);
|
||||
const carouselImages = [US_PASSPORT, REMOVE_CASE, US_PASSPORT_LASTPAGE, Platform.OS === 'ios' ? US_PASSPORT_LASTPAGE_IOS : US_PASSPORT_LASTPAGE_ANDROID, PHONE_SCANBUTTON,];
|
||||
const carouselImages = [US_PASSPORT, US_PASSPORT_LASTPAGE, Platform.OS === 'ios' ? US_PASSPORT_LASTPAGE_IOS : US_PASSPORT_LASTPAGE_ANDROID, PHONE_SCANBUTTON,];
|
||||
|
||||
const openNfcSettings = () => {
|
||||
if (Platform.OS === 'ios') {
|
||||
@@ -60,8 +60,7 @@ const NfcScreen: React.FC<NfcScreenProps> = ({ handleNFCScan }) => {
|
||||
|
||||
return (
|
||||
<ScrollView flex={1} contentContainerStyle={{ flexGrow: 1 }}>
|
||||
<YStack f={1} p="$3" >
|
||||
<Text fontSize="$9" mt="$0" color={textBlack} mb="$4" ml="$2">Verify your passport using <Text fontSize="$9" color={textBlack} style={{ textDecorationLine: 'underline', textDecorationColor: bgGreen }}>NFC</Text></Text>
|
||||
<YStack f={1} >
|
||||
<Carousel
|
||||
images={carouselImages}
|
||||
height={300}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import React from 'react';
|
||||
import { YStack, Text } from 'tamagui';
|
||||
import { ArrowRight } from '@tamagui/lucide-icons';
|
||||
import { bgGreen, textBlack } from '../utils/colors';
|
||||
import { View } from 'react-native';
|
||||
import { YStack, Text, XStack, Image } from 'tamagui';
|
||||
import { ArrowRight, ShieldCheck } from '@tamagui/lucide-icons';
|
||||
import { bgGreen, bgWhite, textBlack } from '../utils/colors';
|
||||
import OPENPASSPORT_LOGO from '../images/openpassport.png';
|
||||
import CustomButton from '../components/CustomButton';
|
||||
import useNavigationStore from '../stores/navigationStore';
|
||||
|
||||
|
||||
|
||||
const StartScreen: React.FC = () => {
|
||||
|
||||
const {
|
||||
@@ -12,19 +16,26 @@ const StartScreen: React.FC = () => {
|
||||
} = useNavigationStore();
|
||||
|
||||
return (
|
||||
<YStack f={1} p="$3">
|
||||
<YStack f={1} mt="$12">
|
||||
<YStack gap="$0.5" mb="$14">
|
||||
<Text fontSize="$9" >Welcome to OpenPassport 👋</Text>
|
||||
<Text fontSize="$8" mt="$6" color={textBlack}>OpenPassport allows you to scan your passport, and to prove your identity in a
|
||||
<Text fontSize="$8" color={textBlack} style={{ textDecorationLine: 'underline', textDecorationColor: bgGreen }}> secure </Text>way.
|
||||
</Text>
|
||||
</YStack>
|
||||
<YStack f={1} >
|
||||
|
||||
<YStack f={1} mt="$6" mb="$2.5" gap="$0" ai="center" jc="space-between" >
|
||||
|
||||
<Text fontSize={38} color={textBlack} textAlign='center'>Welcome to OpenPassport.</Text>
|
||||
<Image src={OPENPASSPORT_LOGO} width={400} height={300} />
|
||||
<Text textAlign='center' fontSize="$4" color={textBlack}>No information will be shared without your explicit consent.</Text>
|
||||
|
||||
</YStack>
|
||||
<CustomButton Icon={<ArrowRight />} text="Let's start" onPress={() => {
|
||||
setSelectedTab("scan");
|
||||
}} />
|
||||
|
||||
<YStack gap="$2.5">
|
||||
<CustomButton Icon={<ArrowRight />} text="Use my passport" onPress={() => {
|
||||
setSelectedTab("scan");
|
||||
}} />
|
||||
<CustomButton bgColor="white" Icon={<ArrowRight />} text="Use a fake passport" onPress={() => {
|
||||
setSelectedTab("mock");
|
||||
}} />
|
||||
|
||||
</YStack>
|
||||
|
||||
</YStack >
|
||||
);
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ export const startCameraScan = async () => {
|
||||
})
|
||||
|
||||
setSelectedTab("nfc");
|
||||
toast.show("✅", {
|
||||
toast.show("✔︎", {
|
||||
message: 'Scan successful',
|
||||
customData: {
|
||||
type: "success",
|
||||
@@ -43,7 +43,7 @@ export const startCameraScan = async () => {
|
||||
})
|
||||
|
||||
setSelectedTab("nfc");
|
||||
toast.show("✅", {
|
||||
toast.show("✔︎", {
|
||||
message: 'Scan successful',
|
||||
customData: {
|
||||
type: "success",
|
||||
|
||||
@@ -8,8 +8,6 @@ import { Buffer } from 'buffer';
|
||||
import * as amplitude from '@amplitude/analytics-react-native';
|
||||
import useUserStore from '../stores/userStore';
|
||||
import useNavigationStore from '../stores/navigationStore';
|
||||
import { parseDSC, getCircuitName } from '../../../common/src/utils/certificates/handleCertificate';
|
||||
import { downloadZkey } from './zkeyDownload';
|
||||
|
||||
export const scan = async (setModalProofStep: (modalProofStep: number) => void) => {
|
||||
const {
|
||||
@@ -69,12 +67,23 @@ const scanAndroid = async (setModalProofStep: (modalProofStep: number) => void)
|
||||
console.log('error during scan:', e);
|
||||
setNfcSheetIsOpen(false);
|
||||
amplitude.track('nfc_scan_unsuccessful', { error: e.message });
|
||||
toast.show('Error', {
|
||||
message: e.message,
|
||||
customData: {
|
||||
type: "error",
|
||||
},
|
||||
})
|
||||
if (e.message.includes("InvalidMRZKey")) {
|
||||
toast.show('Error', {
|
||||
message: "Go to previous screen and rescan your passport with the camera",
|
||||
customData: {
|
||||
type: "error",
|
||||
},
|
||||
timeout: 5000,
|
||||
})
|
||||
useNavigationStore.getState().setSelectedTab("scan");
|
||||
} else {
|
||||
toast.show('Error', {
|
||||
message: e.message,
|
||||
customData: {
|
||||
type: "error",
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -102,8 +111,25 @@ const scanIOS = async (setModalProofStep: (modalProofStep: number) => void) => {
|
||||
} catch (e: any) {
|
||||
console.log('error during scan:', e);
|
||||
amplitude.track('nfc_scan_unsuccessful', { error: e.message });
|
||||
if (!e.message.includes("UserCanceled")) {
|
||||
toast.show('Failed to read passport', {
|
||||
// if (!e.message.includes("UserCanceled")) {
|
||||
// toast.show('Failed to read passport', {
|
||||
// message: e.message,
|
||||
// customData: {
|
||||
// type: "error",
|
||||
// },
|
||||
// })
|
||||
// }
|
||||
if (e.message.includes("InvalidMRZKey")) {
|
||||
toast.show('Error', {
|
||||
message: "Go to previous screen and rescan your passport with the camera",
|
||||
customData: {
|
||||
type: "error",
|
||||
},
|
||||
timeout: 5000,
|
||||
})
|
||||
useNavigationStore.getState().setSelectedTab("scan");
|
||||
} else {
|
||||
toast.show('Error', {
|
||||
message: e.message,
|
||||
customData: {
|
||||
type: "error",
|
||||
@@ -174,9 +200,6 @@ const handleResponseIOS = async (
|
||||
|
||||
try {
|
||||
useUserStore.getState().registerPassportData(passportData)
|
||||
const { signatureAlgorithm, hashFunction } = parseDSC(pem);
|
||||
const circuitName = getCircuitName("prove", signatureAlgorithm, hashFunction);
|
||||
downloadZkey(circuitName as any);
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
} catch (e: any) {
|
||||
console.log('error during parsing:', e);
|
||||
@@ -247,13 +270,11 @@ const handleResponseAndroid = async (
|
||||
signerInfoDigestAlgorithm: signerInfoDigestAlgorithm,
|
||||
digestEncryptionAlgorithm: digestEncryptionAlgorithm,
|
||||
dsc: pem,
|
||||
mockUser: false
|
||||
});
|
||||
|
||||
try {
|
||||
useUserStore.getState().registerPassportData(passportData)
|
||||
const { signatureAlgorithm, hashFunction } = parseDSC(pem);
|
||||
const circuitName = getCircuitName("prove", signatureAlgorithm, hashFunction);
|
||||
downloadZkey(circuitName as any);
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
} catch (e: any) {
|
||||
console.log('error during parsing:', e);
|
||||
|
||||
@@ -57,7 +57,9 @@ export const scanQRCode = () => {
|
||||
if (qrScanner && qrScanner.scanQRCode) {
|
||||
qrScanner.scanQRCode()
|
||||
.then((result: string) => {
|
||||
handleQRCodeScan(result, toast, setSelectedApp, setSelectedTab);
|
||||
const params = parseUrlParams(result);
|
||||
const encodedData = params.get('data');
|
||||
handleQRCodeScan(encodedData as string, toast, setSelectedApp, setSelectedTab);
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.error('QR Scanner Error:', error);
|
||||
|
||||
@@ -45,17 +45,17 @@ install(TARGETS
|
||||
witnesscalc_prove_rsapss_65537_sha256
|
||||
witnesscalc_prove_rsapss_65537_sha256Static
|
||||
|
||||
register_rsa_65537_sha256
|
||||
witnesscalc_register_rsa_65537_sha256
|
||||
witnesscalc_register_rsa_65537_sha256Static
|
||||
# register_rsa_65537_sha256
|
||||
# witnesscalc_register_rsa_65537_sha256
|
||||
# witnesscalc_register_rsa_65537_sha256Static
|
||||
|
||||
register_rsa_65537_sha1
|
||||
witnesscalc_register_rsa_65537_sha1
|
||||
witnesscalc_register_rsa_65537_sha1Static
|
||||
# register_rsa_65537_sha1
|
||||
# witnesscalc_register_rsa_65537_sha1
|
||||
# witnesscalc_register_rsa_65537_sha1Static
|
||||
|
||||
register_rsapss_65537_sha256
|
||||
witnesscalc_register_rsapss_65537_sha256
|
||||
witnesscalc_register_rsapss_65537_sha256Static
|
||||
# register_rsapss_65537_sha256
|
||||
# witnesscalc_register_rsapss_65537_sha256
|
||||
# witnesscalc_register_rsapss_65537_sha256Static
|
||||
|
||||
vc_and_disclose
|
||||
witnesscalc_vc_and_disclose
|
||||
@@ -82,9 +82,9 @@ install(FILES
|
||||
src/prove_rsa_65537_sha256.dat
|
||||
src/prove_rsa_65537_sha1.dat
|
||||
src/prove_rsapss_65537_sha256.dat
|
||||
src/register_rsa_65537_sha256.dat
|
||||
src/register_rsa_65537_sha1.dat
|
||||
src/register_rsapss_65537_sha256.dat
|
||||
# src/register_rsa_65537_sha256.dat
|
||||
# src/register_rsa_65537_sha1.dat
|
||||
# src/register_rsapss_65537_sha256.dat
|
||||
# src/authV2.dat
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
@@ -95,8 +95,8 @@ install(FILES
|
||||
src/witnesscalc_prove_rsa_65537_sha256.h
|
||||
src/witnesscalc_prove_rsa_65537_sha1.h
|
||||
src/witnesscalc_prove_rsapss_65537_sha256.h
|
||||
src/witnesscalc_register_rsa_65537_sha256.h
|
||||
src/witnesscalc_register_rsa_65537_sha1.h
|
||||
src/witnesscalc_register_rsapss_65537_sha256.h
|
||||
# src/witnesscalc_register_rsa_65537_sha256.h
|
||||
# src/witnesscalc_register_rsa_65537_sha1.h
|
||||
# src/witnesscalc_register_rsapss_65537_sha256.h
|
||||
# src/witnesscalc_authV2.h
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
|
||||
|
||||
@@ -179,56 +179,56 @@ target_compile_definitions(witnesscalc_prove_rsapss_65537_sha256Static PUBLIC CI
|
||||
target_compile_definitions(prove_rsapss_65537_sha256 PUBLIC CIRCUIT_NAME=prove_rsapss_65537_sha256)
|
||||
|
||||
# register_rsa_65537_sha256
|
||||
set(register_rsa_65537_sha256_SOURCES ${LIB_SOURCES}
|
||||
register_rsa_65537_sha256.cpp
|
||||
witnesscalc_register_rsa_65537_sha256.h
|
||||
witnesscalc_register_rsa_65537_sha256.cpp
|
||||
)
|
||||
# set(register_rsa_65537_sha256_SOURCES ${LIB_SOURCES}
|
||||
# register_rsa_65537_sha256.cpp
|
||||
# witnesscalc_register_rsa_65537_sha256.h
|
||||
# witnesscalc_register_rsa_65537_sha256.cpp
|
||||
# )
|
||||
|
||||
add_library(witnesscalc_register_rsa_65537_sha256 SHARED ${register_rsa_65537_sha256_SOURCES})
|
||||
add_library(witnesscalc_register_rsa_65537_sha256Static STATIC ${register_rsa_65537_sha256_SOURCES})
|
||||
set_target_properties(witnesscalc_register_rsa_65537_sha256Static PROPERTIES OUTPUT_NAME witnesscalc_register_rsa_65537_sha256)
|
||||
# add_library(witnesscalc_register_rsa_65537_sha256 SHARED ${register_rsa_65537_sha256_SOURCES})
|
||||
# add_library(witnesscalc_register_rsa_65537_sha256Static STATIC ${register_rsa_65537_sha256_SOURCES})
|
||||
# set_target_properties(witnesscalc_register_rsa_65537_sha256Static PROPERTIES OUTPUT_NAME witnesscalc_register_rsa_65537_sha256)
|
||||
|
||||
add_executable(register_rsa_65537_sha256 main.cpp)
|
||||
target_link_libraries(register_rsa_65537_sha256 witnesscalc_register_rsa_65537_sha256Static)
|
||||
# add_executable(register_rsa_65537_sha256 main.cpp)
|
||||
# target_link_libraries(register_rsa_65537_sha256 witnesscalc_register_rsa_65537_sha256Static)
|
||||
|
||||
target_compile_definitions(witnesscalc_register_rsa_65537_sha256 PUBLIC CIRCUIT_NAME=register_rsa_65537_sha256)
|
||||
target_compile_definitions(witnesscalc_register_rsa_65537_sha256Static PUBLIC CIRCUIT_NAME=register_rsa_65537_sha256)
|
||||
target_compile_definitions(register_rsa_65537_sha256 PUBLIC CIRCUIT_NAME=register_rsa_65537_sha256)
|
||||
# target_compile_definitions(witnesscalc_register_rsa_65537_sha256 PUBLIC CIRCUIT_NAME=register_rsa_65537_sha256)
|
||||
# target_compile_definitions(witnesscalc_register_rsa_65537_sha256Static PUBLIC CIRCUIT_NAME=register_rsa_65537_sha256)
|
||||
# target_compile_definitions(register_rsa_65537_sha256 PUBLIC CIRCUIT_NAME=register_rsa_65537_sha256)
|
||||
|
||||
|
||||
# register_rsa_65537_sha1
|
||||
set(register_rsa_65537_sha1_SOURCES ${LIB_SOURCES}
|
||||
register_rsa_65537_sha1.cpp
|
||||
witnesscalc_register_rsa_65537_sha1.h
|
||||
witnesscalc_register_rsa_65537_sha1.cpp
|
||||
)
|
||||
# # register_rsa_65537_sha1
|
||||
# set(register_rsa_65537_sha1_SOURCES ${LIB_SOURCES}
|
||||
# register_rsa_65537_sha1.cpp
|
||||
# witnesscalc_register_rsa_65537_sha1.h
|
||||
# witnesscalc_register_rsa_65537_sha1.cpp
|
||||
# )
|
||||
|
||||
add_library(witnesscalc_register_rsa_65537_sha1 SHARED ${register_rsa_65537_sha1_SOURCES})
|
||||
add_library(witnesscalc_register_rsa_65537_sha1Static STATIC ${register_rsa_65537_sha1_SOURCES})
|
||||
set_target_properties(witnesscalc_register_rsa_65537_sha1Static PROPERTIES OUTPUT_NAME witnesscalc_register_rsa_65537_sha1)
|
||||
# add_library(witnesscalc_register_rsa_65537_sha1 SHARED ${register_rsa_65537_sha1_SOURCES})
|
||||
# add_library(witnesscalc_register_rsa_65537_sha1Static STATIC ${register_rsa_65537_sha1_SOURCES})
|
||||
# set_target_properties(witnesscalc_register_rsa_65537_sha1Static PROPERTIES OUTPUT_NAME witnesscalc_register_rsa_65537_sha1)
|
||||
|
||||
add_executable(register_rsa_65537_sha1 main.cpp)
|
||||
target_link_libraries(register_rsa_65537_sha1 witnesscalc_register_rsa_65537_sha1Static)
|
||||
# add_executable(register_rsa_65537_sha1 main.cpp)
|
||||
# target_link_libraries(register_rsa_65537_sha1 witnesscalc_register_rsa_65537_sha1Static)
|
||||
|
||||
target_compile_definitions(witnesscalc_register_rsa_65537_sha1 PUBLIC CIRCUIT_NAME=register_rsa_65537_sha1)
|
||||
target_compile_definitions(witnesscalc_register_rsa_65537_sha1Static PUBLIC CIRCUIT_NAME=register_rsa_65537_sha1)
|
||||
target_compile_definitions(register_rsa_65537_sha1 PUBLIC CIRCUIT_NAME=register_rsa_65537_sha1)
|
||||
# target_compile_definitions(witnesscalc_register_rsa_65537_sha1 PUBLIC CIRCUIT_NAME=register_rsa_65537_sha1)
|
||||
# target_compile_definitions(witnesscalc_register_rsa_65537_sha1Static PUBLIC CIRCUIT_NAME=register_rsa_65537_sha1)
|
||||
# target_compile_definitions(register_rsa_65537_sha1 PUBLIC CIRCUIT_NAME=register_rsa_65537_sha1)
|
||||
|
||||
# register_rsapss_65537_sha256
|
||||
set(register_rsapss_65537_sha256_SOURCES ${LIB_SOURCES}
|
||||
register_rsapss_65537_sha256.cpp
|
||||
witnesscalc_register_rsapss_65537_sha256.h
|
||||
witnesscalc_register_rsapss_65537_sha256.cpp
|
||||
)
|
||||
# # register_rsapss_65537_sha256
|
||||
# set(register_rsapss_65537_sha256_SOURCES ${LIB_SOURCES}
|
||||
# register_rsapss_65537_sha256.cpp
|
||||
# witnesscalc_register_rsapss_65537_sha256.h
|
||||
# witnesscalc_register_rsapss_65537_sha256.cpp
|
||||
# )
|
||||
|
||||
add_library(witnesscalc_register_rsapss_65537_sha256 SHARED ${register_rsapss_65537_sha256_SOURCES})
|
||||
add_library(witnesscalc_register_rsapss_65537_sha256Static STATIC ${register_rsapss_65537_sha256_SOURCES})
|
||||
set_target_properties(witnesscalc_register_rsapss_65537_sha256Static PROPERTIES OUTPUT_NAME witnesscalc_register_rsapss_65537_sha256)
|
||||
# add_library(witnesscalc_register_rsapss_65537_sha256 SHARED ${register_rsapss_65537_sha256_SOURCES})
|
||||
# add_library(witnesscalc_register_rsapss_65537_sha256Static STATIC ${register_rsapss_65537_sha256_SOURCES})
|
||||
# set_target_properties(witnesscalc_register_rsapss_65537_sha256Static PROPERTIES OUTPUT_NAME witnesscalc_register_rsapss_65537_sha256)
|
||||
|
||||
add_executable(register_rsapss_65537_sha256 main.cpp)
|
||||
target_link_libraries(register_rsapss_65537_sha256 witnesscalc_register_rsapss_65537_sha256Static)
|
||||
# add_executable(register_rsapss_65537_sha256 main.cpp)
|
||||
# target_link_libraries(register_rsapss_65537_sha256 witnesscalc_register_rsapss_65537_sha256Static)
|
||||
|
||||
target_compile_definitions(witnesscalc_register_rsapss_65537_sha256 PUBLIC CIRCUIT_NAME=register_rsapss_65537_sha256)
|
||||
target_compile_definitions(witnesscalc_register_rsapss_65537_sha256Static PUBLIC CIRCUIT_NAME=register_rsapss_65537_sha256)
|
||||
target_compile_definitions(register_rsapss_65537_sha256 PUBLIC CIRCUIT_NAME=register_rsapss_65537_sha256)
|
||||
# target_compile_definitions(witnesscalc_register_rsapss_65537_sha256 PUBLIC CIRCUIT_NAME=register_rsapss_65537_sha256)
|
||||
# target_compile_definitions(witnesscalc_register_rsapss_65537_sha256Static PUBLIC CIRCUIT_NAME=register_rsapss_65537_sha256)
|
||||
# target_compile_definitions(register_rsapss_65537_sha256 PUBLIC CIRCUIT_NAME=register_rsapss_65537_sha256)
|
||||
1719
app/yarn.lock
1719
app/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import { LeanIMT } from '@zk-kit/lean-imt';
|
||||
import { LeanIMT } from '@zk-kit/imt';
|
||||
import { sha256 } from 'js-sha256';
|
||||
import { sha1 } from 'js-sha1';
|
||||
import { sha384, sha512_256 } from 'js-sha512';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openpassport/sdk",
|
||||
"version": "0.1.8",
|
||||
"name": "@proofofpassport/sdk",
|
||||
"version": "0.3.9",
|
||||
"main": "dist/sdk/src/index.js",
|
||||
"types": "dist/sdk/src/index.d.ts",
|
||||
"license": "MIT",
|
||||
@@ -13,6 +13,7 @@
|
||||
"@types/react": "^18.3.4",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"elliptic": "^6.5.7",
|
||||
"fs": "^0.0.1-security",
|
||||
"js-sha1": "^0.7.0",
|
||||
"js-sha256": "^0.11.0",
|
||||
@@ -43,8 +44,7 @@
|
||||
"@types/node-forge": "^1.3.5",
|
||||
"@types/pako": "^2.0.3",
|
||||
"@types/snarkjs": "^0.7.8",
|
||||
"@zk-kit/imt": "^2.0.0-beta.5",
|
||||
"@zk-kit/lean-imt": "^2.0.1",
|
||||
"@zk-kit/imt": "https://gitpkg.now.sh/0xturboblitz/zk-kit/packages/imt?6d417675",
|
||||
"asn1js": "^3.0.5",
|
||||
"axios": "^1.7.2",
|
||||
"chai": "^4.3.8",
|
||||
@@ -81,4 +81,4 @@
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.node.ts',
|
||||
output: {
|
||||
filename: 'bundle.node.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
libraryTarget: 'umd',
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
fallback: {
|
||||
bufferutil: false,
|
||||
'utf-8-validate': false,
|
||||
debug: require.resolve('debug'),
|
||||
},
|
||||
},
|
||||
|
||||
target: 'node',
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.web.ts', // Updated entry point
|
||||
output: {
|
||||
filename: 'bundle.web.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
libraryTarget: 'umd',
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(ts|tsx)$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
mainFields: ['browser', 'module', 'main'],
|
||||
extensions: ['.tsx', '.ts', '.js', '.jsx'],
|
||||
fallback: {
|
||||
bufferutil: false,
|
||||
'utf-8-validate': false,
|
||||
debug: require.resolve('debug'),
|
||||
},
|
||||
},
|
||||
target: 'web',
|
||||
externals: {
|
||||
react: 'react',
|
||||
'react-dom': 'react-dom',
|
||||
'lottie-react': 'lottie-react',
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user