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
accountPhoneNumberThe account.
cancellationTokenCancellationTokenCancels 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
deviceNamestringName shown for the linked device in the Signal app.
cancellationTokenCancellationTokenCancels the request.
Returns
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
deviceNamestringName shown for the linked device in the Signal app.
cancellationTokenCancellationTokenCancels the request.
Returns
Exceptions
- ArgumentException
deviceNameis empty.
ListAsync(CancellationToken)
Lists the accounts registered or linked in the container (GET /v1/accounts).
Task<IReadOnlyList<PhoneNumber>> ListAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
pinstringThe new PIN.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task
A task that completes when the PIN was set.
Exceptions
- ArgumentException
pinis 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
accountPhoneNumberThe account.
nicknamestringThe requested name, without discriminator.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task<UsernameAssignment>
The assigned username and share link, or null if the API did not report them.
Exceptions
- ArgumentException
nicknameis 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
accountPhoneNumberThe rate-limited account.
challengeTokenstringThe challenge token from the rate-limit error.
captchastringThe solved captcha (
signalcaptcha://…).cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
settingsAccountSettingsThe settings to change.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task
A task that completes when the settings were updated.