Types
The Inco Lightning SDK provides encrypted types that serve as handles to encrypted values stored off-chain by the covalidator network.Euint128
Handle to an encrypted unsigned 128-bit integer.Euint128 type represents a reference to an encrypted value, not the encrypted data itself. The actual encrypted data is stored and processed by the covalidator network.
Ebool
Handle to an encrypted boolean value.Storing Handles
Handles are 16 bytes and can be stored directly in your account structs:Handles are deterministically derived from operations, so the same operation with the same inputs always produces the same handle.
Input Functions
Create encrypted values from client-encrypted ciphertext or plaintext.| Function | Description | Signature |
|---|---|---|
new_euint128 | Create encrypted u128 from ciphertext | (CpiContext, Vec<u8>, u8) -> Result<Euint128> |
new_ebool | Create encrypted bool from ciphertext | (CpiContext, Vec<u8>, u8) -> Result<Ebool> |
as_euint128 | Convert plaintext u128 to encrypted handle | (CpiContext, u128) -> Result<Euint128> |
as_ebool | Convert plaintext bool to encrypted handle | (CpiContext, bool) -> Result<Ebool> |
Example: Creating encrypted values
The last parameter in input and operation calls identifies whether the left-hand side operand is ciphertext (
0) or plaintext (1). Always pass 0 when working with encrypted handles.