keyless/pepper/README.md
This directory contains the Pepper Service, and a Rust-based Pepper Client example.
Note: if you are a frontend developer, you can use the Pepper Client example as a reference to understand how to interact with the Pepper Service API.
The simplest way to run the Pepper Service and Pepper Client locally are to use the example scripts in this repository. Follow the steps below to get started.
First, start the Pepper Service using the commands below:
cd keyless/pepper/scripts
./start-pepper-service.sh
This will start the Pepper Service on port 8000, in local development mode, meaning that it
will use a temporary file-based database and connect to the Aptos devnet to fetch on-chain
resources.
Note: the Pepper Service will run in the foreground, so you will need to keep this terminal window open while you interact with the Pepper Service.
Next, you can run the Pepper Client example to interact with the Pepper Service:
cd keyless/pepper/scripts
./start-pepper-client.sh
This will start the Pepper Client, which makes several API calls to the Pepper Service to demonstrate example user flows.
Note: the Pepper Client is an interactive console program, so you will need to follow the instructions to manually complete a session with the Pepper Service.
If you wish to test the Pepper Service with a Firestore database, you can do so by running a Firestore emulator locally. The steps below will guide you through the process.
To run the Pepper Service with a Firestore database, this requires:
Both of these steps can be done via the GCP console. Once you have completed these steps, you can proceed.
First, you will need to start the Firestore emulator locally. This can be done by running:
cd keyless/pepper/scripts
./start-firestore-emulator.sh 8081
The script arguments are:
<FIRESTORE_PORT>: The port where the Firestore emulator will run.The command above will start the Firestore emulator on port 8081. The emulator will run in the foreground, so you
will need to keep this terminal window open while you work with the Pepper Service.
If you ever need to stop the Firestore emulator, you can do so by running:
cd keyless/pepper/scripts
./stop-firestore-emulator.sh 8081
The script arguments are:
<FIRESTORE_PORT>: The port where the existing Firestore emulator is already running.When stopping the Firestore emulator, be sure to enter the correct port number.
Next, you can start the Pepper Service with Firestore by running:
cd keyless/pepper/scripts
./start-pepper-service-with-firestore.sh <FIRESTORE_EMULATOR_HOST> <GOOGLE_APPLICATION_CREDENTIALS> <GOOGLE_PROJECT_ID>
The script arguments are:
<FIRESTORE_EMULATOR_HOST>: The host and port of the Firestore emulator, e.g., http://localhost:8081.<GOOGLE_APPLICATION_CREDENTIALS>: The path to your service account credential file (in JSON format).<GOOGLE_PROJECT_ID>: The ID of your GCP project.To run the example client, execute the following commands:
cd keyless/pepper/scripts
./start-pepper-client-with-firestore.sh <FIRESTORE_EMULATOR_HOST> <GOOGLE_APPLICATION_CREDENTIALS> <PEPPER_SERVICE_URL> <GOOGLE_PROJECT_ID> <FIRESTORE_DATABASE_ID>"
The script arguments are:
<FIRESTORE_EMULATOR_HOST>: The host and port of the Firestore emulator, e.g., http://localhost:8081.<GOOGLE_APPLICATION_CREDENTIALS>: The path to your service account credential file (in JSON format).<PEPPER_SERVICE_URL>: The host and port of the Pepper Service, e.g., http://localhost:8000.<GOOGLE_PROJECT_ID>: The ID of your GCP project.<FIRESTORE_DATABASE_ID>: The ID of your Firestore database.