e.allow() or e.reveal() can be used in decryption.
Getting Started
Take this example contract:Basic Decryption
Here’s how to decrypt a handle using a wallet client:Understanding Reencryption vs Decryption
When using attested decrypt, you have two main options:- Decryption: Returns the plaintext value directly (as shown in the Basic Decryption examples above)
- Reencryption: Instead of returning plaintext, the decrypted value is re-encrypted with a different public key. This allows you to share decrypted data with third parties (delegates) without exposing the plaintext, or to decrypt it locally using your own keypair.
Reencryption for Delegates
You can request that the decryption be reencrypted for a delegate using their public key. This returns an encrypted decryption attestation that only the delegate can decrypt:Reencrypt and Decrypt Locally
You can also request reencryption and decrypt it immediately using a keypair you control:Session Key Decryption
For applications that need to perform decryption without requiring the user to sign each request, you can use session keys with allowance vouchers:XwingKeypair separately for this: