Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down