<commit_before># invite-api

<img src="https://mail.lavaboom.com/img/Lavaboom-logo.svg" align="right" width="300px" />

Golang API of the Lavaboom's invitation app.

Allows inviting users without having them create an account in the main
frontend app. Adds a new flow to the user registration cycle, in which user
receives an invitation code that they can later use to create an account, while
being compatible with the existing account setup wizard.

## Requirements

 - RethinkDB

## How it works

An invitation token is a document in `invites` table of the database defined by
`rethinkdb_name`. If the invitation doesn't contain an `account_id` field, then
user is able to create an account with any free username / unused email. If the
`account_id` is set, then `name` and `alt_email` of that account will be
enforced on the user. After consuming a token, it will be removed by the
backend of the setup wizard.

## Creating a new invitation

Unfortunately a tool for generating invites is not ready to be opensourced, so
in order to create a new token, you need to insert a document into the
`invites` table. Example:

```json
{
    "id": "1q2w3e4r5t6y7u8i9o0p",         // 20 characters-long token
    "account_id": "<KEY>", // ID of the account of lavab/api<commit_msg>Changed json to js in README.md and made the logo smaller<commit_after># invite-api

<img src="https://mail.lavaboom.com/img/Lavaboom-logo.svg" align="right" width="200px" />

Golang API of the Lavaboom's invitation app.

Allows inviting users without having them create an account in the main
frontend app. Adds a new flow to the user registration cycle, in which user
receives an invitation code that they can later use to create an account, while
being compatible with the existing account setup wizard.

## Requirements

 - RethinkDB

## How it works

An invitation token is a document in `invites` table of the database defined by
`rethinkdb_name`. If the invitation doesn't contain an `account_id` field, then
user is able to create an account with any free username / unused email. If the
`account_id` is set, then `name` and `alt_email` of that account will be
enforced on the user. After consuming a token, it will be removed by the
backend of the setup wizard.

## Creating a new invitation

Unfortunately a tool for generating invites is not ready to be opensourced, so
in order to create a new token, you need to insert a document into the
`invites` table. Example:

```javascript
{
    "id": "<PASSWORD>",         // 20 characters-long token
    "account_id": "<KEY>", // ID of the account of lavab/api
{'fraction_non_alphanumeric': 0.07065637065637066, 'fraction_numerical': 0.007722007722007722, 'mean_word_length': 4.140873015873016, 'pattern_counts': {'":': 4, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6140843', 'n_tokens_mistral': 754, 'n_tokens_neox': 719, 'n_words': 379}