encryptInputs with improved API#24
Conversation
| import { CofhejsError, CofhejsErrorCode } from "../../types"; | ||
| import { ZkPackProveVerify } from "./zkPackProveVerify"; | ||
|
|
||
| export class EncryptInputsBuilder<T extends any[]> { |
There was a problem hiding this comment.
This class is responsible for the updated functionality. The types of the inputs are inferred from the parameters, and the types of the outputs are inferred from the inputs.
Ex:
call: cofhejs.encryptInputs([Encryptable.bool(true)])
input types: [EncryptableBool]
output types: [CofheInBool]
The other input parameters (sender / chainId / zk) are provided in the body of cofhejs.encryptInputs. The sender / chainId are pulled from the store, and the zk is created in the multiple entrypoints (in node the zk package uses the tfhe-node builder, and in web it uses the tfhe builder)
| * .encrypt(); | ||
| * ``` | ||
| */ | ||
| export function encryptInputs<T extends any[]>( |
There was a problem hiding this comment.
This is the function that gets exposed as cofhejs.encryptInputs. The state variables are injected here, along with a node specific zkPackProveVerify implementation
| console.log(`Log Encrypt State :: ${state}`); | ||
| }; | ||
|
|
||
| const nestedEncrypt = await cofhejs |
There was a problem hiding this comment.
Tested working implementation against arb-sepolia.
|
Remaining:
|
|
@tovi-fhe ready for a look. |
Refactored encrypt function named
encryptInputBreaks apart the encrypt inputs and options to improve the api. Also introduces the ability to override the sender embedded in the encrypted inputs.
New api: