Background

The sample scripts use some software components(jq, base64, etc.) that might not be possible to install or use (due to system restrictions or variations in their features or way of executing).

For those cases, and if docker is available, the easiest solution would be to generate a docker image with the required components, and then set up a sh script to allow the execution of the WIPO sourced scripts.

Docker image

The following dockerfile, would allow to generate a simple image with the most common software tools that are needed for the execution of the scripts. 

dockerfile
FROM debian
# Install required system packages
RUN apt-get update
RUN apt-get -y install  gnupg vim ssh
RUN apt-get -y install git openssh-client less iproute2 procps apt-transport-https coreutils curl gnupg-agent software-properties-common lsb-release jq xxd 

# additional packages in case newman is required to execute the tests
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get -y install nodejs

Optional components

The node package is only required in case you would want to execute "Newman" locally, to automate the testing of the DAS API.

To build the image (locally), you can use the following command:

 docker build ./ -t <image_name>

Execute scripts

The following "docker run" commands, will launch the docker container then execute the script and finally output the expected results.

There is no need to ssh inside the container

To generate the asymmetric keys:

See e.1.- Generation of (ES256) asymmetric keys for more info.

Execute docker as:

docker run -it --rm -v $(pwd):/src <image_name> sh /src/scripts/private_key_jwt_generation.sh output_folder private_es256_key_name.pem public_es256_key_name.pem

To retrieve the authentication tocken:

See e.2.- Sample authentication script (using JWT private key)

Execute docker as:

docker run -it --rm -v $(pwd):/src <image_name> sh /src/scripts/jwt-ipo-das.sh authorized_client_id {path_to_private_pem_key}/private_es256_key_name.pem




  • No labels