Puumerkki is a library used for signing PDF documents. It can read and modify pdfs to prepare them for signing, calculate the hash for signing, create the signature container and embed it to the pdf. Signing is done by an external service, usually with an ID card from DVV together with a card reader and its software.
See dev-src/clj/puumerkki/main.clj
for example usages
Energiatodistuspalvelu uses this library. Check out the code from energiatodistus-pdf namespace
In order to execute tests in JVM, install Leigingen and run:
lein test
JS-tests are run with Shadow-cljs. Install npm, run npm install
and execute tests:
npm test
There is a test server, that can be used as an example when developing signature solutions.
The server can be used to sign certificates together with the card reader software.
- Install the card reader software https://dvv.fi/en/card-reader-software
- Visit https://localhost:53952/ and accept non-trusted certificate.
- Download root certificates of citizen certificates from DVV by running:
./download-dvv-trusted-certificates.sh
- Start the server:
lein with-profile dev run -t citizen-certificate-roots.pem
- Start a reverse proxy to serve the content over https:
On macOS and on Windows (not tested):
docker run -p 443:443 caddy caddy reverse-proxy --from localhost:443 --to http://host.docker.internal:3000
On Linux (not tested):
docker run -p 443:443 caddy caddy reverse-proxy --from localhost:443 --to http://localhost:3000
- Access the server at https://localhost. Accept the self-signed certificate.
Snapshots are published to Clojars automatically by GitHub Actions when a commit is pushed to master.
Releases are published to Clojars manually by developers.
- Create a Clojars account
- Get verified on Clojars group by following the instructions here.
- Create a deploy token by following instructions in the wiki.
- Set
CLOJARS_USERNAME
andCLOJARS_TOKEN
environment variables.
There are three release tasks to choose from: release-current
, release-minor
, and release-major
.
The first one promotes the current snapshot to a release, and the other two increment the version number accordingly before doing the same.
After the release, a new snapshot version with patch number incremented is set.
NOTE: Why not use the default Leiningen release task or set desired :release-tasks in project.clj?
Version should be incremented after releasing, so that new snapshots have a new version. However, it's not known at the time of releasing whether the next release requires incrementing minor or major version. The current assumption is that most of the time patch release is enough. Therefore, patch version is incremented after releasing, and minor/major version is incremented only when needed when creating a new release. With the default tasks this wouldn't be possible, as every other patch would be skipped if version was incremented every time before release.
To release a new version, follow these steps:
- Switch to a new branch:
git switch -c release
- Update
CHANGELOG.md
. Commit your changes. - Check whether there are any changes after the last release that warrant incrementing either minor (new features) or major (breaking changes) version.
Choose release task accordingly and run it:
lein release-current
,lein release-minor
, orlein release-major
- Push the branch with tags:
git push --follow-tags --set-upstream origin release
- Create a pull request and merge it to master.