I start working on simulating a resolver using sReadSSIs. To run my attempt, follow the same instructions than for the hello world DSU.
Then:
# Step 1: Go inside [tutorial-valentin]
cd tutorial-valentin
# Step 2: Run the app
node mainAlt.js
tutorial-workspace is a basic workspace based on template-workplace and contains the following applications:
- a simple todo application - A simple todo application. Included from ssapp-minimal-app
- a profile application - An application that display the "profile" of an user. Included from profile-ssapp-prototype
- a simple "Hello World! DSU" - a small tutorial aiming to show how you can use DSU to save and load data.
Notes:
- A workspace is a project with many other libraries and configuration loaded.
- We will use ${workSpaceRoot} for the workspace folder
- An included application means that the original code is in a separate repo but got included here (either by hard copy or brought in by git's clone commands)
You need the following software installed on your machine in order to continue the this guide
- Install or update Node (including NPM) to version 12.14.0.
- Have Python 2.7 as default Python on your system. (If you have multiple version of Python installed and have Linux or Mac the instruction section bellow named "Multiple Python under Linux and Mac" ) This version is needed because NodeJS up to version 13 uses gyp writen in Python 2.7.
- Install or update Git
- Have a C/C++ toolchain, like GCC, with support for C++14 minimum. (Instructions in the section belllow named "Install C/C++ toolchain")
- Install node-gyp
Open ~/.bash_profile file.
nano ~/.bash_profile
Then put the alias as follows:
alias python='python2'
Now save the file and then run the ~/.bash_profile file.
source ~/.bash_profile
Now, you can use python2 by typing python.
python --version
Python 2.7.xx
Windows
Run "as administrator" the following command:
npm install --global --production windows-build-tools
Depending on Windows version may be required to run the above command with --vs2015 argument. For other args plese check Windows Build Tools npm page
CentOS
sudo yum install centos-release-scl-rh
sudo yum --enablerepo=centos-sclo-rh-testing install devtoolset-7-gcc*
echo "source scl_source enable devtoolset-7" >> ~/.bashrc
source ~/.bashrc
Ubuntu
sudo apt-get install gcc g++ make
MacOS
Install Xcode. You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Locations (or by running xcode-select --install in your Terminal)
The only commands you need to run in the tutorial-workspace workspace are:
# Step 1: Clone tutorial-workspace from GitHub
git clone https://github.com/PrivateSky/tutorial-workspace.git
# Step 2: Go inside the [tutorial-workspace] folder
cd tutorial-workspace
# Step 3: Brings all dependencies needed
$ npm install
# Step 4: Launch the Node js
$ npm run server
# Step 5: Note: Run this in a separate console! Scans all applications and wallet it finds in the configuration and tries to run the build script for each one
$ npm run build-all
After all this steps are done, you can access the application by going to http://localhost:8080/tutorial/loader/
This tutorial sub project helps you understand how you can work directly with DSUs.
The code for this tutorial is in [helloworld-dsu] folder. It consist of only one file main.js
To FIRST run it simply run the steps found in the [Installation] section above then:
# Step 1: Go inside [helloworld-dsu]
cd helloworld-dsu
# Step 2: Run the app
node main.js
You should get something like:
....
Data written succesfully! :)
KeySSI identifier: BBudGH6ySHG6GUHN8ogNrTWbZHtTCUHnMvP5Un8LrUFrdb2yDx3pbh85gMdLgEAoex6rX86B9dY5Fscjx77uMcfmh
Data load succesfully! :) Hello world!
....
This tutorial sub project helps you understand how you can create a simple SSAPP from scratch.
The code for this tutorial will end up in [helloworld-ssapp] folder.
To FIRST run it simply run the steps found in the [Installation] section above then follow these steps:
# 1. Clone the repo
git clone https://github.com/PrivateSky/ssapp-template.git helloworld-ssapp
# 2. Go inside it, remove .git folder and bring dependecies
cd helloworld-ssapp && rm -rf .git && npm install
# 3. Go one folder up
cd ..
# 4. Bind newly helloworld-ssapp to existing tutorial workspace
npm run bind-app tutorial helloworld-ssapp
# 5. Go inside helloworld-ssapp
cd helloworld-ssapp
# 6. Build it
npm run build
Add a new named hello.html inside ${workSpaceRoot}/web-server/tutorial/wallet-template/pages/
# 7. Create file
touch ../web-server/tutorial/wallet-template/pages/hello.html
and add the following content to it:
<psk-container controller-name="WalletSsappLauncher" data-app-name="helloworld-ssapp">
<psk-ssapp key-ssi="@keySSI"></psk-ssapp>
</psk-container>
Update ${workSpaceRoot}/web-server/tutorial/wallet-template/menu.json
# 8. Edit menu.json
nano ../web-server/tutorial/wallet-template/menu.json
add:
{
"name" : "Hello"
}
to pages sections so in the end should look like:
{
//other lines...
"pages": [
{
"name": "Minimal ssapp"
},
{
"name" : "Hello"
}
]
}
This will inform the containing tutorial workspace to use it as menu entry.
Note : Watch out not to miss the comma (,) before the newly added section.
Edit ${workSpaceRoot}/helloworld-ssapp/code/pages/home.html
# 9. Edit home file
nano ./code/pages/home.html
and replace with:
<psk-page title="Hello World SSApp!">
<psk-card title="Hello World SSApp!">
<p>Jean-Luc Picard: Engage!</p>
</psk-card>
</psk-page>
You need to rebuild the workspace to use newly added SSApp
#10 Go into the workspace root folder
cd ..
# 11. Rebuild the workspace
npm run build-all
Open http://localhost:8080/tutorial/loader/ in a new Incognito Chrome browser (Ctr+Shift+N)