Documentation Index
Fetch the complete documentation index at: https://docs.privora.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Main TypeScript SDK class.
import { Privora } from '@privora/sdk';
const privora = await Privora.connect('http://localhost:8899');
Static Methods
connect
static async connect(url: string): Promise<Privora>
Connect to sequencer and fetch public key.
withoutKey
static withoutKey(url: string): Privora
Create without fetching key.
Properties
connection
get connection(): Connection
Underlying Solana Connection.
Methods
encrypt
encrypt<T extends EncryptedType>(value: number, type: T): PendingEncrypted<T>
Encrypt a value.
encryptBatch
encryptBatch<T extends EncryptedType>(
inputs: Array<{ value: number; type: T }>
): Array<PendingEncrypted<T>>
submit
async submit<T extends EncryptedType>(
encrypted: Encrypted<T> | PendingEncrypted<T>
): Promise<string>
Submit encrypted data, return hash.
submitBatch
async submitBatch<T extends EncryptedType>(
encrypted: Array<Encrypted<T> | PendingEncrypted<T>>
): Promise<string[]>
getFheData
async getFheData(hash: string): Promise<Uint8Array>
userCrypto
userCrypto(keypair: Keypair): UserCrypto
transaction
transaction(): TransactionBuilder
getLatestBlockhash
async getLatestBlockhash(): Promise<{ blockhash: string; lastValidBlockHeight: number }>
getBalance
async getBalance(pubkey: PublicKey | string): Promise<number>
requestAirdrop
async requestAirdrop(pubkey: PublicKey | string, lamports: number): Promise<string>
getMinimumBalanceForRentExemption
async getMinimumBalanceForRentExemption(dataLength: number): Promise<number>
FheEncryptor
Low-level FHE encryption class. Usually accessed via Privora.encrypt().
import { FheEncryptor } from '@privora/sdk';
Methods
class FheEncryptor {
encrypt<T extends EncryptedType>(value: number, type: T): PendingEncrypted<T>;
encryptBatch<T extends EncryptedType>(
inputs: Array<{ value: number; type: T }>
): Array<PendingEncrypted<T>>;
}
RpcClient
Low-level RPC client for sequencer communication.
import { RpcClient } from '@privora/sdk';
Methods
class RpcClient {
constructor(url: string);
async submitFheData(data: Uint8Array): Promise<string>;
async getFheData(hash: string): Promise<Uint8Array>;
async getPublicKey(): Promise<Uint8Array>;
async sendTransaction(
transaction: Transaction,
config?: SendTransactionConfig
): Promise<string>;
}
SignedTransactionSender
Helper for sending pre-signed transactions.
import { SignedTransactionSender } from '@privora/sdk';
Methods
class SignedTransactionSender {
constructor(rpcClient: RpcClient, transaction: Transaction, fheHashes: string[]);
async send(config?: SendTransactionConfig): Promise<string>;
}
Encoding Utilities
Helper functions for encoding/decoding data.
import {
toBase64,
fromBase64,
toHex,
fromHex,
toBs58,
fromBs58
} from '@privora/sdk';
toBase64
function toBase64(data: Uint8Array): string
Convert bytes to base64 string.
fromBase64
function fromBase64(data: string): Uint8Array
Convert base64 string to bytes.
toHex
function toHex(data: Uint8Array): string
Convert bytes to hex string.
fromHex
function fromHex(data: string): Uint8Array
Convert hex string to bytes.
toBs58
function toBs58(data: Uint8Array): string
Convert bytes to base58 string.
fromBs58
function fromBs58(data: string): Uint8Array
Convert base58 string to bytes.
Account Helpers
Utilities for creating Solana accounts.
import {
buildCreateAccountInstruction,
createAccountWithRent,
deriveKeypairFromSignature
} from '@privora/sdk';
buildCreateAccountInstruction
function buildCreateAccountInstruction(
params: BuildCreateAccountInstructionParams
): TransactionInstruction
Build a create account instruction.
createAccountWithRent
async function createAccountWithRent(
params: CreateAccountParams
): Promise<TransactionInstruction>
Create an account instruction with automatic rent calculation.
deriveKeypairFromSignature
function deriveKeypairFromSignature(signature: Uint8Array): Keypair
Derive a deterministic keypair from a wallet signature. Used to create consistent user encryption keys from wallet signatures.
// Example: derive keypair from wallet signature
const message = new TextEncoder().encode('Sign to derive Privora encryption keys');
const signature = await wallet.signMessage(message);
const userKeypair = deriveKeypairFromSignature(signature);