feat: BTCPay Server payment integration via pow.dgray.io proxy
This commit is contained in:
@@ -1,30 +1,38 @@
|
||||
# PoW Captcha Server
|
||||
# PoW Captcha & Payment Server
|
||||
|
||||
PHP-basierter Proof-of-Work Captcha Server für dgray.io.
|
||||
PHP-basierter Server für dgray.io mit Proof-of-Work Captcha und BTCPay Payment-Proxy.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Subdomain `pow.dgray.io` auf den Server zeigen
|
||||
2. Dateien in das Web-Root kopieren
|
||||
3. Secret setzen:
|
||||
3. Secrets setzen:
|
||||
```bash
|
||||
# In .env oder Apache/Nginx config:
|
||||
SetEnv POW_SECRET $(openssl rand -hex 32)
|
||||
SetEnv BTCPAY_API_KEY your_btcpay_api_key
|
||||
SetEnv BTCPAY_STORE_ID your_btcpay_store_id
|
||||
```
|
||||
Oder direkt in `config.php` den Wert von `POW_SECRET` ändern.
|
||||
Oder direkt in `config.php` die Werte ändern.
|
||||
|
||||
4. Testen:
|
||||
```bash
|
||||
# PoW Challenge
|
||||
curl https://pow.dgray.io/challenge
|
||||
|
||||
# BTCPay Invoice erstellen
|
||||
curl -X POST https://pow.dgray.io/btcpay/invoice \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"listingId": "test-123", "currency": "EUR"}'
|
||||
```
|
||||
|
||||
## Endpoints
|
||||
|
||||
### GET /challenge
|
||||
Gibt eine signierte Challenge zurück.
|
||||
Gibt eine signierte PoW-Challenge zurück.
|
||||
|
||||
### POST /verify
|
||||
Prüft die Lösung. Body (JSON):
|
||||
Prüft die PoW-Lösung. Body (JSON):
|
||||
```json
|
||||
{
|
||||
"challenge": "...",
|
||||
@@ -35,9 +43,51 @@ Prüft die Lösung. Body (JSON):
|
||||
}
|
||||
```
|
||||
|
||||
### POST /btcpay/invoice
|
||||
Erstellt eine BTCPay Server Invoice für eine Listing-Gebühr.
|
||||
Body (JSON):
|
||||
```json
|
||||
{
|
||||
"listingId": "uuid-string",
|
||||
"currency": "EUR"
|
||||
}
|
||||
```
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"invoiceId": "...",
|
||||
"checkoutLink": "https://pay.xmr.rocks/i/...",
|
||||
"status": "New",
|
||||
"expirationTime": 1700000000
|
||||
}
|
||||
```
|
||||
|
||||
### GET /btcpay/status?id={invoiceId}
|
||||
Prüft den Zahlungsstatus einer Invoice.
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"invoiceId": "...",
|
||||
"status": "New|Processing|Settled|Expired|Invalid",
|
||||
"additionalStatus": "None|PaidLate|PaidPartial|..."
|
||||
}
|
||||
```
|
||||
|
||||
## Gebühren
|
||||
|
||||
| Währung | Betrag |
|
||||
|---------|--------|
|
||||
| EUR | 1 |
|
||||
| USD | 1 |
|
||||
| CHF | 1 |
|
||||
| GBP | 1 |
|
||||
| JPY | 200 |
|
||||
|
||||
## Sicherheit
|
||||
|
||||
- HMAC-SHA256 signierte Challenges (nicht fälschbar)
|
||||
- TTL: 2 Minuten
|
||||
- CORS: nur `https://dgray.io`
|
||||
- `hash_equals()` gegen Timing-Attacks
|
||||
- BTCPay API-Key bleibt serverseitig (nie im Frontend)
|
||||
- Gebühren serverseitig erzwungen (nicht manipulierbar)
|
||||
|
||||
Reference in New Issue
Block a user