Use this file to discover all available pages before exploring further.
Privora provides a type-safe system for working with encrypted values. This prevents common errors like mixing different integer sizes or confusing references with loaded values.
A 32-byte hash reference to encrypted data stored in the content-addressable store.
use privora_sdk_program::prelude::*;// Create from a hash (e.g., from instruction data)let price_ref = EncryptedRef::<u8>::from_hash(hash_bytes);// EncryptedRef is only 32 bytes - perfect for on-chain storage#[derive(BorshSerialize, BorshDeserialize)]pub struct Order { pub price_ref: EncryptedRef<u8>, // 32 bytes pub qty_ref: EncryptedRef<u8>, // 32 bytes}
Key Properties:
Size: Always 32 bytes (SHA256 hash)
Borsh serializable for account storage
Type parameter T indicates the encrypted integer type
A loaded encrypted value ready for FHE computation.
// Load from referencelet price: Encrypted<u8> = price_ref.load()?;// Perform operationslet doubled = &price + &price;let is_high: EncryptedBool = price.ge(&threshold)?;// Store back to get a new referencelet result_ref: EncryptedRef<u8> = doubled.store()?;
Key Properties:
Contains actual ciphertext data (10KB-100KB)
Supports arithmetic and comparison operations
Created by loading from EncryptedRef or as result of operations
Must be stored back to get a reference for account storage
The result of comparison operations on encrypted values.
// Created from comparisonslet can_match: EncryptedBool = buy_price.ge(&sell_price)?;let is_equal: EncryptedBool = value_a.eq_enc(&value_b)?;// Used for conditional selectionlet fill_price = can_match.select(&sell_price, &buy_price)?;// Can be stored if neededlet bool_ref: EncryptedBoolRef = can_match.store()?;
Key Properties:
Result of comparison operations (ge, gt, le, lt, eq_enc)
Used with select() for conditional logic
Can be stored and loaded like other encrypted values
// Must store to get a referencelet result: Encrypted<u8> = a.add(&b)?;account.result_ref = result; // ERROR: expected EncryptedRef<u8>// Correct:let result: Encrypted<u8> = a.add(&b)?;account.result_ref = result.store()?; // OK