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

Tutorial on how to encrypt events #275

Open
CedarMist opened this issue Feb 15, 2024 · 0 comments
Open

Tutorial on how to encrypt events #275

CedarMist opened this issue Feb 15, 2024 · 0 comments

Comments

@CedarMist
Copy link
Member

SUMMARY

Information in events is public, however developers may want the contract to output information which is only readable by whoever submitted the transaction.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

Documentation

ADDITIONAL INFORMATION

Currently the deoxysii-js and related DeoxysII packages can be used to decrypt data which was encrypted using Sapphire.encrypt

In the contract you can do:

  • bytes32 nonce = bytes32(Sapphire.randomBytes(32,""));
  • bytes ciphertext = Sapphire.encrypt(key, nonce, abi.encode(...))
  • emit Event(nonce, ciphertext)

If the transaction is encrypted the user can pass the encryption key to the contract, or the encryption key can be derived in some other way.

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

No branches or pull requests

1 participant