Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Basic Usage

Quick example

HTTP
export BASE_URL=http://localhost:3000
export AUTH_TOKEN=your-auth-token

# Get a key handshake URL
curl -s -X POST $BASE_URL/key-handshake \
  -H "Authorization: Bearer $AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
# → { "stream_id": "abc123", "url": "nostr+walletconnect://..." }

# Poll for the user's public key
curl -s "$BASE_URL/events/abc123?after=0" \
  -H "Authorization: Bearer $AUTH_TOKEN"

See REST API for the full async flow.

JavaScript
import { PortalClient } from 'portal-sdk';

const client = new PortalClient({
  baseUrl: 'http://localhost:3000',
  authToken: 'your-auth-token'
});

const { url, stream } = await client.newKeyHandshakeUrl();
console.log('User key:', (await client.poll(stream)).main_key);
Java
import cc.getportal.PortalClient;
import cc.getportal.PortalClientConfig;

PortalClient client = new PortalClient(
    PortalClientConfig.create("http://localhost:3000", "your-auth-token")
);

var operation = client.newKeyHandshakeUrl();
System.out.println("URL: " + operation.url());
var result = client.pollUntilComplete(operation);
System.out.println("mainKey: " + result.main_key());

See API Reference and the Java SDK.

What to call