Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zk-sdk] Expose ElGamal and authenticated encryption ciphertext types for wasm target #4171

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

samkim-crypto
Copy link

@samkim-crypto samkim-crypto commented Dec 19, 2024

Problem

The ElGamal and authenticated encryption types are not yet exported for wasm target build.

Summary of Changes

I exported the ElGamal and authenticated encryption types for wasm target in a sequence of steps.

fb298c9: I first added the zeroed() function for the PodElGamalPubkey. Default values for types are useful when initializing types like mint or account in typescript. I first tried exporting default(), but there did not seem to be a clean way to do it without manually implementing the Default trait.

b6f4fff: The JS logic for PodElGamalCiphertext and PodAeCiphertext are very similar to that of PodElGamalPubkey, so I made a macro for the JS logic.

36adba2: I exported the ElGamalCiphertext related types for wasm. I am just exporting the types for now. I will deter exporting encryption or decryption in subsequent PRs as they are not needed to generate the instruction data for the majority of confidential transfer instructions.

0ebd97e: I exported the AeCiphertext and AeKey related types and functions for wasm. Here, I did include the encryption function since we will need the encryption of 0 to properly configure account data.

bda4976: In TS, camelCase is standard while in rust snake_case is standard. Previously, I just exported out the new_rand() function as is, but I figured out a way to specify js_name, so I updated the names to newRand().

Fixes #

@samkim-crypto samkim-crypto marked this pull request as ready for review December 19, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant