# Recovery

We store the wallet in the `localStorage` of a browser. The recovery use-case is when a user logs in from another machine and wants to have the same account they had previously, or when the `localStorage` is cleared for some reason.

There are mainly two steps for recovery:

1. Setup phase: carried out when the user is logged in and authenticated. This stage entails altering the state of the zero wallet to be recoverable. Recovery can be applied only if this phase was performed.
2. Initiate phase: done when the user wants to log in. If a user needs to log into a zero wallet, he/she must have already setup the recovery (previous step) on that wallet.

All recovery mechanism support multiple accounts.&#x20;

For now, we only support Google Drive recovery (we will launch Metamask recovery soon).&#x20;

## Google Drive Recovery

1. Setup phase: the private key of the zero-wallet is exported to the user's Google Drive under the user’s control. A new folder is created on Google Drive and files of zero wallets' private keys are stored under that folder.
2. Initiate phase: we will try to detect the user’s private key stored on Google Drive. Then we will import this private key to create the corresponding zero wallet.

**NOTE:** The private keys of the zero wallets will not at any point be stored anywhere other than the user's Google Drive.

## Metamask Recovery

Let’s assume a user now has a randomly generated authenticated wallet (call it *OLD\_WALLET*) associated with some SCW.

1. Setup phase: The user is asked to sign a message from Metamask. The signed message is then used to create a new random wallet (call it *NEW\_WALLET*). Then we change the owner of the SCW from *OLD\_WALLET* to *NEW\_WALLET*.
2. Initiate phase: Similar steps to the setup. The user is asked to sign a message from Metamask. The signed message is then used to create a new random wallet. This wallet should be a valid zero wallet which is (if setup was already carried out) associated with the same SCW.


---

# 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.zerowallet.org/recovery.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.
