Table of Contents

Class SrpAccountManager<TConnection>

Namespace
FishMMO.Auth.Implementation
Assembly
FishMMO-ServerAuth.dll

SRP-specific account manager for LoginServer authentication. Extends AccountManager<TConnection> with SRP data population, connection account creation, and periodic sweep of stale unauthenticated connections. Auth state machine methods (TryAdvanceAuthState, HasAuthState) are inherited from the base AccountManager<TConnection>.

public class SrpAccountManager<TConnection> : AccountManager<TConnection>, ISrpAccountManager<TConnection>, IAccountManager<TConnection>

Type Parameters

TConnection

The type representing a network connection.

Inheritance
AccountManager<TConnection>
SrpAccountManager<TConnection>
Implements
ISrpAccountManager<TConnection>
IAccountManager<TConnection>
Derived
Inherited Members

Constructors

SrpAccountManager(string)

Initializes a new SrpAccountManager.

public SrpAccountManager(string logPrefix = "SrpAccountManager")

Parameters

logPrefix string

Prefix used in diagnostic log messages.

Methods

AddConnectionAccount(TConnection, string, string, string, string, AccessLevel, bool)

Populates SRP authentication data on an existing connection's AccountData. Requires the connection to be in VerifyPending state (set by the verify broadcast handler). On success, advances the state to WaitingForProof and registers the account name mappings.

public bool AddConnectionAccount(TConnection connection, string accountName, string publicClientEphemeral, string salt, string verifier, AccessLevel accessLevel, bool isUnverified = false)

Parameters

connection TConnection

The network connection.

accountName string

The account name.

publicClientEphemeral string

The public ephemeral value from the client.

salt string

The salt for SRP.

verifier string

The verifier for SRP.

accessLevel AccessLevel

The access level for the account.

isUnverified bool

Returns

bool

true if SRP data was set and state advanced; false if the connection was not in the expected state.

ClearSrpState(TConnection)

Clears SRP state for a connection while preserving account mappings and access level. Calls Clear() to null sensitive string references, then nulls the SrpData reference itself via ClearSrpData(). Use this after SRP success to remove sensitive SRP material from memory.

public void ClearSrpState(TConnection connection)

Parameters

connection TConnection

The connection whose SRP state will be cleared.

SweepUnauthenticatedConnections(TimeSpan, Func<TConnection, bool>, int, int)

Sweeps and removes stale unauthenticated connection state to bound SRP/encryption memory growth. Authenticated connections are only untracked from the unauthenticated timer map.

public int SweepUnauthenticatedConnections(TimeSpan maxUnauthenticatedAge, Func<TConnection, bool> isAuthenticated, int maxScan, int maxRemovals)

Parameters

maxUnauthenticatedAge TimeSpan

Maximum allowed age for unauthenticated state.

isAuthenticated Func<TConnection, bool>

Connection authentication predicate.

maxScan int

Maximum tracked entries to evaluate this sweep.

maxRemovals int

Maximum stale entries to purge this sweep.

Returns

int

Number of stale unauthenticated entries purged.