# Class DirectoryClaimStore | EchoHub Documentation
Persists and exposes the EchoHubSpace directory claim — the opaque token issued on first registration and the row's stable ServerId. Also surfaces ephemeral registration status (success/failure code, conflicting hosts) for operator-facing endpoints. Persistence uses atomic write (tmp + rename). Treat the file contents as a secret.

# Class DirectoryClaimStore

Namespace
  EchoHub.Server.Services

Assembly
  EchoHub.Server.dll

Persists and exposes the EchoHubSpace directory claim — the opaque token issued on first registration and the row's stable `ServerId`. Also surfaces ephemeral registration status (success/failure code, conflicting hosts) for operator-facing endpoints.

Persistence uses atomic write (tmp + rename). Treat the file contents as a secret.

    public sealed class DirectoryClaimStore

Inheritance
  object
  DirectoryClaimStore

Inherited Members
  object.GetType()
  object.ToString()
  object.Equals(object)
  object.Equals(object, object)
  object.ReferenceEquals(object, object)
  object.GetHashCode()

## Constructors

### DirectoryClaimStore(IConfiguration, ILogger<DirectoryClaimStore>)

    public DirectoryClaimStore(IConfiguration configuration, ILogger<DirectoryClaimStore> logger)

#### Parameters

`configuration` IConfiguration
`logger` ILogger<DirectoryClaimStore>

## Properties

### ClaimToken

    public string? ClaimToken { get; }

#### Property Value

string

### FilePath

    public string FilePath { get; }

#### Property Value

string

### ServerId

    public Guid? ServerId { get; }

#### Property Value

Guid?

### Status

    public RegistrationStatus Status { get; }

#### Property Value

RegistrationStatus

## Methods

### SaveClaimAsync(string, Guid, CancellationToken)

Persist a freshly-issued claim token alongside the server's stable ServerId. Called exactly once per row's lifetime — on first claim. Atomic on-disk swap.

    public Task SaveClaimAsync(string claimToken, Guid serverId, CancellationToken ct = default)

#### Parameters

`claimToken` string
`serverId` Guid
`ct` CancellationToken

#### Returns

Task

### SetFailure(string, string[]?)

    public void SetFailure(string errorCode, string[]? conflictingHosts)

#### Parameters

`errorCode` string
`conflictingHosts` string[]

### SetSuccess(Guid)

    public void SetSuccess(Guid serverId)

#### Parameters

`serverId` Guid

### UpdateServerIdAsync(Guid, CancellationToken)

Update only the ServerId — used when re-registering with an existing token (Success path, hub returns ServerId again but no fresh token). No-op if the value is unchanged.

    public Task UpdateServerIdAsync(Guid serverId, CancellationToken ct = default)

#### Parameters

`serverId` Guid
`ct` CancellationToken

#### Returns

Task