Comments (5)
@biscuitdey also circomlibjs supports EdDSA sigs such as with MimC e.g.
const buildEddsa = require("circomlibjs").buildEddsa;
import * as crypto from "crypto";
const SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
const genRandomBabyJubValue = () => {
// Prevent modulo bias
//const lim = BigInt('0x10000000000000000000000000000000000000000000000000000000000000000')
//const min = (lim - SNARK_FIELD_SIZE) % SNARK_FIELD_SIZE
const min = BigInt("6350874878119819312338956282401532410528162663560392320966563075034087161851");
let rand;
// eslint-disable-next-line no-constant-condition
while (true) {
rand = BigInt("0x" + crypto.randomBytes(32).toString("hex"));
if (rand >= min) {
break;
}
}
const privKey = rand % SNARK_SCALAR_FIELD;
return privKey;
};
async function eddsasig() {
const eddsa = await buildEddsa();
const plaintext = rand = BigInt("0x" + crypto.randomBytes(32).toString("hex"));
const F = eddsa.F;
const issuerPrivKey = genRandomBabyJubValue();
const issuerPubKey = eddsa.prv2pub(issuerPrivKey.toString());
const signature = eddsa.signMiMC(issuerPrivKey.toString(), F.e(plaintext));
return signature;
}
from baseline.
@Therecanbeonlyone1969 Is there any library you recommend for generating Eddsa signatures? I found the following libraries :
- @transmute/ed25519-signature-2018
- @digitalcredentials/ed25519-signature-2020
- @digitalbazaar/ed25519-signature-2020
from baseline.
@biscuitdey here you go https://github.com/paulmillr/noble-curves
from baseline.
@biscuitdey also circomlibjs supports EdDSA sigs such as with MimC e.g.
const buildEddsa = require("circomlibjs").buildEddsa; import * as crypto from "crypto"; const SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617n; const genRandomBabyJubValue = () => { // Prevent modulo bias //const lim = BigInt('0x10000000000000000000000000000000000000000000000000000000000000000') //const min = (lim - SNARK_FIELD_SIZE) % SNARK_FIELD_SIZE const min = BigInt("6350874878119819312338956282401532410528162663560392320966563075034087161851"); let rand; // eslint-disable-next-line no-constant-condition while (true) { rand = BigInt("0x" + crypto.randomBytes(32).toString("hex")); if (rand >= min) { break; } } const privKey = rand % SNARK_SCALAR_FIELD; return privKey; }; async function eddsasig() { const eddsa = await buildEddsa(); const plaintext = rand = BigInt("0x" + crypto.randomBytes(32).toString("hex")); const F = eddsa.F; const issuerPrivKey = genRandomBabyJubValue(); const issuerPubKey = eddsa.prv2pub(issuerPrivKey.toString()); const signature = eddsa.signMiMC(issuerPrivKey.toString(), F.e(plaintext)); return signature; }
I am using this same library
from baseline.
Currently blocked by #765
from baseline.
Related Issues (20)
- SRI + Interop - Provide an openAPI specification file
- SRI - Implement schema parser for translating tx payload into circom inputs HOT 1
- SRI - Use the new schema parser approach to translate the tx payload -> circom inputs for the currently implemented use-case
- SRI - BRI3 Branch with reduced PR requirements HOT 1
- SRI - Implement mocking of the Prisma client in all unit tests
- SRI - missing tests builders
- SRI - Setup a new frontend project that will serve as a basis for the demo app HOT 2
- SRI - CCSM : Create Smart Contract HOT 1
- npm i broken in bri-3 project HOT 1
- SRI - CCSM : Connect BPI with CCSM contract HOT 1
- SRI - Extend the e2e tests with worksteps 2 and 3 from the example use-case
- SRI - Trigger storage of CAH in BPI smart contract on successful workstep execution
- SRI - Implement an endpoint to fetch implement an endpoint to fetch StateTreeLeafValueContent object with accompanying info from the BPI, based on the provided CAH
- SRI - extend the CcsmBpiStateAnchor contract to store CAH per workstep instance id
- SRI - Add workflowId and workstepId to transaction model and generate instance ids on each execution HOT 1
- SRI - extend the e2e test to fire up hardhat node and deploy a contract
- SRI - Store the CAH on succefull tx execution and extend the e2e test to assert it HOT 1
- SRI - Extend the e2e test to verify the CAH was created from the public inputs payload and accompanying witness
- SRI - Add the Verifirer.sol as an zkp artifact to the BPI and env HOT 3
- SRI - Execute verification onchain during tx execution in the BPI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from baseline.