register()
Register a new wallet and receive an API key.
DarkfibreSDK.register(privateKey: string): Promise<RegisterResult>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
privateKey | string | Yes | Base58-encoded Solana private key (32 or 64 bytes) |
Return Value
Section titled “Return Value”Returns a RegisterResult object:
{ apiKey: string; // Your new API key walletAddress: string; // The registered wallet address}How It Works
Section titled “How It Works”The registration process proves wallet ownership:
- Creates a message with the current timestamp
- Signs the message with your wallet’s private key
- Sends the signed message to the registration endpoint
- Returns your API key upon successful verification
Example
Section titled “Example”import { DarkfibreSDK } from '@darkfibre/sdk';
// Register a new walletconst result = await DarkfibreSDK.register('your-base58-private-key');
console.log('API Key:', result.apiKey);Alternative: Browser Registration
Section titled “Alternative: Browser Registration”For a simpler registration experience, use the browser interface:
https://darkfibre.dev/register
Connect your Solana wallet and follow the prompts. The browser handles all signature steps automatically.
Related
Section titled “Related”- POST /v1/auth/register - API endpoint reference