Are you sure you want to delete this access key?
You can run this example with:
npx promptfoo@latest init --example http-provider-auth-signature-jks
This example demonstrates how to setup authentication with an HTTP provider using JKS (Java KeyStore) certificates for cryptographic signature validation.
npm install
# Generate a self-signed certificate and store it in a JKS keystore
keytool -genkeypair -alias client -keyalg RSA -keysize 2048 \
-keystore clientkeystore.jks -storepass password -keypass password \
-dname "CN=PromptFoo Test, OU=Test, O=Test, L=Test, ST=Test, C=US" \
-validity 365
npm start
The example uses the following JKS configuration:
./clientkeystore.jks
password
client
password
Important: In production, use environment variables for passwords and secure key management practices.
If you're unsure about the alias or contents of your JKS keystore, you can inspect it using:
keytool -list -keystore clientkeystore.jks -storepass password
This will show all aliases in the keystore. Update the keyAlias
in both app.js
and promptfooconfig.yaml
to match your actual alias.
# Set the keystore password via environment variable
export PROMPTFOO_JKS_PASSWORD=password
# Run test cases
promptfoo eval --no-cache
# View results
promptfoo view
Alternatively, you can uncomment the keystorePassword
line in promptfooconfig.yaml
and run directly:
# Run test cases (with password in config)
promptfoo eval --no-cache
IMPORTANT: Be sure to run with --no-cache
when testing! Otherwise it may cache responses from good signatures.
signature
, timestamp
, client-id
)This example demonstrates using environment variables for sensitive data:
PROMPTFOO_JKS_PASSWORD
- Password for the JKS keystore (alternative to config keystorePassword)KEYSTORE_PASSWORD
- Password for the JKS keystore (used by server)KEY_PASSWORD
- Password for the private key (used by server)You can provide the keystore password in two ways:
Via environment variable (recommended for production):
export PROMPTFOO_JKS_PASSWORD=password
promptfoo eval
Via configuration file:
signatureAuth:
type: jks
keystorePath: ./clientkeystore.jks
keystorePassword: password # Direct config
If both are provided, the configuration file value takes precedence, with the environment variable serving as a fallback.
Press p or to see the previous file or, n or to see the next file
Browsing data directories saved to S3 is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with AWS S3!
Are you sure you want to delete this access key?
Browsing data directories saved to Google Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Google Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to Azure Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Azure Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to S3 compatible storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with your S3 compatible storage!
Are you sure you want to delete this access key?