The purpose of the account server is to receive and store messages intended for a client and make them available on demand. The account server speaks SMTP to receive messages, and uses the ATRN functionality to send messages towards the client on a previously established connection.
On account creation, the client must also create an account on the account server, using JSON-RPC calls.
The account name and password are autogenerated by the account server and returned when the account is created. Accounts have a maximum defined storage space assigned, and they expire after not being checked (and mails fetched) for a period of time.
On creation, the account server returns:
- URI of account server for the user's account (hostname, port. smtps://account_server:port/).
- Name of the account (autogenerated, random string).
- Password for account access (autgenerated, random string).
- Expiry time. How long of inactivity will trigger deletion of account contents (not account itself).
- Quota. How much storage has been assigned.
- Used. How much storage is currently used (version 2).
- Messages. Count of unfetched messages (version 2).
- ReferralKey (see below).
An API call to change the account password is made available.
An API call to receive the same data as on account creationg (minus password) is made available.
An API call to purge all messages in the account is made available.
Given a ReferralKey (see below), link this account to the account that created the ReferralKey for purpose of referral tracking/marketing. A ReferralKey can only be linked to a single account.
On account creation the Account Server returns a ReferralKey to the client. The ReferralKey contains the assymetrically encrypted name of the account just created and the date of creation:
Given: AccountName, CreateDate, PubKey (public key of referral system)
nonce := create_random_bytes()
message := JSON_Struct(AccountName, CreateDate)
temp_key_public, temp_key_private := ECC_CreateKey()
encrypted := NACL_Seal(PubKey,temp_key_private,nonce,message)
ReferralKey := nonce | temp_key_public | encrypted
The ReferralKey is sent by the client to the first 10 nyms added to the contact list.
As soon as a client receives a ReferralKey it should make the Link API call to link its own account to the Referral account.
The account server is used to deliver tokens purchased by the client from the official in-App source. Messages from the in-App shop that contain tokens must state what kind of tokens and their respective quantities in an unencrypted header of the message. The account server then uses that information to create an account-total of token types and their quantities to enable profit sharing with referrers.
Important: Only messages from the in-App store are checked for token information, all other senders are ignored.
To communicated tokens within a message, the X-Mute-PurchaseReferral header is used. It contains the token flags and the number of tokens with this flag, followed by other flags. Preceeding the list is the number of entries in the header. The header is then base64encoded:
X-Mute-PurchaseReferral: base64encode(number,token_flag:count[,token_flag:count,...])
The account name in the form X@name.account_server
(see 1.1) is used for
nymaddress creation and delivery of messages.
Only the host part (domain part) of that address is specified
(name.account_server
), the local part (pre @
) is undefined — any value that
meets the standards for email addresses will do.