wasm-ports icon indicating copy to clipboard operation
wasm-ports copied to clipboard

pairing example

Open HuangMinming opened this issue 1 year ago • 7 comments

Hi, are there examples for using pairing.js? What is the function name export? For example, we use these code to init a curve, how does pairing.js init a curve? Thanks.

char param_str[] = "type a\n"
                       "q 8780710799663312522437781984754049815806883199414208211028653399266475630880222957078625179422662221423155858769582317459277713367317481324925129998224791\n"
                       "h 12016012264891146079388821366740534204802954401251311822919615131047207289359704531102844802183906537786776\n"
                       "r 730750818665451621361119245571504901405976559617\n"
                       "exp2 159\n"
                       "exp1 107\n"
                       "sign1 1\n"
                       "sign0 1";
    pbc_param_t par;
    pbc_param_init_set_str(par, param_str);
    pairing_init_pbc_param(pairing, par);

HuangMinming avatar Sep 25 '24 14:09 HuangMinming

Hi, are there examples for using pairing.js? What is the function name export? For example, we use these code to init a curve, how does pairing.js init a curve? Thanks.

char param_str[] = "type a\n"
                       "q 8780710799663312522437781984754049815806883199414208211028653399266475630880222957078625179422662221423155858769582317459277713367317481324925129998224791\n"
                       "h 12016012264891146079388821366740534204802954401251311822919615131047207289359704531102844802183906537786776\n"
                       "r 730750818665451621361119245571504901405976559617\n"
                       "exp2 159\n"
                       "exp1 107\n"
                       "sign1 1\n"
                       "sign0 1";
    pbc_param_t par;
    pbc_param_init_set_str(par, param_str);
    pairing_init_pbc_param(pairing, par);

Thanks for your question! @HuangMinming It sounds like you're working with pairing.js and trying to understand how to initialize a curve. Could you share a bit more about your use case and what you're aiming to accomplish with the curve initialization? We’re currently working on a new version of Truebit, which may include more up-to-date examples and tools that could help with your project. If you’re interested, we’d be happy to assist you with transitioning to the latest version!

Looking forward to hearing more about your project.

Best regards, Ariel Sandez [email protected]

arielforte avatar Sep 25 '24 17:09 arielforte

Thanks for your reply. I want to generate an pair of asymmetrical key base on PBC, and serialize them to string. Since I do it on VUE, so I need a js lib which base on PBC, I found this repository. I tried to import pairing.js and pairing.wasm to my VUE project, but it difficult to get the api name. I am not familiar with emscripten. I don't know what is the api name in js.

I am looking forward to your further reply

HuangMinming avatar Sep 26 '24 00:09 HuangMinming

@HuangMinming Are you trying to execute JavaScript PBC code in a verifiable way, or are you just looking for a PBC library in JavaScript?

teutsch avatar Sep 26 '24 07:09 teutsch

@teutsch I am looking for a PBC library in JavaScript. I want to generate a pair of key and serialize them to string. Send the string to server. The server is developed with c and based on PBC. The server can load the string and deserialize to key. Therefore, I am looking for a JavaScript PBC library which use the same serialized result with C PBC library.

HuangMinming avatar Sep 26 '24 08:09 HuangMinming

The pairings task is just an example of what can be done with Truebit on Ethereum. It's not the library you want to use.

teutsch avatar Sep 26 '24 08:09 teutsch

@teutsch Thanks for you reply. So, I think I can modify pairing.cpp, add some functions which I need, and export these functions to further using However, I don't know how to modify the compile.sh to export the functions. Could you help to provide a demo? For example, I want to export function pairing_init() to init(). Thanks.

HuangMinming avatar Sep 26 '24 08:09 HuangMinming

I'll defer that question to @mrsmkl.

teutsch avatar Sep 26 '24 08:09 teutsch