@noir-lang/backend_barretenberg
Advanced tools
Comparing version 0.31.0-bf3a75a.nightly to 0.31.0-d44f882.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-bf3a75a.nightly", | ||
"version": "0.31.0-d44f882.nightly", | ||
"packageManager": "yarn@3.5.1", | ||
@@ -46,3 +46,3 @@ "license": "(MIT OR Apache-2.0)", | ||
"@aztec/bb.js": "0.43.0", | ||
"@noir-lang/types": "0.31.0-bf3a75a.nightly", | ||
"@noir-lang/types": "0.31.0-d44f882.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@noir-lang/types@0.31.0-d44f882.nightly(transitive)
- Removed@noir-lang/types@0.31.0-bf3a75a.nightly(transitive)