API Reference
Complete API reference for the Privacy Boost React Native SDK (version0.2.14). Everything below is derived from the generated UniFFI bindings —
signatures match what consumers actually see.
Module exports
buildShieldPayload
and finalizeShield.
PrivacyBoost
Main SDK class. One instance per app; hold it in a module-level ref or a context provider.Constructor
SdkError.ConfigError if initialization fails, including
unsupported persistence storage or passkey unlock configuration.
State
Authentication
AuthResult tagged union — see AuthResult for all
variants and handling.
CredentialRequired.
MnemonicGenerated (first-time
user). Call this after the user confirms they’ve saved the recovery phrase.
Operations
unwrapWeth unwraps WETH the user already holds in their wallet back to
native ETH — it does not interact with the shielded pool.
prepareShield builds a deposit payload without submitting it — for callers
that relay the transaction themselves (a gasless relayer, an EIP-7702 session
key, or a plain raw transaction). It returns the calldata to relay plus the note
commitment; nothing is sent on-chain. Pass undefined for recipient to shield
to yourself, or a privacy address to shield to someone else. After relaying, pass
the mined receipt to the top-level finalizeShield
to recover the on-chain request id.
Status polling
Balances & tokens
History & notes
Merkle tree
Audit APIs
For auditable operations — returns all-party visible data, not just the calling user’s. Intended for compliance dashboards and regulators, not for end-user UIs.App metadata
Session persistence
Identity lookup
Pending transactions
Local bookkeeping for optimistic UI — not persisted across SDK instances.Chain context
Create a handle scoped to a different chain while sharing the same SDK identity.Utilities
ChainContextHandle
Returned bysdk.createChainContext(). Mirrors the main SDK’s chain-scoped
operations against a different chain, without requiring a second
authentication.
Stateless shield helpers
Top-level named exports for building a deposit payload without a signed-in session — for a backend that holds only a recipient’s privacy address. No wallet, no private keys.buildShieldPayload builds a recipient-targeted deposit payload from public
material only. Resolve tokenId, shieldContractAddress, and teePublicKey
from the token catalog / config. An ephemeral sender keypair is generated and
discarded internally, and the note is spendable only by recipient.
wethContractAddress is required only when shielding native ETH;
minShieldAmount (per-token minimum in wei) rejects below-minimum deposits;
emitApprove emits the ERC-20 approve call (pass true by default).
finalizeShield recovers the on-chain shield request id from the mined receipt
of a relayed deposit. Stateless — the caller obtained the receipt from its own
relay/RPC. Throws if the deposit reverted or the DepositRequested log is
absent. The TransactionReceipt is the same shape returned by
WalletDelegate.waitForTransactionReceipt (see WalletDelegate).
Delegate interfaces
WalletDelegate
TokenProvider
Types
PrivacyBoostConfig
persistenceStorage and persistenceUnlock unset until native persistence
is wired through this package.
ChainContextConfig
KeySource
Tagged union — each variant is constructable.StorageBackend
UnlockMethod
Passkey is rejected on React Native because iOS and Android do not expose the
WebAuthn PRF extension needed for reproducible vault unlock keys.
AuthResult
Tagged union returned byauthenticate(). You must handle all four variants.
LoginResult
ShieldResult
finalizeShield also returns a ShieldResult.
Call / PreparedShield
Returned byprepareShield and buildShieldPayload. Each Call is a single
on-chain call to relay; value and data are 0x-hex.
UnshieldResult / TransferResult
ShieldStatus / TransactionStatus
TokenBalance
RegisteredToken
FeeRates
Transaction / TransactionNote / TransactionsResult
UnspentNote
MerkleTreeStats
Audit result types
PendingTransaction
ExportedSession
data is an opaque serialized core session. Store and pass it back unchanged;
do not parse or persist individual key fields.
IdentityResult
AppInfoEntry
SdkError
Tagged union. Every variant is a constructable class, checked via.instanceOf(err). See the Error Handling guide
for patterns and the full variant table.
SdkError_Tags:
Gift Methods
Claimable transfers (gifts) — instance methods onsdk, taking positional
arguments. See the
Claimable Transfers guide and the
concept page.
Preview feature — pending external audit, and enabled per deployment. These
methods may not be present in the checked-in generated bindings.
TransferResult whose giftRecord and
claimLink fields are populated for gift operations.
amount is wei; refundAfterBlock/currentBlock are block
numbers. Returns a TransferResult with claimLink and giftRecord populated.
getPendingGifts().
acknowledgeUnknownSender must be true — it acknowledges accepting funds from
an unknown sender.
cGift (preferred when the list
may shift as gifts settle).
pbgift:v1:... claim link, without a server lookup
first.
index
is the positional index into getGiftRecords().
A third funding mode,
giftFundSecretBearer, binds a gift to a secret instead
of a wallet. It is experimental, disabled by default, and a bearer
instrument (whoever holds the link can claim). See the
concept page before considering it.GiftRecord
PendingGift
GiftLinkPreview
giftRecord, claimLink) on TransferResult are populated only
for gift operations; see UnshieldResult / TransferResult.
Portal
Portal deposit addresses. See the Portal Deposits guide and the concept page.Preview feature — pending external audit, and enabled per deployment. React
Native exposes portal lifecycle methods on
PrivacyBoost. Low-level portal
functions are limited to custodial escape hatches.sdk.createPortal(...), which derives the portal EOA from
the account seed and keeps the key inside core.
E, gaslessly delegate and register it via the server relays, then
publish the discovery entry. Omit index to use the next free derivation index.
portal.
requestPortalDeposit from the connected wallet and return the transaction
hash.
cancelPortalDeposit from the connected wallet and return the transaction
hash.
E. Broadcast the returned raw transaction yourself.
Low-level escape hatches
These module-level functions are imported from@sunnyside-io/privacy-boost-react-native and are for custodial integrations
that manage their own portal EOA key. The seed-derived createPortal flow does
not expose a private key.
E and its secret private key.
E → blind) — the supported submit path so
the indexer can credit deposits to the right account.
/info, or
undefined if the server does not support portals.