Skip to content

Working with Wallet and Entity

cmoralesdiego edited this page Apr 8, 2021 · 1 revision

In order to work with the Alastria ID ecosystem, firstly, it is recommended to have the wallet project, the entity project, the library, examples and Smart contracts in the same folder. It can be put for example on the desktop as shown in the following picture.

Alastria Projects Download

In order to run the projects without any problem, the following components must be installed.

Wallet

First, Nodejs will be installed, whose version to install is 10.X. To do this from the terminal, it can be installed as follows:

sudo apt install curl 
sudo apt install git  
cd ~
curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs

It is also necessary to install the make command, and for this, from the terminal where we have installed nodejs, we execute the following command:

sudo apt install build-essential

Once installed, we will download the project from the repository wallet. For this with a git clone https://github.com/alastria/alastria-wallet.git Once this is done, we execute the following command to install all the necessary node packages in the project: npm install And we already fear it, now it only remains to start the wallet using the following command: npm run start: browser It will ask us if we want to install the necessary plugins, we must accept it. During the startup process, it will ask us a couple of times to say Y or N, we give Y twice, and after waiting about 5-7 minutes, we can start the wallet. Although it appears that we can access through the url: localhost: 8000, we access through the 127.0.0.1:8000,

And we can see the wallet interface: Alastria Wallet Interface

Once the access codes have been entered, it will take us to the following screen:

First screen of the Wallet

For correct operation, it is necessary to install an extension in Firefox to be able to work correctly with CORS. This extension is CORS Everywhere, which can be found at the following url: https://addons.mozilla.org/en-US/firefox/addon/cors-everywhere/

Entity

This part can be considered as the website of a bank, an entity that gives us credentials, or a website where you want to acquire the services of a car to go on vacation where the Sovereign Digital Identity is necessary.

To install the Alastria Identity entity, it is necessary to install Docker and Docker-compose, for this, we carry out the following actions:

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch = amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
sudo usermod -aG docker $ {USER}
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s) - $ (uname -m)" -o / usr / local / bin / docker-compose
sudo chmod + x / usr / local / bin / docker-compose

Once this is done, so that the Docker daemon works correctly without having to use sudo, we restart and once done in the folder where we have everything related to Alastria ID, we execute the following command:

git clone https://github.com/alastria/alastria-identity-entity.git

We go to the develop branch with the git checkout develop command and in it, we start the Docker that is in the project, for this we enter the following command in the console:

docker-compose up -d mongo-express

Opening another terminal window, we go to the entityFrontend directory and execute the npm i command, waiting for all the packages in the package.json to install correctly.

After that, we go into the entityBackend directory, and perform the same action that has been done in the Frontend, with which, on the command line, we execute a npm i again. Within the Frontend part, as has been done in the wallet, the last line of the file must be replaced in the following path:

/home/ubuntu/Desktop/alastria/alastria-wallet/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js

And we replace the following line at the end of the file:

node: false

For this other:

node: {crypto: true, stream: true, buffer: true}

In the backend, we will find a config.json file, which we will have to modify so that the database that we have built with Docker can store the data related to the registration of the credentials, and the url of the Callback that instead of the IP we put localhost. In this file, we find the following content:

{
  "Log": {
    "level": "debug"
  },
  "nodeUrl": {
    "alastria": "http://63.33.206.111/rpc"
  },
  "mongo": {
    "url": "mongodb: // localhost: 27017",
    "dbName": "alastriaUsers",
    "collectionUser": "users",
    "collectionData": "usersObjects",
    "collectionCredentials": "credentials",
    "interceptorElapse": 100
  },
  "didFormat": {
    "network": "quor",
    "networkID": "redT"
  },
  "socketPort": 8080,
  "addressPassword": "Passw0rd",
  "entityDID": "did: wing: quor: redT: 8f440049cbbe5c6bc9eff46369f9091f1d81333c",
  "title": "Legal Expert in Blockchain",
  "netID": "redT",
  "context": [
    "https://www.w3.org/2018/credentials/v1",
    "JWT"
  ],
  "procHash": "H398sjHd ... kldjUYn475n",
  "callbackUrl": "http://34.244.47.233:10010/v1/entity/",
  "procUrl": "https://www.example-company.com/alastria/businessprocess/4583",
  "entityEthAddress": "0x6e62c66dee0604cf35440fc2868f726a2cf1e47c",
  "entityPrivateKey": "a6ad807cab657b88bee4e13a9c784c01e3f26a9c4f10aa5a16684afc973599de",
  "entityPublicKey": "0xe1e3fee6d907bd93e313fd8d9a1e6787d042634df7136c67126d9e639d18a6b944b0eba7f61b2239a1f98e6cf1c026952bc9a7875ca62857da ,bfb3091"
  "authKeyToken": "qwertyuiopasdfghjklzxcvbnm123456",
  "keyManagerUrl": "",
  "revokeCode": 2,
  "typeCredential": ["VerifiableCredential", "AlastriaVerifiableCredential", "UniversityDegreeCredential"],
  "typePresentation": ["VerifiablePresentationRequest", "AlastriaVerifiablePresentationRequest"]
}

Once these changes have been made, in both the aforementioned directories, entityFrontend, and entityBackend, we do a npm start to fully lift the system.

Once you have done the process of raising the environment, it usually takes about 3-5 minutes, in a browser, we can access the Entity through the url http: // localhost: 4200. After this process, the first thing we should do is register, so we click on the "Register" link that will take us to the following screen: Alastria Register Screen We fill in the data, and we click Register now, taking us to the next screen where on the left we can see the data filled in by us and on the right, we will find three links where we can choose between Edit Profile, Reset password and Alastria ID.

Clicking on Alastria ID, it shows us the following screen Create Alastria ID Screen

By clicking on Create Alastria ID, a screen with a QR will appear, and after inspecting the element, taking the title part, which is in a JWT format, we can go to the Wallet, and clicking on Read QR, a box of text where we will introduce the JWT that we have taken in the entity part. QR Scanning Once this process is done, if everything is correct, a Congratulations message will appear in the Entity part if the link has been made correctly, and in the Wallet part, a message saying that it has been done correctly. Scanning Success

After that, the part to the right of the Entity, in your profile, where the link to Alastria ID previously appeared, will change to Fill your AlastriaID profile.

In this section, fill your AlastriaID profile, you can add the Certified information in our identity, to be able to make use of it in the different services where we want to use it. AlastriaID Profile Once the information that we want to use has been selected, a QR will appear that, as was done in the previous process when we created the identity, we must scan. This time, the part of the qr tag that we must take is the title, which will appear with a url like this: QR Inspector When we copy it, in the wallet, click on Read QR, and enter the url that we have copied in the text box, and we will be able to see in the Activity part, the credentials that we have just registered. Credentials

From the Entity part, if we go to Home and select one of the services, clicking on Click for show qr to fill, it will show us a qr code, whose title part when we inspect the element, will show us a url that from the Wallet, we will have to read. Service Provider QR

Once read, it will tell us to check the data to be accessed, and after checking it and clicking OK, if everything has gone correctly, it will show us a Success message. Scanning Success

Again, in the Entity, in the service on which we have performed the action, a message will appear with a green tick like the one shown in the image. Service Success

If we check the Activity in the Wallet, on the Presentations tab, this presentation can be made about the service in which the contract has been made. Presentations

In turn, these presentations can be revoked, by clicking on the one that interests us, a button will appear with the Revoke action, after clicking on it, said Presentation will appear as revoked. Revoke presentation

The same happens in Entity, in the Profile we can revoke the data that we have inserted. By clicking on Revoke profile Data, we can see the list of registered credentials and that by selecting them we can revoke them.

Profile Revokation