The proveOffChain
method generates an off-chain proof for a ZPass credential, executing the program locally without submitting to the blockchain. The program can be both deployed on-chain or a local program that is not deployed on-chain but is provided and agreed upon by all the involved parties (issuer, user, verifier).
options
(ProveOffChainOptions): An object containing:localProgram
(string): The Aleo program source codefunctionName
(string): Name of the function to executeinputs
(string[]): Array of input parameters for the functionofflineQuery
(OfflineQuery, optional): An optional offline query object used to insert the global state root and state paths needed to create a valid inclusion proof offline.
Returns a Promise that resolves to an object containing:
outputs
(string[]): Array of function outputsexecution
(string): The execution traceverifyingKey
(string): The verifying key for the proof
const { outputs, execution, verifyingKey } = await zpass.proveOffChain({
localProgram: programSource,
functionName: functionName,
inputs: [signature, `{
issuer: ${issuer},
subject: ${subject},
dob: ${dob},
nationality: ${nationality},
expiry: ${expiry}
}`,
`{ salt: ${salt} }`,
],
});