# Resetter Registration

In the case that a client loses all of her private keys, the client has an option to **reset** her DID, i.e. revoking all of her key series in that DID, with the approval of her resetters.

To invoke the reset operation, a list of resetters must be first registered with `did_register_resetters` operation. All  resetters must also approve the registration themselves before the reset operation becomes available. In the resetter registration request, the client must specify (i) each resetter's *DID address* ("`did_address`") and (ii) each resetter's *vote power* (`"vote_power"`) and (iii) the acceptable number of combined voting powers (`"acceptable_votes"`) for approving the reset operation.

Note that the client cannot submit a request to reset her DID herself. To reset all key series in a DID, the client must contact each of her resetters individually and ask them to submit a reset request.  For the reset operation to be complete, the combined voting powers from all resetters must surpass the threshold.

{% hint style="info" %}
For a set resetters to become active, all resetters in the set must respond and approve the registration.&#x20;
{% endhint %}

## did\_register\_resetters

<mark style="color:green;">`POST`</mark> `https://test-network.finema.co/did/<did_address>/reset`

#### Request Body

| Name              | Type   | Description                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------- |
| operation         | string | The method's name that is "did\_register\_resetters".                                                   |
| did\_address      | string | The DID address.                                                                                        |
| current\_key      | string | The current public key in the series. It is used to verify the request's signature.                     |
| next\_key\_hash   | string | The SHA-256 hash of the next public key in the series.                                                  |
| resetters         | string | The list of the resetters. Each element in the list contains a resetter's DID address and voting power. |
| acceptable\_votes | string | The voting power threshold in a resetter consensus.                                                     |
| nonce             | number | The request nonce.                                                                                      |

{% tabs %}
{% tab title="200 The operation name and DID address (\<did\_address>) will be given as the response." %}

```
{
    "operation": "did_register_resetters",
    "did_address": "did:idin:afb7ba88c76edbda55c344b70ae0cf0556d770ec256820d7185000de395391b5",
}
```

{% endtab %}

{% tab title="422 " %}

```
{
    "errors": [
        {
           "status": 422,
            "title": "Invalid Attribute",
            "detail": "the server cannot process the request",
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Example Message and Request

```
{
    "operation": "did_register_resetters",
   "did_address": "did:idin:afb7ba88c76edbda55c344b70ae0cf0556d770ec256820d7185000de395391b5",
    "current_key": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEbqWnPp+v+a3QfT1rpJUfMxma0oFY\nc/7m07qWVr7Uf158jIon0teT+SHt9ChncFDVbUp5fYo+EDRjiEnygkpxJQ==\n-----END PUBLIC KEY-----",
    "next_key_hash": "665267b5854fd3a81b97850c696eb745448f57e53c93e05edb2e8b85e377dde5",
    "resetters": [
        {
            "did_address": "did:idin:14cd5183f730afe756a5e43f794c66ea72bd0e90095dfa84a46631371f3c3a88",
            "vote_power": 1
        },
        {
            "did_address": "did:idin:048ca23c7edfb71655cb6dc5628c8327816edfcb377963deecba3a3e91e5f8b0",
            "vote_power": 2
        },
        {
            "did_address": "did:idin:37c92d742a1fac53588a4d7918d12275540c0cacd19b56036f6720dcf7da0b2c",
            "vote_power": 3
        }
    ],
    "acceptable_votes": 3,
    "nonce": 3
}
```

The above message can then be encoded in Base64 and signed with ECDSA to obtain the following HTTP request

```
{
    "message": "eyJyZXNldHRlcnMiOiBbeyJkaWRfYWRkcmVzcyI6ICJkaWQ6aWRpbjoxNGNkNTE4M2Y3MzBhZmU3NTZhNWU0M2Y3OTRjNjZlYTcyYmQwZTkwMDk1ZGZhODRhNDY2MzEzNzFmM2MzYTg4IiwgInZvdGVfcG93ZXIiOiAxfSwgeyJkaWRfYWRkcmVzcyI6ICJkaWQ6aWRpbjowNDhjYTIzYzdlZGZiNzE2NTVjYjZkYzU2MjhjODMyNzgxNmVkZmNiMzc3OTYzZGVlY2JhM2EzZTkxZTVmOGIwIiwgInZvdGVfcG93ZXIiOiAyfSwgeyJkaWRfYWRkcmVzcyI6ICJkaWQ6aWRpbjozN2M5MmQ3NDJhMWZhYzUzNTg4YTRkNzkxOGQxMjI3NTU0MGMwY2FjZDE5YjU2MDM2ZjY3MjBkY2Y3ZGEwYjJjIiwgInZvdGVfcG93ZXIiOiAzfV0sICJhY2NlcHRhYmxlX3ZvdGVzIjogMywgImN1cnJlbnRfa2V5IjogIi0tLS0tQkVHSU4gUFVCTElDIE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