- Run the proxy server:
cargo run -- --config config.toml
- Run the example frontend:
cd examples/siwe-frontend && yarn && yarn start
- Go to http://localhost:8080
You can configure the proxy server via an optional config.toml
file or command-line arguments. If neither is set, built-in defaults are used.
config.toml
example:
bind_address = "0.0.0.0:8080"
upstream_url = "http://validium-sequencer:8545"
cargo run -- --bind-address 127.0.0.1:9000 --upstream-url http://localhost:8545
By default, the server uses config.toml
in the current directory. You can use --config config.toml
to specify a different path.
If not specified, bind_address
defaults to 0.0.0.0:8080
, upstream_url
defaults to http://validium-sequencer:8545
.
Precedence order for configuration is: CLI arguments > config.toml
> defaults.
You can specify one or more admin API tokens via the admin_keys
field in config.toml
:
admin_keys = ["admin-token-1-abcdefg", "admin-token-2-hijklmn"]
Any HTTP request with header
Authorization: Bearer <admin_key>
matching one of these values will receive full admin permissions.
Full: Requests using a valid admin key.
Restricted: Requests with a regular JWT.
None: Requests without any authorization or with invalid authorization.
-
Treat admin keys as sensitive credentials.
-
Rotate admin keys by updating the config and restarting the server.
Used for signing and verifying user JWT tokens.
Each entry under jwt_signer_keys
must have a unique kid
and secret
.
The default_kid
field specifies which key is used to sign new JWTs.
Example:
default_kid = "key-2025-07"
jwt_signer_keys = [
{ kid = "key-2025-07", secret = "supersecret1" },
{ kid = "key-2025-06", secret = "supersecret2" }
]
The jwt_expiry_secs
field sets the lifetime (in seconds) for newly issued JWT tokens.
Example:
jwt_expiry_secs = 3600 # JWTs are valid for 1 hour, timeout is not exact, there is a 60s leeway by default
To rotate JWT signer keys, you can add a new key entry to jwt_signer_keys
, set default_kid
to the new key, and optionally remove old keys.
For a graceful key rotation (phased removal):
-
After switching
default_kid
, keep old keys injwt_signer_keys
(for verification only), so old tokens remain valid until expiry. -
Once all old tokens are expired (i.e., after
jwt_expiry_secs
), you can safely remove the old key entry. -
Old JWTs signed with removed keys will be rejected.
Note: After changing keys, restart the server to reload configuration.
-
Treat JWT signer keys as sensitive credentials.
-
Rotate keys regularly for better security.