putOtp method
Set a custom OTP (semi-permanent passcode) on the secondary server
Implementation
Future<String> putOtp(String value) async {
if (!_initialized) {
throw Exception('Manager not initialized. Call initialize() first.');
}
try {
_logger.info('Setting custom OTP for $atSign');
final otpCommand = 'otp:put:$value\n';
String? response = await _atClient
.getRemoteSecondary()!
.executeCommand(otpCommand, auth: true);
if (response == null || !response.contains('ok')) {
throw Exception('Failed to set custom OTP. Response: $response');
}
_logger.info('Successfully set custom OTP');
return value;
} catch (e, s) {
_logger.severe('Failed to set custom OTP: $e', e, s);
rethrow;
}
}