API Reference
Complete API reference for the Privacy Boost TypeScript SDK.Generated Documentation
Full API documentation can be generated using TypeDoc:- All exported types and interfaces
- JSDoc comments and examples
- Type signatures and inheritance
PrivacyBoost
Main SDK class.PrivacyBoost.create(config)
Creates and initializes a new SDK instance.
| Name | Type | Description |
|---|---|---|
config.appId | string | Application identifier |
config.indexerUrl | string | Indexer service URL |
config.chainId | number | (Optional) EVM chain ID (auto-discovered from indexer) |
config.shieldContract | string | (Optional) Shield contract address (auto-discovered from indexer) |
config.wethContract | string | (Optional) WETH contract address |
sdk.auth
Authentication resource.auth.authenticate(adapter, options?)
Connect a wallet, derive privacy keys, and authenticate with the server in a single call.
| Name | Type | Description |
|---|---|---|
adapter | WalletAdapter | Wallet adapter implementation |
options | AuthenticateOptions | (Optional) Options object with keySource and tokenProvider |
options.keySource | KeySource | (Optional) Key derivation source. Defaults to walletDerived when no persistence is configured. |
options.tokenProvider | function | (Optional) Callback to obtain a JWT from the login payload |
AuthResult - either { status: 'authenticated', privacyAddress, mpk } or { status: 'credentialRequired', action, unlockType, submit }. If credential is required, call result.submit(credential) to complete authentication.
auth.logout()
End session completely, clear all state.
auth.clearSession()
Clear JWT only, keep keys for quick re-auth.
auth.isConnected()
Check if wallet is connected.
auth.isAuthenticated()
Check if user is authenticated.
auth.getPrivacyAddress()
Get user’s privacy address.
auth.getMpk()
Get user’s master public key.
sdk.vault
Vault resource for privacy operations.vault.shield(params)
Deposit tokens to private balance.
vault.unshield(params)
Withdraw tokens to public address.
vault.send(params)
Send private transfer.
vault.getBalance(tokenAddress)
Get shielded balance for a token.
vault.getAllBalances()
Get all token balances.
vault.syncBalance(tokenAddress)
Sync balance from indexer.
vault.syncAllBalances()
Sync all balances from indexer.
vault.getToken(address)
Get token metadata.
vault.getSupportedTokens()
Get list of supported tokens.
vault.parseAmount(tokenAddress, amount)
Parse string amount to bigint.
vault.formatAmount(amount, decimals)
Format bigint to string.
sdk.transactions
Transactions resource.transactions.fetchHistory(params?)
Get transaction history.
Utility Functions
isValidPrivacyAddress(address)
Check if address is valid privacy address.
validatePrivacyAddress(address)
Validate a privacy address.
encodePrivacyAddress(mpk, viewingPublicKey)
Encode MPK and viewing public key to privacy address.
decodePrivacyAddress(address)
Decode privacy address to components.
extractMpkFromPrivacyAddress(address)
Extract MPK from privacy address.
isEvmAddress(address)
Check if valid EVM address.
isNativeEth(address)
Check if address represents native ETH.
Types
KeySource
Key derivation source, passed to authenticate().
| Variant | Description |
|---|---|
walletDerived | Derive keys from a wallet signature (default when no persistence is configured) |
mnemonic | Derive keys from a BIP-39 mnemonic phrase |
rawSeed | Derive keys from a raw 32-byte hex seed |