Contents

registerAlias#

Initiate the registration of an alias with a taldir (directory) service. The alias (for example an e-mail address or a phone number) is associated with a target URI, typically the wallet’s mailbox URI. Unless the registration is already paid for, the service sends a challenge to the alias; the registration is completed with completeRegisterAlias once the user has received the challenge.

Request:

The request arguments are a TaldirRegistrationRequest object.

Response:

On success, the result is a TaldirRegistrationResponse: an empty object if a challenge was sent to the alias, or a TaldirAlreadyPaidResponse object if the registration already exists and is still paid for.

Side effects:

Requests the alias registration at the taldir service over the network; the service may require payment for the registration.

Expected errors:

The caller can handle the following errors inline: WALLET_ALIAS_REGISTRATION_FAILED.

interface TaldirRegistrationRequest {
  // Alias to register, in alias-type-specific format.
  alias: string;

  // Type of the alias, e.g. "email" or "sms".
  aliasType: string;

  // Target URI to associate with the alias.
  targetUri: string;

  // Base URL of the taldir service.
  taldirBaseUrl: string;

  // For how long the registration should last or be extended.
  duration: RelativeTime;
}
type TaldirRegistrationResponse =
  | TaldirAlreadyPaidResponse
  | EmptyObject;
interface TaldirAlreadyPaidResponse {
  // The remaining duration for which this registration is still
  // paid for.
  valid_for: RelativeTime;
}