epi-workspace bundles all the necessary dependencies for building and running EPI SSApps in a single package.
For more details about what a workspace is check out the template-workspace.
- Installation
- Running
- Prepare & release a new stable version of the workspace
- Build Android APK
- Build iOS ipa
- Configuring ApiHub for Messages Mapping Engine Middleware
- DFM reporting functionality
- ACF SSApps instalation and test
- BDNS conventions
In order to use the workspace, we need to follow a list of steps presented below.
$ git clone https://github.com/PharmaLedger-IMI/epi-workspace.git
After the repository was cloned, you must install all the dependencies.
$ cd epi-workspace
#Important: If you plan to contribute to the project and/or dependencies please use npm run dev-install cmd instead
$ npm install
Note: this command might take quite some time depending on your internet connection and you machine processing power.
While in the epi-workspace folder run:
$ npm run server
At the end of this command you get something similar to:
Open a new console inside epi-workspace folder and run:
# Note: Run this in a new console inside "epi-workspace" folder
$ npm run build-all
To run the application launch your browser (preferably Chrome) in Incognito mode and access the http://localhost:8080 link.
Demiurge is intended to be a management platform. Important flows include the user authorization flow for the Enterprise Wallet users. Once a user create an Enterprise wallet he gets authorized to use the features only after an admin Demiurge user adds the enterprise wallet DID into the ePI write group.
The first Demiurge wallet will be the "super admin". This first user will be able to make other users admin by adding them into the ePI admin group.
- As Demiurge admin open your Demiurge wallet
- Navigate to the Groups page
- Select ePI admin group
- Input the user DID that needs admin priviledges
- Click add button.
- As Demiurge admin open your Demiurge wallet
- Navigate to the Groups page
- Select ePI write group
- Input the user DID that needs to be authorized to used the Enterprise wallet
- Click add button.
Enterprise wallet allows creation of Products and Batches.
Username: test1234
Email: test@test.test
Company: Test Company Inc
Password: Test1234567890#
Once the Enterprise wallet opens will prompt a message to share your DID information with an admin in order get authorized and gain access to the features.
Now you will be able to add Products (and leaflets for it) and create Batches of products and other ePI cool features.
This is the part a normal user will see. The part that will be used to scan barcodes on drug's packages.
Steps:
- start from a fresh install of the workspace.
git clone https://github.com/PharmaLedger-IMI/epi-workspace
cd epi-workspace
- ensure that env variable called DEV is set to true in env.json file
{ "PSK_TMP_WORKING_DIR": "tmp", "PSK_CONFIG_LOCATION": "../apihub-root/external-volume/config", "DEV": true }
- run the installation process of the workspace
npm install
- run the server and build the ssapps and wallets
npm run server
npm run build-all
- verify that the builds are successfully and the ssapps are functioning properly
- execute the freeze command
npm run freeze
- verify the output of freeze command and check for errors. If any, correct them and run again the freeze command.
- commit the new version of the octopus.json file obtained with the freeze command.
Steps
- Install all dependencies for this workspace
#freeze
npm install
#or development
npm run dev-install
- Bind Android repository into workspace
npm run install-mobile
- Launch API HUB
npm run server
- Prepare the Node files that will be packed into the Android app
#In another tab / console
npm run build-mobile
- Have /mobile/scan-app/android/local.properties file with the following content
# Change the value to your SDK path
sdk.dir=/home/username/Android/Sdk
- Build the APK
npm run build-android-apk
This concludes the steps to build the APK file.
Note: The .apk file should be in folder
mobile/scan-app/android/app/build/outputs/apk/release
- Install all dependencies for this workspace (if needed)
#freeze
npm install
#or development
npm run dev-install
- Bind iOS repository into workspace
npm run install-mobile
If the installation script fails check if you have carthage tool. If you don't have it then install it and rerun the install-mobile step.
brew install carthage
- Launch API HUB
npm run server
- Prepare the Node files that will be packed into the iOS app
npm run build-mobile
- Go to xCode
Open mobile/scan-app/ios/PSSmartWalletNativeLayer.xcworkspace file with XCode
- Setup the signing & capabilities
select pskNodeServer from the explorer right pane > into the signing & capabilities tab change the team and bundleID (hint for dev team: if forgot the easy way to find it is in the default bundleId is in firebase/settings ios-epi)
- Ensure that both targets are set for iOS 12
select one by one the psKNodeServer and PSSmartWalletNativeLayer and in general tab check/set version 12 to deployment info section
- Choose target device
before build select the type (phone or any ios) depending on your needs
- Build, Archive and Distribute
Before running the build - archive - distribute process ensure that the certificate that you will use contains necessary device ids. (hint: https://developer.apple.com/documentation/xcode/distributing-your-app-to-registered-devices)
The purpose of the EPI Mapping Engine is to process various types of messages received from an external source in order to create/update various types of DSUs.
- Find the domain configuration in
/apihub-root/external-volume/config/domains/<domainName.json>
and modify or add thebricksDomain
property with wallet subdomain value.
- Restart the server.
Now the ApiHub Mapping Engine is configured for processing messages from external sources through
/mappingEngine/:domainName"
endpoint via the PUT HTTP verb.
In order to test the mapping engine functionality it can be used any API testing tools.
Make a request like this PUT http://localhost:8080/mappingEngine/<domainName>
Set header token on the request with the value of the WalletSSI copied from the Holder page after the Issuer-Holder credentials workflow completed.
Please note that the content should be on the request body as a raw string containing the JSON message. JSON messages examples could be downloaded from the import section page in the wallet app.
A 200 response status means that the message was successfully sent to the mapping engine, and the processing of the message has started. This middleware makes use of a message queuing service, which groups and digests messages all at once. Grouping is important because some messages could depend on other messages (e.g. a batch could not be created until a product is first created and anchored in blockchain), and the service is queuing messages until a previous group is digested. As a result, a 200 HTTP status code does not imply that the message was successfully digested. The Import page in the wallet app displays the import's details and status.
A 500 response status means that the domain might not be well configured, or the message is malformed. The message will not appear in the Import page in the wallet app.
DFM stands for Detecting Falsified Medicines (formerly Anti-Counterfeiting Data Collaboration) - Use-Case 4 of PharmaLedger
- Bind DFM repository into workspace
npm run install-dfm
- Launch DFM servers npm run dfm-server
For the moment, DelayV and TrueMed Auth SSApps are added into epi-workspace to facilitate the integration of the use case 4 results. In order to accomplish this, special commands where created like npm run install-acf and npm run build-acf-ssapps.
- Start by installing the Mobile Trust Loaders
npm run install-mobile
- Bind DFM repository into workspace
npm run install-dfm
- Install ACF SSApps
npm run install-acf-ssapps
-
Update the apiKeys and secrets in the Auth SSApps
-
Edit the mobile/config/scan-app/ios/PSKNodeServer/PSKNodeServer/nodejsProject/apihub-root/external-volume/config/bdns.hosts file in order to point the epi domain to your desired location. For example, durring local development if your iPhone and developer machine are into the same network you can use your local machine ip as url into the mobile bdns config file.
-
Build ACDC Authentication SSApps
npm run build-acf-ssapps
In the console there should be the KeySSI's of the Auth SSApps. We need them in order to properly create and edit batches in order to activate the Authentication feature for them.
Keep in mind that also for testing purpose and fast development the Auth SSApps are also included into the epi mobile build if the npm run install-acf-ssaps was executed.
- Test ACF Authentication SSApps into mobile build
npm run install-mobile
npm run build-mobile
npm run build-acf-ssapps
- Follow the rest of the standard steps to obtain the mobile build
git clone http://github.com/pharmaledger-imi/epi-workspace
cd epi-workspace
npm run dev-install
npm run install-mobile
npm run install-dfm
npm run install-acf-ssapps
#until here we have everything that we need installed into our workspace
#before continuing please make necessary corrections for apikeys and mobile bdns file
npm run build-mobile
npm run build-acf-ssapps
#at this point you can switch to Xcode and build your native app
#now we need to return to workspace and prepare the dsu-fabric wallet and create some products to test
npm run build-all
Domain: sandbox.epi.companyShortName
Subdomain: sandbox.epi.companyShortName
Vault: sandbox.vault.companyShortName
Domain: sandbox.epi.companyShortName
Subdomain: sandbox.epi.companyShortName
Vault: sandbox.vault.companyShortName
Domain: dev.epi
Subdomain: dev.epi.companyShortName
Vault: dev.vault.companyShortName
Domain: qa.epi
Subdomain: qa.epi.companyShortName
Vault: qa.vault.companyShortName
Domain: epi
Subdomain: epi.companyShortName
Vault: vault.companyShortName
Domain: demo.epi.pla
Subdomain: demo.epi.pla
Vault: demo.vault.pla
Domain: quality.epi.pla
Subdomain: quality.epi.pla
Vault: quality.vault.pla