### API description 1. Receives json payload to be verified. 1. Finds and removes Base64 encoded KSI signature from json (attribute `ksiSignature`). 1. Deserializes the signature. 1. Hashes the remaining json using algorithm specified in the signature. 1. Verifies the hash against the signature and signature against trust anchor. 1. If signature is invalid then returns error message. 1. Tries to extend the signature. 1. Returns the original payload, if the signature is extended then replaces the original signature with extended signature. Json schema is not defined, i.e no restrictions on allowed attributes. Before verification json file is formatted by removing all whitespaces and new lines. ### Endpoint POST /verify Body - json to be verified ### Responses 1. Verification succeeds 1. Status code: 200 1. Body: verified json 1. Verification fails 1. Status code: 400 1. Body: error message ``` { "errorCode": "GEN-01", "errorMessage": "Wrong document" } ``` 1. Bad input 1. Status code: 400 1. Body: error message ``` { "errorMessage": "Input does not contain signature (key 'ksiSignature' is missing)" } ``` ## Running API ### Configuration Sample configuration is provided in `application.properties.sample` For more information see [Spring Documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.files) ### Running the application 1. `docker load < naiades-verifier-.tar.gz` 1. `docker run -v /path/to/conf/:/workspace/config/ -p 8080:8080 guardtime.com/naiades/naiades-verifier:` ### Running the application in the development environment 1. `docker load < naiades-verifier-1.0.1.tar.gz` 1. `docker run --detach -v /home/mandint/verifier/:/workspace/config/ -p 8080:8080 guardtime.com/naiades/naiades-verifier:1.0.1` 1. `docker network connect --ip 172.18.1.22 naiades-platform-poc_default NAME` NAME is the name of the Docker container after its start.