Class AccountData
- Namespace
- FishMMO.Auth.Implementation
- Assembly
- FishMMO-ServerAuth.dll
Holds account-related data for a server session, including authentication state, access level, and optional SRP authentication data.
public class AccountData
- Inheritance
-
AccountData
- Inherited Members
Remarks
AuthState is the single source of truth for a connection's position
in the authentication lifecycle. All transitions are performed atomically under
the AccountManager lock via TryAdvanceAuthState.
Constructors
AccountData()
Initializes a new instance of the AccountData class at Handshake state. Used when encryption data is first established, before any auth-specific data is known.
public AccountData()
AccountData(AccessLevel, ServerSrpData)
Initializes a new instance of the AccountData class with SRP data.
public AccountData(AccessLevel accessLevel, ServerSrpData srpData)
Parameters
accessLevelAccessLevelThe access level of the account.
srpDataServerSrpDataThe SRP authentication data for the account.
Properties
AccessLevel
Gets the access level of the account.
public AccessLevel AccessLevel { get; }
Property Value
AuthState
Gets or sets the authentication state for this connection.
Transitions are guarded by AccountManager's SyncRoot lock.
public AuthState AuthState { get; }
Property Value
IsUnverified
True when the underlying account exists but has not yet completed email verification. We carry this flag through the SRP exchange so that the AccountUnverified response can be deferred until after a successful M1 proof — wrong-password attempts on an unverified account still return the same InvalidUsernameOrPassword as any other failed login, removing the username-existence oracle that an early reject would create. Reset by Clear().
public bool IsUnverified { get; }
Property Value
SrpData
Gets the SRP authentication data for the account. Null for token-authenticated connections and after SRP material is cleared.
public ServerSrpData? SrpData { get; }
Property Value
Methods
Clear()
Clears the account data, resetting authentication state, access level, and SRP data.
public void Clear()
ClearSrpData()
Clears only the SRP authentication data, preserving the access level and auth state. Calls Clear() to null sensitive string references before releasing the SrpData reference itself. Use this after SRP success to remove sensitive SRP material from memory without demoting the account's privilege level.
public void ClearSrpData()
SetAccessLevel(AccessLevel)
Updates the access level. Used by token auth after database lookup.
public void SetAccessLevel(AccessLevel accessLevel)
Parameters
accessLevelAccessLevelThe access level to set.
SetSrpData(AccessLevel, ServerSrpData, bool)
Populates SRP authentication data on an existing AccountData. Called by the verify worker after creating ServerSrpData.
public void SetSrpData(AccessLevel accessLevel, ServerSrpData srpData, bool isUnverified = false)
Parameters
accessLevelAccessLevelThe access level from the database.
srpDataServerSrpDataThe SRP session data.
isUnverifiedboolWhether the account is unverified pending email confirmation.