
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
> ⚠️ **NOTE**: The current implementation produces circuits that are too large to fit within existing constraint limits. PRs that optimize this library are welcome!
⚠️ NOTE: The current implementation produces circuits that are too large to fit within existing constraint limits. PRs that optimize this library are welcome!
A provable EdDSA signature verification library for o1js, enabling zkApp developers to verify EdDSA signatures inside zk-SNARKs.
npm install eddsa-o1js
Here's a quick example of how to use eddsa-o1js to verify an EdDSA signature:
import { ZkProgram, Bool, Bytes } from 'o1js';
import { createEddsa, createForeignTwisted, TwistedCurves } from 'eddsa-o1js';
// Create a custom Edwards25519 curve class
class Edwards25519 extends createForeignTwisted(TwistedCurves.Edwards25519) {}
class Scalar extends Edwards25519.Scalar {}
class Eddsa extends createEddsa(Edwards25519) {}
class Bytes32 extends Bytes(32) {}
// Define a ZkProgram that verifies EdDSA signatures
const eddsa = ZkProgram({
name: 'eddsa',
publicInput: Bytes32,
publicOutput: Bool,
methods: {
verifyEddsa: {
privateInputs: [Eddsa, Edwards25519],
async method(
message: Bytes32,
signature: Eddsa,
publicKey: Edwards25519
) {
return {
publicOutput: signature.verify(message, publicKey),
};
},
},
},
});
// Example: Generate a signature and verify it
async function run() {
// Generate a keypair
let privateKey = Edwards25519.Scalar.random();
let publicKey = Edwards25519.generator.scale(privateKey);
// Sign a message
let message = Bytes32.fromString('Hello, o1js!');
let signature = Eddsa.sign(message.toBytes(), privateKey.toBigInt());
// Compile the program
await eddsa.compile();
// Verify the signature in zk
let { proof } = await eddsa.verifyEddsa(message, signature, publicKey);
// Check the result
proof.publicOutput.assertTrue('signature verifies');
}
For more detailed examples, please check the examples directory:
createEddsa(TwistedCurve)
: Factory function that creates an EdDSA implementation for a specific curvecreateForeignTwisted(TwistedCurveParams)
: Creates a provable twisted Edwards curve implementationTwistedCurves
: Contains parameters for common twisted Edwards curves (e.g., Edwards25519)# Build the project
npm run build
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
FAQs
> ⚠️ **NOTE**: The current implementation produces circuits that are too large to fit within existing constraint limits. PRs that optimize this library are welcome!
We found that eddsa-o1js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.