From f417cd9a62281405034482487ad138ade6fdb754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Tue, 24 Oct 2023 21:53:56 +0100 Subject: [PATCH 01/10] wip --- .../01-class.BarretenbergBackend.md | 212 ++++++++++++++++++ .../01-interface.BackendOptions.md | 11 + .../02-interface.CompiledCircuit.md | 12 + .../02-Interfaces/03-interface.ProofData.md | 12 + .../noir_js/01-Classes/01-class.Noir.md | 150 +++++++++++++ .../02-Interfaces/01-interface.Backend.md | 109 +++++++++ .../02-interface.CompiledCircuit.md | 12 + .../02-Interfaces/03-interface.ProofData.md | 12 + .../01_bb_backend.md | 0 .../{reference => reference_old}/02_noirjs.md | 0 docs/docusaurus.config.js | 51 ++++- docs/package.json | 8 +- tooling/noir_js/src/index.ts | 11 +- tooling/noir_js/src/program.ts | 17 ++ tooling/noir_js/tsconfig.json | 10 +- tooling/noir_js/typedoc.json | 6 + .../noir_js_backend_barretenberg/src/index.ts | 5 + .../noir_js_backend_barretenberg/src/types.ts | 1 + .../tsconfig.json | 7 +- .../noir_js_backend_barretenberg/typedoc.json | 6 + tooling/noir_js_types/.gitignore | 4 +- tooling/noir_js_types/src/types.ts | 2 + tooling/noir_js_types/tsconfig.json | 5 +- yarn.lock | 120 +++++++++- 24 files changed, 766 insertions(+), 17 deletions(-) create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/01-Classes/01-class.BarretenbergBackend.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/01-interface.BackendOptions.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/02-interface.CompiledCircuit.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/03-interface.ProofData.md create mode 100644 docs/docs/noir_js/reference/noir_js/01-Classes/01-class.Noir.md create mode 100644 docs/docs/noir_js/reference/noir_js/02-Interfaces/01-interface.Backend.md create mode 100644 docs/docs/noir_js/reference/noir_js/02-Interfaces/02-interface.CompiledCircuit.md create mode 100644 docs/docs/noir_js/reference/noir_js/02-Interfaces/03-interface.ProofData.md rename docs/docs/noir_js/{reference => reference_old}/01_bb_backend.md (100%) rename docs/docs/noir_js/{reference => reference_old}/02_noirjs.md (100%) create mode 100644 tooling/noir_js/typedoc.json create mode 100644 tooling/noir_js_backend_barretenberg/typedoc.json diff --git a/docs/docs/noir_js/reference/backend_barretenberg/01-Classes/01-class.BarretenbergBackend.md b/docs/docs/noir_js/reference/backend_barretenberg/01-Classes/01-class.BarretenbergBackend.md new file mode 100644 index 00000000000..100340a6945 --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/01-Classes/01-class.BarretenbergBackend.md @@ -0,0 +1,212 @@ +--- +sidebar_label: BarretenbergBackend +--- + +# BarretenbergBackend + +## Implements + +- `Backend` + +## Constructors + +### constructor + +```ts +new BarretenbergBackend(acirCircuit, options = ...): BarretenbergBackend +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `acirCircuit` | [`CompiledCircuit`](../02-Interfaces/02-interface.CompiledCircuit.md) | +| `options` | [`BackendOptions`](../02-Interfaces/01-interface.BackendOptions.md) | + +#### Returns + +[`BarretenbergBackend`](01-class.BarretenbergBackend.md) + +#### Source + +[noir\_js\_backend\_barretenberg/src/index.ts:20](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L20) + +## Properties + +| Property | Type | Source | +| :------ | :------ | :------ | +| **`private`** `acirComposer` | `any` | [noir\_js\_backend\_barretenberg/src/index.ts:17](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L17) | +| **`private`** `acirUncompressedBytecode` | `Uint8Array` | [noir\_js\_backend\_barretenberg/src/index.ts:18](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L18) | +| **`private`** `api` | `any` | [noir\_js\_backend\_barretenberg/src/index.ts:16](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L16) | +| **`private`** `options` | [`BackendOptions`](../02-Interfaces/01-interface.BackendOptions.md) | [noir\_js\_backend\_barretenberg/src/index.ts:22](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L22) | + +## Methods + +### destroy + +```ts +destroy(): Promise< void > +``` + +#### Returns + +`Promise`\< `void` \> + +#### Implementation of + +Backend.destroy + +#### Source + +[noir\_js\_backend\_barretenberg/src/index.ts:153](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L153) + +*** + +### generateFinalProof + +```ts +generateFinalProof(decompressedWitness): Promise< ProofData > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\< [`ProofData`](../02-Interfaces/03-interface.ProofData.md) \> + +#### Implementation of + +Backend.generateFinalProof + +#### Source + +[noir\_js\_backend\_barretenberg/src/index.ts:50](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L50) + +*** + +### generateIntermediateProof + +```ts +generateIntermediateProof(witness): Promise< ProofData > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `witness` | `Uint8Array` | + +#### Returns + +`Promise`\< [`ProofData`](../02-Interfaces/03-interface.ProofData.md) \> + +#### Implementation of + +Backend.generateIntermediateProof + +#### Source + +[noir\_js\_backend\_barretenberg/src/index.ts:66](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L66) + +*** + +### generateIntermediateProofArtifacts + +```ts +generateIntermediateProofArtifacts(proofData, numOfPublicInputs = 0): Promise< { + proofAsFields: string[]; + vkAsFields: string[]; + vkHash: string; + } > +``` + +#### Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `proofData` | [`ProofData`](../02-Interfaces/03-interface.ProofData.md) | `undefined` | +| `numOfPublicInputs` | `number` | `0` | + +#### Returns + +`Promise`\< \{ + `proofAsFields`: `string`[]; + `vkAsFields`: `string`[]; + `vkHash`: `string`; + } \> + +#### Source + +[noir\_js\_backend\_barretenberg/src/index.ts:107](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L107) + +*** + +### instantiate + +```ts +instantiate(): Promise< void > +``` + +#### Returns + +`Promise`\< `void` \> + +#### Source + +[noir\_js\_backend\_barretenberg/src/index.ts:28](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L28) + +*** + +### verifyFinalProof + +```ts +verifyFinalProof(proofData): Promise< boolean > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../02-Interfaces/03-interface.ProofData.md) | + +#### Returns + +`Promise`\< `boolean` \> + +#### Implementation of + +Backend.verifyFinalProof + +#### Source + +[noir\_js\_backend\_barretenberg/src/index.ts:133](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L133) + +*** + +### verifyIntermediateProof + +```ts +verifyIntermediateProof(proofData): Promise< boolean > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../02-Interfaces/03-interface.ProofData.md) | + +#### Returns + +`Promise`\< `boolean` \> + +#### Implementation of + +Backend.verifyIntermediateProof + +#### Source + +[noir\_js\_backend\_barretenberg/src/index.ts:140](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L140) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/01-interface.BackendOptions.md b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/01-interface.BackendOptions.md new file mode 100644 index 00000000000..b09ed204e3f --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/01-interface.BackendOptions.md @@ -0,0 +1,11 @@ +--- +sidebar_label: BackendOptions +--- + +# BackendOptions + +## Properties + +| Property | Type | Source | +| :------ | :------ | :------ | +| `threads` | `number` | [noir\_js\_backend\_barretenberg/src/types.ts:3](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/types.ts#L3) | diff --git a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/02-interface.CompiledCircuit.md b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/02-interface.CompiledCircuit.md new file mode 100644 index 00000000000..e40f06f7555 --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/02-interface.CompiledCircuit.md @@ -0,0 +1,12 @@ +--- +sidebar_label: CompiledCircuit +--- + +# CompiledCircuit + +## Properties + +| Property | Type | Source | +| :------ | :------ | :------ | +| `abi` | `Abi` | noir\_js\_types/lib/esm/types.d.ts:19 | +| `bytecode` | `string` | noir\_js\_types/lib/esm/types.d.ts:18 | diff --git a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/03-interface.ProofData.md b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/03-interface.ProofData.md new file mode 100644 index 00000000000..356f8c9db1a --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/03-interface.ProofData.md @@ -0,0 +1,12 @@ +--- +sidebar_label: ProofData +--- + +# ProofData + +## Properties + +| Property | Type | Source | +| :------ | :------ | :------ | +| `proof` | `Uint8Array` | noir\_js\_types/lib/esm/types.d.ts:13 | +| `publicInputs` | `Uint8Array`[] | noir\_js\_types/lib/esm/types.d.ts:12 | diff --git a/docs/docs/noir_js/reference/noir_js/01-Classes/01-class.Noir.md b/docs/docs/noir_js/reference/noir_js/01-Classes/01-class.Noir.md new file mode 100644 index 00000000000..419bb207781 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/01-Classes/01-class.Noir.md @@ -0,0 +1,150 @@ +--- +sidebar_label: Noir +--- + +# Noir + +## Constructors + +### constructor + +```ts +new Noir(circuit, backend?): Noir +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `circuit` | [`CompiledCircuit`](../02-Interfaces/02-interface.CompiledCircuit.md) | +| `backend`? | [`Backend`](../02-Interfaces/01-interface.Backend.md) | + +#### Returns + +[`Noir`](01-class.Noir.md) + +#### Source + +[tooling/noir\_js/src/program.ts:8](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L8) + +## Properties + +| Property | Type | Source | +| :------ | :------ | :------ | +| **`private`** `backend?` | [`Backend`](../02-Interfaces/01-interface.Backend.md) | [tooling/noir\_js/src/program.ts:10](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L10) | +| **`private`** `circuit` | [`CompiledCircuit`](../02-Interfaces/02-interface.CompiledCircuit.md) | [tooling/noir\_js/src/program.ts:9](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L9) | + +## Methods + +### destroy + +```ts +destroy(): Promise< void > +``` + +This method destroys the resources allocated in the [instantiate](#instantiate) method. +Noir doesn't currently call this method, but it's highly recommended that developers do so in order to save resources. + +#### Returns + +`Promise`\< `void` \> + +#### Source + +[tooling/noir\_js/src/program.ts:34](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L34) + +#### Example + +```typescript +await backend.destroy(); +``` + +*** + +### execute + +```ts +execute(inputs): Promise< { + returnValue: InputValue; + witness: Uint8Array; + } > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `inputs` | `InputMap` | + +#### Returns + +`Promise`\< \{ + `returnValue`: `InputValue`; + `witness`: `Uint8Array`; + } \> + +#### Source + +[tooling/noir\_js/src/program.ts:44](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L44) + +*** + +### generateFinalProof + +```ts +generateFinalProof(inputs): Promise< ProofData > +``` + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `InputMap` | The initial inputs to your program | + +#### Returns + +`Promise`\< [`ProofData`](../02-Interfaces/03-interface.ProofData.md) \> + +a proof which can be verified by the verifier + +#### Source + +[tooling/noir\_js/src/program.ts:57](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L57) + +*** + +### getBackend + +```ts +private getBackend(): Backend +``` + +#### Returns + +[`Backend`](../02-Interfaces/01-interface.Backend.md) + +#### Source + +[tooling/noir\_js/src/program.ts:38](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L38) + +*** + +### verifyFinalProof + +```ts +verifyFinalProof(proofData): Promise< boolean > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../02-Interfaces/03-interface.ProofData.md) | + +#### Returns + +`Promise`\< `boolean` \> + +#### Source + +[tooling/noir\_js/src/program.ts:62](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L62) diff --git a/docs/docs/noir_js/reference/noir_js/02-Interfaces/01-interface.Backend.md b/docs/docs/noir_js/reference/noir_js/02-Interfaces/01-interface.Backend.md new file mode 100644 index 00000000000..da7f635ef19 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/02-Interfaces/01-interface.Backend.md @@ -0,0 +1,109 @@ +--- +sidebar_label: Backend +--- + +# Backend + +## Methods + +### destroy + +```ts +destroy(): Promise< void > +``` + +#### Returns + +`Promise`\< `void` \> + +#### Source + +tooling/noir\_js\_types/lib/esm/types.d.ts:7 + +*** + +### generateFinalProof + +```ts +generateFinalProof(decompressedWitness): Promise< ProofData > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\< [`ProofData`](03-interface.ProofData.md) \> + +#### Source + +tooling/noir\_js\_types/lib/esm/types.d.ts:3 + +*** + +### generateIntermediateProof + +```ts +generateIntermediateProof(decompressedWitness): Promise< ProofData > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\< [`ProofData`](03-interface.ProofData.md) \> + +#### Source + +tooling/noir\_js\_types/lib/esm/types.d.ts:4 + +*** + +### verifyFinalProof + +```ts +verifyFinalProof(proofData): Promise< boolean > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](03-interface.ProofData.md) | + +#### Returns + +`Promise`\< `boolean` \> + +#### Source + +tooling/noir\_js\_types/lib/esm/types.d.ts:5 + +*** + +### verifyIntermediateProof + +```ts +verifyIntermediateProof(proofData): Promise< boolean > +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](03-interface.ProofData.md) | + +#### Returns + +`Promise`\< `boolean` \> + +#### Source + +tooling/noir\_js\_types/lib/esm/types.d.ts:6 diff --git a/docs/docs/noir_js/reference/noir_js/02-Interfaces/02-interface.CompiledCircuit.md b/docs/docs/noir_js/reference/noir_js/02-Interfaces/02-interface.CompiledCircuit.md new file mode 100644 index 00000000000..9ad06d3bc7f --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/02-Interfaces/02-interface.CompiledCircuit.md @@ -0,0 +1,12 @@ +--- +sidebar_label: CompiledCircuit +--- + +# CompiledCircuit + +## Properties + +| Property | Type | Source | +| :------ | :------ | :------ | +| `abi` | `Abi` | tooling/noir\_js\_types/lib/esm/types.d.ts:19 | +| `bytecode` | `string` | tooling/noir\_js\_types/lib/esm/types.d.ts:18 | diff --git a/docs/docs/noir_js/reference/noir_js/02-Interfaces/03-interface.ProofData.md b/docs/docs/noir_js/reference/noir_js/02-Interfaces/03-interface.ProofData.md new file mode 100644 index 00000000000..5a930000570 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/02-Interfaces/03-interface.ProofData.md @@ -0,0 +1,12 @@ +--- +sidebar_label: ProofData +--- + +# ProofData + +## Properties + +| Property | Type | Source | +| :------ | :------ | :------ | +| `proof` | `Uint8Array` | tooling/noir\_js\_types/lib/esm/types.d.ts:13 | +| `publicInputs` | `Uint8Array`[] | tooling/noir\_js\_types/lib/esm/types.d.ts:12 | diff --git a/docs/docs/noir_js/reference/01_bb_backend.md b/docs/docs/noir_js/reference_old/01_bb_backend.md similarity index 100% rename from docs/docs/noir_js/reference/01_bb_backend.md rename to docs/docs/noir_js/reference_old/01_bb_backend.md diff --git a/docs/docs/noir_js/reference/02_noirjs.md b/docs/docs/noir_js/reference_old/02_noirjs.md similarity index 100% rename from docs/docs/noir_js/reference/02_noirjs.md rename to docs/docs/noir_js/reference_old/02_noirjs.md diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index ff07b5697ce..6128f3a6b69 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -62,7 +62,7 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ - ({ + { // Replace with your project's social card navbar: { logo: { @@ -87,8 +87,7 @@ const config = { metadata: [ { name: 'Noir', - content: - 'noir, programming, language, documentation, zk, zero-knowledge, l2, crypto, layer2, ethereum', + content: 'noir, programming, language, documentation, zk, zero-knowledge, l2, crypto, layer2, ethereum', }, ], footer: { @@ -149,7 +148,51 @@ const config = { indexName: 'noir-lang', }, - }), + }, + plugins: [ + [ + 'docusaurus-plugin-typedoc', + { + id: 'noir_js', + entryPoints: ['../tooling/noir_js/src/index.ts'], + tsconfig: '../tooling/noir_js/tsconfig.json', + entryPointStrategy: 'resolve', + out: 'noir_js/reference/noir_js', + plugin: ['typedoc-plugin-markdown'], + + readme: 'none', + skipIndexPage: true, + hidePageHeader: true, + hideBreadcrumbs: true, + hideInPageTOC: true, + titleTemplate: '{name}', + identifiersAsCodeBlocks: true, + propertiesFormat: 'table', + typeDeclarationFormat: 'table', + }, + ], + [ + 'docusaurus-plugin-typedoc', + { + id: 'noir_js_backend_barretenberg', + entryPoints: ['../tooling/noir_js_backend_barretenberg/src/index.ts'], + tsconfig: '../tooling/noir_js_backend_barretenberg/tsconfig.json', + entryPointStrategy: 'resolve', + out: 'noir_js/reference/backend_barretenberg', + plugin: ['typedoc-plugin-markdown'], + + readme: 'none', + skipIndexPage: true, + hidePageHeader: true, + hideBreadcrumbs: true, + hideInPageTOC: true, + titleTemplate: '{name}', + identifiersAsCodeBlocks: true, + propertiesFormat: 'table', + typeDeclarationFormat: 'table', + }, + ], + ], }; module.exports = config; diff --git a/docs/package.json b/docs/package.json index edf4bba0686..6bf69030fc6 100644 --- a/docs/package.json +++ b/docs/package.json @@ -14,12 +14,18 @@ "@mdx-js/react": "^1.6.22", "axios": "^1.4.0", "clsx": "^1.2.1", + "docusaurus-plugin-typedoc": "1.0.0-next.15", "hast-util-is-element": "^1.1.0", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", "react-dom": "^17.0.2", "rehype-katex": "^5.0.0", - "remark-math": "^3.0.1" + "remark-math": "^3.0.1", + "typedoc": "^0.25.0", + "typedoc-plugin-frontmatter": "^0.0.2", + "typedoc-plugin-markdown": "4.0.0-next.20", + "typedoc-plugin-merge-modules": "^5.1.0", + "typescript": "^5.2.2" }, "devDependencies": { "@docusaurus/module-type-aliases": "^2.4.0" diff --git a/tooling/noir_js/src/index.ts b/tooling/noir_js/src/index.ts index 3d424ca0dea..f8734248e0c 100644 --- a/tooling/noir_js/src/index.ts +++ b/tooling/noir_js/src/index.ts @@ -1,8 +1,13 @@ import * as acvm from '@noir-lang/acvm_js'; import * as abi from '@noir-lang/noirc_abi'; +import { CompiledCircuit, ProofData, Backend } from '@noir-lang/types'; -export { acvm, abi }; - -export { WitnessMap } from '@noir-lang/acvm_js'; +// typedoc exports +/** @interface */ +export { CompiledCircuit, ProofData, Backend }; export { Noir } from './program.js'; + +/** @ignore */ +export { acvm, abi }; +export { WitnessMap } from '@noir-lang/acvm_js'; diff --git a/tooling/noir_js/src/program.ts b/tooling/noir_js/src/program.ts index bf48e15fcad..a46b4ed4fad 100644 --- a/tooling/noir_js/src/program.ts +++ b/tooling/noir_js/src/program.ts @@ -10,6 +10,7 @@ export class Noir { private backend?: Backend, ) {} + /** @ignore */ async init(): Promise { // If these are available, then we are in the // web environment. For the node environment, this @@ -19,6 +20,17 @@ export class Noir { } } + /** + * + * This method destroys the resources allocated in the [instantiate](#instantiate) method. + * Noir doesn't currently call this method, but it's highly recommended that developers do so in order to save resources. + * + * @example + * ```typescript + * await backend.destroy(); + * ``` + * + */ async destroy(): Promise { await this.backend?.destroy(); } @@ -37,6 +49,11 @@ export class Noir { } // Initial inputs to your program + /** + * + * @param inputs - The initial inputs to your program + * @returns a proof which can be verified by the verifier + */ async generateFinalProof(inputs: InputMap): Promise { const { witness } = await this.execute(inputs); return this.getBackend().generateFinalProof(witness); diff --git a/tooling/noir_js/tsconfig.json b/tooling/noir_js/tsconfig.json index 1e0fdea09c7..ede0d41ee94 100644 --- a/tooling/noir_js/tsconfig.json +++ b/tooling/noir_js/tsconfig.json @@ -2,7 +2,6 @@ "compilerOptions": { "target": "esnext", "declaration": true, - "emitDeclarationOnly": false, "module": "ESNext", "moduleResolution": "node", "outDir": "./lib", @@ -12,5 +11,10 @@ "noImplicitAny": false, }, "include": ["src/**/*.ts"], - "exclude": ["node_modules"] -} \ No newline at end of file + "exclude": ["node_modules"], + "references": [ + { + "path": "../noir_js_types/tsconfig.json" + }, + ] +} diff --git a/tooling/noir_js/typedoc.json b/tooling/noir_js/typedoc.json new file mode 100644 index 00000000000..ff572de0c2e --- /dev/null +++ b/tooling/noir_js/typedoc.json @@ -0,0 +1,6 @@ +{ + "entryPoints": ["src/index.ts"], + "excludeInternal": true, + "disableSources": true, + "excludePrivate": true, +} diff --git a/tooling/noir_js_backend_barretenberg/src/index.ts b/tooling/noir_js_backend_barretenberg/src/index.ts index 11c56a7384d..6221e710ff7 100644 --- a/tooling/noir_js_backend_barretenberg/src/index.ts +++ b/tooling/noir_js_backend_barretenberg/src/index.ts @@ -68,6 +68,7 @@ export class BarretenbergBackend implements Backend { return this.generateProof(witness, makeEasyToVerifyInCircuit); } + /** @ignore */ async generateProof(compressedWitness: Uint8Array, makeEasyToVerifyInCircuit: boolean): Promise { await this.instantiate(); const proofWithPublicInputs = await this.api.acirCreateProof( @@ -142,6 +143,7 @@ export class BarretenbergBackend implements Backend { return this.verifyProof(proof, makeEasyToVerifyInCircuit); } + /** @ignore */ async verifyProof(proof: Uint8Array, makeEasyToVerifyInCircuit: boolean): Promise { await this.instantiate(); await this.api.acirInitVerificationKey(this.acirComposer); @@ -178,3 +180,6 @@ function flattenUint8Arrays(arrays: Uint8Array[]): Uint8Array { return result; } + +// typedoc exports +export { BackendOptions, CompiledCircuit, ProofData }; diff --git a/tooling/noir_js_backend_barretenberg/src/types.ts b/tooling/noir_js_backend_barretenberg/src/types.ts index b88a942d986..918ce616148 100644 --- a/tooling/noir_js_backend_barretenberg/src/types.ts +++ b/tooling/noir_js_backend_barretenberg/src/types.ts @@ -1,3 +1,4 @@ +/** @interface */ export type BackendOptions = { threads: number; }; diff --git a/tooling/noir_js_backend_barretenberg/tsconfig.json b/tooling/noir_js_backend_barretenberg/tsconfig.json index 393fa38f583..1e28c044bba 100644 --- a/tooling/noir_js_backend_barretenberg/tsconfig.json +++ b/tooling/noir_js_backend_barretenberg/tsconfig.json @@ -12,5 +12,10 @@ "noImplicitAny": false, }, "include": ["src/**/*.ts"], - "exclude": ["node_modules"] + "exclude": ["node_modules"], + "references": [ + { + "path": "../noir_js_types" + } + ] } diff --git a/tooling/noir_js_backend_barretenberg/typedoc.json b/tooling/noir_js_backend_barretenberg/typedoc.json new file mode 100644 index 00000000000..d1b9932866c --- /dev/null +++ b/tooling/noir_js_backend_barretenberg/typedoc.json @@ -0,0 +1,6 @@ +{ + "entryPoints": ["src/index.ts"], + "excludeInternal": true, + "excludePrivate": true, + "disableSources": true, +} diff --git a/tooling/noir_js_types/.gitignore b/tooling/noir_js_types/.gitignore index 7951405f85a..e92523b6247 100644 --- a/tooling/noir_js_types/.gitignore +++ b/tooling/noir_js_types/.gitignore @@ -1 +1,3 @@ -lib \ No newline at end of file +lib + +*.tsbuildinfo diff --git a/tooling/noir_js_types/src/types.ts b/tooling/noir_js_types/src/types.ts index f534ec9a920..28133daa92b 100644 --- a/tooling/noir_js_types/src/types.ts +++ b/tooling/noir_js_types/src/types.ts @@ -14,11 +14,13 @@ export interface Backend { destroy(): Promise; } +/** @interface */ export type ProofData = { publicInputs: Uint8Array[]; proof: Uint8Array; }; +/** @interface */ export type CompiledCircuit = { bytecode: string; abi: Abi; diff --git a/tooling/noir_js_types/tsconfig.json b/tooling/noir_js_types/tsconfig.json index 1fe2a46abaa..0d5441cc5a2 100644 --- a/tooling/noir_js_types/tsconfig.json +++ b/tooling/noir_js_types/tsconfig.json @@ -1,12 +1,13 @@ { "compilerOptions": { + "composite": true, "declaration": true, "module": "ESNext", "moduleResolution": "node", "outDir": "lib/esm", "target": "ES2020", - "rootDir": "./src" + "rootDir": "./src", }, "include": ["src/**/*.ts"], "exclude": ["node_modules"] -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 71338f8f3a3..d8e5ca6d9bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2281,7 +2281,7 @@ __metadata: languageName: node linkType: hard -"@docusaurus/types@npm:2.4.3": +"@docusaurus/types@npm:2.4.3, @docusaurus/types@npm:^2.4.1": version: 2.4.3 resolution: "@docusaurus/types@npm:2.4.3" dependencies: @@ -5882,6 +5882,13 @@ __metadata: languageName: node linkType: hard +"ansi-sequence-parser@npm:^1.1.0": + version: 1.1.1 + resolution: "ansi-sequence-parser@npm:1.1.1" + checksum: ead5b15c596e8e85ca02951a844366c6776769dcc9fd1bd3a0db11bb21364554822c6a439877fb599e7e1ffa0b5f039f1e5501423950457f3dcb2f480c30b188 + languageName: node + linkType: hard + "ansi-styles@npm:^3.2.1": version: 3.2.1 resolution: "ansi-styles@npm:3.2.1" @@ -8233,12 +8240,18 @@ __metadata: "@mdx-js/react": ^1.6.22 axios: ^1.4.0 clsx: ^1.2.1 + docusaurus-plugin-typedoc: 1.0.0-next.15 hast-util-is-element: ^1.1.0 prism-react-renderer: ^1.3.5 react: ^17.0.2 react-dom: ^17.0.2 rehype-katex: ^5.0.0 remark-math: ^3.0.1 + typedoc: ^0.25.0 + typedoc-plugin-frontmatter: ^0.0.2 + typedoc-plugin-markdown: 4.0.0-next.20 + typedoc-plugin-merge-modules: ^5.1.0 + typescript: ^5.2.2 languageName: unknown linkType: soft @@ -8251,6 +8264,17 @@ __metadata: languageName: node linkType: hard +"docusaurus-plugin-typedoc@npm:1.0.0-next.15": + version: 1.0.0-next.15 + resolution: "docusaurus-plugin-typedoc@npm:1.0.0-next.15" + dependencies: + "@docusaurus/types": ^2.4.1 + peerDependencies: + typedoc-plugin-markdown: ">=4.0.0-next.19" + checksum: 69fcadcb90288151d40140d75cb06612dedf60c34fd0806c3ea309267dfe3b25406f280d4b883676d3924e06588483b8d5ac895a5cd67957e715a3d0425de628 + languageName: node + linkType: hard + "dom-converter@npm:^0.2.0": version: 0.2.0 resolution: "dom-converter@npm:0.2.0" @@ -11379,6 +11403,13 @@ __metadata: languageName: node linkType: hard +"jsonc-parser@npm:^3.2.0": + version: 3.2.0 + resolution: "jsonc-parser@npm:3.2.0" + checksum: 946dd9a5f326b745aa326d48a7257e3f4a4b62c5e98ec8e49fa2bdd8d96cef7e6febf1399f5c7016114fd1f68a1c62c6138826d5d90bc650448e3cf0951c53c7 + languageName: node + linkType: hard + "jsonfile@npm:^2.1.0": version: 2.4.0 resolution: "jsonfile@npm:2.4.0" @@ -12060,6 +12091,15 @@ __metadata: languageName: node linkType: hard +"marked@npm:^4.3.0": + version: 4.3.0 + resolution: "marked@npm:4.3.0" + bin: + marked: bin/marked.js + checksum: 0db6817893952c3ec710eb9ceafb8468bf5ae38cb0f92b7b083baa13d70b19774674be04db5b817681fa7c5c6a088f61300815e4dd75a59696f4716ad69f6260 + languageName: node + linkType: hard + "marky@npm:^1.2.2": version: 1.2.5 resolution: "marky@npm:1.2.5" @@ -12345,7 +12385,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.1": +"minimatch@npm:^9.0.1, minimatch@npm:^9.0.3": version: 9.0.3 resolution: "minimatch@npm:9.0.3" dependencies: @@ -15384,6 +15424,18 @@ __metadata: languageName: node linkType: hard +"shiki@npm:^0.14.1": + version: 0.14.5 + resolution: "shiki@npm:0.14.5" + dependencies: + ansi-sequence-parser: ^1.1.0 + jsonc-parser: ^3.2.0 + vscode-oniguruma: ^1.7.0 + vscode-textmate: ^8.0.0 + checksum: 41d847817cfc9bb6d8bf190316896698d250303656546446659cc02caed8dcc171b10cd113bb5da82425b51d0032e87aafcdc36c3dd61dadc123170b438da736 + languageName: node + linkType: hard + "side-channel@npm:^1.0.4": version: 1.0.4 resolution: "side-channel@npm:1.0.4" @@ -16391,6 +16443,49 @@ __metadata: languageName: node linkType: hard +"typedoc-plugin-frontmatter@npm:^0.0.2": + version: 0.0.2 + resolution: "typedoc-plugin-frontmatter@npm:0.0.2" + dependencies: + yaml: ^2.2.2 + checksum: 44cbdb82e3fd8f4eb89cdf54783b5b07b03a57edc7bda85a48280edba73f401a2f5439cbba97426dd79e9584c410244af5dd20d5d7281c27d67d61675fa7aaef + languageName: node + linkType: hard + +"typedoc-plugin-markdown@npm:4.0.0-next.20": + version: 4.0.0-next.20 + resolution: "typedoc-plugin-markdown@npm:4.0.0-next.20" + peerDependencies: + typedoc: ">=0.24.0" + checksum: f1217bc822940cdc978cde54e7fead86441254ca443e9760ccb63e9cc9c0ee05df1d3e846f081fc35ee1385d75b85f92d18e5474a5a5a698a0e5679fbcb9121f + languageName: node + linkType: hard + +"typedoc-plugin-merge-modules@npm:^5.1.0": + version: 5.1.0 + resolution: "typedoc-plugin-merge-modules@npm:5.1.0" + peerDependencies: + typedoc: 0.24.x || 0.25.x + checksum: f01d825a1c6b73c29faaf515e76076931b16bcc5762c8e9b56d18a7eca6d450bd3691012e96bc3a09ce05f29aef90744e93e187171c561ef0a3c2c1fe116803f + languageName: node + linkType: hard + +"typedoc@npm:^0.25.0": + version: 0.25.2 + resolution: "typedoc@npm:0.25.2" + dependencies: + lunr: ^2.3.9 + marked: ^4.3.0 + minimatch: ^9.0.3 + shiki: ^0.14.1 + peerDependencies: + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x + bin: + typedoc: bin/typedoc + checksum: 5b6e24bae7498bb542aaba495378ed5a3e13c76eb04a1ae95b506f76bda4d517847101fb05a7eab3f6b79357d1e2ac6f4747d39792395329b72e463f7effda65 + languageName: node + linkType: hard + "typescript@npm:4.9.4": version: 4.9.4 resolution: "typescript@npm:4.9.4" @@ -16927,6 +17022,20 @@ __metadata: languageName: node linkType: hard +"vscode-oniguruma@npm:^1.7.0": + version: 1.7.0 + resolution: "vscode-oniguruma@npm:1.7.0" + checksum: 53519d91d90593e6fb080260892e87d447e9b200c4964d766772b5053f5699066539d92100f77f1302c91e8fc5d9c772fbe40fe4c90f3d411a96d5a9b1e63f42 + languageName: node + linkType: hard + +"vscode-textmate@npm:^8.0.0": + version: 8.0.0 + resolution: "vscode-textmate@npm:8.0.0" + checksum: 127780dfea89559d70b8326df6ec344cfd701312dd7f3f591a718693812b7852c30b6715e3cfc8b3200a4e2515b4c96f0843c0eacc0a3020969b5de262c2a4bb + languageName: node + linkType: hard + "wait-on@npm:^6.0.1": version: 6.0.1 resolution: "wait-on@npm:6.0.1" @@ -17458,6 +17567,13 @@ __metadata: languageName: node linkType: hard +"yaml@npm:^2.2.2": + version: 2.3.3 + resolution: "yaml@npm:2.3.3" + checksum: cdfd132e7e0259f948929efe8835923df05c013c273c02bb7a2de9b46ac3af53c2778a35b32c7c0f877cc355dc9340ed564018c0242bfbb1278c2a3e53a0e99e + languageName: node + linkType: hard + "yargs-parser@npm:20.2.4": version: 20.2.4 resolution: "yargs-parser@npm:20.2.4" From 53b5b0446a188064ecbadca589ae120b8ffd9739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Sun, 29 Oct 2023 22:58:50 +0000 Subject: [PATCH 02/10] chore(docs): finishing up --- docs/docs/noir_js/noir_js.md | 2 +- docs/docs/noir_js/reference/01_noirjs.md | 143 --------- docs/docs/noir_js/reference/02_bb_backend.md | 272 ------------------ .../reference/backend_barretenberg/.nojekyll | 1 + .../01-class.BarretenbergBackend.md | 212 -------------- .../01-interface.BackendOptions.md | 11 - .../02-interface.CompiledCircuit.md | 12 - .../02-Interfaces/03-interface.ProofData.md | 12 - .../classes/BarretenbergBackend.md | 113 ++++++++ .../reference/backend_barretenberg/index.md | 27 ++ .../interfaces/Backend.md | 72 +++++ .../type-aliases/BackendOptions.md | 19 ++ .../type-aliases/CompiledCircuit.md | 20 ++ .../type-aliases/ProofData.md | 20 ++ .../backend_barretenberg/typedoc-sidebar.cjs | 4 + docs/docs/noir_js/reference/noir_js/.nojekyll | 1 + .../noir_js/01-Classes/01-class.Noir.md | 150 ---------- .../02-Interfaces/01-interface.Backend.md | 109 ------- .../02-interface.CompiledCircuit.md | 12 - .../02-Interfaces/03-interface.ProofData.md | 12 - .../noir_js/reference/noir_js/classes/Noir.md | 130 +++++++++ .../reference/noir_js/functions/and.md | 22 ++ .../reference/noir_js/functions/blake2s256.md | 21 ++ .../functions/ecdsa_secp256k1_verify.md | 29 ++ .../functions/ecdsa_secp256r1_verify.md | 28 ++ .../reference/noir_js/functions/keccak256.md | 21 ++ .../reference/noir_js/functions/sha256.md | 21 ++ .../reference/noir_js/functions/xor.md | 22 ++ docs/docs/noir_js/reference/noir_js/index.md | 36 +++ .../noir_js/type-aliases/CompiledCircuit.md | 20 ++ .../type-aliases/ForeignCallHandler.md | 24 ++ .../noir_js/type-aliases/ForeignCallInput.md | 9 + .../noir_js/type-aliases/ForeignCallOutput.md | 9 + .../noir_js/type-aliases/ProofData.md | 20 ++ .../noir_js/type-aliases/WitnessMap.md | 9 + .../reference/noir_js/typedoc-sidebar.cjs | 4 + .../noir_js/reference_old/01_bb_backend.md | 2 +- docs/docusaurus.config.js | 40 ++- docs/package.json | 4 +- docs/sidebars.js | 18 +- tooling/noir_js/src/index.ts | 8 +- tooling/noir_js/src/program.ts | 39 ++- tooling/noir_js/tsconfig.json | 2 +- tooling/noir_js/typedoc.json | 6 - .../noir_js_backend_barretenberg/src/index.ts | 29 +- .../noir_js_backend_barretenberg/src/types.ts | 6 +- .../noir_js_backend_barretenberg/typedoc.json | 6 - tooling/noir_js_types/src/types.ts | 48 +++- yarn.lock | 24 +- 49 files changed, 878 insertions(+), 1003 deletions(-) delete mode 100644 docs/docs/noir_js/reference/01_noirjs.md delete mode 100644 docs/docs/noir_js/reference/02_bb_backend.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/.nojekyll delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/01-Classes/01-class.BarretenbergBackend.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/01-interface.BackendOptions.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/02-interface.CompiledCircuit.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/03-interface.ProofData.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/index.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/interfaces/Backend.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md create mode 100644 docs/docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs create mode 100644 docs/docs/noir_js/reference/noir_js/.nojekyll delete mode 100644 docs/docs/noir_js/reference/noir_js/01-Classes/01-class.Noir.md delete mode 100644 docs/docs/noir_js/reference/noir_js/02-Interfaces/01-interface.Backend.md delete mode 100644 docs/docs/noir_js/reference/noir_js/02-Interfaces/02-interface.CompiledCircuit.md delete mode 100644 docs/docs/noir_js/reference/noir_js/02-Interfaces/03-interface.ProofData.md create mode 100644 docs/docs/noir_js/reference/noir_js/classes/Noir.md create mode 100644 docs/docs/noir_js/reference/noir_js/functions/and.md create mode 100644 docs/docs/noir_js/reference/noir_js/functions/blake2s256.md create mode 100644 docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md create mode 100644 docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md create mode 100644 docs/docs/noir_js/reference/noir_js/functions/keccak256.md create mode 100644 docs/docs/noir_js/reference/noir_js/functions/sha256.md create mode 100644 docs/docs/noir_js/reference/noir_js/functions/xor.md create mode 100644 docs/docs/noir_js/reference/noir_js/index.md create mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md create mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md create mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md create mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md create mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/ProofData.md create mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/WitnessMap.md create mode 100644 docs/docs/noir_js/reference/noir_js/typedoc-sidebar.cjs delete mode 100644 tooling/noir_js/typedoc.json delete mode 100644 tooling/noir_js_backend_barretenberg/typedoc.json diff --git a/docs/docs/noir_js/noir_js.md b/docs/docs/noir_js/noir_js.md index 23ea550e156..f895b22eaf8 100644 --- a/docs/docs/noir_js/noir_js.md +++ b/docs/docs/noir_js/noir_js.md @@ -33,4 +33,4 @@ To install its JavaScript library, run this in your project: npm i @noir-lang/backend_barretenberg ``` -For more details on how to instantiate and use the libraries, refer to the [Full Noir App Guide](./getting_started/01_tiny_noir_app.md) and [Reference](./reference/01_noirjs.md) sections. +For more details on how to instantiate and use the libraries, refer to the [Full Noir App Guide](./getting_started/01_tiny_noir_app.md) and [Reference](./reference/noir_js/classes/Noir.md) sections. diff --git a/docs/docs/noir_js/reference/01_noirjs.md b/docs/docs/noir_js/reference/01_noirjs.md deleted file mode 100644 index d9e5a0c6115..00000000000 --- a/docs/docs/noir_js/reference/01_noirjs.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: Noir -description: Reference to noir_js library and the Noir class -keywords: [Noir project, javascript, typescript, node.js, browser, react, class, reference] ---- - -## Table of Contents - -- [constructor](#constructor) -- [init](#init) -- [generateFinalProof](#generatefinalproof) -- [verifyFinalProof](#verifyfinalproof) - -## `constructor` - -The `constructor` is a method used to create and initialize objects created within the `Noir` class. In the `Noir` class constructor, you need to pass two parameters: `circuit` and `backend`. - -### Syntax - -```js -constructor(circuit, backend); -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `circuit` | Object | A circuit represented in a `json` format, containing the ABI and bytecode. Typically obtained by running [`nargo compile`](../../nargo/01_commands.md) | -| `backend` | Object | A backend instance, before initialization. | - -### Usage - -```js -const noir = new Noir(circuit, backend); -``` - -## `init` - -This async method should be called after class instantiation. It will run processes on the ACVM, instantiate your backend, etc. - -### Syntax - -```js -async init() -``` - -### Parameters - -This method takes no parameters - -### Usage - -```js -await noirInstance.init(); -``` - -## `execute` - -This async method allows to execute a circuit to get its witness and return value. [`generateFinalProof`](#generatefinalproof) calls it for you, but you can call it directly (i.e. to feed directly to a backend, or to get the return value). - -### Syntax - -```js -async execute(inputs) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| `inputs` | Object | An object containing the inputs to your circuit. | - -### Returns - -| Return value | Type | Description | -| ------------ | --------------------- | --------------------------------------------------- | -| `witness` | Promise | The witness | -| `returnValue` | Promise | The return value | - -### Usage - -```js -const { witness, returnValue } = await noir.execute(inputs) -``` - -## `generateFinalProof` - -This async method generates a witness and a proof given an object as input. - -### Syntax - -```js -async generateFinalproof(input) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| `input` | Object | An object containing the inputs to your circuit. | - -### Returns - -| Return value | Type | Description | -| ------------ | --------------------- | --------------------------------------------------- | -| `proof` | Promise | An array with the byte representation of the proof. | - -### Usage - -```js -// consider the Standard Noir Example given with nargo init -const input = { x: 1, y: 2 }; -noirInstance.generateProof(input); -``` - -## `verifyFinalProof` - -This async method instantiates the verification key and verifies your proof. - -### Syntax - -```js -async verifyFinalProof(proof) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ---------- | --------------------------------------------------------------------------------------------- | -| `proof` | Uint8Array | The Uint8Array representation of your proof, usually obtained by calling `generateFinalProof` | - -### Returns - -| Return value | Type | Description | -| ------------ | ------------------ | -------------------------------------------- | -| `verified` | Promise | A boolean for whether the proof was verified | - -### Usage - -```js -const proof = noirInstance.generateProof(input); -noirInstance.verifyFinalProof(proof); -``` diff --git a/docs/docs/noir_js/reference/02_bb_backend.md b/docs/docs/noir_js/reference/02_bb_backend.md deleted file mode 100644 index 21c2ff32b57..00000000000 --- a/docs/docs/noir_js/reference/02_bb_backend.md +++ /dev/null @@ -1,272 +0,0 @@ ---- -title: BarretenbergBackend -description: Reference documentation for the barretenberg_backend library and the BarretenbergBackend class -keywords: - [ - BarretenbergBackend, - Barretenberg, - javascript, - typescript, - node.js, - browser, - class, - reference, - noir_js, - ] ---- - -## Table of Contents - -- [constructor](#constructor) -- [generateFinalProof](#generatefinalproof) -- [generateIntermediateProof](#generateintermediateproof) -- [generateProof](#generateproof) -- [generateIntermediateProofArtifacts](#generateintermediateproofartifacts) -- [verifyFinalProof](#verifyfinalproof) -- [verifyIntermediateProof](#verifyintermediateproof) -- [verifyProof](#verifyproof) -- [destroy](#destroy) - -## `constructor` - -The `constructor` is a method used to create and initialize objects created within the `BarretenbergBackend` class. In this class, you should pass at least one argument for the `circuit`. - -### Syntax - -```js -constructor(acirCircuit, (numberOfThreads = 1)); -``` - -### Parameters - -| Parameter | Type | Description | -| ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `acirCircuit` | Object | A circuit represented in a `json` format, containing the ABI and bytecode Tipically obtained by running [`nargo compile`](../../nargo/01_commands.md). This is the same circuit expected to be passed to [the Noir class](01_noirjs.md) | -| `numberOfThreads` | Number (optional) | The number of threads to be used by the backend. Defaults to 1. | - -### Usage - -```js -const backend = new BarretenbergBackend(acirCircuit); -``` - -## `generateFinalProof` - -An async wrapper around the [generateProof](#generateproof) method that passes a `false` flag. Usually called by the Noir class. - -### Syntax - -```js -async generateFinalProof(decompressedWitness) -``` - -### Parameters - -| Parameter | Type | Description | -| --------------------- | ------ | -------------------------------------------------------- | -| `decompressedWitness` | Object | The decompressed witness for generating the final proof. | - -### Returns - -| Return value | Type | Description | -| ------------ | -------------------- | --------------------------------------------------------- | -| `proof` | Promise | An array with the byte representation of the final proof. | - -### Usage - -```js -const finalProof = await backend.generateFinalProof(decompressedWitness); -``` - -## `generateIntermediateProof` - -An async wrapper around the [generateProof](#generateproof) method that passes a `true` flag. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. - -### Syntax - -```js -async generateIntermediateProof(witness) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | -------------------------------------------------- | -| `witness` | Object | The witness for generating the intermediate proof. | - -### Returns - -| Return value | Type | Description | -| ------------ | -------------------- | --------------------------------------------------------------- | -| `proof` | Promise | An array with the byte representation of the intermediate proof | - -### Usage - -```js -const intermediateProof = await backend.generateIntermediateProof(witness); -``` - -## `generateProof` - -This async method generates a proof. Takes the witness generated by ACVM, and a boolean that evaluates to `true` when the proof _is_ meant to be verified in another circuit. Not currently used by the Noir class. - -### Syntax - -```js -async generateProof(decompressedWitness, makeEasyToVerifyInCircuit) -``` - -### Parameters - -| Parameter | Type | Description | -| --------------------------- | ------- | ---------------------------------------------------------------------------------------------- | -| `decompressedWitness` | Object | The decompressed witness for generating the proof. | -| `makeEasyToVerifyInCircuit` | Boolean | A flag indicating whether to generate proof components for easy verification within a circuit. | - -### Returns - -| Return value | Type | Description | -| ------------ | -------------------- | -------------------------------------------------- | -| `proof` | Promise | An array with the byte representation of the proof | - -### Usage - -```js -const proof = await backend.generateProof(decompressedWitness, makeEasyToVerifyInCircuit); -``` - -## `generateIntermediateProofArtifacts` - -This async method returns the artifacts needed to verify the intermediate proof in another circuit. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. - -### Syntax - -```js -async generateIntermediateProofArtifacts(proof, numOfPublicInputs = 0) -``` - -### Parameters - -| Parameter | Type | Description | -| ------------------- | ----------------- | ---------------------------------------------------------------- | -| `proof` | Object | The proof object. | -| `numOfPublicInputs` | Number (optional) | The number of public inputs in the inner proof, defaulting to 0. | - -### Returns - -| Return value | Type | Description | -| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `proofAsFields` | string[] | An array of strings with the hexadecimal representation of the [Fields](../../language_concepts/data_types/00_fields.md) that make up a proof | -| `vkAsFields` | string[] | An array of strings with the hexadecimal representation of the [Fields](../../language_concepts/data_types/00_fields.md) that make up the verification key | -| `vkHash` | string | A pedersen hash of the verification key | - -### Usage - -```js -const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); -``` - -## `verifyFinalProof` - -An async wrapper around [verifyProof](#verifyproof) that sets the `false` flag. Usually called by the Noir class. - -### Syntax - -```js -async verifyFinalProof(proof) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | --------------------------- | -| `proof` | Object | The proof object to verify. | - -### Returns - -| Return value | Type | Description | -| ------------ | ------------------ | -------------------------------------------- | -| `verified` | Promise | A boolean for whether the proof was verified | - -### Usage - -```js -const isValidFinal = await backend.verifyFinalProof(proof); -``` - -## `verifyIntermediateProof` - -An async wrapper around [verifyProof](#verifyproof) that sets the `true` flag. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. - -### Syntax - -```js -async verifyIntermediateProof(proof) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------- | -| `proof` | Object | The intermediate proof object to verify. | - -### Returns - -| Return value | Type | Description | -| ------------ | ------------------ | -------------------------------------------- | -| `verified` | Promise | A boolean for whether the proof was verified | - -### Usage - -```js -const isValidIntermediate = await backend.verifyIntermediateProof(proof); -``` - -## `verifyProof` - -This async method verifies a proof. Takes the proof, and a boolean that evaluates to `true` when the proof is intermediate. - -### Syntax - -```js -async verifyProof(proof, makeEasyToVerifyInCircuit) -``` - -### Parameters - -| Parameter | Type | Description | -| --------------------------- | ------- | ------------------------------------------------------------ | -| `proof` | Object | The proof object to verify | -| `makeEasyToVerifyInCircuit` | Boolean | A flag indicating whether the proof is intermediate or final | - -### Returns - -| Parameter | Type | Description | -| ---------- | ------------------ | -------------------------------------------- | -| `verified` | Promise\ | A boolean for whether the proof was verified | - -### Usage - -```js -const isValid = await backend.verifyProof(proof, makeEasyToVerifyInCircuit); -``` - -## `destroy` - -This method destroys the resources allocated in the [instantiate](#instantiate) method. Noir doesn't currently call this method, but it's highly recommended that developers do so in order to save resources. - -### Syntax - -```js -async destroy() -``` - -### Parameters - -This method takes no parameters. - -### Usage - -```js -await backend.destroy(); -``` diff --git a/docs/docs/noir_js/reference/backend_barretenberg/.nojekyll b/docs/docs/noir_js/reference/backend_barretenberg/.nojekyll new file mode 100644 index 00000000000..e2ac6616add --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/docs/noir_js/reference/backend_barretenberg/01-Classes/01-class.BarretenbergBackend.md b/docs/docs/noir_js/reference/backend_barretenberg/01-Classes/01-class.BarretenbergBackend.md deleted file mode 100644 index 100340a6945..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/01-Classes/01-class.BarretenbergBackend.md +++ /dev/null @@ -1,212 +0,0 @@ ---- -sidebar_label: BarretenbergBackend ---- - -# BarretenbergBackend - -## Implements - -- `Backend` - -## Constructors - -### constructor - -```ts -new BarretenbergBackend(acirCircuit, options = ...): BarretenbergBackend -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `acirCircuit` | [`CompiledCircuit`](../02-Interfaces/02-interface.CompiledCircuit.md) | -| `options` | [`BackendOptions`](../02-Interfaces/01-interface.BackendOptions.md) | - -#### Returns - -[`BarretenbergBackend`](01-class.BarretenbergBackend.md) - -#### Source - -[noir\_js\_backend\_barretenberg/src/index.ts:20](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L20) - -## Properties - -| Property | Type | Source | -| :------ | :------ | :------ | -| **`private`** `acirComposer` | `any` | [noir\_js\_backend\_barretenberg/src/index.ts:17](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L17) | -| **`private`** `acirUncompressedBytecode` | `Uint8Array` | [noir\_js\_backend\_barretenberg/src/index.ts:18](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L18) | -| **`private`** `api` | `any` | [noir\_js\_backend\_barretenberg/src/index.ts:16](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L16) | -| **`private`** `options` | [`BackendOptions`](../02-Interfaces/01-interface.BackendOptions.md) | [noir\_js\_backend\_barretenberg/src/index.ts:22](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L22) | - -## Methods - -### destroy - -```ts -destroy(): Promise< void > -``` - -#### Returns - -`Promise`\< `void` \> - -#### Implementation of - -Backend.destroy - -#### Source - -[noir\_js\_backend\_barretenberg/src/index.ts:153](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L153) - -*** - -### generateFinalProof - -```ts -generateFinalProof(decompressedWitness): Promise< ProofData > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `decompressedWitness` | `Uint8Array` | - -#### Returns - -`Promise`\< [`ProofData`](../02-Interfaces/03-interface.ProofData.md) \> - -#### Implementation of - -Backend.generateFinalProof - -#### Source - -[noir\_js\_backend\_barretenberg/src/index.ts:50](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L50) - -*** - -### generateIntermediateProof - -```ts -generateIntermediateProof(witness): Promise< ProofData > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `witness` | `Uint8Array` | - -#### Returns - -`Promise`\< [`ProofData`](../02-Interfaces/03-interface.ProofData.md) \> - -#### Implementation of - -Backend.generateIntermediateProof - -#### Source - -[noir\_js\_backend\_barretenberg/src/index.ts:66](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L66) - -*** - -### generateIntermediateProofArtifacts - -```ts -generateIntermediateProofArtifacts(proofData, numOfPublicInputs = 0): Promise< { - proofAsFields: string[]; - vkAsFields: string[]; - vkHash: string; - } > -``` - -#### Parameters - -| Parameter | Type | Default value | -| :------ | :------ | :------ | -| `proofData` | [`ProofData`](../02-Interfaces/03-interface.ProofData.md) | `undefined` | -| `numOfPublicInputs` | `number` | `0` | - -#### Returns - -`Promise`\< \{ - `proofAsFields`: `string`[]; - `vkAsFields`: `string`[]; - `vkHash`: `string`; - } \> - -#### Source - -[noir\_js\_backend\_barretenberg/src/index.ts:107](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L107) - -*** - -### instantiate - -```ts -instantiate(): Promise< void > -``` - -#### Returns - -`Promise`\< `void` \> - -#### Source - -[noir\_js\_backend\_barretenberg/src/index.ts:28](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L28) - -*** - -### verifyFinalProof - -```ts -verifyFinalProof(proofData): Promise< boolean > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../02-Interfaces/03-interface.ProofData.md) | - -#### Returns - -`Promise`\< `boolean` \> - -#### Implementation of - -Backend.verifyFinalProof - -#### Source - -[noir\_js\_backend\_barretenberg/src/index.ts:133](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L133) - -*** - -### verifyIntermediateProof - -```ts -verifyIntermediateProof(proofData): Promise< boolean > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../02-Interfaces/03-interface.ProofData.md) | - -#### Returns - -`Promise`\< `boolean` \> - -#### Implementation of - -Backend.verifyIntermediateProof - -#### Source - -[noir\_js\_backend\_barretenberg/src/index.ts:140](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/index.ts#L140) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/01-interface.BackendOptions.md b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/01-interface.BackendOptions.md deleted file mode 100644 index b09ed204e3f..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/01-interface.BackendOptions.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -sidebar_label: BackendOptions ---- - -# BackendOptions - -## Properties - -| Property | Type | Source | -| :------ | :------ | :------ | -| `threads` | `number` | [noir\_js\_backend\_barretenberg/src/types.ts:3](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js_backend_barretenberg/src/types.ts#L3) | diff --git a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/02-interface.CompiledCircuit.md b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/02-interface.CompiledCircuit.md deleted file mode 100644 index e40f06f7555..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/02-interface.CompiledCircuit.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -sidebar_label: CompiledCircuit ---- - -# CompiledCircuit - -## Properties - -| Property | Type | Source | -| :------ | :------ | :------ | -| `abi` | `Abi` | noir\_js\_types/lib/esm/types.d.ts:19 | -| `bytecode` | `string` | noir\_js\_types/lib/esm/types.d.ts:18 | diff --git a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/03-interface.ProofData.md b/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/03-interface.ProofData.md deleted file mode 100644 index 356f8c9db1a..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/02-Interfaces/03-interface.ProofData.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -sidebar_label: ProofData ---- - -# ProofData - -## Properties - -| Property | Type | Source | -| :------ | :------ | :------ | -| `proof` | `Uint8Array` | noir\_js\_types/lib/esm/types.d.ts:13 | -| `publicInputs` | `Uint8Array`[] | noir\_js\_types/lib/esm/types.d.ts:12 | diff --git a/docs/docs/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md b/docs/docs/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md new file mode 100644 index 00000000000..74115ac8b19 --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md @@ -0,0 +1,113 @@ +# BarretenbergBackend + +## Implements + +- [`Backend`](../interfaces/Backend.md) + +## Constructors + +### new BarretenbergBackend(acirCircuit, options) + +```ts +new BarretenbergBackend(acirCircuit, options): BarretenbergBackend +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `acirCircuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | +| `options` | [`BackendOptions`](../type-aliases/BackendOptions.md) | + +#### Returns + +[`BarretenbergBackend`](BarretenbergBackend.md) + +## Methods + +### generateIntermediateProof() + +```ts +generateIntermediateProof(witness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `witness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`generateIntermediateProof`](../interfaces/Backend.md#generateintermediateproof) + +#### Example + +```typescript +const intermediateProof = await backend.generateIntermediateProof(witness); +``` + +*** + +### generateIntermediateProofArtifacts() + +```ts +generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise +``` + +#### Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | `undefined` | +| `numOfPublicInputs` | `number` | `0` | + +#### Returns + +`Promise`\<`object`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`generateIntermediateProofArtifacts`](../interfaces/Backend.md#generateintermediateproofartifacts) + +#### Example + +```typescript +const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); +``` + +*** + +### verifyIntermediateProof() + +```ts +verifyIntermediateProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`verifyIntermediateProof`](../interfaces/Backend.md#verifyintermediateproof) + +#### Example + +```typescript +const isValidIntermediate = await backend.verifyIntermediateProof(proof); +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/index.md b/docs/docs/noir_js/reference/backend_barretenberg/index.md new file mode 100644 index 00000000000..3680ba3ca77 --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/index.md @@ -0,0 +1,27 @@ +# Backend Barretenberg + +## Exports + +### Classes + +| Class | Description | +| :------ | :------ | +| [BarretenbergBackend](classes/BarretenbergBackend.md) | - | + +### Interfaces + +| Interface | Description | +| :------ | :------ | +| [Backend](interfaces/Backend.md) | - | + +### Type Aliases + +| Type alias | Description | +| :------ | :------ | +| [BackendOptions](type-aliases/BackendOptions.md) | - | +| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | +| [ProofData](type-aliases/ProofData.md) | - | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/interfaces/Backend.md b/docs/docs/noir_js/reference/backend_barretenberg/interfaces/Backend.md new file mode 100644 index 00000000000..6457ed7bdeb --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/interfaces/Backend.md @@ -0,0 +1,72 @@ +# Backend + +## Methods + +### generateIntermediateProof() + +```ts +generateIntermediateProof(decompressedWitness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Description + +Generates an intermediate proof (meant to be verified in another circuit) + +*** + +### generateIntermediateProofArtifacts() + +```ts +generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | +| `numOfPublicInputs` | `number` | + +#### Returns + +`Promise`\<`object`\> + +#### Description + +Retrieves the artifacts from a proof in the Field format + +*** + +### verifyIntermediateProof() + +```ts +verifyIntermediateProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Description + +Verifies an intermediate proof + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md new file mode 100644 index 00000000000..266ade75d17 --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md @@ -0,0 +1,19 @@ +# BackendOptions + +```ts +type BackendOptions: object; +``` + +## Description + +An options object, currently only used to specify the number of threads to use. + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `threads` | `number` | **Description**

Number of threads | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md new file mode 100644 index 00000000000..34e0dd04205 --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md @@ -0,0 +1,20 @@ +# CompiledCircuit + +```ts +type CompiledCircuit: object; +``` + +## Description + +The representation of a compiled circuit + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `abi` | `Abi` | **Description**

ABI representation of the circuit | +| `bytecode` | `string` | **Description**

The bytecode of the circuit | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md new file mode 100644 index 00000000000..4aeff73d3e4 --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md @@ -0,0 +1,20 @@ +# ProofData + +```ts +type ProofData: object; +``` + +## Description + +The representation of a proof + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | +| `publicInputs` | `Uint8Array`[] | **Description**

Public inputs of a proof | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs b/docs/docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs new file mode 100644 index 00000000000..04e662c845f --- /dev/null +++ b/docs/docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/classes/BarretenbergBackend","label":"BarretenbergBackend"}]},{"type":"category","label":"Interfaces","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/interfaces/Backend","label":"Backend"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/BackendOptions","label":"BackendOptions"},{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/ProofData","label":"ProofData"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/docs/docs/noir_js/reference/noir_js/.nojekyll b/docs/docs/noir_js/reference/noir_js/.nojekyll new file mode 100644 index 00000000000..e2ac6616add --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/docs/noir_js/reference/noir_js/01-Classes/01-class.Noir.md b/docs/docs/noir_js/reference/noir_js/01-Classes/01-class.Noir.md deleted file mode 100644 index 419bb207781..00000000000 --- a/docs/docs/noir_js/reference/noir_js/01-Classes/01-class.Noir.md +++ /dev/null @@ -1,150 +0,0 @@ ---- -sidebar_label: Noir ---- - -# Noir - -## Constructors - -### constructor - -```ts -new Noir(circuit, backend?): Noir -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `circuit` | [`CompiledCircuit`](../02-Interfaces/02-interface.CompiledCircuit.md) | -| `backend`? | [`Backend`](../02-Interfaces/01-interface.Backend.md) | - -#### Returns - -[`Noir`](01-class.Noir.md) - -#### Source - -[tooling/noir\_js/src/program.ts:8](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L8) - -## Properties - -| Property | Type | Source | -| :------ | :------ | :------ | -| **`private`** `backend?` | [`Backend`](../02-Interfaces/01-interface.Backend.md) | [tooling/noir\_js/src/program.ts:10](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L10) | -| **`private`** `circuit` | [`CompiledCircuit`](../02-Interfaces/02-interface.CompiledCircuit.md) | [tooling/noir\_js/src/program.ts:9](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L9) | - -## Methods - -### destroy - -```ts -destroy(): Promise< void > -``` - -This method destroys the resources allocated in the [instantiate](#instantiate) method. -Noir doesn't currently call this method, but it's highly recommended that developers do so in order to save resources. - -#### Returns - -`Promise`\< `void` \> - -#### Source - -[tooling/noir\_js/src/program.ts:34](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L34) - -#### Example - -```typescript -await backend.destroy(); -``` - -*** - -### execute - -```ts -execute(inputs): Promise< { - returnValue: InputValue; - witness: Uint8Array; - } > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `inputs` | `InputMap` | - -#### Returns - -`Promise`\< \{ - `returnValue`: `InputValue`; - `witness`: `Uint8Array`; - } \> - -#### Source - -[tooling/noir\_js/src/program.ts:44](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L44) - -*** - -### generateFinalProof - -```ts -generateFinalProof(inputs): Promise< ProofData > -``` - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `inputs` | `InputMap` | The initial inputs to your program | - -#### Returns - -`Promise`\< [`ProofData`](../02-Interfaces/03-interface.ProofData.md) \> - -a proof which can be verified by the verifier - -#### Source - -[tooling/noir\_js/src/program.ts:57](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L57) - -*** - -### getBackend - -```ts -private getBackend(): Backend -``` - -#### Returns - -[`Backend`](../02-Interfaces/01-interface.Backend.md) - -#### Source - -[tooling/noir\_js/src/program.ts:38](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L38) - -*** - -### verifyFinalProof - -```ts -verifyFinalProof(proofData): Promise< boolean > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../02-Interfaces/03-interface.ProofData.md) | - -#### Returns - -`Promise`\< `boolean` \> - -#### Source - -[tooling/noir\_js/src/program.ts:62](https://github.com/noir-lang/noir/blob/dcda1c7ae/tooling/noir_js/src/program.ts#L62) diff --git a/docs/docs/noir_js/reference/noir_js/02-Interfaces/01-interface.Backend.md b/docs/docs/noir_js/reference/noir_js/02-Interfaces/01-interface.Backend.md deleted file mode 100644 index da7f635ef19..00000000000 --- a/docs/docs/noir_js/reference/noir_js/02-Interfaces/01-interface.Backend.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -sidebar_label: Backend ---- - -# Backend - -## Methods - -### destroy - -```ts -destroy(): Promise< void > -``` - -#### Returns - -`Promise`\< `void` \> - -#### Source - -tooling/noir\_js\_types/lib/esm/types.d.ts:7 - -*** - -### generateFinalProof - -```ts -generateFinalProof(decompressedWitness): Promise< ProofData > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `decompressedWitness` | `Uint8Array` | - -#### Returns - -`Promise`\< [`ProofData`](03-interface.ProofData.md) \> - -#### Source - -tooling/noir\_js\_types/lib/esm/types.d.ts:3 - -*** - -### generateIntermediateProof - -```ts -generateIntermediateProof(decompressedWitness): Promise< ProofData > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `decompressedWitness` | `Uint8Array` | - -#### Returns - -`Promise`\< [`ProofData`](03-interface.ProofData.md) \> - -#### Source - -tooling/noir\_js\_types/lib/esm/types.d.ts:4 - -*** - -### verifyFinalProof - -```ts -verifyFinalProof(proofData): Promise< boolean > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](03-interface.ProofData.md) | - -#### Returns - -`Promise`\< `boolean` \> - -#### Source - -tooling/noir\_js\_types/lib/esm/types.d.ts:5 - -*** - -### verifyIntermediateProof - -```ts -verifyIntermediateProof(proofData): Promise< boolean > -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](03-interface.ProofData.md) | - -#### Returns - -`Promise`\< `boolean` \> - -#### Source - -tooling/noir\_js\_types/lib/esm/types.d.ts:6 diff --git a/docs/docs/noir_js/reference/noir_js/02-Interfaces/02-interface.CompiledCircuit.md b/docs/docs/noir_js/reference/noir_js/02-Interfaces/02-interface.CompiledCircuit.md deleted file mode 100644 index 9ad06d3bc7f..00000000000 --- a/docs/docs/noir_js/reference/noir_js/02-Interfaces/02-interface.CompiledCircuit.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -sidebar_label: CompiledCircuit ---- - -# CompiledCircuit - -## Properties - -| Property | Type | Source | -| :------ | :------ | :------ | -| `abi` | `Abi` | tooling/noir\_js\_types/lib/esm/types.d.ts:19 | -| `bytecode` | `string` | tooling/noir\_js\_types/lib/esm/types.d.ts:18 | diff --git a/docs/docs/noir_js/reference/noir_js/02-Interfaces/03-interface.ProofData.md b/docs/docs/noir_js/reference/noir_js/02-Interfaces/03-interface.ProofData.md deleted file mode 100644 index 5a930000570..00000000000 --- a/docs/docs/noir_js/reference/noir_js/02-Interfaces/03-interface.ProofData.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -sidebar_label: ProofData ---- - -# ProofData - -## Properties - -| Property | Type | Source | -| :------ | :------ | :------ | -| `proof` | `Uint8Array` | tooling/noir\_js\_types/lib/esm/types.d.ts:13 | -| `publicInputs` | `Uint8Array`[] | tooling/noir\_js\_types/lib/esm/types.d.ts:12 | diff --git a/docs/docs/noir_js/reference/noir_js/classes/Noir.md b/docs/docs/noir_js/reference/noir_js/classes/Noir.md new file mode 100644 index 00000000000..bc31eac49e5 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/classes/Noir.md @@ -0,0 +1,130 @@ +# Noir + +## Constructors + +### new Noir(circuit, backend) + +```ts +new Noir(circuit, backend?): Noir +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `circuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | +| `backend`? | `Backend` | + +#### Returns + +[`Noir`](Noir.md) + +## Methods + +### destroy() + +```ts +destroy(): Promise +``` + +#### Returns + +`Promise`\<`void`\> + +#### Description + +Destroys the underlying backend instance. + +#### Example + +```typescript +await noir.destroy(); +``` + +*** + +### execute() + +```ts +execute(inputs): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `inputs` | `InputMap` | + +#### Returns + +`Promise`\<`object`\> + +#### Description + +Allows to execute a circuit to get its witness and return value. + +#### Example + +```typescript +async execute(inputs) +``` + +*** + +### generateFinalProof() + +```ts +generateFinalProof(inputs): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `inputs` | `InputMap` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Description + +Generates a witness and a proof given an object as input. + +#### Example + +```typescript +async generateFinalproof(input) +``` + +*** + +### verifyFinalProof() + +```ts +verifyFinalProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Description + +Instantiates the verification key and verifies a proof. + +#### Example + +```typescript +async verifyFinalProof(proof) +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/and.md b/docs/docs/noir_js/reference/noir_js/functions/and.md new file mode 100644 index 00000000000..c783283e396 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/functions/and.md @@ -0,0 +1,22 @@ +# and() + +```ts +and(lhs, rhs): string +``` + +Performs a bitwise AND operation between `lhs` and `rhs` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `lhs` | `string` | | +| `rhs` | `string` | | + +## Returns + +`string` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/blake2s256.md b/docs/docs/noir_js/reference/noir_js/functions/blake2s256.md new file mode 100644 index 00000000000..7882d0da8d5 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/functions/blake2s256.md @@ -0,0 +1,21 @@ +# blake2s256() + +```ts +blake2s256(inputs): Uint8Array +``` + +Calculates the Blake2s256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md b/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md new file mode 100644 index 00000000000..0ba5783f0d5 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md @@ -0,0 +1,29 @@ +# ecdsa\_secp256k1\_verify() + +```ts +ecdsa_secp256k1_verify( + hashed_msg, + public_key_x_bytes, + public_key_y_bytes, + signature): boolean +``` + +Calculates the Blake2s256 hash of the input bytes and represents these as a single field element. +Verifies a ECDSA signature over the secp256k1 curve. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `hashed_msg` | `Uint8Array` | | +| `public_key_x_bytes` | `Uint8Array` | | +| `public_key_y_bytes` | `Uint8Array` | | +| `signature` | `Uint8Array` | | + +## Returns + +`boolean` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md b/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md new file mode 100644 index 00000000000..0b20ff68957 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md @@ -0,0 +1,28 @@ +# ecdsa\_secp256r1\_verify() + +```ts +ecdsa_secp256r1_verify( + hashed_msg, + public_key_x_bytes, + public_key_y_bytes, + signature): boolean +``` + +Verifies a ECDSA signature over the secp256r1 curve. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `hashed_msg` | `Uint8Array` | | +| `public_key_x_bytes` | `Uint8Array` | | +| `public_key_y_bytes` | `Uint8Array` | | +| `signature` | `Uint8Array` | | + +## Returns + +`boolean` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/keccak256.md b/docs/docs/noir_js/reference/noir_js/functions/keccak256.md new file mode 100644 index 00000000000..d10f155ce86 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/functions/keccak256.md @@ -0,0 +1,21 @@ +# keccak256() + +```ts +keccak256(inputs): Uint8Array +``` + +Calculates the Keccak256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/sha256.md b/docs/docs/noir_js/reference/noir_js/functions/sha256.md new file mode 100644 index 00000000000..6ba4ecac022 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/functions/sha256.md @@ -0,0 +1,21 @@ +# sha256() + +```ts +sha256(inputs): Uint8Array +``` + +Calculates the SHA256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/xor.md b/docs/docs/noir_js/reference/noir_js/functions/xor.md new file mode 100644 index 00000000000..8d762b895d3 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/functions/xor.md @@ -0,0 +1,22 @@ +# xor() + +```ts +xor(lhs, rhs): string +``` + +Performs a bitwise XOR operation between `lhs` and `rhs` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `lhs` | `string` | | +| `rhs` | `string` | | + +## Returns + +`string` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/index.md b/docs/docs/noir_js/reference/noir_js/index.md new file mode 100644 index 00000000000..58902c17b99 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/index.md @@ -0,0 +1,36 @@ +# Noir JS + +## Exports + +### Classes + +| Class | Description | +| :------ | :------ | +| [Noir](classes/Noir.md) | - | + +### Type Aliases + +| Type alias | Description | +| :------ | :------ | +| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | +| [ForeignCallHandler](type-aliases/ForeignCallHandler.md) | A callback which performs an foreign call and returns the response. | +| [ForeignCallInput](type-aliases/ForeignCallInput.md) | - | +| [ForeignCallOutput](type-aliases/ForeignCallOutput.md) | - | +| [ProofData](type-aliases/ProofData.md) | - | +| [WitnessMap](type-aliases/WitnessMap.md) | - | + +### Functions + +| Function | Description | +| :------ | :------ | +| [and](functions/and.md) | Performs a bitwise AND operation between `lhs` and `rhs` | +| [blake2s256](functions/blake2s256.md) | Calculates the Blake2s256 hash of the input bytes | +| [ecdsa\_secp256k1\_verify](functions/ecdsa_secp256k1_verify.md) | Calculates the Blake2s256 hash of the input bytes and represents these as a single field element. | +| [ecdsa\_secp256r1\_verify](functions/ecdsa_secp256r1_verify.md) | Verifies a ECDSA signature over the secp256r1 curve. | +| [keccak256](functions/keccak256.md) | Calculates the Keccak256 hash of the input bytes | +| [sha256](functions/sha256.md) | Calculates the SHA256 hash of the input bytes | +| [xor](functions/xor.md) | Performs a bitwise XOR operation between `lhs` and `rhs` | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md b/docs/docs/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md new file mode 100644 index 00000000000..34e0dd04205 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md @@ -0,0 +1,20 @@ +# CompiledCircuit + +```ts +type CompiledCircuit: object; +``` + +## Description + +The representation of a compiled circuit + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `abi` | `Abi` | **Description**

ABI representation of the circuit | +| `bytecode` | `string` | **Description**

The bytecode of the circuit | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md new file mode 100644 index 00000000000..812b8b16481 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md @@ -0,0 +1,24 @@ +# ForeignCallHandler + +```ts +type ForeignCallHandler: (name, inputs) => Promise; +``` + +A callback which performs an foreign call and returns the response. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | The identifier for the type of foreign call being performed. | +| `inputs` | [`ForeignCallInput`](ForeignCallInput.md)[] | An array of hex encoded inputs to the foreign call. | + +## Returns + +`Promise`\<[`ForeignCallOutput`](ForeignCallOutput.md)[]\> + +outputs - An array of hex encoded outputs containing the results of the foreign call. + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md new file mode 100644 index 00000000000..dd95809186a --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md @@ -0,0 +1,9 @@ +# ForeignCallInput + +```ts +type ForeignCallInput: string[]; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md new file mode 100644 index 00000000000..b71fb78a946 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md @@ -0,0 +1,9 @@ +# ForeignCallOutput + +```ts +type ForeignCallOutput: string | string[]; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/ProofData.md b/docs/docs/noir_js/reference/noir_js/type-aliases/ProofData.md new file mode 100644 index 00000000000..4aeff73d3e4 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/type-aliases/ProofData.md @@ -0,0 +1,20 @@ +# ProofData + +```ts +type ProofData: object; +``` + +## Description + +The representation of a proof + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | +| `publicInputs` | `Uint8Array`[] | **Description**

Public inputs of a proof | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/WitnessMap.md b/docs/docs/noir_js/reference/noir_js/type-aliases/WitnessMap.md new file mode 100644 index 00000000000..258c46f9d0c --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/type-aliases/WitnessMap.md @@ -0,0 +1,9 @@ +# WitnessMap + +```ts +type WitnessMap: Map; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/typedoc-sidebar.cjs b/docs/docs/noir_js/reference/noir_js/typedoc-sidebar.cjs new file mode 100644 index 00000000000..c18318850d0 --- /dev/null +++ b/docs/docs/noir_js/reference/noir_js/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"noir_js/reference/noir_js/classes/Noir","label":"Noir"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallHandler","label":"ForeignCallHandler"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallInput","label":"ForeignCallInput"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallOutput","label":"ForeignCallOutput"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ProofData","label":"ProofData"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/WitnessMap","label":"WitnessMap"}]},{"type":"category","label":"Functions","items":[{"type":"doc","id":"noir_js/reference/noir_js/functions/and","label":"and"},{"type":"doc","id":"noir_js/reference/noir_js/functions/blake2s256","label":"blake2s256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify","label":"ecdsa_secp256k1_verify"},{"type":"doc","id":"noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify","label":"ecdsa_secp256r1_verify"},{"type":"doc","id":"noir_js/reference/noir_js/functions/keccak256","label":"keccak256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/sha256","label":"sha256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/xor","label":"xor"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/docs/docs/noir_js/reference_old/01_bb_backend.md b/docs/docs/noir_js/reference_old/01_bb_backend.md index 21c2ff32b57..f9f5e36c4df 100644 --- a/docs/docs/noir_js/reference_old/01_bb_backend.md +++ b/docs/docs/noir_js/reference_old/01_bb_backend.md @@ -41,7 +41,7 @@ constructor(acirCircuit, (numberOfThreads = 1)); | Parameter | Type | Description | | ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `acirCircuit` | Object | A circuit represented in a `json` format, containing the ABI and bytecode Tipically obtained by running [`nargo compile`](../../nargo/01_commands.md). This is the same circuit expected to be passed to [the Noir class](01_noirjs.md) | +| `acirCircuit` | Object | A circuit represented in a `json` format, containing the ABI and bytecode Tipically obtained by running [`nargo compile`](../../nargo/01_commands.md). This is the same circuit expected to be passed to [the Noir class](../noir_js.md) | | `numberOfThreads` | Number (optional) | The number of threads to be used by the backend. Defaults to 1. | ### Usage diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 6128f3a6b69..c07028b6ae0 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -157,18 +157,28 @@ const config = { entryPoints: ['../tooling/noir_js/src/index.ts'], tsconfig: '../tooling/noir_js/tsconfig.json', entryPointStrategy: 'resolve', - out: 'noir_js/reference/noir_js', + out: 'docs/noir_js/reference/noir_js', plugin: ['typedoc-plugin-markdown'], + name: 'Noir JS', + disableSources: true, + excludePrivate: true, + sidebar: { + filteredIds: ['noir_js/reference/noir_js/index'], + }, readme: 'none', - skipIndexPage: true, hidePageHeader: true, hideBreadcrumbs: true, hideInPageTOC: true, - titleTemplate: '{name}', - identifiersAsCodeBlocks: true, - propertiesFormat: 'table', + useCodeBlocks: true, typeDeclarationFormat: 'table', + propertiesFormat: 'table', + parametersFormat: 'table', + enumMembersFormat: 'table', + indexFormat: 'table', + outputFileStrategy: 'members', + memberPageTitle: '{name}', + membersWithOwnFile: ['Interface', 'Class', 'TypeAlias', 'Function'], }, ], [ @@ -178,18 +188,28 @@ const config = { entryPoints: ['../tooling/noir_js_backend_barretenberg/src/index.ts'], tsconfig: '../tooling/noir_js_backend_barretenberg/tsconfig.json', entryPointStrategy: 'resolve', - out: 'noir_js/reference/backend_barretenberg', + out: 'docs/noir_js/reference/backend_barretenberg', plugin: ['typedoc-plugin-markdown'], + name: 'Backend Barretenberg', + disableSources: true, + excludePrivate: true, + sidebar: { + filteredIds: ['noir_js/reference/backend_barretenberg/index'], + }, readme: 'none', - skipIndexPage: true, hidePageHeader: true, hideBreadcrumbs: true, hideInPageTOC: true, - titleTemplate: '{name}', - identifiersAsCodeBlocks: true, - propertiesFormat: 'table', + useCodeBlocks: true, typeDeclarationFormat: 'table', + propertiesFormat: 'table', + parametersFormat: 'table', + enumMembersFormat: 'table', + indexFormat: 'table', + outputFileStrategy: 'members', + memberPageTitle: '{name}', + membersWithOwnFile: ['Interface', 'Class', 'TypeAlias'], }, ], ], diff --git a/docs/package.json b/docs/package.json index 6bf69030fc6..b1ffb96ed74 100644 --- a/docs/package.json +++ b/docs/package.json @@ -14,7 +14,7 @@ "@mdx-js/react": "^1.6.22", "axios": "^1.4.0", "clsx": "^1.2.1", - "docusaurus-plugin-typedoc": "1.0.0-next.15", + "docusaurus-plugin-typedoc": "1.0.0-next.18", "hast-util-is-element": "^1.1.0", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", @@ -23,7 +23,7 @@ "remark-math": "^3.0.1", "typedoc": "^0.25.0", "typedoc-plugin-frontmatter": "^0.0.2", - "typedoc-plugin-markdown": "4.0.0-next.20", + "typedoc-plugin-markdown": "4.0.0-next.25", "typedoc-plugin-merge-modules": "^5.1.0", "typescript": "^5.2.2" }, diff --git a/docs/sidebars.js b/docs/sidebars.js index 8fddb677a58..3fd391cf09c 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -119,8 +119,22 @@ const sidebars = { label: 'Reference', items: [ { - type: 'autogenerated', - dirName: 'noir_js/reference', + type: 'category', + label: 'Noir JS', + link: { + type: 'doc', + id: 'noir_js/reference/noir_js/index', + }, + items: require('./docs/noir_js/reference/noir_js/typedoc-sidebar.cjs'), + }, + { + type: 'category', + label: 'Backend Barretenberg', + link: { + type: 'doc', + id: 'noir_js/reference/backend_barretenberg/index', + }, + items: require('./docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs'), }, ], }, diff --git a/tooling/noir_js/src/index.ts b/tooling/noir_js/src/index.ts index 5471595d15c..5e700a5b583 100644 --- a/tooling/noir_js/src/index.ts +++ b/tooling/noir_js/src/index.ts @@ -1,5 +1,6 @@ import * as acvm from '@noir-lang/acvm_js'; import * as abi from '@noir-lang/noirc_abi'; +import { CompiledCircuit, ProofData } from '@noir-lang/types'; export { ecdsa_secp256r1_verify, @@ -11,9 +12,12 @@ export { and, } from '@noir-lang/acvm_js'; +export { WitnessMap, ForeignCallHandler, ForeignCallInput, ForeignCallOutput } from '@noir-lang/acvm_js'; + export { Noir } from './program.js'; /** @ignore */ export { acvm, abi }; -/** @ignore */ -export { WitnessMap, ForeignCallHandler, ForeignCallInput, ForeignCallOutput } from '@noir-lang/acvm_js'; + +// type exports for typedoc +export { CompiledCircuit, ProofData }; diff --git a/tooling/noir_js/src/program.ts b/tooling/noir_js/src/program.ts index a46b4ed4fad..a7c334d544d 100644 --- a/tooling/noir_js/src/program.ts +++ b/tooling/noir_js/src/program.ts @@ -22,12 +22,12 @@ export class Noir { /** * - * This method destroys the resources allocated in the [instantiate](#instantiate) method. - * Noir doesn't currently call this method, but it's highly recommended that developers do so in order to save resources. + * @description + * Destroys the underlying backend instance. * * @example * ```typescript - * await backend.destroy(); + * await noir.destroy(); * ``` * */ @@ -40,7 +40,15 @@ export class Noir { return this.backend; } - // Initial inputs to your program + /** + * @description + * Allows to execute a circuit to get its witness and return value. + * + * @example + * ```typescript + * async execute(inputs) + * ``` + */ async execute(inputs: InputMap): Promise<{ witness: Uint8Array; returnValue: InputValue }> { await this.init(); const witness = await generateWitness(this.circuit, inputs); @@ -48,17 +56,34 @@ export class Noir { return { witness: compressWitness(witness), returnValue }; } - // Initial inputs to your program /** * - * @param inputs - The initial inputs to your program - * @returns a proof which can be verified by the verifier + * @description + * Generates a witness and a proof given an object as input. + * + * @example + * ```typescript + * async generateFinalproof(input) + * ``` + * */ async generateFinalProof(inputs: InputMap): Promise { const { witness } = await this.execute(inputs); return this.getBackend().generateFinalProof(witness); } + /** + * + * @description + * Instantiates the verification key and verifies a proof. + * + * + * @example + * ```typescript + * async verifyFinalProof(proof) + * ``` + * + */ async verifyFinalProof(proofData: ProofData): Promise { return this.getBackend().verifyFinalProof(proofData); } diff --git a/tooling/noir_js/tsconfig.json b/tooling/noir_js/tsconfig.json index ede0d41ee94..0dbc5204556 100644 --- a/tooling/noir_js/tsconfig.json +++ b/tooling/noir_js/tsconfig.json @@ -14,7 +14,7 @@ "exclude": ["node_modules"], "references": [ { - "path": "../noir_js_types/tsconfig.json" + "path": "../noir_js_types" }, ] } diff --git a/tooling/noir_js/typedoc.json b/tooling/noir_js/typedoc.json deleted file mode 100644 index ff572de0c2e..00000000000 --- a/tooling/noir_js/typedoc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "entryPoints": ["src/index.ts"], - "excludeInternal": true, - "disableSources": true, - "excludePrivate": true, -} diff --git a/tooling/noir_js_backend_barretenberg/src/index.ts b/tooling/noir_js_backend_barretenberg/src/index.ts index 6221e710ff7..8063d351d2d 100644 --- a/tooling/noir_js_backend_barretenberg/src/index.ts +++ b/tooling/noir_js_backend_barretenberg/src/index.ts @@ -25,6 +25,7 @@ export class BarretenbergBackend implements Backend { this.acirUncompressedBytecode = acirToUint8Array(acirBytecodeBase64); } + /** @ignore */ async instantiate(): Promise { if (!this.api) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -47,6 +48,7 @@ export class BarretenbergBackend implements Backend { // // The settings for this proof are the same as the settings for a "normal" proof // ie one that is not in the recursive setting. + /** @ignore */ async generateFinalProof(decompressedWitness: Uint8Array): Promise { const makeEasyToVerifyInCircuit = false; return this.generateProof(decompressedWitness, makeEasyToVerifyInCircuit); @@ -63,6 +65,14 @@ export class BarretenbergBackend implements Backend { // We set `makeEasyToVerifyInCircuit` to true, which will tell the backend to // generate the proof using components that will make the proof // easier to verify in a circuit. + + /** + * + * @example + * ```typescript + * const intermediateProof = await backend.generateIntermediateProof(witness); + * ``` + */ async generateIntermediateProof(witness: Uint8Array): Promise { const makeEasyToVerifyInCircuit = true; return this.generateProof(witness, makeEasyToVerifyInCircuit); @@ -104,6 +114,14 @@ export class BarretenbergBackend implements Backend { // method. // // The number of public inputs denotes how many public inputs are in the inner proof. + + /** + * + * @example + * ```typescript + * const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); + * ``` + */ async generateIntermediateProofArtifacts( proofData: ProofData, numOfPublicInputs = 0, @@ -130,6 +148,7 @@ export class BarretenbergBackend implements Backend { }; } + /** @ignore */ async verifyFinalProof(proofData: ProofData): Promise { const proof = reconstructProofWithPublicInputs(proofData); const makeEasyToVerifyInCircuit = false; @@ -137,6 +156,13 @@ export class BarretenbergBackend implements Backend { return verified; } + /** + * + * @example + * ```typescript + * const isValidIntermediate = await backend.verifyIntermediateProof(proof); + * ``` + */ async verifyIntermediateProof(proofData: ProofData): Promise { const proof = reconstructProofWithPublicInputs(proofData); const makeEasyToVerifyInCircuit = true; @@ -150,6 +176,7 @@ export class BarretenbergBackend implements Backend { return await this.api.acirVerifyProof(this.acirComposer, proof, makeEasyToVerifyInCircuit); } + /** @ignore */ async destroy(): Promise { if (!this.api) { return; @@ -182,4 +209,4 @@ function flattenUint8Arrays(arrays: Uint8Array[]): Uint8Array { } // typedoc exports -export { BackendOptions, CompiledCircuit, ProofData }; +export { Backend, BackendOptions, CompiledCircuit, ProofData }; diff --git a/tooling/noir_js_backend_barretenberg/src/types.ts b/tooling/noir_js_backend_barretenberg/src/types.ts index 918ce616148..041e36fdf91 100644 --- a/tooling/noir_js_backend_barretenberg/src/types.ts +++ b/tooling/noir_js_backend_barretenberg/src/types.ts @@ -1,4 +1,8 @@ -/** @interface */ +/** + * @description + * An options object, currently only used to specify the number of threads to use. + */ export type BackendOptions = { + /** @description Number of threads */ threads: number; }; diff --git a/tooling/noir_js_backend_barretenberg/typedoc.json b/tooling/noir_js_backend_barretenberg/typedoc.json deleted file mode 100644 index d1b9932866c..00000000000 --- a/tooling/noir_js_backend_barretenberg/typedoc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "entryPoints": ["src/index.ts"], - "excludeInternal": true, - "excludePrivate": true, - "disableSources": true, -} diff --git a/tooling/noir_js_types/src/types.ts b/tooling/noir_js_types/src/types.ts index 28133daa92b..c150803939f 100644 --- a/tooling/noir_js_types/src/types.ts +++ b/tooling/noir_js_types/src/types.ts @@ -1,27 +1,63 @@ import { Abi } from '@noir-lang/noirc_abi'; export interface Backend { - // Generate an outer proof. This is the proof for the circuit which will verify - // inner proofs and or can be seen as the proof created for regular circuits. + /** + * @ignore + * @description Generates a final proof (not meant to be verified in another circuit) */ generateFinalProof(decompressedWitness: Uint8Array): Promise; - // Generates an inner proof. This is the proof that will be verified - // in another circuit. + /** + * @description Generates an intermediate proof (meant to be verified in another circuit) */ generateIntermediateProof(decompressedWitness: Uint8Array): Promise; + /** + * + * @description Retrieves the artifacts from a proof in the Field format + */ + generateIntermediateProofArtifacts( + proofData: ProofData, + numOfPublicInputs: number, + ): Promise<{ + /** @description An array of Fields containing the proof */ + proofAsFields: string[]; + /** @description An array of Fields containing the verification key */ + vkAsFields: string[]; + /** @description A Field containing the verification key hash */ + vkHash: string; + }>; + + /** + * @ignore + * @description Verifies a final proof */ verifyFinalProof(proofData: ProofData): Promise; + + /** @description Verifies an intermediate proof */ verifyIntermediateProof(proofData: ProofData): Promise; + + /** + * @ignore + * @description Destroys the backend */ destroy(): Promise; } -/** @interface */ +/** + * @description + * The representation of a proof + * */ export type ProofData = { + /** @description Public inputs of a proof */ publicInputs: Uint8Array[]; + /** @description An byte array representing the proof */ proof: Uint8Array; }; -/** @interface */ +/** + * @description + * The representation of a compiled circuit + * */ export type CompiledCircuit = { + /** @description The bytecode of the circuit */ bytecode: string; + /** @description ABI representation of the circuit */ abi: Abi; }; diff --git a/yarn.lock b/yarn.lock index dfb265c4f9b..a6c3ecfc0c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8240,7 +8240,7 @@ __metadata: "@mdx-js/react": ^1.6.22 axios: ^1.4.0 clsx: ^1.2.1 - docusaurus-plugin-typedoc: 1.0.0-next.15 + docusaurus-plugin-typedoc: 1.0.0-next.18 hast-util-is-element: ^1.1.0 prism-react-renderer: ^1.3.5 react: ^17.0.2 @@ -8249,7 +8249,7 @@ __metadata: remark-math: ^3.0.1 typedoc: ^0.25.0 typedoc-plugin-frontmatter: ^0.0.2 - typedoc-plugin-markdown: 4.0.0-next.20 + typedoc-plugin-markdown: 4.0.0-next.25 typedoc-plugin-merge-modules: ^5.1.0 typescript: ^5.2.2 languageName: unknown @@ -8264,14 +8264,14 @@ __metadata: languageName: node linkType: hard -"docusaurus-plugin-typedoc@npm:1.0.0-next.15": - version: 1.0.0-next.15 - resolution: "docusaurus-plugin-typedoc@npm:1.0.0-next.15" +"docusaurus-plugin-typedoc@npm:1.0.0-next.18": + version: 1.0.0-next.18 + resolution: "docusaurus-plugin-typedoc@npm:1.0.0-next.18" dependencies: "@docusaurus/types": ^2.4.1 peerDependencies: - typedoc-plugin-markdown: ">=4.0.0-next.19" - checksum: 69fcadcb90288151d40140d75cb06612dedf60c34fd0806c3ea309267dfe3b25406f280d4b883676d3924e06588483b8d5ac895a5cd67957e715a3d0425de628 + typedoc-plugin-markdown: ">=4.0.0-next.24" + checksum: a501e3bd1cc5b33d215a1b71b018a34d4aa5bd98f39580ab114a127d3f555078443d6b690119c0adb17fb8867ba4131382ad5d14dbaa7919715020cdfaf6b9c4 languageName: node linkType: hard @@ -16452,12 +16452,12 @@ __metadata: languageName: node linkType: hard -"typedoc-plugin-markdown@npm:4.0.0-next.20": - version: 4.0.0-next.20 - resolution: "typedoc-plugin-markdown@npm:4.0.0-next.20" +"typedoc-plugin-markdown@npm:4.0.0-next.25": + version: 4.0.0-next.25 + resolution: "typedoc-plugin-markdown@npm:4.0.0-next.25" peerDependencies: - typedoc: ">=0.24.0" - checksum: f1217bc822940cdc978cde54e7fead86441254ca443e9760ccb63e9cc9c0ee05df1d3e846f081fc35ee1385d75b85f92d18e5474a5a5a698a0e5679fbcb9121f + typedoc: ">=0.25.0" + checksum: 284e2ce44446faf8db5fc54dfa84e7cd819cfc60bbed12ffb781cb24a166ba6b3a220c542990a3eb14aefff33f1d7c8322378297551f55476155cf532fbbb807 languageName: node linkType: hard From 1aec6aa707cb04b27253ac9b0f0730e1ff72328e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Sun, 29 Oct 2023 23:03:37 +0000 Subject: [PATCH 03/10] chore(docs): finishing up --- docs/.gitignore | 1 + .../noir_js/reference_old/01_bb_backend.md | 272 ------------------ docs/docs/noir_js/reference_old/02_noirjs.md | 143 --------- 3 files changed, 1 insertion(+), 415 deletions(-) delete mode 100644 docs/docs/noir_js/reference_old/01_bb_backend.md delete mode 100644 docs/docs/noir_js/reference_old/02_noirjs.md diff --git a/docs/.gitignore b/docs/.gitignore index 96ecf9cbc03..0323708542a 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -21,3 +21,4 @@ yarn-debug.log* yarn-error.log* package-lock.json +noir_js/reference diff --git a/docs/docs/noir_js/reference_old/01_bb_backend.md b/docs/docs/noir_js/reference_old/01_bb_backend.md deleted file mode 100644 index f9f5e36c4df..00000000000 --- a/docs/docs/noir_js/reference_old/01_bb_backend.md +++ /dev/null @@ -1,272 +0,0 @@ ---- -title: BarretenbergBackend -description: Reference documentation for the barretenberg_backend library and the BarretenbergBackend class -keywords: - [ - BarretenbergBackend, - Barretenberg, - javascript, - typescript, - node.js, - browser, - class, - reference, - noir_js, - ] ---- - -## Table of Contents - -- [constructor](#constructor) -- [generateFinalProof](#generatefinalproof) -- [generateIntermediateProof](#generateintermediateproof) -- [generateProof](#generateproof) -- [generateIntermediateProofArtifacts](#generateintermediateproofartifacts) -- [verifyFinalProof](#verifyfinalproof) -- [verifyIntermediateProof](#verifyintermediateproof) -- [verifyProof](#verifyproof) -- [destroy](#destroy) - -## `constructor` - -The `constructor` is a method used to create and initialize objects created within the `BarretenbergBackend` class. In this class, you should pass at least one argument for the `circuit`. - -### Syntax - -```js -constructor(acirCircuit, (numberOfThreads = 1)); -``` - -### Parameters - -| Parameter | Type | Description | -| ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `acirCircuit` | Object | A circuit represented in a `json` format, containing the ABI and bytecode Tipically obtained by running [`nargo compile`](../../nargo/01_commands.md). This is the same circuit expected to be passed to [the Noir class](../noir_js.md) | -| `numberOfThreads` | Number (optional) | The number of threads to be used by the backend. Defaults to 1. | - -### Usage - -```js -const backend = new BarretenbergBackend(acirCircuit); -``` - -## `generateFinalProof` - -An async wrapper around the [generateProof](#generateproof) method that passes a `false` flag. Usually called by the Noir class. - -### Syntax - -```js -async generateFinalProof(decompressedWitness) -``` - -### Parameters - -| Parameter | Type | Description | -| --------------------- | ------ | -------------------------------------------------------- | -| `decompressedWitness` | Object | The decompressed witness for generating the final proof. | - -### Returns - -| Return value | Type | Description | -| ------------ | -------------------- | --------------------------------------------------------- | -| `proof` | Promise | An array with the byte representation of the final proof. | - -### Usage - -```js -const finalProof = await backend.generateFinalProof(decompressedWitness); -``` - -## `generateIntermediateProof` - -An async wrapper around the [generateProof](#generateproof) method that passes a `true` flag. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. - -### Syntax - -```js -async generateIntermediateProof(witness) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | -------------------------------------------------- | -| `witness` | Object | The witness for generating the intermediate proof. | - -### Returns - -| Return value | Type | Description | -| ------------ | -------------------- | --------------------------------------------------------------- | -| `proof` | Promise | An array with the byte representation of the intermediate proof | - -### Usage - -```js -const intermediateProof = await backend.generateIntermediateProof(witness); -``` - -## `generateProof` - -This async method generates a proof. Takes the witness generated by ACVM, and a boolean that evaluates to `true` when the proof _is_ meant to be verified in another circuit. Not currently used by the Noir class. - -### Syntax - -```js -async generateProof(decompressedWitness, makeEasyToVerifyInCircuit) -``` - -### Parameters - -| Parameter | Type | Description | -| --------------------------- | ------- | ---------------------------------------------------------------------------------------------- | -| `decompressedWitness` | Object | The decompressed witness for generating the proof. | -| `makeEasyToVerifyInCircuit` | Boolean | A flag indicating whether to generate proof components for easy verification within a circuit. | - -### Returns - -| Return value | Type | Description | -| ------------ | -------------------- | -------------------------------------------------- | -| `proof` | Promise | An array with the byte representation of the proof | - -### Usage - -```js -const proof = await backend.generateProof(decompressedWitness, makeEasyToVerifyInCircuit); -``` - -## `generateIntermediateProofArtifacts` - -This async method returns the artifacts needed to verify the intermediate proof in another circuit. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. - -### Syntax - -```js -async generateIntermediateProofArtifacts(proof, numOfPublicInputs = 0) -``` - -### Parameters - -| Parameter | Type | Description | -| ------------------- | ----------------- | ---------------------------------------------------------------- | -| `proof` | Object | The proof object. | -| `numOfPublicInputs` | Number (optional) | The number of public inputs in the inner proof, defaulting to 0. | - -### Returns - -| Return value | Type | Description | -| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `proofAsFields` | string[] | An array of strings with the hexadecimal representation of the [Fields](../../language_concepts/data_types/00_fields.md) that make up a proof | -| `vkAsFields` | string[] | An array of strings with the hexadecimal representation of the [Fields](../../language_concepts/data_types/00_fields.md) that make up the verification key | -| `vkHash` | string | A pedersen hash of the verification key | - -### Usage - -```js -const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); -``` - -## `verifyFinalProof` - -An async wrapper around [verifyProof](#verifyproof) that sets the `false` flag. Usually called by the Noir class. - -### Syntax - -```js -async verifyFinalProof(proof) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | --------------------------- | -| `proof` | Object | The proof object to verify. | - -### Returns - -| Return value | Type | Description | -| ------------ | ------------------ | -------------------------------------------- | -| `verified` | Promise | A boolean for whether the proof was verified | - -### Usage - -```js -const isValidFinal = await backend.verifyFinalProof(proof); -``` - -## `verifyIntermediateProof` - -An async wrapper around [verifyProof](#verifyproof) that sets the `true` flag. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. - -### Syntax - -```js -async verifyIntermediateProof(proof) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------- | -| `proof` | Object | The intermediate proof object to verify. | - -### Returns - -| Return value | Type | Description | -| ------------ | ------------------ | -------------------------------------------- | -| `verified` | Promise | A boolean for whether the proof was verified | - -### Usage - -```js -const isValidIntermediate = await backend.verifyIntermediateProof(proof); -``` - -## `verifyProof` - -This async method verifies a proof. Takes the proof, and a boolean that evaluates to `true` when the proof is intermediate. - -### Syntax - -```js -async verifyProof(proof, makeEasyToVerifyInCircuit) -``` - -### Parameters - -| Parameter | Type | Description | -| --------------------------- | ------- | ------------------------------------------------------------ | -| `proof` | Object | The proof object to verify | -| `makeEasyToVerifyInCircuit` | Boolean | A flag indicating whether the proof is intermediate or final | - -### Returns - -| Parameter | Type | Description | -| ---------- | ------------------ | -------------------------------------------- | -| `verified` | Promise\ | A boolean for whether the proof was verified | - -### Usage - -```js -const isValid = await backend.verifyProof(proof, makeEasyToVerifyInCircuit); -``` - -## `destroy` - -This method destroys the resources allocated in the [instantiate](#instantiate) method. Noir doesn't currently call this method, but it's highly recommended that developers do so in order to save resources. - -### Syntax - -```js -async destroy() -``` - -### Parameters - -This method takes no parameters. - -### Usage - -```js -await backend.destroy(); -``` diff --git a/docs/docs/noir_js/reference_old/02_noirjs.md b/docs/docs/noir_js/reference_old/02_noirjs.md deleted file mode 100644 index d9e5a0c6115..00000000000 --- a/docs/docs/noir_js/reference_old/02_noirjs.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: Noir -description: Reference to noir_js library and the Noir class -keywords: [Noir project, javascript, typescript, node.js, browser, react, class, reference] ---- - -## Table of Contents - -- [constructor](#constructor) -- [init](#init) -- [generateFinalProof](#generatefinalproof) -- [verifyFinalProof](#verifyfinalproof) - -## `constructor` - -The `constructor` is a method used to create and initialize objects created within the `Noir` class. In the `Noir` class constructor, you need to pass two parameters: `circuit` and `backend`. - -### Syntax - -```js -constructor(circuit, backend); -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `circuit` | Object | A circuit represented in a `json` format, containing the ABI and bytecode. Typically obtained by running [`nargo compile`](../../nargo/01_commands.md) | -| `backend` | Object | A backend instance, before initialization. | - -### Usage - -```js -const noir = new Noir(circuit, backend); -``` - -## `init` - -This async method should be called after class instantiation. It will run processes on the ACVM, instantiate your backend, etc. - -### Syntax - -```js -async init() -``` - -### Parameters - -This method takes no parameters - -### Usage - -```js -await noirInstance.init(); -``` - -## `execute` - -This async method allows to execute a circuit to get its witness and return value. [`generateFinalProof`](#generatefinalproof) calls it for you, but you can call it directly (i.e. to feed directly to a backend, or to get the return value). - -### Syntax - -```js -async execute(inputs) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| `inputs` | Object | An object containing the inputs to your circuit. | - -### Returns - -| Return value | Type | Description | -| ------------ | --------------------- | --------------------------------------------------- | -| `witness` | Promise | The witness | -| `returnValue` | Promise | The return value | - -### Usage - -```js -const { witness, returnValue } = await noir.execute(inputs) -``` - -## `generateFinalProof` - -This async method generates a witness and a proof given an object as input. - -### Syntax - -```js -async generateFinalproof(input) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------ | -| `input` | Object | An object containing the inputs to your circuit. | - -### Returns - -| Return value | Type | Description | -| ------------ | --------------------- | --------------------------------------------------- | -| `proof` | Promise | An array with the byte representation of the proof. | - -### Usage - -```js -// consider the Standard Noir Example given with nargo init -const input = { x: 1, y: 2 }; -noirInstance.generateProof(input); -``` - -## `verifyFinalProof` - -This async method instantiates the verification key and verifies your proof. - -### Syntax - -```js -async verifyFinalProof(proof) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ---------- | --------------------------------------------------------------------------------------------- | -| `proof` | Uint8Array | The Uint8Array representation of your proof, usually obtained by calling `generateFinalProof` | - -### Returns - -| Return value | Type | Description | -| ------------ | ------------------ | -------------------------------------------- | -| `verified` | Promise | A boolean for whether the proof was verified | - -### Usage - -```js -const proof = noirInstance.generateProof(input); -noirInstance.verifyFinalProof(proof); -``` From bccfa0ff28647b35bea1315955ebaa032adce428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Sun, 29 Oct 2023 23:09:27 +0000 Subject: [PATCH 04/10] chore(docs): finishing up --- docs/.gitignore | 2 +- .../reference/backend_barretenberg/.nojekyll | 1 - .../classes/BarretenbergBackend.md | 113 --------------- .../reference/backend_barretenberg/index.md | 27 ---- .../interfaces/Backend.md | 72 ---------- .../type-aliases/BackendOptions.md | 19 --- .../type-aliases/CompiledCircuit.md | 20 --- .../type-aliases/ProofData.md | 20 --- .../backend_barretenberg/typedoc-sidebar.cjs | 4 - docs/docs/noir_js/reference/noir_js/.nojekyll | 1 - .../noir_js/reference/noir_js/classes/Noir.md | 130 ------------------ .../reference/noir_js/functions/and.md | 22 --- .../reference/noir_js/functions/blake2s256.md | 21 --- .../functions/ecdsa_secp256k1_verify.md | 29 ---- .../functions/ecdsa_secp256r1_verify.md | 28 ---- .../reference/noir_js/functions/keccak256.md | 21 --- .../reference/noir_js/functions/sha256.md | 21 --- .../reference/noir_js/functions/xor.md | 22 --- docs/docs/noir_js/reference/noir_js/index.md | 36 ----- .../noir_js/type-aliases/CompiledCircuit.md | 20 --- .../type-aliases/ForeignCallHandler.md | 24 ---- .../noir_js/type-aliases/ForeignCallInput.md | 9 -- .../noir_js/type-aliases/ForeignCallOutput.md | 9 -- .../noir_js/type-aliases/ProofData.md | 20 --- .../noir_js/type-aliases/WitnessMap.md | 9 -- .../reference/noir_js/typedoc-sidebar.cjs | 4 - 26 files changed, 1 insertion(+), 703 deletions(-) delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/.nojekyll delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/index.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/interfaces/Backend.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md delete mode 100644 docs/docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs delete mode 100644 docs/docs/noir_js/reference/noir_js/.nojekyll delete mode 100644 docs/docs/noir_js/reference/noir_js/classes/Noir.md delete mode 100644 docs/docs/noir_js/reference/noir_js/functions/and.md delete mode 100644 docs/docs/noir_js/reference/noir_js/functions/blake2s256.md delete mode 100644 docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md delete mode 100644 docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md delete mode 100644 docs/docs/noir_js/reference/noir_js/functions/keccak256.md delete mode 100644 docs/docs/noir_js/reference/noir_js/functions/sha256.md delete mode 100644 docs/docs/noir_js/reference/noir_js/functions/xor.md delete mode 100644 docs/docs/noir_js/reference/noir_js/index.md delete mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md delete mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md delete mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md delete mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md delete mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/ProofData.md delete mode 100644 docs/docs/noir_js/reference/noir_js/type-aliases/WitnessMap.md delete mode 100644 docs/docs/noir_js/reference/noir_js/typedoc-sidebar.cjs diff --git a/docs/.gitignore b/docs/.gitignore index 0323708542a..4480a408a9c 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -7,6 +7,7 @@ # Generated files .docusaurus .cache-loader +/docs/noir_js/reference/ # Misc .DS_Store @@ -21,4 +22,3 @@ yarn-debug.log* yarn-error.log* package-lock.json -noir_js/reference diff --git a/docs/docs/noir_js/reference/backend_barretenberg/.nojekyll b/docs/docs/noir_js/reference/backend_barretenberg/.nojekyll deleted file mode 100644 index e2ac6616add..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/docs/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md b/docs/docs/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md deleted file mode 100644 index 74115ac8b19..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md +++ /dev/null @@ -1,113 +0,0 @@ -# BarretenbergBackend - -## Implements - -- [`Backend`](../interfaces/Backend.md) - -## Constructors - -### new BarretenbergBackend(acirCircuit, options) - -```ts -new BarretenbergBackend(acirCircuit, options): BarretenbergBackend -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `acirCircuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | -| `options` | [`BackendOptions`](../type-aliases/BackendOptions.md) | - -#### Returns - -[`BarretenbergBackend`](BarretenbergBackend.md) - -## Methods - -### generateIntermediateProof() - -```ts -generateIntermediateProof(witness): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `witness` | `Uint8Array` | - -#### Returns - -`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`generateIntermediateProof`](../interfaces/Backend.md#generateintermediateproof) - -#### Example - -```typescript -const intermediateProof = await backend.generateIntermediateProof(witness); -``` - -*** - -### generateIntermediateProofArtifacts() - -```ts -generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise -``` - -#### Parameters - -| Parameter | Type | Default value | -| :------ | :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | `undefined` | -| `numOfPublicInputs` | `number` | `0` | - -#### Returns - -`Promise`\<`object`\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`generateIntermediateProofArtifacts`](../interfaces/Backend.md#generateintermediateproofartifacts) - -#### Example - -```typescript -const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); -``` - -*** - -### verifyIntermediateProof() - -```ts -verifyIntermediateProof(proofData): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | - -#### Returns - -`Promise`\<`boolean`\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`verifyIntermediateProof`](../interfaces/Backend.md#verifyintermediateproof) - -#### Example - -```typescript -const isValidIntermediate = await backend.verifyIntermediateProof(proof); -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/index.md b/docs/docs/noir_js/reference/backend_barretenberg/index.md deleted file mode 100644 index 3680ba3ca77..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/index.md +++ /dev/null @@ -1,27 +0,0 @@ -# Backend Barretenberg - -## Exports - -### Classes - -| Class | Description | -| :------ | :------ | -| [BarretenbergBackend](classes/BarretenbergBackend.md) | - | - -### Interfaces - -| Interface | Description | -| :------ | :------ | -| [Backend](interfaces/Backend.md) | - | - -### Type Aliases - -| Type alias | Description | -| :------ | :------ | -| [BackendOptions](type-aliases/BackendOptions.md) | - | -| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | -| [ProofData](type-aliases/ProofData.md) | - | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/interfaces/Backend.md b/docs/docs/noir_js/reference/backend_barretenberg/interfaces/Backend.md deleted file mode 100644 index 6457ed7bdeb..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/interfaces/Backend.md +++ /dev/null @@ -1,72 +0,0 @@ -# Backend - -## Methods - -### generateIntermediateProof() - -```ts -generateIntermediateProof(decompressedWitness): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `decompressedWitness` | `Uint8Array` | - -#### Returns - -`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> - -#### Description - -Generates an intermediate proof (meant to be verified in another circuit) - -*** - -### generateIntermediateProofArtifacts() - -```ts -generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | -| `numOfPublicInputs` | `number` | - -#### Returns - -`Promise`\<`object`\> - -#### Description - -Retrieves the artifacts from a proof in the Field format - -*** - -### verifyIntermediateProof() - -```ts -verifyIntermediateProof(proofData): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | - -#### Returns - -`Promise`\<`boolean`\> - -#### Description - -Verifies an intermediate proof - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md deleted file mode 100644 index 266ade75d17..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md +++ /dev/null @@ -1,19 +0,0 @@ -# BackendOptions - -```ts -type BackendOptions: object; -``` - -## Description - -An options object, currently only used to specify the number of threads to use. - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `threads` | `number` | **Description**

Number of threads | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md deleted file mode 100644 index 34e0dd04205..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md +++ /dev/null @@ -1,20 +0,0 @@ -# CompiledCircuit - -```ts -type CompiledCircuit: object; -``` - -## Description - -The representation of a compiled circuit - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `abi` | `Abi` | **Description**

ABI representation of the circuit | -| `bytecode` | `string` | **Description**

The bytecode of the circuit | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md b/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md deleted file mode 100644 index 4aeff73d3e4..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md +++ /dev/null @@ -1,20 +0,0 @@ -# ProofData - -```ts -type ProofData: object; -``` - -## Description - -The representation of a proof - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | -| `publicInputs` | `Uint8Array`[] | **Description**

Public inputs of a proof | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs b/docs/docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs deleted file mode 100644 index 04e662c845f..00000000000 --- a/docs/docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-check -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/classes/BarretenbergBackend","label":"BarretenbergBackend"}]},{"type":"category","label":"Interfaces","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/interfaces/Backend","label":"Backend"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/BackendOptions","label":"BackendOptions"},{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/ProofData","label":"ProofData"}]}]}; -module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/docs/docs/noir_js/reference/noir_js/.nojekyll b/docs/docs/noir_js/reference/noir_js/.nojekyll deleted file mode 100644 index e2ac6616add..00000000000 --- a/docs/docs/noir_js/reference/noir_js/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/docs/noir_js/reference/noir_js/classes/Noir.md b/docs/docs/noir_js/reference/noir_js/classes/Noir.md deleted file mode 100644 index bc31eac49e5..00000000000 --- a/docs/docs/noir_js/reference/noir_js/classes/Noir.md +++ /dev/null @@ -1,130 +0,0 @@ -# Noir - -## Constructors - -### new Noir(circuit, backend) - -```ts -new Noir(circuit, backend?): Noir -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `circuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | -| `backend`? | `Backend` | - -#### Returns - -[`Noir`](Noir.md) - -## Methods - -### destroy() - -```ts -destroy(): Promise -``` - -#### Returns - -`Promise`\<`void`\> - -#### Description - -Destroys the underlying backend instance. - -#### Example - -```typescript -await noir.destroy(); -``` - -*** - -### execute() - -```ts -execute(inputs): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `inputs` | `InputMap` | - -#### Returns - -`Promise`\<`object`\> - -#### Description - -Allows to execute a circuit to get its witness and return value. - -#### Example - -```typescript -async execute(inputs) -``` - -*** - -### generateFinalProof() - -```ts -generateFinalProof(inputs): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `inputs` | `InputMap` | - -#### Returns - -`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> - -#### Description - -Generates a witness and a proof given an object as input. - -#### Example - -```typescript -async generateFinalproof(input) -``` - -*** - -### verifyFinalProof() - -```ts -verifyFinalProof(proofData): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | - -#### Returns - -`Promise`\<`boolean`\> - -#### Description - -Instantiates the verification key and verifies a proof. - -#### Example - -```typescript -async verifyFinalProof(proof) -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/and.md b/docs/docs/noir_js/reference/noir_js/functions/and.md deleted file mode 100644 index c783283e396..00000000000 --- a/docs/docs/noir_js/reference/noir_js/functions/and.md +++ /dev/null @@ -1,22 +0,0 @@ -# and() - -```ts -and(lhs, rhs): string -``` - -Performs a bitwise AND operation between `lhs` and `rhs` - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `lhs` | `string` | | -| `rhs` | `string` | | - -## Returns - -`string` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/blake2s256.md b/docs/docs/noir_js/reference/noir_js/functions/blake2s256.md deleted file mode 100644 index 7882d0da8d5..00000000000 --- a/docs/docs/noir_js/reference/noir_js/functions/blake2s256.md +++ /dev/null @@ -1,21 +0,0 @@ -# blake2s256() - -```ts -blake2s256(inputs): Uint8Array -``` - -Calculates the Blake2s256 hash of the input bytes - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `inputs` | `Uint8Array` | | - -## Returns - -`Uint8Array` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md b/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md deleted file mode 100644 index 0ba5783f0d5..00000000000 --- a/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md +++ /dev/null @@ -1,29 +0,0 @@ -# ecdsa\_secp256k1\_verify() - -```ts -ecdsa_secp256k1_verify( - hashed_msg, - public_key_x_bytes, - public_key_y_bytes, - signature): boolean -``` - -Calculates the Blake2s256 hash of the input bytes and represents these as a single field element. -Verifies a ECDSA signature over the secp256k1 curve. - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `hashed_msg` | `Uint8Array` | | -| `public_key_x_bytes` | `Uint8Array` | | -| `public_key_y_bytes` | `Uint8Array` | | -| `signature` | `Uint8Array` | | - -## Returns - -`boolean` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md b/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md deleted file mode 100644 index 0b20ff68957..00000000000 --- a/docs/docs/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md +++ /dev/null @@ -1,28 +0,0 @@ -# ecdsa\_secp256r1\_verify() - -```ts -ecdsa_secp256r1_verify( - hashed_msg, - public_key_x_bytes, - public_key_y_bytes, - signature): boolean -``` - -Verifies a ECDSA signature over the secp256r1 curve. - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `hashed_msg` | `Uint8Array` | | -| `public_key_x_bytes` | `Uint8Array` | | -| `public_key_y_bytes` | `Uint8Array` | | -| `signature` | `Uint8Array` | | - -## Returns - -`boolean` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/keccak256.md b/docs/docs/noir_js/reference/noir_js/functions/keccak256.md deleted file mode 100644 index d10f155ce86..00000000000 --- a/docs/docs/noir_js/reference/noir_js/functions/keccak256.md +++ /dev/null @@ -1,21 +0,0 @@ -# keccak256() - -```ts -keccak256(inputs): Uint8Array -``` - -Calculates the Keccak256 hash of the input bytes - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `inputs` | `Uint8Array` | | - -## Returns - -`Uint8Array` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/sha256.md b/docs/docs/noir_js/reference/noir_js/functions/sha256.md deleted file mode 100644 index 6ba4ecac022..00000000000 --- a/docs/docs/noir_js/reference/noir_js/functions/sha256.md +++ /dev/null @@ -1,21 +0,0 @@ -# sha256() - -```ts -sha256(inputs): Uint8Array -``` - -Calculates the SHA256 hash of the input bytes - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `inputs` | `Uint8Array` | | - -## Returns - -`Uint8Array` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/functions/xor.md b/docs/docs/noir_js/reference/noir_js/functions/xor.md deleted file mode 100644 index 8d762b895d3..00000000000 --- a/docs/docs/noir_js/reference/noir_js/functions/xor.md +++ /dev/null @@ -1,22 +0,0 @@ -# xor() - -```ts -xor(lhs, rhs): string -``` - -Performs a bitwise XOR operation between `lhs` and `rhs` - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `lhs` | `string` | | -| `rhs` | `string` | | - -## Returns - -`string` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/index.md b/docs/docs/noir_js/reference/noir_js/index.md deleted file mode 100644 index 58902c17b99..00000000000 --- a/docs/docs/noir_js/reference/noir_js/index.md +++ /dev/null @@ -1,36 +0,0 @@ -# Noir JS - -## Exports - -### Classes - -| Class | Description | -| :------ | :------ | -| [Noir](classes/Noir.md) | - | - -### Type Aliases - -| Type alias | Description | -| :------ | :------ | -| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | -| [ForeignCallHandler](type-aliases/ForeignCallHandler.md) | A callback which performs an foreign call and returns the response. | -| [ForeignCallInput](type-aliases/ForeignCallInput.md) | - | -| [ForeignCallOutput](type-aliases/ForeignCallOutput.md) | - | -| [ProofData](type-aliases/ProofData.md) | - | -| [WitnessMap](type-aliases/WitnessMap.md) | - | - -### Functions - -| Function | Description | -| :------ | :------ | -| [and](functions/and.md) | Performs a bitwise AND operation between `lhs` and `rhs` | -| [blake2s256](functions/blake2s256.md) | Calculates the Blake2s256 hash of the input bytes | -| [ecdsa\_secp256k1\_verify](functions/ecdsa_secp256k1_verify.md) | Calculates the Blake2s256 hash of the input bytes and represents these as a single field element. | -| [ecdsa\_secp256r1\_verify](functions/ecdsa_secp256r1_verify.md) | Verifies a ECDSA signature over the secp256r1 curve. | -| [keccak256](functions/keccak256.md) | Calculates the Keccak256 hash of the input bytes | -| [sha256](functions/sha256.md) | Calculates the SHA256 hash of the input bytes | -| [xor](functions/xor.md) | Performs a bitwise XOR operation between `lhs` and `rhs` | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md b/docs/docs/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md deleted file mode 100644 index 34e0dd04205..00000000000 --- a/docs/docs/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md +++ /dev/null @@ -1,20 +0,0 @@ -# CompiledCircuit - -```ts -type CompiledCircuit: object; -``` - -## Description - -The representation of a compiled circuit - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `abi` | `Abi` | **Description**

ABI representation of the circuit | -| `bytecode` | `string` | **Description**

The bytecode of the circuit | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md deleted file mode 100644 index 812b8b16481..00000000000 --- a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md +++ /dev/null @@ -1,24 +0,0 @@ -# ForeignCallHandler - -```ts -type ForeignCallHandler: (name, inputs) => Promise; -``` - -A callback which performs an foreign call and returns the response. - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `name` | `string` | The identifier for the type of foreign call being performed. | -| `inputs` | [`ForeignCallInput`](ForeignCallInput.md)[] | An array of hex encoded inputs to the foreign call. | - -## Returns - -`Promise`\<[`ForeignCallOutput`](ForeignCallOutput.md)[]\> - -outputs - An array of hex encoded outputs containing the results of the foreign call. - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md deleted file mode 100644 index dd95809186a..00000000000 --- a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md +++ /dev/null @@ -1,9 +0,0 @@ -# ForeignCallInput - -```ts -type ForeignCallInput: string[]; -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md b/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md deleted file mode 100644 index b71fb78a946..00000000000 --- a/docs/docs/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md +++ /dev/null @@ -1,9 +0,0 @@ -# ForeignCallOutput - -```ts -type ForeignCallOutput: string | string[]; -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/ProofData.md b/docs/docs/noir_js/reference/noir_js/type-aliases/ProofData.md deleted file mode 100644 index 4aeff73d3e4..00000000000 --- a/docs/docs/noir_js/reference/noir_js/type-aliases/ProofData.md +++ /dev/null @@ -1,20 +0,0 @@ -# ProofData - -```ts -type ProofData: object; -``` - -## Description - -The representation of a proof - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | -| `publicInputs` | `Uint8Array`[] | **Description**

Public inputs of a proof | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/type-aliases/WitnessMap.md b/docs/docs/noir_js/reference/noir_js/type-aliases/WitnessMap.md deleted file mode 100644 index 258c46f9d0c..00000000000 --- a/docs/docs/noir_js/reference/noir_js/type-aliases/WitnessMap.md +++ /dev/null @@ -1,9 +0,0 @@ -# WitnessMap - -```ts -type WitnessMap: Map; -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/docs/noir_js/reference/noir_js/typedoc-sidebar.cjs b/docs/docs/noir_js/reference/noir_js/typedoc-sidebar.cjs deleted file mode 100644 index c18318850d0..00000000000 --- a/docs/docs/noir_js/reference/noir_js/typedoc-sidebar.cjs +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-check -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"noir_js/reference/noir_js/classes/Noir","label":"Noir"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallHandler","label":"ForeignCallHandler"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallInput","label":"ForeignCallInput"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallOutput","label":"ForeignCallOutput"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ProofData","label":"ProofData"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/WitnessMap","label":"WitnessMap"}]},{"type":"category","label":"Functions","items":[{"type":"doc","id":"noir_js/reference/noir_js/functions/and","label":"and"},{"type":"doc","id":"noir_js/reference/noir_js/functions/blake2s256","label":"blake2s256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify","label":"ecdsa_secp256k1_verify"},{"type":"doc","id":"noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify","label":"ecdsa_secp256r1_verify"},{"type":"doc","id":"noir_js/reference/noir_js/functions/keccak256","label":"keccak256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/sha256","label":"sha256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/xor","label":"xor"}]}]}; -module.exports = typedocSidebar.items; \ No newline at end of file From 17fa7bae497854b73686878e99513cb7992d0fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Sun, 29 Oct 2023 23:17:21 +0000 Subject: [PATCH 05/10] chore(docs): finishing up --- tooling/noir_js_backend_barretenberg/src/index.ts | 3 --- tooling/noir_js_types/src/types.ts | 3 --- 2 files changed, 6 deletions(-) diff --git a/tooling/noir_js_backend_barretenberg/src/index.ts b/tooling/noir_js_backend_barretenberg/src/index.ts index 8063d351d2d..2e5a44ae8d2 100644 --- a/tooling/noir_js_backend_barretenberg/src/index.ts +++ b/tooling/noir_js_backend_barretenberg/src/index.ts @@ -48,7 +48,6 @@ export class BarretenbergBackend implements Backend { // // The settings for this proof are the same as the settings for a "normal" proof // ie one that is not in the recursive setting. - /** @ignore */ async generateFinalProof(decompressedWitness: Uint8Array): Promise { const makeEasyToVerifyInCircuit = false; return this.generateProof(decompressedWitness, makeEasyToVerifyInCircuit); @@ -148,7 +147,6 @@ export class BarretenbergBackend implements Backend { }; } - /** @ignore */ async verifyFinalProof(proofData: ProofData): Promise { const proof = reconstructProofWithPublicInputs(proofData); const makeEasyToVerifyInCircuit = false; @@ -176,7 +174,6 @@ export class BarretenbergBackend implements Backend { return await this.api.acirVerifyProof(this.acirComposer, proof, makeEasyToVerifyInCircuit); } - /** @ignore */ async destroy(): Promise { if (!this.api) { return; diff --git a/tooling/noir_js_types/src/types.ts b/tooling/noir_js_types/src/types.ts index c150803939f..5ed6b1721e9 100644 --- a/tooling/noir_js_types/src/types.ts +++ b/tooling/noir_js_types/src/types.ts @@ -2,7 +2,6 @@ import { Abi } from '@noir-lang/noirc_abi'; export interface Backend { /** - * @ignore * @description Generates a final proof (not meant to be verified in another circuit) */ generateFinalProof(decompressedWitness: Uint8Array): Promise; @@ -27,7 +26,6 @@ export interface Backend { }>; /** - * @ignore * @description Verifies a final proof */ verifyFinalProof(proofData: ProofData): Promise; @@ -35,7 +33,6 @@ export interface Backend { verifyIntermediateProof(proofData: ProofData): Promise; /** - * @ignore * @description Destroys the backend */ destroy(): Promise; } From 57493e5d110e9bb9498d013d960e38238daf1e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Fri, 3 Nov 2023 12:26:29 +0000 Subject: [PATCH 06/10] adding other builds --- .github/workflows/build-docs.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index cdebb2b8bcc..158eff52112 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -66,7 +66,9 @@ jobs: run: yarn - name: Build docs - run: yarn workspace docs build + run: | + yarn workspaces foreach -pt --from '{@noir-lang/types, @noir-lang/backend_barretenberg, @noir-lang/noir_js, @noir-lang/acvm_js, @noir-lang/noirc_abi}' run build + yarn workspace docs build - name: Remove pre-releases working-directory: docs From 6b9013ef86d12baa3715b13291186fed4bd65a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Fri, 3 Nov 2023 12:32:22 +0000 Subject: [PATCH 07/10] adding wasm builds --- .github/workflows/build-docs.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 158eff52112..1628efe7d14 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -62,6 +62,18 @@ jobs: with: node-version: '18' + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build wasm packages + run: | + nix build -L .#noirc_abi_wasm + nix build -L .#acvm_js + - name: Install dependencies run: yarn From 91b859a0350e487ead845022d60b6f76ffc8edcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Fri, 3 Nov 2023 12:57:11 +0000 Subject: [PATCH 08/10] adding wasm builds --- .github/workflows/build-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 1628efe7d14..b6ace28dbeb 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -79,7 +79,7 @@ jobs: - name: Build docs run: | - yarn workspaces foreach -pt --from '{@noir-lang/types, @noir-lang/backend_barretenberg, @noir-lang/noir_js, @noir-lang/acvm_js, @noir-lang/noirc_abi}' run build + yarn workspaces foreach -pt --from '{@noir-lang/types, @noir-lang/backend_barretenberg, @noir-lang/noir_js}' run build yarn workspace docs build - name: Remove pre-releases From 3cba52476a65ea740926863fb862e103cd1ec1c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Fri, 3 Nov 2023 13:08:13 +0000 Subject: [PATCH 09/10] adding wasm builds --- .github/workflows/build-docs.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index b6ace28dbeb..cc653396fcc 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -77,10 +77,9 @@ jobs: - name: Install dependencies run: yarn - - name: Build docs + - name: Build run: | - yarn workspaces foreach -pt --from '{@noir-lang/types, @noir-lang/backend_barretenberg, @noir-lang/noir_js}' run build - yarn workspace docs build + yarn build - name: Remove pre-releases working-directory: docs From eca492c238d37c5a935069570079e983b39ef9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Fri, 3 Nov 2023 13:19:39 +0000 Subject: [PATCH 10/10] adding wasm builds --- .github/workflows/build-docs.yml | 35 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index cc653396fcc..11c2bd89a8d 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -62,24 +62,37 @@ jobs: with: node-version: '18' - - name: Setup Nix - uses: ./.github/actions/nix + - name: Install wasm-bindgen-cli + uses: taiki-e/install-action@v2 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: "noir" - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + tool: wasm-bindgen-cli@0.2.86 - - name: Build wasm packages + - name: Install wasm-opt run: | - nix build -L .#noirc_abi_wasm - nix build -L .#acvm_js + npm i wasm-opt -g - name: Install dependencies run: yarn - - - name: Build + + - name: Build acvm_js + run: yarn workspace @noir-lang/acvm_js build + + - name: Build noirc_abi + run: yarn workspace @noir-lang/noirc_abi build + + - name: Build noir_js_types + run: yarn workspace @noir-lang/types build + + - name: Build barretenberg wrapper + run: yarn workspace @noir-lang/backend_barretenberg build + + - name: Run noir_js run: | - yarn build + yarn workspace @noir-lang/noir_js build + + - name: Build docs + run: + yarn workspace docs build - name: Remove pre-releases working-directory: docs