Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
typeflat

Requirements

Due to variations in how jq, base64 and other tools are compiled (under o.s. different than linux), an option is to execute the scripts under docker.

Create docker image

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. First create the docker file for the image (with all the dependencies), we could use the following dockerfile

Code Block
languageyml
titledockerfile
linenumberstrue
collapsetrue
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


Note
titleOptional 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 can then be created using (locally), you can use the following command:

Code Block
 docker build ./ -t <image_name>

Execute scripts

To generate the asymmetric keys:

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

Execute docker as:

Code Block
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 a.2.- Sample authentication script (using JWT private key)

Execute # execute docker as:

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