Register & authenticate
The SDK handles registration via DarkfibreSDK.register(). This page explains what happens under the hood.
How Authentication Works
Section titled “How Authentication Works”Darkfibre uses signature-based authentication to prove wallet ownership. Here’s the flow:
- Create a message with the current timestamp:
darkfibre:{timestamp} - Sign the message with your wallet’s private key
- Send to API with your wallet address, message, and signature
- Receive API key if the signature is valid
This proves you control the private key without ever sending it to the server.
Browser Wallet Registration (Recommended)
Section titled “Browser Wallet Registration (Recommended)”The easiest way to register is using the browser wallet interface:
https://darkfibre.dev/register
This handles all the signature steps automatically. Simply connect your Solana wallet and follow the prompts to receive your API key.
Using Your API Key
Section titled “Using Your API Key”Once you have your API key, include it in the Authorization header on every REST request:
Authorization: Bearer api_your_key_hereProgrammatic Registration
Section titled “Programmatic Registration”If you need to register programmatically (for automated setups or non-browser environments), you can call the API endpoint directly.
Endpoint
Section titled “Endpoint”POST /v1/auth/registerRequest Body
Section titled “Request Body”{ "walletAddress": "YOUR_SOLANA_WALLET_ADDRESS", "message": "darkfibre:1736123456789", "signature": "BASE58_ENCODED_SIGNATURE"}For complete API reference, see: POST /v1/auth/register.