Table of Contents

Class TwoFactorResetRequestEntity

Namespace
FishMMO.Database.Npgsql.Entities
Assembly
FishMMO-DB.dll

A request to remove an account's second factor after a waiting period, for a player who has lost both their authenticator and their recovery codes.

public class TwoFactorResetRequestEntity
Inheritance
TwoFactorResetRequestEntity
Inherited Members

Remarks

The delay is the security. Whoever asks has, at most, the password; if asking removed the second factor straight away, the second factor would protect against nothing a stolen password does not already give. The waiting period is the window in which the real owner — who still has their authenticator — signs in normally, and a normal sign-in cancels the request. Staff may shorten the wait once they have verified the player some other way.

Completing a request never satisfies two-factor. It removes the old factor so the account can enrol a new one; the session that completes it has proved the password and nothing more, and must be sent to enrolment, not treated as having passed a second factor.

At most one request per account is pending, enforced by a partial unique index on account_name WHERE status = 0. Asking again returns the existing request unchanged, so repeating the request can neither restart the clock on the owner nor shorten it for an attacker.

No foreign key to accounts, for the reasons given on PasswordResetTokenEntity: accounts are never deleted, and every write here follows a read of the account.

Properties

AccountName

The account, matching accounts.name, stored lowercase.

public string AccountName { get; set; }

Property Value

string

EffectiveUtc

When it may be completed.

public DateTime EffectiveUtc { get; set; }

Property Value

DateTime

Remarks

Only ever moved earlier, and only by staff. Pushing it later is a cancel followed by a new request, so the longer wait starts from a request the history can show.

ID

Surrogate key.

public long ID { get; set; }

Property Value

long

RequestedIp

Client address that asked, for abuse investigation.

public string? RequestedIp { get; set; }

Property Value

string

RequestedUtc

When it was asked for.

public DateTime RequestedUtc { get; set; }

Property Value

DateTime

ResolvedBy

Who cancelled or completed it: a staff account, or the account itself.

public string? ResolvedBy { get; set; }

Property Value

string

ResolvedUtc

When it was cancelled or completed.

public DateTime? ResolvedUtc { get; set; }

Property Value

DateTime?

ShortenedBy

The staff account that last brought it forward.

public string? ShortenedBy { get; set; }

Property Value

string

ShortenedUtc

When staff last brought the effective time forward.

public DateTime? ShortenedUtc { get; set; }

Property Value

DateTime?

StaffReason

Why staff last shortened or cancelled it.

public string? StaffReason { get; set; }

Property Value

string

Status

Where the request has got to.

public TwoFactorResetStatus Status { get; set; }

Property Value

TwoFactorResetStatus

Version

PostgreSQL xmin concurrency token. Staff shortening a request while the player signs in and cancels it is two writers on one row.

public uint Version { get; set; }

Property Value

uint