fix(auth): jose durch pure-JS RS256-Implementierung ersetzen #164

Merged
admin-mrrm merged 2 commits from 162-fix-jose-crypto-subtle into main 2026-05-02 22:01:17 +02:00
Owner

Problem

jose (für JWT-Signaturverifikation) nutzt crypto.subtle.importKey — in React Native / Hermes nicht verfügbar → Fehler nach Login.

Lösung

Die gesamte id-token.ts wurde ohne externe JWT-Bibliothek neu implementiert:

RS256-Verifikation (pure JS)

  • BigInt-modPow für die RSA-Public-Operation: sig^e mod n
  • PKCS#1-v1.5-Padding-Prüfung + SHA-256 via @noble/hashes/sha256
  • Funktioniert in jedem JS-Environment ohne native Crypto-API

JWKS-Fetching

  • Fetch direkt mit fetch(), ohne createRemoteJWKSet von jose
  • 5-Minuten In-Memory-Cache
  • Fallback: alle RSA-Keys versuchen wenn kein kid vorhanden

Entfernt

  • jose aus packages/auth/package.json (250 transitive Abhängigkeiten entfernt)

Closes #163

## Problem `jose` (für JWT-Signaturverifikation) nutzt `crypto.subtle.importKey` — in React Native / Hermes nicht verfügbar → Fehler nach Login. ## Lösung Die gesamte `id-token.ts` wurde ohne externe JWT-Bibliothek neu implementiert: ### RS256-Verifikation (pure JS) - BigInt-`modPow` für die RSA-Public-Operation: `sig^e mod n` - PKCS#1-v1.5-Padding-Prüfung + SHA-256 via `@noble/hashes/sha256` - Funktioniert in jedem JS-Environment ohne native Crypto-API ### JWKS-Fetching - Fetch direkt mit `fetch()`, ohne `createRemoteJWKSet` von jose - 5-Minuten In-Memory-Cache - Fallback: alle RSA-Keys versuchen wenn kein `kid` vorhanden ### Entfernt - `jose` aus `packages/auth/package.json` (250 transitive Abhängigkeiten entfernt) Closes #163
fix(auth): jose durch pure-JS RS256-Implementierung ersetzen
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
dc8ea158c2
jose verwendet crypto.subtle.importKey für JWT-Signaturverifikation —
in React Native/Hermes nicht verfügbar.

Neue Implementierung: BigInt modPow + @noble/hashes/sha256.
Kein crypto.subtle, kein native Modul, keine neuen Abhängigkeiten.
jose komplett entfernt.

JWKS wird mit 5-Minuten-Cache selbst gefetcht. RS256 (Keycloak-Default)
wird vollständig kryptografisch verifiziert inklusive PKCS#1-v1.5-Padding.

Closes #163

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merge branch 'main' into 162-fix-jose-crypto-subtle
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
fd605ae1ca
admin-mrrm deleted branch 162-fix-jose-crypto-subtle 2026-05-02 22:01:18 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
admin-mrrm/mrrmlabapp!164
No description provided.