Library of Ashurbanipal · MELEK

Library›Posting help›Building a MELEK Signup Page

Building a MELEK Signup Page

Building a MELEK signup page lets any website create MELEK accounts for its visitors. The page generates the account's keys in the visitor's browser, and only the public keys leave it. This is how the signup page at melek.salon/account/signup.html works, and its source is public. See also Building a MELEK Front End.

How a MELEK account is made

A MELEK account is a name plus four public keys (owner, active, posting and memo). Creating it is a chain operation signed by an existing account, the creator. MELEK uses the free, resource-credit model: the creator signs claim_account (fee 0.000 MELEK, paid in Resource Credits) and then create_claimed_account with the new name and keys.

Step 1: generate the keys in the browser

  1. Generate a long random master password in the browser.
  2. Derive each role's private key the standard Graphene way: sha256(name + role + password), for the roles owner, active, posting and memo.
  3. Turn each private key into its public key, written with the prefix MELEK.

Never send the password or a private key to any server. melek.salon's own code for this is in site/alpha/account/graphene-keys.mjs in the HinduTempleCoins/Bot repository.

Step 2: make sure the visitor has kept the keys

A MELEK password cannot be reset by anyone. Before creating the account, melek.salon makes the visitor download or copy the keys and type the master password back in. Do the same: an account whose keys were never saved is lost the moment the tab closes.

Step 3: create the account

There are two ways.

Use the melek.salon signup service. Send the name and the four public keys:

POST https://melek.salon/faucet/create with the JSON body {"name": "...", "ownerPub": "MELEK...", "activePub": "MELEK...", "postingPub": "MELEK...", "memoPub": "MELEK..."}.

It allows requests from any website. The answer is {"ok": true, ...}, or {"ok": false, "reason": "..."} with one of: invalid-account-name, name-taken, rate-limited (five accounts per visitor address a day) or an error. GET https://melek.salon/faucet/health reports whether the service is up.

Be your own creator. Any MELEK account with enough MELEK Power can create accounts. From your server, sign claim_account and then create_claimed_account with your creator account's active key, which stays on your server. Add your own limits so one visitor cannot use up your resource credits.

Step 4: check it worked

Read the account back from the chain: condenser_api.get_accounts with the new name at https://melek.salon/rpc. Show the visitor their name, remind them to keep the password, and send them to sign in. See Signing In to Post on MELEK.

Account names

3 to 16 characters: lowercase letters, numbers and hyphens, starting with a letter. Check a name is free with get_accounts before generating keys.

Chain values

See also

Sources

Coverage

How to build a signup page that creates MELEK accounts, using the melek.salon service or your own creator account.

Videos

Watch videos about Building a MELEK Signup Page on YouTube ↗

Videos are found by the article's title on YouTube and are not reviewed or endorsed by the Library.

Filed under  Posting help