Install the Verification Service
This article sets up an instance of the credential verification service. If you have not run either service before, work through the quickstart first — it brings up the verifier, the issuer and their database together and covers the prerequisites once.
Requirements
- Docker with the Compose plugin.
- OpenSSL, to generate the signing certificate.
- curl and
jq, to create the tenant. - The certificate of the issuer whose credentials you verify — for our issuer, the one generated in Install the issuance service.
- Access to Partisia's container registry:
docker login registry.gitlab.com. Please book a call with us to arrange it. - A PostgreSQL database the service can reach, with a database created for it. See Database.
Configure the service
The service reads one JSON file, server.json, with the settings of the server. It starts without a tenant: the
verifier itself, with its signing key, client metadata, issuer trust anchors and API keys, is created once the
service runs, in Create the tenant. This example is a complete working configuration:
{
"port": 8081, // (1)!
"baseUrl": "http://localhost:8081", // (2)!
"database": { // (3)!
"persistenceUnitName": "model",
"driver": "org.postgresql.Driver",
"url": "jdbc:postgresql://postgres:5432/verifier",
"user": "postgres",
"password": "postgres"
},
"admin": { // (4)!
"apiKeys": {
"admin-api-key": "Local development"
}
}
}
- REST endpoint port. Required.
- The address this service advertises to wallets. Required — the wallet uses it to fetch the authorization request and to submit the presentation, so it must be an address the wallet can reach.
- PostgreSQL connection. Required.
- For a full explanation of this field see Database.
- Admin keys, for creating the tenant and changing its API keys, logo and issuer trust anchors while the service
runs. Required. The JSON key is the token; the value is a label. Replace
admin-api-keybefore anyone else can reach the service.- For a full explanation of this field see Admin endpoints.
server.json is read on every start. For the complete list of settings, see the
configuration reference.
Generate the signing certificate
mkdir -p verifier/conf/signing-key
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
-keyout verifier/conf/signing-key/verifier-localhost.key \
-out verifier/conf/signing-key/verifier-localhost.pem \
-days 365 -subj "/CN=localhost" -sha256
This certificate is more than a formality on the verifier: its hash is the verifier's OID4VP client_id, and a
wallet validates it before showing the holder a consent screen. A self-signed pair works with a wallet you
configure yourself; wallets you do not operate will refuse it. See Trust model.
Run it
Run the image with your configuration directory mounted:
docker run -d \
-p 8081:8081 \
-w /app \
-v "$(pwd)/verifier/conf:/app/conf:ro" \
registry.gitlab.com/secata/platform/did/release/verifier-backend:latest
The issuer and verifier are released independently but tested as pairs, so pull both at the same time. See Going to production for recording which version you run.
In practice you will run this alongside the database with Compose; the quickstart has a
complete docker-compose.yml.
The log prints Starting server when the service is ready. Navigate to
http://localhost:8081/openapi for the API specification, where you can try the
endpoints directly.
Create the tenant
Create the verifier with the admin endpoints, giving it the signing certificate, the name wallets show the holder, and the issuers it trusts:
jq -n \
--rawfile key verifier/conf/signing-key/verifier-localhost.key \
--rawfile certificate verifier/conf/signing-key/verifier-localhost.pem \
--rawfile issuer issuer/conf/signing-key/issuer-localhost.pem \
'{
code: "example",
client_name: "Verifier",
signing: { private_key: $key, certificate_chain: [$certificate] },
issuer_trust_anchors: { "issuer-localhost": $issuer }
}' |
curl -X POST http://localhost:8081/admin/tenants \
-H 'Authorization: Bearer admin-api-key' \
-H 'Content-Type: application/json' \
--data-binary @-
The service answers 201. Then add an API key for your application:
curl -X POST http://localhost:8081/admin/tenants/example/api-keys \
-H 'Authorization: Bearer admin-api-key' \
-H 'Content-Type: application/json' \
-d '{ "client": "My application" }'
The answer, {"id": "…", "api_key": "…"}, is the only time the key is shown. Store it where your application
reads it from: every call it makes to the service carries it, and returns 401 without it. See
API keys.
A logo is optional; set one with
PUT /admin/tenants/example/logo.
Every other tenant setting is optional — the results callback, AltID. For the complete list see the configuration reference.
Trust your issuer
issuer_trust_anchors holds the root certificates of the issuers you accept. The example above uses the
certificate from Install the issuance service. For an
issuer whose certificate chains to a certificate authority, use that authority's root instead. Use the certificate
(.pem), never the key.
Do not leave it out. Without the certificate, every credential your issuer signs is rejected. Add, replace and remove anchors later through the admin endpoints. See Issuer trust anchors.
Check it works
Create a verification query, then start a session from it, with the API key from Create the tenant:
curl -X POST http://localhost:8081/presentation/oid4vp/new-session \
-H 'Authorization: Bearer <your API key>' \
-H 'Content-Type: application/json' \
-d '{ "verification_query_id": "<your query id>" }'
A successful call returns a session_id and a request_uri. Confirm the session exists with
GET /presentation/oid4vp/status/{session_id}, which should report VERIFICATION_STARTED.
A 400 Bad Request here means verification_query_id was missing or names a query that does not exist — a session
cannot be started without one.
What's next?
The verification service is now able to talk to wallets and verify the presentations they send.
- Create a verification query. State which credentials and claims you are asking for. Required before any session can start.
- Request a presentation. What your own application calls, and when.
- Receive verified data. Configure a callback so results are pushed to your application instead of polled.
- Issuer trust anchors. Decide which issuers this verifier accepts.
Troubleshooting
Startup, connection and request failures are collected in Troubleshooting.