irmago
is an IRMA implementation in Go. It contains multiple libraries and applications:
- The commandline tool
irma
, which contains an IRMA server; subcommands for manipulating IRMA schemes, generating IRMA issuer public/private keypairs, performing test IRMA sessions on the command line; and more. - The Go library
irmaserver
providing a HTTP server that handles IRMA session with the IRMA mobile app, and functions for starting and managing IRMA sessions. - The root package
irma
contains generic IRMA functionality used by all other components below, such as parsing IRMA schemes, parsing IRMA metadata attributes, and structs representing messages of the IRMA protocol. - The Go package
irmaclient
is a library that serves as the client in the IRMA protocol; it can receive and disclose IRMA attributes and store and read them from storage. It also implements the keyshare protocol and handles registering to keyshare servers. The IRMA mobile app usesirmaclient
.
Technical documentation of all components of irmago
and more can be found at https://irma.app/docs.
git clone https://github.com/privacybydesign/irmago
irmago
and its subpackages use Go modules for their dependencies. The go
command will automatically download dependencies when needed.
To install the irma
command line tool:
go install ./irma
Some of the unit tests connect to locally running external services, namely PostgreSQL and an SMTP server running at port 1025. These need to be up and running before these tests can be executed. They can be installed as follows.
-
Install using e.g.
brew install postgresql
, orapt-get install postgresql
, or via another package manager of your OS. -
Prepare the database and user:
create database test; create user testuser with encrypted password 'testpassword'; grant all privileges on database test to testuser;
This only needs to be done once. No table or rows need to be created; the unit tests do this themselves.
For the SMTP server you can use MailHog (see also their installation instructions):
- Install using
brew install mailhog
orgo get github.com/mailhog/MailHog
. - Run using
MailHog
, or~/go/bin/MailHog
, depending on your setup.
For the unit tests it only matters that the SMTP server itself is running and accepts emails, but MailHog additionally comes with a webinterface showing incoming emails. By default this runs at http://localhost:8025.
After installing PostgreSQL and MailHog, the tests can be run using:
go test -p 1 ./...
- The option
./...
makes sure all tests are run. You can also limit the number of tests by only running the tests from a single directory or even from a single file, for example only running all tests in the directory./internal/sessiontest
. When you only want to execute one single test, for example theTestDisclosureSession
test, you can do this by adding the option-run TestDisclosureSession
. - The option
-p 1
is necessary to prevent parallel execution of tests. Most tests use file manipulation and therefore tests can interfere.
If installing PostgreSQL or MailHog is not an option for you, then you can exclude all tests that use those by additionally passing --tags=local_tests
:
go test -p 1 --tags=local_tests ./...