-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(noir-js): Add program API (#2856)
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Tom French <tom@tomfren.ch>
- Loading branch information
1 parent
4deb07f
commit 6a2cd78
Showing
6 changed files
with
62 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import { Backend } from './backend/backend_interface.js'; | ||
import { generateWitness } from './witness_generation.js'; | ||
|
||
export class Noir { | ||
constructor( | ||
private circuit: { bytecode: string; abi: any }, | ||
private backend: Backend, | ||
) {} | ||
|
||
// Initial inputs to your program | ||
async generateFinalProof(inputs: any): Promise<Uint8Array> { | ||
const serializedWitness = await generateWitness(this.circuit, inputs); | ||
return this.backend.generateFinalProof(serializedWitness); | ||
} | ||
|
||
async verifyFinalProof(proof: Uint8Array): Promise<boolean> { | ||
return this.backend.verifyFinalProof(proof); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} | ||
} |