Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodTsnipCustomTLSClient.RecoverAccount

function RecoverAccount: Boolean;
OTP account recovery - the lost-password path (KAPA.txt section 7), driven end to end by this component:

1. brings the transport up (as StartTransport);
2. asks the server to send a one-time code out of band - the server application's ClassServer.OnRequestOTP handler delivers it by email/SMS;
3. collects that code from THIS application via OnOTPCode;
4. logs in with it (single-use, time-limited, throttle-independent, so recovery works while the account is locked out);
5. collects a replacement password via OnNewPassword and uploads the new verifier - which is also what re-opens the login throttle;
6. drops the connection: the OTP session is restricted server-side to changing the password, so it is useless for anything further.

On True, SnifPassword already holds the new password - call Start next for a normal login. On False the connection is dropped and nothing can be concluded from the outside: the flow is uniform whether or not the account exists (an unknown user simply never receives a code). Exceptions from the remote steps (a dropped or reaped connection) are treated as failure rather than raised; configuration errors (missing event handlers, no Host) do raise.

While an event handler waits on the user - minutes, up to the code's server-side lifetime - a background thread sends one EMPTY TLS record every RecoveryHeartbeatInterval ms. The snip layers on both ends never see it, but it is authenticated traffic that re-arms the server's idle deadline and keeps NAT/firewall state alive. TsnipTLSServer's own sessions would survive idle expiry anyway (they answer the idle nudge with keep-alive), so the heartbeat is what keeps recovery working through middleboxes and under server-side liveness policies that close silent connections. RecoveryHeartbeatInterval = 0 disables it.

TLS 1.3 only, like LoginKAPA: without the RFC 9266 channel binding this method refuses to run, so a new verifier cannot be planted through a legacy tunnel. Uses no client-side pepper and the registration defaults (TsnifAkeParams.Default, no host-key binding); an application that needs either drives the StreamSec.Snic.Authentication proxies directly.