✨ types(auth): Admin-Login-, MFA- und WebAuthn-Verträge

Eine Quelle für Server und Admin-UI:
- `AdminLoginResponse`: Union aus `AdminMfaChallenge` (`mfaRequired: true`)
  und `AdminLoginSession` (`token`, `user`, `amr`, `mfaEnrollmentRecommended`).
  Die Diskriminante ist `mfaRequired`, damit Clients sauber narrowen.
- `AdminAuthMethod` (`pwd|totp|recovery|webauthn`) vs. `AdminMfaMethod`
  (ohne `pwd`) — Go schreibt `pwd` immer in `amr`, bietet es aber nie als
  Faktor an.
- `AdminMfaStatus`, `AdminMfaTotpEnrollment`, `AdminMfaConfirmResult`,
  `AdminStepUpResult`.
- WebAuthn: `AdminWebAuthnCreationOptions`,
  `AdminWebAuthnRequestOptions`, `AdminWebAuthnCredentialJSON`,
  `AdminWebAuthnCredentialView`, `AdminAuthenticatorTransport`.

Type-Tests in `types-test/admin-auth.ts`: `Expect<Equal<…>>`-Assertions und
`@ts-expect-error` für die nicht möglichen Felder der Challenge. `npm test`
führt jetzt Schemas **und** `tsc` aus (TypeScript als devDependency).
This commit is contained in:
apairon committed 2026-11-06 19:09:14 +00:00
1 parent 24c2d34b3a
commit 2546d05b25
5 files changed
+198 -4

No files matched your search

+2 -1
View File
@@ -1,6 +1,7 @@
{
"include": ["demo-api/**/*"],
"include": ["demo-api/**/*", "types-test/**/*"],
"compilerOptions": {
"target": "es2020",
"typeRoots": ["."],
"module": "commonjs",
"noImplicitAny": true,