Socket
Socket
Sign inDemoInstall

@noir-lang/backend_barretenberg

Package Overview
Dependencies
Maintainers
0
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noir-lang/backend_barretenberg - npm Package Compare versions

Comparing version 0.31.0 to 0.32.0-0bb8372.nightly

12

lib/cjs/backend.d.ts
import { Backend, CompiledCircuit, ProofData, VerifierBackend } from '@noir-lang/types';
import { BackendOptions } from './types.js';
import { type Barretenberg } from '@aztec/bb.js';
export declare class BarretenbergVerifierBackend implements VerifierBackend {
export declare class BarretenbergBackend implements Backend, VerifierBackend {
protected options: BackendOptions;

@@ -12,8 +12,2 @@ protected api: Barretenberg;

instantiate(): Promise<void>;
/** @description Verifies a proof */
verifyProof(proofData: ProofData): Promise<boolean>;
getVerificationKey(): Promise<Uint8Array>;
destroy(): Promise<void>;
}
export declare class BarretenbergBackend extends BarretenbergVerifierBackend implements Backend {
/** @description Generates a proof */

@@ -42,2 +36,6 @@ generateProof(compressedWitness: Uint8Array): Promise<ProofData>;

}>;
/** @description Verifies a proof */
verifyProof(proofData: ProofData): Promise<boolean>;
getVerificationKey(): Promise<Uint8Array>;
destroy(): Promise<void>;
}

@@ -26,3 +26,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.BarretenbergBackend = exports.BarretenbergVerifierBackend = void 0;
exports.BarretenbergBackend = void 0;
const fflate_1 = require("fflate");

@@ -35,3 +35,3 @@ const serialize_js_1 = require("./serialize.js");

const numBytesInProofWithoutPublicInputs = 2144;
class BarretenbergVerifierBackend {
class BarretenbergBackend {
options;

@@ -68,3 +68,4 @@ // These type assertions are used so that we don't

const api = await Barretenberg.new(this.options);
const [_exact, _total, subgroupSize] = await api.acirGetCircuitSizes(this.acirUncompressedBytecode);
const honkRecursion = false;
const [_exact, _total, subgroupSize] = await api.acirGetCircuitSizes(this.acirUncompressedBytecode, honkRecursion);
const crs = await Crs.new(subgroupSize + 1);

@@ -78,23 +79,2 @@ await api.commonInitSlabAllocator(subgroupSize);

}
/** @description Verifies a proof */
async verifyProof(proofData) {
const proof = (0, verifier_js_1.reconstructProofWithPublicInputs)(proofData);
await this.instantiate();
await this.api.acirInitVerificationKey(this.acirComposer);
return await this.api.acirVerifyProof(this.acirComposer, proof);
}
async getVerificationKey() {
await this.instantiate();
await this.api.acirInitVerificationKey(this.acirComposer);
return await this.api.acirGetVerificationKey(this.acirComposer);
}
async destroy() {
if (!this.api) {
return;
}
await this.api.destroy();
}
}
exports.BarretenbergVerifierBackend = BarretenbergVerifierBackend;
class BarretenbergBackend extends BarretenbergVerifierBackend {
/** @description Generates a proof */

@@ -141,3 +121,21 @@ async generateProof(compressedWitness) {

}
/** @description Verifies a proof */
async verifyProof(proofData) {
const proof = (0, verifier_js_1.reconstructProofWithPublicInputs)(proofData);
await this.instantiate();
await this.api.acirInitVerificationKey(this.acirComposer);
return await this.api.acirVerifyProof(this.acirComposer, proof);
}
async getVerificationKey() {
await this.instantiate();
await this.api.acirInitVerificationKey(this.acirComposer);
return await this.api.acirGetVerificationKey(this.acirComposer);
}
async destroy() {
if (!this.api) {
return;
}
await this.api.destroy();
}
}
exports.BarretenbergBackend = BarretenbergBackend;
import { Backend, CompiledCircuit, ProofData, VerifierBackend } from '@noir-lang/types';
import { BackendOptions } from './types.js';
import { type Barretenberg } from '@aztec/bb.js';
export declare class BarretenbergVerifierBackend implements VerifierBackend {
export declare class BarretenbergBackend implements Backend, VerifierBackend {
protected options: BackendOptions;

@@ -12,8 +12,2 @@ protected api: Barretenberg;

instantiate(): Promise<void>;
/** @description Verifies a proof */
verifyProof(proofData: ProofData): Promise<boolean>;
getVerificationKey(): Promise<Uint8Array>;
destroy(): Promise<void>;
}
export declare class BarretenbergBackend extends BarretenbergVerifierBackend implements Backend {
/** @description Generates a proof */

@@ -42,2 +36,6 @@ generateProof(compressedWitness: Uint8Array): Promise<ProofData>;

}>;
/** @description Verifies a proof */
verifyProof(proofData: ProofData): Promise<boolean>;
getVerificationKey(): Promise<Uint8Array>;
destroy(): Promise<void>;
}

@@ -8,3 +8,3 @@ import { decompressSync as gunzip } from 'fflate';

const numBytesInProofWithoutPublicInputs = 2144;
export class BarretenbergVerifierBackend {
export class BarretenbergBackend {
options;

@@ -41,3 +41,4 @@ // These type assertions are used so that we don't

const api = await Barretenberg.new(this.options);
const [_exact, _total, subgroupSize] = await api.acirGetCircuitSizes(this.acirUncompressedBytecode);
const honkRecursion = false;
const [_exact, _total, subgroupSize] = await api.acirGetCircuitSizes(this.acirUncompressedBytecode, honkRecursion);
const crs = await Crs.new(subgroupSize + 1);

@@ -51,22 +52,2 @@ await api.commonInitSlabAllocator(subgroupSize);

}
/** @description Verifies a proof */
async verifyProof(proofData) {
const proof = reconstructProofWithPublicInputs(proofData);
await this.instantiate();
await this.api.acirInitVerificationKey(this.acirComposer);
return await this.api.acirVerifyProof(this.acirComposer, proof);
}
async getVerificationKey() {
await this.instantiate();
await this.api.acirInitVerificationKey(this.acirComposer);
return await this.api.acirGetVerificationKey(this.acirComposer);
}
async destroy() {
if (!this.api) {
return;
}
await this.api.destroy();
}
}
export class BarretenbergBackend extends BarretenbergVerifierBackend {
/** @description Generates a proof */

@@ -113,2 +94,20 @@ async generateProof(compressedWitness) {

}
/** @description Verifies a proof */
async verifyProof(proofData) {
const proof = reconstructProofWithPublicInputs(proofData);
await this.instantiate();
await this.api.acirInitVerificationKey(this.acirComposer);
return await this.api.acirVerifyProof(this.acirComposer, proof);
}
async getVerificationKey() {
await this.instantiate();
await this.api.acirInitVerificationKey(this.acirComposer);
return await this.api.acirGetVerificationKey(this.acirComposer);
}
async destroy() {
if (!this.api) {
return;
}
await this.api.destroy();
}
}

@@ -6,3 +6,3 @@ {

],
"version": "0.31.0",
"version": "0.32.0-0bb8372.nightly",
"packageManager": "yarn@3.5.1",

@@ -45,4 +45,4 @@ "license": "(MIT OR Apache-2.0)",

"dependencies": {
"@aztec/bb.js": "0.41.0",
"@noir-lang/types": "0.31.0",
"@aztec/bb.js": "0.46.1",
"@noir-lang/types": "0.32.0-0bb8372.nightly",
"fflate": "^0.8.0"

@@ -49,0 +49,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc