@noir-lang/backend_barretenberg
Advanced tools
Comparing version 0.31.0-96ef87b.nightly to 0.31.0-b59a29e.nightly
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; | ||
@@ -78,23 +78,2 @@ // These type assertions are used so that we don't | ||
} | ||
/** @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 +120,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; | ||
@@ -51,22 +51,2 @@ // These type assertions are used so that we don't | ||
} | ||
/** @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 +93,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-96ef87b.nightly", | ||
"version": "0.31.0-b59a29e.nightly", | ||
"packageManager": "yarn@3.5.1", | ||
@@ -45,4 +45,4 @@ "license": "(MIT OR Apache-2.0)", | ||
"dependencies": { | ||
"@aztec/bb.js": "0.43.0", | ||
"@noir-lang/types": "0.31.0-96ef87b.nightly", | ||
"@aztec/bb.js": "0.46.1", | ||
"@noir-lang/types": "0.31.0-b59a29e.nightly", | ||
"fflate": "^0.8.0" | ||
@@ -49,0 +49,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33965
719
+ Added@aztec/bb.js@0.46.1(transitive)
+ Added@noir-lang/types@0.31.0-b59a29e.nightly(transitive)
- Removed@aztec/bb.js@0.43.0(transitive)
- Removed@noir-lang/types@0.31.0-96ef87b.nightly(transitive)
Updated@aztec/bb.js@0.46.1