Skip to main content
The Browser SDK is designed for client-side use only. Never expose your secret API key in frontend code - only use your public key.
1

Install the Browser SDK

npm install @chipi-stack/backend
2

Get your Public API Key

  1. Go to your API Keys in the Chipi Dashboard
  2. Copy your Public Key (pk_prod_xxxx)
You only need the Public Key for frontend applications. Never use your Secret Key in client-side code.
3

Initialize the SDK

Create a new instance of the ChipiBrowserSDK with your public API key:
import { ChipiBrowserSDK } from "@chipi-stack/backend";

const browserClient = new ChipiBrowserSDK({
  apiPublicKey: "pk_prod_your_public_key",
});
4

Handle Authentication

The Browser SDK requires a bearer token for authentication. You’ll need to obtain this from your authentication provider:
// Example with your auth system
async function getBearerToken() {
  // Replace with your actual auth implementation
  const token = await yourAuthProvider.getToken();
  return token;
}
5

Create Your First Wallet

Now you can create a wallet for your users:
const bearerToken = await getBearerToken();

const newWallet = await browserClient.createWallet({
  params: {
    encryptKey: "user-secure-pin",
    externalUserId: "your-user-id-123",
    chain: "STARKNET",
  },
  bearerToken: bearerToken,
});

console.log('New wallet created:', newWallet);
// Output: { wallet: { publicKey: "0x...", encryptedPrivateKey: "..." }, txHash: "0x..." }
6

Make Your First Transfer

Transfer tokens between wallets:
const bearerToken = await getBearerToken();

const transferResult = await browserClient.transfer({
  params: {
    encryptKey: "user-secure-pin",
    wallet: {
      publicKey: newWallet.wallet.publicKey,
      encryptedPrivateKey: newWallet.wallet.encryptedPrivateKey,
    },
    amount: "100",
    token: "USDC",
    recipient: "0x1234567890abcdef...",
  },
  bearerToken: bearerToken,
});

console.log('Transfer completed:', transferResult);

Next Steps

Now that you have the basic setup working, explore more advanced features:

Security Best Practices

  • Secure your bearer tokens properly
  • Validate user inputs before making API calls
Need help? Join our Telegram Community for support and to connect with other developers.