Files
Loki/rust/loki-rs/tests/parity_push/push.json
T
Claude eddcf97e3b Lot 12 : notifications Web Push tenues par la façade (LOKI_PUSH=rust)
La façade sert la clé VAPID et les (dés)abonnements, et pousse elle-même
les notifications « réponse prête » quand LOKI_PUSH=rust (expérimental ;
le Go reste le défaut) : chiffrement RFC 8291 (aes128gcm, enregistrement
complété à 4096 octets comme webpush-go), signature VAPID RFC 8292 (JWT
ES256), abonnements purgés sur 404/410, par ring déjà présent via rustls.
Mêmes clés en base que le Go.

Côté Go : facade_push.go remet les routes du tunnel à la façade, et
sendPushToAll (fin de tour, fin de tâche) lui délègue l'envoi.

Parité : parity_push_test.go tire du Go les durées et onze appels de route
avec la liste des abonnements en base, rejoués par tests/push.rs ; le
chiffrement reproduit l'exemple de la RFC 8291 à l'octet près, et un envoi
de bout en bout est déchiffré côté navigateur.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016tcGfJWefW5kUGoC2wL8cv
2026-10-15 17:01:07 +00:00

127 lines
3.8 KiB
JSON

{
"durations": {
"-5s": "0s",
"0s": "0s",
"1h0m0s": "1 h 00 mn",
"1h12m10s": "1 h 12 mn",
"3m5s": "3 mn 05s",
"400ms": "0s",
"42s": "42s",
"600ms": "1s"
},
"calls": [
{
"method": "GET",
"path": "/api/push/key",
"status": 200,
"out": {
"key": "{{CLE}}",
"ok": true
},
"subs": ""
},
{
"method": "POST",
"path": "/api/push/subscribe",
"body": "{\"endpoint\":\"https://push.exemple.fr/a\",\"keys\":{\"p256dh\":\"BAAA\",\"auth\":\"x1\"}}",
"status": 200,
"out": {
"ok": true
},
"subs": "[{\"endpoint\":\"https://push.exemple.fr/a\",\"keys\":{\"auth\":\"x1\",\"p256dh\":\"BAAA\"}}]"
},
{
"method": "POST",
"path": "/api/push/subscribe",
"body": "{\"endpoint\":\"https://push.exemple.fr/b\",\"keys\":{\"p256dh\":\"BBBB\",\"auth\":\"x2\"},\"expirationTime\":null}",
"status": 200,
"out": {
"ok": true
},
"subs": "[{\"endpoint\":\"https://push.exemple.fr/a\",\"keys\":{\"auth\":\"x1\",\"p256dh\":\"BAAA\"}},{\"endpoint\":\"https://push.exemple.fr/b\",\"keys\":{\"auth\":\"x2\",\"p256dh\":\"BBBB\"}}]"
},
{
"method": "POST",
"path": "/api/push/subscribe",
"body": "{\"endpoint\":\"https://push.exemple.fr/a\",\"keys\":{\"p256dh\":\"BCCC\",\"auth\":\"x3\"}}",
"status": 200,
"out": {
"ok": true
},
"subs": "[{\"endpoint\":\"https://push.exemple.fr/a\",\"keys\":{\"auth\":\"x3\",\"p256dh\":\"BCCC\"}},{\"endpoint\":\"https://push.exemple.fr/b\",\"keys\":{\"auth\":\"x2\",\"p256dh\":\"BBBB\"}}]"
},
{
"method": "POST",
"path": "/api/push/subscribe",
"body": "{\"keys\":{\"p256dh\":\"B\",\"auth\":\"y\"}}",
"status": 400,
"out": {
"error": "abonnement invalide",
"ok": false
},
"subs": "[{\"endpoint\":\"https://push.exemple.fr/a\",\"keys\":{\"auth\":\"x3\",\"p256dh\":\"BCCC\"}},{\"endpoint\":\"https://push.exemple.fr/b\",\"keys\":{\"auth\":\"x2\",\"p256dh\":\"BBBB\"}}]"
},
{
"method": "POST",
"path": "/api/push/subscribe",
"body": "pas du json",
"status": 400,
"out": {
"error": "abonnement invalide",
"ok": false
},
"subs": "[{\"endpoint\":\"https://push.exemple.fr/a\",\"keys\":{\"auth\":\"x3\",\"p256dh\":\"BCCC\"}},{\"endpoint\":\"https://push.exemple.fr/b\",\"keys\":{\"auth\":\"x2\",\"p256dh\":\"BBBB\"}}]"
},
{
"method": "POST",
"path": "/api/push/unsubscribe",
"body": "{\"endpoint\":\"https://push.exemple.fr/inconnu\"}",
"status": 200,
"out": {
"ok": true
},
"subs": "[{\"endpoint\":\"https://push.exemple.fr/a\",\"keys\":{\"auth\":\"x3\",\"p256dh\":\"BCCC\"}},{\"endpoint\":\"https://push.exemple.fr/b\",\"keys\":{\"auth\":\"x2\",\"p256dh\":\"BBBB\"}}]"
},
{
"method": "POST",
"path": "/api/push/unsubscribe",
"body": "{\"endpoint\":\"https://push.exemple.fr/a\"}",
"status": 200,
"out": {
"ok": true
},
"subs": "[{\"endpoint\":\"https://push.exemple.fr/b\",\"keys\":{\"auth\":\"x2\",\"p256dh\":\"BBBB\"}}]"
},
{
"method": "POST",
"path": "/api/push/unsubscribe",
"body": "pas du json",
"status": 200,
"out": {
"ok": true
},
"subs": "[{\"endpoint\":\"https://push.exemple.fr/b\",\"keys\":{\"auth\":\"x2\",\"p256dh\":\"BBBB\"}}]"
},
{
"method": "POST",
"path": "/api/push/unsubscribe",
"body": "{\"endpoint\":\"https://push.exemple.fr/b\"}",
"status": 200,
"out": {
"ok": true
},
"subs": "[]"
},
{
"method": "GET",
"path": "/api/push/key",
"status": 200,
"out": {
"key": "{{CLE}}",
"ok": true
},
"subs": "[]"
}
]
}