Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 1.99 KB

generateProof.md

File metadata and controls

65 lines (51 loc) · 1.99 KB

generateProof Function

The generateProof function is a direct method for generating Pluto proofs programmatically from a manifest object. It provides a straightforward way to generate proofs without using the React components.

Note: This function is part of the @plutoxyz/react-native-sdk package.

TypeScript Definition

function generateProof(manifest: ManifestFile): Promise<string>;

For detailed type definitions of ManifestFile and related types, see the Types Reference.

Usage

Basic Usage

import { generateProof } from "@plutoxyz/react-native-sdk";

const generateMyProof = async () => {
  try {
    const manifest = {
      manifestVersion: "1.0.0",
      id: "example-manifest",
      title: "Example Manifest",
      description: "An example manifest for proof generation",
      mode: "TEE",
      request: {
        method: "GET",
        url: "https://api.example.com/data",
        headers: {
          "Content-Type": "application/json",
        },
        body: null,
      },
      response: {
        status: "200",
        headers: {
          "Content-Type": "application/json",
        },
        body: {
          json: ["example-data"],
        },
      },
    };

    const proof = await generateProof(manifest);
    console.log("Proof generated:", proof);
  } catch (error) {
    console.error("Error generating proof:", error);
  }
};

Parameters

Parameter Type Required Description
manifest ManifestFile Yes The manifest object containing the request and response data for proof generation

Return Value

The function returns a Promise<string> that resolves to the generated proof string.