Skip to main content

Key Store

The Expo Open OTA server requires several keys and secrets to interact with the Expo API and your CDN.

The Key store is a module that manages how these keys are accessed by the server.

You can use 3 different key stores:

  1. Local Key Store: Keys are stored in a directory on the server as *.pem files.
  2. AWS Secrets Manager: Keys are stored in AWS Secrets Manager and securely accessed by the server.
  3. Environment Variables: Keys are stored as environment variables in base64 format.
note

The environment variables required for key store configuration are listed below. You can set them in a .env file in the root of the project or keep them in a safe place to prepare for deployment.

Keys

The following keys are used by the server:

  1. Expo signing key pairs: Used to sign and verify the updates returned by the server to expo-updates. The key pair consists of a public and private key and are required by the server.
  2. Cloudfront private key: Used to sign the Cloudfront URLs for the assets. This key is optional and only required if you are using Cloudfront as your CDN.

Expo signing certificate

To generate expo signing key pairs :

  1. On your terminal, go to the root directory of your expo project.
  2. Run the following command:
cd ./my-expo-project
npx eoas generate-certs

Three files will be generated in the certs directory:

  1. private-key.pem: The private key used to sign the updates.

  2. public-key.pem: The public key used to verify the updates. Those two keys are used by the server to sign and verify the updates.

  3. certificate.pem: Used by your expo client to verify the updates. It should be committed to your expo project.

Cloudfront private key

note

This key is only required if you are using Cloudfront as your CDN.

Please refer to this section on how to generate a Cloudfront private key.

Key Store Configuration

You will have to encode the keys in base64 format and set the following environment variables:

Encode keys
echo -n "your-private-key" | base64

Then set the following environment variables:

.env
KEYS_STORAGE_TYPE=environment
PUBLIC_EXPO_KEY_B64=base64-encoded-public-key
PRIVATE_EXPO_KEY_B64=base64-encoded-private-key
PRIVATE_CLOUDFRONT_KEY_B64=base64-encoded-cloudfront-private-key