Table of Contents

Interface IAccountService

Namespace
Signal.Application.Abstractions
Assembly
Signal.Application.dll

Lists accounts and links new devices.

public interface IAccountService

Methods

DeleteUsernameAsync(PhoneNumber, CancellationToken)

Removes the account's username (DELETE /v1/accounts/{number}/username).

Task DeleteUsernameAsync(PhoneNumber account, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the username was removed.

GetLinkQrCodeAsync(string, CancellationToken)

Gets a PNG QR code for linking the container as a secondary device of an existing Signal account (GET /v1/qrcodelink). Scan it in the Signal app under "Linked devices".

Task<byte[]> GetLinkQrCodeAsync(string deviceName, CancellationToken cancellationToken = default)

Parameters

deviceName string

Name shown for the linked device in the Signal app.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<byte[]>

The PNG image bytes.

GetLinkUriAsync(string, CancellationToken)

Gets the raw device link URI (sgnl://linkdevice?…) for linking the container as a secondary device (GET /v1/qrcodelink/raw). Use it to render your own QR code instead of GetLinkQrCodeAsync(string, CancellationToken).

Task<string> GetLinkUriAsync(string deviceName, CancellationToken cancellationToken = default)

Parameters

deviceName string

Name shown for the linked device in the Signal app.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<string>

The device link URI.

Exceptions

ArgumentException

deviceName is empty.

ListAsync(CancellationToken)

Lists the accounts registered or linked in the container (GET /v1/accounts).

Task<IReadOnlyList<PhoneNumber>> ListAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels the request.

Returns

Task<IReadOnlyList<PhoneNumber>>

The account phone numbers.

RemovePinAsync(PhoneNumber, CancellationToken)

Removes the registration lock PIN (DELETE /v1/accounts/{number}/pin).

Task RemovePinAsync(PhoneNumber account, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the PIN was removed.

SetPinAsync(PhoneNumber, string, CancellationToken)

Sets the registration lock PIN (POST /v1/accounts/{number}/pin). The PIN is then required to register the number again (see IRegistrationService.VerifyAsync).

Task SetPinAsync(PhoneNumber account, string pin, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

pin string

The new PIN.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the PIN was set.

Exceptions

ArgumentException

pin is empty.

SetUsernameAsync(PhoneNumber, string, CancellationToken)

Sets the account's username (POST /v1/accounts/{number}/username). Signal appends a numeric discriminator, so requesting alice results in e.g. alice.42.

Task<UsernameAssignment?> SetUsernameAsync(PhoneNumber account, string nickname, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

nickname string

The requested name, without discriminator.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<UsernameAssignment>

The assigned username and share link, or null if the API did not report them.

Exceptions

ArgumentException

nickname is empty.

SignalApiException

The name is invalid or unavailable.

SubmitRateLimitChallengeAsync(PhoneNumber, string, string, CancellationToken)

Lifts a rate limit imposed by Signal by submitting a solved captcha (POST /v1/accounts/{number}/rate-limit-challenge).

Task SubmitRateLimitChallengeAsync(PhoneNumber account, string challengeToken, string captcha, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The rate-limited account.

challengeToken string

The challenge token from the rate-limit error.

captcha string

The solved captcha (signalcaptcha://…).

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the challenge was accepted.

Remarks

When sending fails with a rate-limit error, Signal provides a challenge token. Solve the captcha at https://signalcaptchas.org/challenge/generate.html and submit both.

Exceptions

ArgumentException

A token or captcha is empty.

UpdateSettingsAsync(PhoneNumber, AccountSettings, CancellationToken)

Updates privacy settings (PUT /v1/accounts/{number}/settings). null values are left unchanged.

Task UpdateSettingsAsync(PhoneNumber account, AccountSettings settings, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

settings AccountSettings

The settings to change.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the settings were updated.