From 1c8be5e6cf64787d204d217e85bed780a6ec5527 Mon Sep 17 00:00:00 2001 From: pope-h Date: Sun, 8 Mar 2026 01:23:04 +0100 Subject: [PATCH] feat(sep-1): serve stellar.toml for ORGUSD --- backend/src/index.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/backend/src/index.ts b/backend/src/index.ts index c005d8e3..973f772e 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -18,6 +18,44 @@ app.use(cors()); app.use(express.json()); app.use(passport.initialize()); +app.get('/.well-known/stellar.toml', (req, res) => { + const issuer = process.env.ORGUSD_ISSUER_PUBLIC; + const networkPassphrase = process.env.STELLAR_NETWORK_PASSPHRASE; + + if (!issuer) { + res.status(503).json({ + error: 'Service Unavailable', + message: 'ORGUSD_ISSUER_PUBLIC is not configured', + }); + return; + } + + const toml = [ + 'VERSION="2.0.0"', + networkPassphrase ? `NETWORK_PASSPHRASE="${networkPassphrase}"` : null, + '', + '[DOCUMENTATION]', + 'ORG_NAME="PayD"', + 'ORG_URL="https://github.com/pope-h/PayD"', + 'ORG_DESCRIPTION="PayD is a Stellar-based cross-border payroll platform."', + 'ORG_GITHUB="pope-h/PayD"', + 'ORG_OFFICIAL_EMAIL="support@example.com"', + '', + '[[CURRENCIES]]', + 'code="ORGUSD"', + `issuer="${issuer}"`, + 'display_decimals=2', + 'name="ORGUSD"', + 'desc="Organization-specific stablecoin used for payroll disbursements on Stellar."', + ] + .filter((line): line is string => Boolean(line)) + .join('\n'); + + res.setHeader('Access-Control-Allow-Origin', '*'); + res.setHeader('Content-Type', 'text/plain; charset=utf-8'); + res.status(200).send(toml); +}); + // Routes app.use('/auth', authRoutes);