Lux Financial

Authentication

API key management, security practices, and webhook signature verification.

Authentication

All API requests require authentication using an API key.

API Keys

API keys are prefixed to indicate their type:

PrefixTypeDescription
sk_live_Live SecretProduction environment, real funds
sk_test_Test SecretSandbox environment, test data
pk_live_Live PublishableClient-side, limited permissions
pk_test_Test PublishableClient-side sandbox

Using API Keys

Pass your API key in the Api-Key header:

curl https://api.lux.financial/v0/customers \
  -H "Api-Key: sk_live_your_api_key"

TypeScript SDK

import { Lux } from '@luxbank/sdk';

const lux = new Lux({
  apiKey: process.env.LUX_API_KEY,
});

Python SDK

from luxbank import Lux

lux = Lux(api_key=os.environ.get("LUX_API_KEY"))

Security Best Practices

  1. Never expose secret keys client-side — Use publishable keys for browser/mobile
  2. Use environment variables — Don't hardcode keys in source code
  3. Rotate keys regularly — Generate new keys periodically
  4. Use separate keys per environment — Different keys for staging vs production

API Key Permissions

Keys can be scoped to specific permissions:

PermissionDescription
customers:readView customer data
customers:writeCreate/update customers
accounts:readView account balances
accounts:writeCreate accounts
transfers:readView transfer history
transfers:writeCreate transfers
payments:readView payment history
payments:writeCreate payments

Webhook Signature Verification

Webhook payloads are signed using HMAC-SHA256. Verify signatures using your webhook secret:

import crypto from 'crypto';

function verifyWebhook(payload: string, signature: string, secret: string): boolean {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

On this page