FFiber Offers
Documentation / Reference

Production and security

The included resolver is deliberately local-first so teams can build against a small, inspectable surface. A public payment deployment needs durable data, authenticated operations, secure key handling, monitoring, and real Fiber-node validation.

Deployment baseline

RESOLVER_API_KEY=change-me \
RESOLVER_PUBLIC_URL=https://resolver.example \
FIBER_RPC_URL=http://127.0.0.1:8227 \
npm run dev
  • Terminate TLS at a trusted reverse proxy and expose the resolver only through HTTPS.
  • Set RESOLVER_PUBLIC_URL to the externally reachable origin so links and webhooks use the correct address.
  • Set RESOLVER_API_KEY; a production resolver refuses to start without it. It is the root key. Give each person or system a named key with only the scope it needs, as described below.
  • Store API keys and Fiber RPC credentials in a secret manager, not source files or browser code.
  • Run the PostgreSQL migration service before accepting live payments and use Redis/BullMQ for distributed maintenance work.

Each resolver deployment serves one merchant node, configured through FIBER_RPC_URL. The endpoint may use a custom port or hosted private URL. Do not configure customer payer nodes in the resolver and do not accept RPC URLs from public requests. One resolver per merchant is deliberate: hosting several merchants on one resolver would put RPC access to all their nodes in one operator's hands. Named keys are for the people and systems of that one merchant, not for tenants.

Operator keys and sessions

RESOLVER_API_KEY has the admin scope and is never stored. Use it to make a named key for each person or system, with the lowest scope that does the job: manage for the shop's backend, read for accounting or monitoring, and admin only for the people who manage keys. A key can carry an expiry. The resolver stores only a hash of each named key. A revoked or expired key stops working on every replica at its next request, and so do the sessions opened with it. See Keys and scopes for the routes.

Rotate a key

  1. Create a new key with the same name and scope.
  2. Deploy it where the old one was used.
  3. Watch the old key's last_used_at in GET /operator/keys. It is updated at most once a minute.
  4. Revoke the old key once its last_used_at stops moving.

There is no single rotate call, because it would cut the old key off before the new one is deployed. RESOLVER_API_KEY is rotated by changing it on every replica. The sessions opened with the old value end with it.

Browser sessions

Signing in to the dashboard opens a session that the resolver stores. The browser holds an HttpOnly, SameSite=Strict cookie with the session ID and a secret; the resolver keeps only a hash of the secret. On HTTPS the cookie is Secure and carries the __Host- prefix. A session has its key's scope and lasts RESOLVER_ADMIN_SESSION_TTL_SECONDS, 8 hours by default. It ends sooner when the operator signs out, when its key is revoked or expires, or when an admin ends every session with DELETE /operator/sessions. A change sent with the cookie is accepted only from the resolver's own pages.

UpgradingKeys, sessions, and the offer switch need the latest database migration. The Compose migrate service applies it; a single process on PostgreSQL runs npm run db:migrate. The JSON file store needs nothing. Sessions opened before the upgrade no longer verify, so operators sign in once more.

Settlement and webhook workers

The Docker deployment runs BullMQ workers against Redis. The interval-based worker remains a single-process development fallback.

RESOLVER_WORKERS_ENABLED=true
RESOLVER_WORKERS_RUN_ON_START=true
RESOLVER_SETTLEMENT_SYNC_INTERVAL_MS=3000
RESOLVER_WEBHOOK_RETRY_INTERVAL_MS=30000
RESOLVER_WEBHOOK_MAX_ATTEMPTS=8
RESOLVER_WEBHOOK_RETRY_MIN_AGE_MS=30000
RESOLVER_WEBHOOK_RETRY_MAX_DELAY_MS=3600000
RESOLVER_WEBHOOK_EVENT_RETENTION_DAYS=30
RESOLVER_WEBHOOK_TIMEOUT_MS=10000

Monitor the worker state reported by GET /diagnostics. The delivery timeout defaults to 10 seconds. A failed delivery is retried after 30 seconds, then after twice as long each time, and is marked dead after the eighth attempt; an operator can send failed and dead deliveries again at any time. Events with nothing left to deliver are removed after 30 days.

Security boundaries

BoundaryRequired controlReason
Offer lifecycle keyMerchant-owned encrypted key storage and rotation plan.The signature protects offer content and revocation; the resolver separately verifies the Fiber node identity. If the key is lost, an operator can still switch the offer off.
Resolver keysA named key per person or system with the lowest scope that works, rotated, and never exposed to wallets.Reading the merchant's records needs read; registration, the offer switch, status updates, syncs, and webhooks need manage; keys and sessions need admin.
Operator sessionStored on the resolver, HttpOnly and SameSite=Strict cookie, changes accepted only from the resolver's own pages.A session can be ended on the resolver, and a form on another site cannot act with the cookie.
Webhook secretEncrypted storage, HMAC verification, event ID deduplication, timestamp tolerance.Protects fulfillment from forged or replayed delivery requests.
Fiber RPCPrivate network access or authenticated RPC access.Prevents an untrusted party from controlling invoice or node diagnostics calls.
Offer and request dataRate limits, request-size limits, structured validation, and observability.Protects the public resolver surface from abuse and makes failures diagnosable.

Operational checklist

  1. Run npm run verify and review the resolver smoke flow on every release candidate.
  2. Probe the live node with npm run fiber:check before deploying a live invoice source.
  3. Probe the merchant node from the resolver. Run route dry-runs in the payer application against its own node; use pair topology only when both endpoints are controlled test fixtures.
  4. Alert on resolver reachability, worker failures, high webhook failure rates, and failed invoice syncs.
  5. Back up durable resolution and webhook event data. Reconciliation records are business records, not transient UI state.
  6. Log offer ID, resolution ID, webhook event ID, and delivery ID together so an operator can trace a payment attempt end to end.
  7. Keep the resolver's log. Every change an operator makes is one operator_action JSON line naming the key that made it; these lines are the audit trail.
Independent merchant deploymentRun npm run cli -- init before the first Docker startup, then use npm run cli -- doctor to prove that the resolver and merchant CLI are connected to the same FNN. PostgreSQL is authoritative in Docker; the JSON adapter remains a local single-process fallback.

Troubleshooting guide

The Fiber RPC endpoint is unavailable

Run npm run fiber:check and inspect GET /diagnostics. The resolver reports the node failure and does not silently replace live invoices with simulated ones.

Readiness is blocked

Read summary, blockers, and next_actions. Merchant readiness checks node reachability and offer validity. The payer wallet should inspect its own outbound liquidity and route dry-run result.

The same checkout received an unexpected response

Retry the invoice request with the original idempotency key and identical amount and asset. A changed request with the same key is rejected with IDEMPOTENCY_KEY_REUSED by design.

A webhook is pending or failed

Inspect the event outbox and delivery response. Verify the receiver returns a 2xx status quickly, validates the HMAC against the raw body, and deduplicates event IDs. Retry explicitly or enable the worker after the receiver is healthy.

An offer must stop taking payments

Switch it off with POST /offers/:offer_id/disable or npm run cli -- disable OFFER_ID --reason TEXT. This needs a key with the manage scope, not the offer's lifecycle key, so it also works when that key is lost. Payers get 410 OFFER_DISABLED until the offer is switched on again with enable. Invoices issued before the switch stay payable until they expire, after FIBER_INVOICE_TTL_SECONDS (900 seconds by default). To stop an offer for good, revoke it with its lifecycle key.

An operator gets INSUFFICIENT_SCOPE

The key works but its scope is too low. The error's details name the scope the route needs and the scope the key has. Make a key with the right scope rather than handing out an admin key.

A live payment does not route

Run a dry-run from the payer's own node. Use the optional pair topology report only in a controlled environment where the operator owns both endpoints. Keep the raw Fiber error for debugging, but communicate the normalized failure summary and next action to the user.

Release readiness

Before a testnet merchant pilot

Use HTTPS, real Fiber RPC endpoints, a persistent data store, scoped API credentials, a verified webhook receiver, background worker monitoring, and live topology and route checks.

Fiber Offers is built to be useful infrastructure in the wider Fiber stack. Treat the documented interfaces as integration contracts and keep deployment hardening in step with the value being moved through them.