# Account registration

The **PKSA** can register one or more accounts and do it either by issuing one command with multiple accounts or by issuing one command per account.

The **PKSA** sends the following message to the **HAS**:

### register\_req

```js
{
    cmd: "register_req",
    app: string,
    accounts: [ 
        {
            name: string
            pok: string
        }
        {{,...}}
    ]
}
```

{% tabs %}
{% tab title="Properties" %}

* **`app`**: can contain any value identifying the **PKSA**
* **`accounts`** an array that can contain one or more `account` objects
  * **`name`**: the Hive account name
  * **`pok`**: the current [UNIX time](https://en.wikipedia.org/wiki/Unix_time) encrypted using the account private key and the HAS server public key (see [Proof of Key](/has-for-wallets-pksa/proof-of-key.md))
    {% endtab %}
    {% endtabs %}

The [Proof Of Key](/has-for-wallets-pksa/proof-of-key.md) sent to the **HAS** for each account enables it to verify that the **PKSA** has access to the private keys of the account it wants to register.&#x20;

This prevents malicious actors from creating a **PKSA**, registering accounts for which they do not have private keys, and sniffing requests relayed by the **HAS**.

{% hint style="info" %}
The `register_req` command can be issued multiple times. If an account is already registered, the command will be ignored.
{% endhint %}

{% hint style="danger" %}
When multiple accounts are registered at the same time, the HAS server will check that **ALL** provided accounts exist on the Hive blockchain and return an error if **any** of them does not exist and cannot be registered.
{% endhint %}

For each successfully registered account, the **HAS** server will reply with the following message:

### register\_ack

```
{
    cmd: "register_ack",
    account: string
}
```

{% tabs %}
{% tab title="Properties" %}

* **`account`**: the account that has been successfully registered
  {% endtab %}
  {% endtabs %}

**Timing**

The account registration can be performed before or after the HIVE applications will issue related authentication or transaction requests.

a) If the **PKSA** registration occurred before the requests are issued, it will receive those requests immediately.

b) If no **PKSA** is registered when the **HAS** receives authentication or transaction requests, it will queue them, waiting for a **PKSA** to register. If no **PKSA** registers before they expire, requests are discarded.

In both cases, (a) and (b), the **APP** will be notified of the requests' pending or expired status.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hiveauth.com/has-for-wallets-pksa/account-registration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
