Skip to content
Meshline
SDK 1.1.0 · TypeView source on GitHub

Developer guide · API index

Members on this page

Meshline.Sdk

Meshline.Components

ProfileManager Class

Resolves, verifies, caches, and publishes account profiles.

public sealed class ProfileManager : Meshline.Components.ClientComponent

Inheritance System.Object → ClientComponent → ProfileManager

Exceptions

System.ArgumentNullException
The network context in options is null. The options argument is null.

System.ArgumentException
The configured account identifier is invalid.

System.NotSupportedException
The configured account identifier uses an unsupported account namespace.

Constructors

ProfileManager(ClientOptions, DatabaseOptions, RelayClientPool, AccountManager, IDeviceSigner) Constructor

Resolves, verifies, caches, and publishes account profiles.

public ProfileManager(Meshline.Models.Client.ClientOptions options, Meshline.Storage.DatabaseOptions databaseOptions, Meshline.Transport.RelayClientPool relayClients, Meshline.Components.AccountManager accountManager, Meshline.Interactions.IDeviceSigner deviceSigner);

Parameters

options ClientOptions

The network and account configuration for this component.

databaseOptions DatabaseOptions

The SQLite database configuration; create its parent directory and apply migrations before initialization.

relayClients RelayClientPool

The shared relay pool. The application owns it and must dispose it after all dependent components.

accountManager AccountManager

The account component sharing this network, account, database, and relay pool.

deviceSigner IDeviceSigner

The device signer used for profile signatures and device-authenticated relay access.

Exceptions

System.ArgumentNullException
The network context in options is null. The options argument is null.

System.ArgumentException
The configured account identifier is invalid.

System.NotSupportedException
The configured account identifier uses an unsupported account namespace.

Properties

ProfileManager.AccountId Property

The account's CAIP-10 identifier.

public string AccountId { get; }

Property Value

System.String

ProfileManager.Profile Property

The current account's profile, or null when it is unavailable.

public Meshline.Models.Protocol.AccountProfile? Profile { get; }

Property Value

AccountProfile

Methods

ProfileManager.GetProfileAsync(string, CancellationToken) Method

Resolves and verifies an account profile and updates its local cache.

public System.Threading.Tasks.Task<Meshline.Models.Protocol.AccountProfile?> GetProfileAsync(string? accountId=null, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

accountId System.String

The target account identifier, or null for the current account.

cancellationToken System.Threading.CancellationToken

A token that can cancel the operation.

Returns

System.Threading.Tasks.Task<AccountProfile>
The resolved profile, or null when no profile is available.

Exceptions

System.OperationCanceledException
The operation is canceled through cancellationToken, a component or relay lifetime ends, or a relay request times out.

System.InvalidOperationException
This component or a required component has not completed initialization. The account has no resolvable home route or a usable device-authenticated session cannot be established.

System.ObjectDisposedException
This component, a required component, or the shared relay pool has been disposed.

System.Net.Http.HttpRequestException
Relay discovery, authentication, or the HTTP request fails at the transport layer.

RelayException
The relay rejects the operation with a structured protocol error that is not handled by this method.

System.IO.InvalidDataException
Relay evidence or returned state is missing, inconsistent, or fails protocol validation.

System.Text.Json.JsonException
A stored or received protocol document cannot be serialized or deserialized.

System.Text.DecoderFallbackException
A relay response contains bytes that are not valid UTF-8.

Microsoft.Data.Sqlite.SqliteException
The SQLite database cannot be opened or a database command fails, for example because the schema is not migrated or the file is locked.

Microsoft.EntityFrameworkCore.DbUpdateException
Persisting local changes fails, including database constraint or optimistic-concurrency failures.

System.Security.Cryptography.CryptographicException
The local device key cannot be validated against its certificate, or cryptographic signing or verification fails.

System.ArgumentException
The requested account identifier is invalid.

System.NotSupportedException
The requested account uses an unsupported namespace.

ProfileManager.PublishProfileAsync(AccountProfile, CancellationToken) Method

Republishes the newest available profile for this account, including an optional supplied snapshot.

public System.Threading.Tasks.Task<Meshline.Models.Protocol.AccountProfile?> PublishProfileAsync(Meshline.Models.Protocol.AccountProfile? profile=null, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

profile AccountProfile

An optional profile snapshot for this account to consider alongside cached state.

cancellationToken System.Threading.CancellationToken

A token that can cancel the operation.

Returns

System.Threading.Tasks.Task<AccountProfile>
The republished profile, or null if no profile was available to publish.

Exceptions

System.OperationCanceledException
The operation is canceled through cancellationToken, a component or relay lifetime ends, or a relay request times out.

System.InvalidOperationException
This component or a required component has not completed initialization. The account has no resolvable home route or a usable device-authenticated session cannot be established. A pending profile publication conflicts with the requested content.

System.ObjectDisposedException
This component, a required component, or the shared relay pool has been disposed.

System.Net.Http.HttpRequestException
Relay discovery, authentication, or the HTTP request fails at the transport layer.

RelayException
The relay rejects the operation with a structured protocol error that is not handled by this method.

System.IO.InvalidDataException
Relay evidence or returned state is missing, inconsistent, or fails protocol validation.

System.Text.Json.JsonException
A stored or received protocol document cannot be serialized or deserialized.

System.Text.DecoderFallbackException
A relay response contains bytes that are not valid UTF-8.

Microsoft.Data.Sqlite.SqliteException
The SQLite database cannot be opened or a database command fails, for example because the schema is not migrated or the file is locked.

Microsoft.EntityFrameworkCore.DbUpdateException
Persisting local changes fails, including database constraint or optimistic-concurrency failures.

System.Security.Cryptography.CryptographicException
The local device key cannot be validated against its certificate, or cryptographic signing or verification fails.

System.ArgumentException
The profile belongs to another account, a required public-discovery field is deleted, or the resulting profile fails validation.

ProfileManager.UpdateProfileAsync(ProfileUpdate, CancellationToken) Method

Applies profile field updates, signs the result with the local device, and publishes it.

public System.Threading.Tasks.Task<Meshline.Models.Protocol.AccountProfile> UpdateProfileAsync(Meshline.Models.Client.ProfileUpdate update, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

update ProfileUpdate

The field assignments and deletions to apply; unspecified fields remain unchanged.

cancellationToken System.Threading.CancellationToken

A token that can cancel the operation.

Returns

System.Threading.Tasks.Task<AccountProfile>
The signed profile published after applying the updates.

Exceptions

System.OperationCanceledException
The operation is canceled through cancellationToken, a component or relay lifetime ends, or a relay request times out.

System.InvalidOperationException
This component or a required component has not completed initialization. The account has no resolvable home route or a usable device-authenticated session cannot be established. A pending profile publication conflicts with the requested content.

System.ObjectDisposedException
This component, a required component, or the shared relay pool has been disposed.

System.Net.Http.HttpRequestException
Relay discovery, authentication, or the HTTP request fails at the transport layer.

RelayException
The relay rejects the operation with a structured protocol error that is not handled by this method.

System.IO.InvalidDataException
Relay evidence or returned state is missing, inconsistent, or fails protocol validation.

System.Text.Json.JsonException
A stored or received protocol document cannot be serialized or deserialized.

System.Text.DecoderFallbackException
A relay response contains bytes that are not valid UTF-8.

Microsoft.Data.Sqlite.SqliteException
The SQLite database cannot be opened or a database command fails, for example because the schema is not migrated or the file is locked.

Microsoft.EntityFrameworkCore.DbUpdateException
Persisting local changes fails, including database constraint or optimistic-concurrency failures.

System.Security.Cryptography.CryptographicException
The local device key cannot be validated against its certificate, or cryptographic signing or verification fails.

System.ArgumentException
The profile belongs to another account, a required public-discovery field is deleted, or the resulting profile fails validation.

Events

ProfileManager.ProfileChanged Event

Occurs when the current account's locally known profile changes.

public event EventHandler? ProfileChanged;

Event Type

System.EventHandler