Skip to content

Commit e855bde

Browse files
committed
Merge branch 'dev'
2 parents fbf3de0 + 5f10782 commit e855bde

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+34731
-16751
lines changed

Dockerfile

Lines changed: 0 additions & 27 deletions
This file was deleted.

README.md

Lines changed: 29 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,78 +2,20 @@
22

33
## Introduction
44

5-
Cryptify offers file encryption/decryption based on IRMA attributes. It allows you to encrypt any file
6-
with an attribute and only people with that attribute can view the contents.
5+
Cryptify offers file encryption/decryption based on IRMA attributes. It allows
6+
you to encrypt any file with an attribute and only people with that attribute
7+
can view the contents.
78

89
## Docker development setup
910

10-
This section indicates how you can set-up the development environment to test sender verification, for this two Linux terminals are needed.
11-
The first terminal is to start the docker daemon and the second terminal is to start the cryptify containers that run on the daemon.
12-
To access cryptify on localhost (or 127.0.0.1) and the mail server on 127.0.0.1:1080 enter the following commands:
11+
To run a development setup:
1312

14-
Terminal 1:
1513
```
16-
sudo apt update
17-
sudo apt-get install docker.io
18-
sudo apt-get install docker-compose
19-
sudo dockerd
14+
docker-compose -f docker-compose.dev.yml up
2015
```
2116

22-
Terminal 2:
23-
```
24-
sudo apt-get install nodejs
25-
sudo apt-get install npm
26-
sudo git clone https://github.com/mpmfrans/cryptify.git
27-
cd cryptify
28-
git checkout add-email-verification
29-
30-
sudo mkdir irma
31-
cd irma
32-
sudo wget https://github.com/privacybydesign/irmago/releases/download/v0.9.0/irma-master-linux-amd64
33-
sudo chmod +x irma-master-linux-amd64
34-
cd ..
35-
cd cryptify-front-end
36-
sudo npm install
37-
cd ..
38-
sudo docker-compose -f docker-compose.dev.yml up
39-
```
40-
41-
To test sender verification, you'll need an Android device with the IRMA mobile application (https://play.google.com/store/apps/details?id=org.irmacard.cardemu) installed.
42-
Connect your device to your computer via USB and enable USB debugging (https://developer.android.com/studio/debug/dev-options).
43-
Also, install the Android Debug Bridge (https://developer.android.com/studio/releases/platform-tools).
44-
45-
Enable developer mode on the IRMA mobile application by navigating to 'About IRMA' from the hamburger menu and tapping the version number until 'developer mode enabled'
46-
appears at the bottom of the screen. This allows unsecure connections to an IRMA server so only use this for testing purposes.
47-
48-
Finally, to enable the IRMA mobile application to find the server running on localhost check the presence of your android device(s) by running adb devices.
49-
To be able to use Android Debug Bridge, unzip the platform-tools_r32.0.0-windows.zip, the files are in the platform-tools folder. Open Windows Powershell within
50-
this folder. To check the presence of android device(s):
17+
To run a production-like setup:
5118

52-
```
53-
./adb devices
54-
```
55-
56-
This should show your device as attached. If not, make sure USB debugging is enabled, and try unplugging and plugging the device.
57-
To forward localhost traffic:
58-
59-
```
60-
./adb reverse tcp:8088 tcp:8088
61-
```
62-
63-
This should simply output 8088 to indicate success. If the IRMA mobile application gives error messages saying you need an internet
64-
connection, run this command again. It can be unpredictable so don't be surprised if you need to run it more often. Now, you are able to scan the
65-
QR-code with your android device and IRMA.
66-
67-
## Installation (short version)
68-
69-
Build the files using:
70-
```
71-
./deploy.sh
72-
```
73-
74-
All needed source is now available in `./dist/{backend,frontend}`.
75-
76-
To quickly get a production-alike version, run:
7719
```
7820
docker-compose up
7921
```
@@ -82,69 +24,65 @@ docker-compose up
8224

8325
### Development setup
8426

85-
* Clone the project
27+
- Clone the project
8628

87-
git clone git@github.com:privacybydesign/cryptify.git
29+
git clone git@github.com:privacybydesign/cryptify.git
8830

89-
* Install nodejs 14 and rust
31+
- Install nodejs 14 and rust
9032

91-
# On Debian / Ubuntu
92-
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
93-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
33+
# On Debian / Ubuntu
34+
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
35+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
9436

95-
* Goto the `cryptify-front-end` folder and install dependencies
37+
- Goto the `cryptify-front-end` folder and install dependencies
9638

97-
npm install
39+
npm install
9840

9941
### Running the front-end
10042

101-
* Change the `baseurl` constant in `FileProvider.ts` to `http://localhost:3000`.
102-
This way the front-end uses the locally running backend.
43+
- Change the `baseurl` constant in `FileProvider.ts` to `http://localhost:3000`.
44+
This way the front-end uses the locally running backend.
10345

104-
* Start the development server
46+
- Start the development server
10547

106-
npm run start
48+
npm run start
10749

10850
### Packaging webpage
10951

110-
* Build the web site
52+
- Build the web site
11153

112-
npm run build
54+
npm run build
11355

11456
### Packaging electron
11557

116-
* Package electron installers
58+
- Package electron installers
11759

118-
npm run dist-electron
60+
npm run dist-electron
11961

12062
## Backend
12163

12264
### Configuration
12365

12466
For the back-end to be able to send e-mail and store files, the following environment variables are needed:
12567

126-
* *EMAIL_SMTP_URL*: the URL of the server to be used as SMTP server, including e-mail, password and port.
127-
* *EMAIL_FROM*: the address from which e-mail are to be sent.
128-
* *STORAGE_DIR*: The directory where the files are going to be stored.
68+
- _ROCKET_CONFIG_: The path to the configuration file (example in `conf/`)
12969

13070
### Build
13171

13272
The backend can be built using:
73+
13374
```
134-
npm install
135-
npm run build
75+
env ROCKET_ENV={development,production} cargo build
13676
```
13777

138-
### Installation
78+
The backend can be run using:
13979

140-
The only dependency of the backend is `nodemailer`. This can be installed using:
14180
```
142-
npm install --production
81+
env ROCKET_CONFIG={path_to_config} ./target/{release,debug}/cryptify-backend
14382
```
14483

145-
### Run
146-
The backend can then be run using:
84+
Get a development setup using:
14785

14886
```
149-
npm run start-dev
87+
env ROCKET_ENV=development ROCKET_CONFIG={path_to_config} cargo watch -x run
15088
```

backend.Dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,3 @@ FROM debian:buster-slim
22
RUN apt-get update && \
33
apt-get install -y libssl-dev && \
44
rm -rf /var/lib/apt/lists/*
5-
6-
COPY ./dist/backend/server /app/backend
7-
COPY ./conf/config.toml /app/config.toml
8-
9-
CMD ["/app/backend"]

cryptify-back-end/config.toml renamed to conf/config.dev.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ smtp_url = "mailhog"
77
smtp_port = 1025
88
# smtp_username = ""
99
# smtp_password = ""
10-
irma_server = "http://irmaserver:8088/"
10+
irma_server = "http://irma:8088"

conf/nginx.conf

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
worker_processes 4;
2+
3+
events {
4+
worker_connections 1024;
5+
}
6+
7+
http {
8+
sendfile on;
9+
tcp_nopush on;
10+
tcp_nodelay on;
11+
keepalive_timeout 295s;
12+
types_hash_max_size 2048;
13+
server_tokens on;
14+
15+
include /etc/nginx/mime.types;
16+
types {
17+
application/wasm wasm;
18+
}
19+
20+
access_log /dev/fd/1;
21+
error_log /dev/fd/2;
22+
23+
gzip on;
24+
25+
root /var/www/html/;
26+
index index.html;
27+
28+
server {
29+
listen 80 default_server;
30+
listen [::]:80 default_server;
31+
32+
add_header X-Frame-Options "DENY" always;
33+
add_header X-Content-Type-Options "nosniff" always;
34+
add_header Referrer-Policy "no-referrer" always;
35+
36+
location /irma {
37+
proxy_pass http://irma:8088;
38+
}
39+
40+
location ~ ^/(verification|fileupload|filedownload)/ {
41+
proxy_pass http://backend:8000;
42+
}
43+
}
44+
}

conf/nginx.dev.conf

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,11 @@ http {
3030
add_header X-Content-Type-Options "nosniff" always;
3131
add_header Referrer-Policy "no-referrer" always;
3232

33-
location /fileupload {
34-
proxy_pass http://backend:8000;
35-
}
36-
37-
location /verification/start {
38-
proxy_pass http://backend:8000;
39-
}
40-
41-
location /verification/result {
42-
proxy_pass http://backend:8000;
43-
}
44-
45-
location /verification {
46-
proxy_pass http://backend:8000;
33+
location /irma {
34+
proxy_pass http://irma:8088;
4735
}
4836

49-
location /filedownload {
37+
location ~ ^/(verification|fileupload|filedownload)/ {
5038
proxy_pass http://backend:8000;
5139
}
5240

cryptify-back-end/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
22
/data
3+
config.toml

cryptify-back-end/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cryptify-back-end/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ qrcode = "0.12.0"
1616
rand = "0.8.4"
1717
reqwest = { version = "0.11.7", features = ["blocking", "json"] }
1818
rocket = { version = "0.5.0-rc.1", features = ["json"] }
19+
#rocket_cors = "0.6.0-alpha1"
1920
serde = { version = "1.0", features = ["derive"] }
2021
serde_json = "1.0.64"
2122
sha2 = "0.9.5"

0 commit comments

Comments
 (0)