create2FASecret method
Erstellt ein neues 2FA-Secret für eine Anwendung
Generiert ein neues TOTP-Secret für die Zwei-Faktor-Authentifizierung einer spezifischen Anwendung. Das Secret wird für die Einrichtung von Authenticator-Apps verwendet.
appname - Name der Anwendung (z.B. "GSD-DFApp")
Returns: RestApiResponse mit dem neuen 2FA-Secret und QR-Code-Daten
Das Response enthält:
- Base32-kodiertes Secret für manuelle Eingabe
- QR-Code-URL für Authenticator-Apps
- Backup-Codes für Notfälle
Beispiel:
RestApiResponse response = await api.v1.authentication.create2FASecret("GSD-DFApp");
if (response.isOk) {
String secret = response.data['secret'];
String qrCodeUrl = response.data['qrCode'];
List backupCodes = response.data['backupCodes'];
}
Implementation
Future<RestApiResponse> create2FASecret(String appname) {
return _runtime.execute(
ApiRequest<RestApiResponse>(
method: ApiHttpMethod.post,
version: ApiVersion.v1,
path: '/2fa/secret',
queryParameters: <String, String>{'app': appname},
authentication: AuthenticationPolicy.session,
responsePolicy: _responsePolicy,
operationId: 'v1.authentication.create2FASecret',
),
);
}