
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@deserialize/privacero
Advanced tools
This is the SDK for Privacy Cash. It has been audited by Zigtur (https://x.com/zigtur).
This is the SDK for Privacy Cash. It has been audited by Zigtur (https://x.com/zigtur).
This SDK powers Privacy Cash's frontend, assuming the single wallet use case. If you use it or published npm library from this repo, please fully test and beware of the inherent software risks or potential bugs.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This SDK provides APIs for developers to interact with Privacy Cash relayers easily. Developers can easily deposit/withdraw/query balances in Privacy Cash solana program.
For SOL:
deposit() - Deposit SOL into Privacy Cashwithdraw() - Withdraw SOL from Privacy CashgetPrivateBalance() - Query private SOL balanceFor SPL Tokens (USDC, USDT):
depositSPL() / depositUSDC() - Deposit SPL tokenswithdrawSPL() / withdrawUSDC() - Withdraw SPL tokensgetPrivateBalanceSpl() - Query private SPL token balanceRequirements:
Check the example project under /example folder for complete implementation examples.
The SDK now supports unsigned transaction generation, enabling secure backend implementations without exposing private keys. This architecture separates transaction generation from signing, allowing you to:
Traditional approach where SDK signs transactions automatically:
import { PrivacyCash } from 'privacycash';
const client = new PrivacyCash({
RPC_url: 'https://api.mainnet-beta.solana.com',
owner: 'your-private-key-base58',
});
// Deposit (signs and submits automatically)
const result = await client.deposit({
lamports: 10000000, // 0.01 SOL
});
console.log('Transaction:', result.tx);
Secure approach for backend-frontend architectures:
// ============================================
// BACKEND: Generate unsigned transaction
// ============================================
import { PrivacyCash } from 'privacycash';
const backend = new PrivacyCash({
RPC_url: process.env.RPC_URL,
owner: userPublicKey, // Only public key needed!
});
// Generate unsigned transaction
const result = await backend.deposit({
lamports: 10000000, // 0.01 SOL
returnUnsigned: true, // ← Key parameter
});
if ('unsignedTransaction' in result) {
// Serialize for transfer to frontend
const txData = {
transaction: Buffer.from(result.unsignedTransaction.serialize()).toString('base64'),
metadata: {
encryptedOutput1: result.metadata.encryptedOutput1.toString('base64'),
publicKey: result.metadata.publicKey.toString(),
referrer: result.metadata.referrer,
},
};
// Send to frontend
return res.json(txData);
}
// ============================================
// FRONTEND: Sign with wallet
// ============================================
import { VersionedTransaction } from '@solana/web3.js';
// Receive unsigned transaction from backend
const { transaction, metadata } = await fetch('/api/generate-deposit').then(r => r.json());
// Deserialize transaction
const tx = VersionedTransaction.deserialize(
Buffer.from(transaction, 'base64')
);
// Sign with user's wallet (Phantom, Solflare, etc.)
const signedTx = await wallet.signTransaction(tx);
// Send back to backend
await fetch('/api/submit-deposit', {
method: 'POST',
body: JSON.stringify({
signedTransaction: Buffer.from(signedTx.serialize()).toString('base64'),
metadata,
}),
});
// ============================================
// BACKEND: Submit signed transaction
// ============================================
import { VersionedTransaction } from '@solana/web3.js';
// Deserialize signed transaction
const signedTx = VersionedTransaction.deserialize(
Buffer.from(req.body.signedTransaction, 'base64')
);
// Deserialize metadata
const metadata = {
encryptedOutput1: Buffer.from(req.body.metadata.encryptedOutput1, 'base64'),
publicKey: new PublicKey(req.body.metadata.publicKey),
referrer: req.body.metadata.referrer,
};
// Submit to relayer
const finalResult = await backend.submitSignedDeposit(signedTx, metadata);
console.log('Transaction confirmed:', finalResult.tx);
console.log('Explorer:', `https://solscan.io/tx/${finalResult.tx}`);
deposit(options)
lamports: number - Amount in lamports (1 SOL = 1,000,000,000 lamports)returnUnsigned?: boolean - If true, returns unsigned transactionPromise<UnsignedDepositResult | SignedDepositResult>// Automatic signing (default)
const result = await client.deposit({ lamports: 10000000 });
// Unsigned transaction
const result = await client.deposit({
lamports: 10000000,
returnUnsigned: true
});
depositUSDC(options)
base_units: number - Amount in base units (1 USDC = 1,000,000 base units)returnUnsigned?: boolean - If true, returns unsigned transactionPromise<UnsignedDepositSPLResult | SignedDepositSPLResult>const result = await client.depositUSDC({
base_units: 1000000, // 1 USDC
returnUnsigned: true
});
depositSPL(options)
base_units: number - Amount in base unitsmintAddress: PublicKey | string - SPL token mint addressreturnUnsigned?: boolean - If true, returns unsigned transactionPromise<UnsignedDepositSPLResult | SignedDepositSPLResult>const result = await client.depositSPL({
base_units: 1000000,
mintAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
returnUnsigned: true
});
submitSignedDeposit(signedTransaction, metadata)
signedTransaction: VersionedTransaction - Signed transaction from frontendmetadata: UnsignedDepositResult['metadata'] - Metadata from unsigned resultPromise<{ tx: string }> - Transaction signatureconst result = await client.submitSignedDeposit(signedTx, metadata);
console.log('Transaction:', result.tx);
submitSignedDepositSPL(signedTransaction, metadata)
signedTransaction: VersionedTransaction - Signed transaction from frontendmetadata: UnsignedDepositSPLResult['metadata'] - Metadata from unsigned resultPromise<{ tx: string }> - Transaction signatureconst result = await client.submitSignedDepositSPL(signedTx, metadata);
console.log('Transaction:', result.tx);
import type {
UnsignedDepositResult,
SignedDepositResult,
UnsignedDepositSPLResult,
SignedDepositSPLResult,
} from 'privacycash';
// Unsigned SOL deposit result
type UnsignedDepositResult = {
unsignedTransaction: VersionedTransaction;
metadata: {
encryptedOutput1: Buffer;
publicKey: PublicKey;
referrer?: string;
};
};
// Signed deposit result
type SignedDepositResult = {
tx: string; // Transaction signature
};
// Unsigned SPL deposit result (includes mintAddress)
type UnsignedDepositSPLResult = {
unsignedTransaction: VersionedTransaction;
metadata: {
encryptedOutput1: Buffer;
publicKey: PublicKey;
referrer?: string;
mintAddress: string;
};
};
import express from 'express';
import { PrivacyCash } from 'privacycash';
import { PublicKey, VersionedTransaction } from '@solana/web3.js';
const app = express();
app.use(express.json());
// Generate unsigned deposit transaction
app.post('/api/deposit/generate', async (req, res) => {
const { userPublicKey, amount } = req.body;
const client = new PrivacyCash({
RPC_url: process.env.RPC_URL,
owner: userPublicKey, // No private key needed!
});
const result = await client.deposit({
lamports: amount,
returnUnsigned: true,
});
if ('unsignedTransaction' in result) {
res.json({
transaction: Buffer.from(result.unsignedTransaction.serialize()).toString('base64'),
metadata: {
encryptedOutput1: result.metadata.encryptedOutput1.toString('base64'),
publicKey: result.metadata.publicKey.toString(),
},
});
}
});
// Submit signed transaction
app.post('/api/deposit/submit', async (req, res) => {
const { signedTransaction, metadata, userPublicKey } = req.body;
const client = new PrivacyCash({
RPC_url: process.env.RPC_URL,
owner: userPublicKey,
});
const tx = VersionedTransaction.deserialize(
Buffer.from(signedTransaction, 'base64')
);
const meta = {
encryptedOutput1: Buffer.from(metadata.encryptedOutput1, 'base64'),
publicKey: new PublicKey(metadata.publicKey),
};
const result = await client.submitSignedDeposit(tx, meta);
res.json({ signature: result.tx });
});
app.listen(3000);
import { useWallet } from '@solana/wallet-adapter-react';
import { VersionedTransaction } from '@solana/web3.js';
function DepositButton() {
const { publicKey, signTransaction } = useWallet();
const handleDeposit = async () => {
// 1. Generate unsigned transaction from backend
const response = await fetch('/api/deposit/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
userPublicKey: publicKey.toString(),
amount: 10000000, // 0.01 SOL
}),
});
const { transaction, metadata } = await response.json();
// 2. Deserialize and sign
const tx = VersionedTransaction.deserialize(
Buffer.from(transaction, 'base64')
);
const signedTx = await signTransaction(tx);
// 3. Send back to backend for submission
const submitResponse = await fetch('/api/deposit/submit', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
signedTransaction: Buffer.from(signedTx.serialize()).toString('base64'),
metadata,
userPublicKey: publicKey.toString(),
}),
});
const { signature } = await submitResponse.json();
console.log('Deposit successful:', signature);
};
return <button onClick={handleDeposit}>Deposit 0.01 SOL</button>;
}
The SDK maintains 100% backward compatibility. Existing code continues to work without modifications:
// Old code (still works)
const result = await client.deposit({ lamports: 10000000 });
// Returns: { tx: 'signature...' }
// New code (opt-in)
const result = await client.deposit({
lamports: 10000000,
returnUnsigned: true
});
// Returns: { unsignedTransaction: ..., metadata: ... }
✅ Private keys never leave the user's device ✅ Backend cannot sign transactions on behalf of users ✅ Full audit trail of all transactions ✅ Compatible with hardware wallets ✅ Follows Solana wallet adapter standards
The SDK includes comprehensive tests covering:
Run tests:
npm test
npm test
npm run teste2e
Running e2e tests will cost some transaction fees on your wallet, so don't put too much SOL into your wallet. Maybe put 0.1 SOL, and the tests might cost 0.02 SOL.
FAQs
This is the SDK for Privacy Cash. It has been audited by Zigtur (https://x.com/zigtur).
We found that @deserialize/privacero demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.