# Account Creation and Checkout flow

### Account Creation

<figure><img src="/files/lmkFfATh8PtAiobsCrs5" alt=""><figcaption></figcaption></figure>

When creating and account, Alice needs to compute a secret that will be used to control the account.\
The secret is used to compute a commitment which is a poseidon hash of the secret.

The secret is then encrypted once with a user supplied password and then the cipher text is encrypted again with a Public Key that belongs to DebitLlama. \
\
When the smart contract is called to create the account, the encrypted secret is saved along with the commitment.

### Checkout flow

<figure><img src="/files/sWZU2vMf5TXiLGATDrGZ" alt=""><figcaption></figcaption></figure>

When Alice navigates to the checkout page first she needs to log in.

Pass key authentication is optional for now, it's active by default if an authenticator device is added.

After the identity of Alice is verified the debitLlama service will decrypt the encrypted cipher with it's private key and forward it to Alice. Alice needs to use her password to decrypt the final cipher to reveal the secret.

The secret is used to compute a zkProof using a commitment-reveal scheme and it contains the parameters of the subscription which are immutable.\
The zero-knowledge proof is passed to the server, while the secret is deleted from the browser's memory.<br>

The proof is picked up by the relayer who will submit the transaction on-behalf of alice to call the smart contract and relay the payments to the merchant, Bob.

### Subscription Flow

<figure><img src="/files/jCaNwTtIlY4w9dP13aUq" alt=""><figcaption></figcaption></figure>

The subscription only requires the ZKSnark and will be automatically completed, no more interaction required from the users as long as the wallet balance covers the payments.


---

# 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://debitllama.gitbook.io/debitllama/account-creation-and-checkout-flow.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.
