Install the Issuance Service
This article sets up an instance of the credential issuance service. If you have not run either service before, work through the quickstart first — it brings up the issuer, the verifier 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. - 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
issuer itself, with its signing key, display name, logo and API keys, is created once the service runs, in
Create the tenant. This example is a complete working configuration:
{
"port": 8079, // (1)!
"baseUrl": "http://localhost:8079", // (2)!
"database": { // (3)!
"persistenceUnitName": "model",
"driver": "org.postgresql.Driver",
"url": "jdbc:postgresql://postgres:5432/issuer",
"user": "postgres",
"password": "postgres"
},
"admin": { // (4)!
"apiKeys": {
"admin-api-key": "Local development"
}
}
}
- REST endpoint port. Required.
- The address this service advertises to wallets. Required — a wallet uses it to fetch the credential offer, metadata and the credential itself, 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 and logo 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 issuer/conf/signing-key
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
-keyout issuer/conf/signing-key/issuer-localhost.key \
-out issuer/conf/signing-key/issuer-localhost.pem \
-days 365 -subj "/CN=localhost" -sha256
This is a self-signed pair, which is right for local work. Facing verifiers you do not operate, you need a certificate chaining to a root they trust — see Signing certificates.
Run it
Run the image with your configuration directory mounted:
docker run -d \
-p 8079:8079 \
-w /app \
-v "$(pwd)/issuer/conf:/app/conf:ro" \
registry.gitlab.com/secata/platform/did/release/issuer-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:8079/openapi for the API specification, where you can try the
endpoints directly.
Create the tenant
Create the issuer with the admin endpoints, giving it the signing certificate and a name wallets may show:
jq -n \
--rawfile key issuer/conf/signing-key/issuer-localhost.key \
--rawfile certificate issuer/conf/signing-key/issuer-localhost.pem \
'{
code: "example",
display_name: "Credential Issuer",
signing: { private_key: $key, certificate_chain: [$certificate] }
}' |
curl -X POST http://localhost:8079/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:8079/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. For the complete list, including the callback and the status list, see the configuration reference.
The optional authorization server
The issuance protocol requires an OAuth 2.0 authorization server, so that credentials are only issued to authorized holders. That server must support the pre-authorized code flow.
If you do not want to run your own, leave authorization_server out of the tenant's settings. When the field is
absent the issuance service acts as the authorization server itself, which is what the example above does. To
point it at your own server instead, add it to the tenant's settings when you create it:
"authorization_server": {
"base_url": "https://auth.example.org"
}
Setting this changes how issuances start: you obtain a pre-authorized code from your own server and pass it in. See OAuth 2.0 integration.
What's next?
The issuance service is now able to talk to wallets and issue credentials.
- Create a credential configuration. The service cannot issue anything until you declare what it is allowed to issue.
- Start an issuance. What your own application calls, and when.
- Receive the issued credential. Configure a callback so your application is told when a credential has been delivered, instead of polling.
Troubleshooting
Startup, connection and request failures are collected in Troubleshooting.