Skip to main content
Types and functions for FHE decryption authorization.

DecryptionAuth

use privora_sdk_program::auth::pda::DecryptionAuth;

find_pda

pub fn find_pda(data_hash: &[u8; 32], user: &Pubkey) -> (Pubkey, u8)
Find the decryption authorization PDA. Seeds: ["decrypt_auth", data_hash, user_pubkey]

find_pda_for_ref

pub fn find_pda_for_ref<T: EncryptedInt>(
    encrypted_ref: &EncryptedRef<T>,
    user: &Pubkey,
) -> (Pubkey, u8)
Find PDA using an EncryptedRef.

derive_pda

pub fn derive_pda(data_hash: &[u8; 32], user: &Pubkey, bump: u8) -> Option<Pubkey>
Derive PDA with known bump.

MatchAuth

use privora_sdk_program::auth::pda::MatchAuth;

find_pda

pub fn find_pda(
    order_id_a: u64,
    order_id_b: u64,
    field: &str,
    user: &Pubkey,
) -> (Pubkey, u8)
Find match authorization PDA. Seeds: ["match_auth", order_id_a, order_id_b, field, user_pubkey]

DecryptedResult

use privora_sdk_program::auth::pda::DecryptedResult;

find_pda

pub fn find_pda(data_hash: &[u8; 32], user: &Pubkey) -> (Pubkey, u8)
Find decrypted result storage PDA.

CPI Functions

use privora_sdk_program::auth::cpi::*;

create_decryption_auth

pub fn create_decryption_auth(
    fhe_auth_program: &AccountInfo,
    auth_pda: &AccountInfo,
    data_hash: &[u8; 32],
    user: &Pubkey,
    payer: &AccountInfo,
    system_program: &AccountInfo,
) -> ProgramResult
Create a decryption authorization PDA via CPI.

request_decryption

pub fn request_decryption(
    data_hash: &[u8; 32],
    user: &Pubkey,
    auth_pda: &AccountInfo,
) -> Result<Vec<u8>, ProgramError>
Request decryption of authorized data.

Constants

pub const FHE_AUTH_PROGRAM_ID: Pubkey =
    solana_pubkey::pubkey!("FheAuth111111111111111111111111111111111111");