Portal is a Nostr-based authentication and payment SDK allowing applications to authenticate users and process payments through Nostr and Lightning Network.
Portal provides a comprehensive solution for:
- Nostr-based user authentication
- Single and recurring payment processing
- Profile management and verification
- Cross-platform integration (Rust, TypeScript, and more)
/app- API exposed to the app/backend- Example backend/cli- Command-line interface tool/rates- Bitcoin exchange rates from multiple sources/react-native- React Native bindings for theappcrate/rest- SDK wrapper exposing a REST/websocket interface/sdk- Core SDK implementation/rest/clients/ts- TypeScript client for the REST API/wallet- Supported wallets(NWC, Breez)
- Rust toolchain (latest stable)
- Node.js and npm (for TypeScript client)
cargo build --releaseYou can run the SDK Daemon using Docker. The image is published on Docker Hub as getportal/sdk-daemon:latest.
docker run --rm --name portal-sdk-daemon -d \
-p 3000:3000 \
-e NOSTR_KEY=<your-nsec-here> \
getportal/sdk-daemon:latest- The daemon will be available on port 3000.
- The default auth token is 'remember-to-change-this'
- You can override environment variables as needed (see below).
AUTH_TOKEN: Authentication token for API accessNOSTR_KEY: Your Nostr private key in hex formatNWC_URL: (Optional) Nostr Wallet Connect URLNOSTR_SUBKEY_PROOF: (Optional) Nostr subkey proofNOSTR_RELAYS: (Optional) Comma-separated list of relay URLs
Since this is a REST API, you can use it from any programming language that supports websocket connections.
But best is to use the official SDK for your programming language.
Currently supported SDKs:
npm install portal-sdkimport { PortalClient } from 'portal-sdk';
// Initialize client
const client = new PortalClient({
serverUrl: 'ws://localhost:3000/ws'
});
// Authenticate
await client.connect('your-auth-token');
// Generate authentication URL
const { url, stream_id } = await client.getKeyHandshakeUrl();
// Request payment
const paymentResult = await client.requestSinglePayment({
main_key: 'user-pubkey',
subkeys: [],
payment_request: {
description: 'Product purchase',
amount: 1000,
currency: 'Millisats'
}
});
// Close connection when done
client.disconnect();Secure user authentication using Nostr protocol, supporting both main keys and delegated subkeys.
- Single Payments: One-time payments via Lightning Network
- Recurring Payments: Subscription-based payments with customizable recurrence patterns
- Payment Status Tracking: Real-time updates on payment status
Fetch and verify user profiles through Nostr's social graph.
See the /rest/README.md file for detailed API documentation.
This project is licensed under the MIT License, except for the app library.