All project setup was tested only in Linux, Apple and Win may or may not require adjustments.
To test and run this assessment we need Docker, Traefik and bindings for accredify.local and docs.accredify.local
in the hosts file.
If you already have traefik up and running - all you need to do is either make sure you use traefik-public network or
modify the docker-compose.yml file in this repository to use your traefik network name.
If you don't have traefik up and running yet - all you need to do is to make sure ports 80 and 443 are unoccupied on
the host machine and run the command make traefik-install, which will create docker network named traefik-public and
run the traefik from the provided traefik.docker-compose.yml file. Don't forget to remove that network later if you
don't need it by docker network rm traefik-public.
We need to edit hosts file to point needed hosts locally:
echo '127.0.0.1 accredify.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 docs.accredify.local' | sudo tee -a /etc/hosts
Run make install and wait for project to be ready.
Tests can be executed by make test, and coverage can be checked by make coverage
OpenAPI should be up and running at http://docs.accredify.local with pre-seeded user with token
KG32wC3f8SkoaOYaN7aiN1LIzL8sGNoL to try api out through the interface. Also sample file sample.json is provided
in the repository root for convenience. The only difference with the technical assessment json from the link above is
signature, since i couldn't reproduce it by the provided algorithm.
I prefer to keep things simple, so main separation of concerns i did here is isolating verification logic itself inside
a VerificationService, since it doesn't matter how will we receive data for verification, it's only concern is it's
verification. This logic is the core for the process and this service can be modernized a lot - like contents type
recognition, dynamic verifications resolving, etc. Verification logic itself for now is extracted into Validators,
which can be selected to be applied to the contents type in needed order. For file verification, which was the main
task, i've created FileVerificationService and separated file contents extraction logic to allow for easy expansion
of supported file formats in the future. I've put a minimum amount of effort into integration with google dns api part
to keep things simple - it doesn't even have it own tests with mocks. Integrations is a complex subject sometimes, so
i decided not to put focus on it here.