Home

APIs/controllers/discoveryController.js

APIs/controllers/echoController.js

This file is responsible for handling the requests of the echo api. It contains the functions:

  1. echo_get : The handler of the GET request in the echo API.
  2. echo_post : The handler of the POST request in the echo API.
Source:

APIs/controllers/institutionsController.js

This file is responsible for handling the requests of the institutions api. It contains the functions:

  1. institutions_get : The handler of the GET request in the institutions API.
  2. institutions_post : The handler of the POST request in the institutions API.
Source:

APIs/routes.js

In this file the proper functions are registered to the methods of each API.

Source:

app.js

This is the main file. It starts the update process of the database and the HTTPS server.

Source:

connector/auth.js

In this file is written the core functionality for authenticating the incoming requests. It contains the function:

  1. authenticate : The main function that used to authenticate the incoming requests.
Source:

connector/db.js

In this file are written the queries to the database. It contains the functions:

  1. cert_hash_exist : Given a certificate hash, returns the number of records maching the certificate hash.
  2. rsa_hash_exist : Given a RSA hash, returns the number of records maching the RSA hash.
  3. get_rsa_key_from_hash : Given a RSA hash, returns the macthed RSA keys or empty Array.
  4. get_heis_from_rsa_hash : Given a RSA hash, returns an Array with the HEI-IDs or empty Array.
  5. get_heis_from_cert_hash : Given a certificate hash, returns an Array with the HEI-IDs or empty Array.
  6. insert_request_id : Inserts the request_id in the database.
  7. request_id_exist : Checks if the request id exists in the database.
Source:

connector/helpers/auth_helper.js

This file is a helper for the auth.js file. It contains the functions:

  1. sha_256_digest : This function is used to create the SHA-256 of the request body in base64 encoding.
  2. get_keyid_from_header : This function is used to extract the keyID from the http-signature header.
Source:

connector/helpers/respond_helper.js

This file is a helper for the respond.js and the method_not_allowed.js files. It contains the functions:

  1. create_x_request_sign_header : This function is used to create the x-request-signature header.
  2. create_digest_header : This function is used to create the digest header.
Source:

connector/method_not_allowed.js

In this file is written the handler for the incoming requests that use inappropriate method. It contains the function:

  1. method_not_allowed : The use of this function is used to create the response to the methods that are not allowed.
Source:

connector/respond.js

This file is responsible for constucting the response of the server. It contains the function:

  1. respond : The use of this function is used to create the response for the incoming requests.
Source:

updater/downloader.js

This file is responsible for fetching and maintaining a catalogue copy from the registry, localy. It contains the functions:

  1. create_backup : Creates a backup of the catalogue.xml.
  2. catalogue_exists : Checks if the catalogue.xml exists.
  3. get_from_backup : If the catalogue.xml does not exist get data from catalogue
  4. get_catalogue : Fetches the catalogue from the regisrty.
Source:

updater/logger.js

This file is responsible for creating a logger object, that is used to keep log files. It contains the functions:

  1. create_logger : Creates the logger object.
Source:

updater/updater.js

This file is responsible for keeping the database up-to-date, based on the last fetched catalogue from the registry. It contains the functions:

  1. clear_db : Clears the database collections.
  2. createDB : Used to update the database.
  3. init_db : This function is used to invoke the update process every INTERVAL seconds.
Source: