Skip to content

Commit e559eef

Browse files
Merge remote-tracking branch 'origin/add-missing-readme-info' into centralize-docs
# Conflicts: # docs/repos/postguard.md
2 parents 24f237b + 1746b13 commit e559eef

8 files changed

Lines changed: 381 additions & 60 deletions

docs/repos/cryptify.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,36 @@ Cryptify has two parts:
1313
- **Backend** (Rust, Rocket framework): Handles file storage, chunked uploads, email notifications, and serves the API.
1414
- **Frontend** (TypeScript): Web UI for uploading and downloading encrypted files.
1515

16+
## Configuration
17+
18+
The backend reads its configuration from a TOML file. Example configuration files are in `conf/`. Set the `ROCKET_CONFIG` environment variable to point to the configuration file.
19+
20+
Configuration parameters:
21+
22+
| Parameter | Description | Example |
23+
|---|---|---|
24+
| `server_url` | Public URL of the frontend (via nginx) | `http://localhost:8080/` |
25+
| `address` | Bind address | `0.0.0.0` |
26+
| `port` | Backend listen port | `8000` |
27+
| `data_dir` | Directory for storing uploaded files | `/tmp/data` |
28+
| `email_from` | Sender address for notification emails | `noreply@postguard.local` |
29+
| `smtp_url` | SMTP server hostname | `mailcrab` |
30+
| `smtp_port` | SMTP server port | `1025` |
31+
| `smtp_tls` | Enable TLS for SMTP | `false` |
32+
| `smtp_username` | Optional SMTP username | `user` |
33+
| `smtp_password` | Optional SMTP password | `pw` |
34+
| `allowed_origins` | Regex pattern for CORS allowed origins | `^https?://(localhost\|127\\.0\\.0\\.1)(:[0-9]+)?$` |
35+
| `pkg_url` | URL of the PostGuard PKG server | `http://postguard-pkg:8087` |
36+
37+
## API
38+
39+
The backend exposes a file upload/download API. An OpenAPI 3.0 specification is available in `api-description.yaml` in the repository root. The main endpoints:
40+
41+
- `POST /fileupload/init` — Initialize a multipart file upload (takes sender email, recipient email, file size, mail content, and language).
42+
- `PUT /fileupload/{uuid}` — Upload a file chunk (use `Content-Range` header for chunked uploads).
43+
- `POST /fileupload/finalize/{uuid}` — Finalize the upload and send the notification email.
44+
- `GET /filedownload/{uuid}` — Download a file.
45+
1646
## Development
1747

1848
### Docker (recommended)

docs/repos/pdf-signature.md

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,96 @@
22

33
[GitHub](https://github.com/encryption4all/pdf-signature) · Rust + TypeScript · PDF Signing
44

5-
PDF signing and signature verification utility. Used within the PostGuard ecosystem for signing PDF documents with identity-based signatures.
5+
PDF signing and signature verification utility forked from [Cryptify](/repos/cryptify). It encrypts and decrypts files based on IRMA/Yivi attributes, allowing only people with the right attributes to view the contents.
66

77
## Architecture
88

99
The repository is structured similarly to [Cryptify](/repos/cryptify), with a Rust backend and TypeScript frontend:
1010

11-
- **Backend** (`cryptify-back-end/`): Rust service handling PDF operations
12-
- **Frontend** (`cryptify-front-end/`): TypeScript web interface
11+
- **Backend** (`cryptify-back-end/`): Rust (Rocket) service handling file storage, chunked uploads, email notifications, and the HTTP API.
12+
- **Frontend** (`cryptify-front-end/`): TypeScript/React web interface with optional Electron packaging.
13+
14+
## Configuration
15+
16+
The backend reads its configuration from a TOML file. Example configuration files are in `conf/`. Set the `ROCKET_CONFIG` environment variable to point to the configuration file.
17+
18+
Configuration parameters:
19+
20+
| Parameter | Description | Example |
21+
|---|---|---|
22+
| `server_url` | Public URL of the frontend | `http://localhost:8080/` |
23+
| `address` | Bind address | `0.0.0.0` |
24+
| `data_dir` | Directory for storing uploaded files | `/tmp/data` |
25+
| `email_from` | Sender address for notification emails | `noreply@postguard.local` |
26+
| `smtp_url` | SMTP server hostname | `mailcrab` |
27+
| `smtp_port` | SMTP server port | `1025` |
28+
| `smtp_credentials` | Optional SMTP credentials | `["user", "pw"]` |
29+
| `allowed_origins` | Regex pattern for CORS allowed origins | `^http://localhost:8080$` |
30+
| `pkg_url` | URL of the PostGuard PKG server | `https://postguard-main.cs.ru.nl/pkg` |
1331

1432
## Development
1533

1634
### Docker (recommended)
1735

1836
```bash
19-
# Development setup
37+
# Development setup (with hot reload via cargo watch)
2038
docker-compose -f docker-compose.dev.yml up
2139

2240
# Production-like setup
2341
docker-compose up
2442
```
2543

44+
The development Docker Compose setup includes a Mailcrab instance for testing emails (web UI at `http://localhost:1080`, SMTP at port 1025).
45+
2646
### Manual Setup
2747

28-
See the Cryptify development instructions for the general pattern. The backend requires Rust and the frontend requires Node.js.
48+
#### Frontend
49+
50+
Requires Node.js 14 and Rust:
51+
52+
```bash
53+
cd cryptify-front-end
54+
npm install
55+
npm run start # development server
56+
npm run build # production build
57+
```
58+
59+
When developing locally, change the `baseurl` constant in `FileProvider.ts` to `http://localhost:3000` so the frontend uses the local backend.
60+
61+
#### Backend
62+
63+
Requires Rust:
64+
65+
```bash
66+
# Development (with auto-reload)
67+
env ROCKET_ENV=development ROCKET_CONFIG=conf/config.dev.toml cargo watch -x run
68+
69+
# Production build
70+
env ROCKET_ENV=production cargo build --release
71+
72+
# Run the production binary
73+
env ROCKET_CONFIG=conf/config.toml ./target/release/cryptify-backend
74+
```
75+
76+
The backend needs the `ROCKET_CONFIG` environment variable pointing to a configuration file so it can send emails and store files.
77+
78+
### Electron Packaging
79+
80+
The frontend can also be packaged as a desktop app:
81+
82+
```bash
83+
cd cryptify-front-end
84+
npm run dist-electron
85+
```
86+
87+
## API
88+
89+
The backend exposes a file upload/download API. An OpenAPI 3.0 specification is available in `api-description.yaml` in the repository root. The main endpoints:
90+
91+
- `POST /fileupload/init` — Initialize a multipart file upload (takes sender email, recipient email, file size, mail content, and language).
92+
- `PUT /fileupload/{uuid}` — Upload a file chunk (use `Content-Range` header for chunked uploads).
93+
- `POST /fileupload/finalize/{uuid}` — Finalize the upload and send the notification email.
94+
- `GET /filedownload/{uuid}` — Download a file.
2995

3096
## Releasing
3197

docs/repos/postguard-examples.md

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,38 @@ npm run dev
1818

1919
### .NET Console App (`pg-dotnet/`)
2020

21-
A .NET console application demonstrating the [postguard-dotnet](/repos/postguard-dotnet) SDK for server-side encryption and Cryptify upload.
21+
A .NET console application demonstrating the [postguard-dotnet](/repos/postguard-dotnet) SDK for the "Informatierijk notificeren" use case. It shows two patterns:
22+
23+
1. **Encrypt and Upload** — Encrypts sample files for a citizen (exact email) and an organisation (email domain), uploads to Cryptify, and returns a UUID for custom distribution.
24+
2. **Encrypt and Deliver** — Same as above, but also sends an email notification to the recipient via Cryptify.
2225

2326
**Prerequisites:**
2427

2528
- .NET 8.0+ SDK
26-
- Rust toolchain (for building the native crypto library)
29+
- Rust toolchain via [rustup](https://rustup.rs/) (for building the native crypto library)
2730
- A PostGuard API key
2831

2932
**Setup:**
3033

34+
Clone postguard-dotnet alongside this repo:
35+
36+
```
37+
Repos/
38+
├── postguard-examples/ (this repo)
39+
│ └── pg-dotnet/
40+
└── postguard-dotnet/ (SDK)
41+
```
42+
43+
Build the native library (one-time):
44+
3145
```bash
32-
# Clone postguard-dotnet alongside this repo
33-
# Build the native library (one-time)
3446
cd ../postguard/pg-ffi && ./build.sh
47+
```
3548

36-
# Set your API key
37-
export PG_API_KEY="PG-API-your-key-here"
49+
Set your API key and run:
3850

39-
# Run
51+
```bash
52+
export PG_API_KEY="PG-API-your-key-here"
4053
cd pg-dotnet
4154
dotnet run
4255
```
@@ -49,6 +62,35 @@ export PG_CRYPTIFY_URL="https://fileshare.postguard.eu"
4962
dotnet run
5063
```
5164

65+
**Usage example:**
66+
67+
```csharp
68+
var pg = new PostGuard(new PostGuardConfig
69+
{
70+
PkgUrl = "https://pkg.staging.postguard.eu",
71+
CryptifyUrl = "https://fileshare.staging.postguard.eu"
72+
});
73+
74+
var sealed = pg.Encrypt(new EncryptInput
75+
{
76+
Files = [new PgFile("report.txt", stream)],
77+
Recipients = [
78+
pg.Recipient.Email("citizen@example.com"),
79+
pg.Recipient.EmailDomain("info@org.nl")
80+
],
81+
Sign = pg.Sign.ApiKey(apiKey)
82+
});
83+
84+
// Upload only — returns UUID for custom delivery
85+
var result = await sealed.UploadAsync();
86+
87+
// Or upload + send email notification
88+
var result = await sealed.UploadAsync(new UploadOptions
89+
{
90+
Notify = new NotifyOptions { Message = "Your documents", Language = "EN" }
91+
});
92+
```
93+
5294
## Code Snippets
5395

5496
The examples in this repo are used as the source for code snippets in the [PostGuard documentation](https://docs.postguard.eu). When updating examples, keep in mind that documentation snippets reference specific commit hashes.

docs/repos/postguard-fallback.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[GitHub](https://github.com/encryption4all/postguard-fallback) · Rust · Web Decryption Service
44

5-
Also known as **TGuard**. A self-contained web service for sending and decrypting PostGuard-encrypted messages, designed as a fallback for users who don't have a PostGuard client installed. Users can decrypt messages directly in their browser after proving their identity via [Yivi](https://yivi.app) (formerly IRMA).
5+
Also known as **TGuard**. A self-contained web service for sending and decrypting [irmaseal](https://github.com/encryption4all/irmaseal)-encrypted messages. Users encrypt messages client-side, and recipients can decrypt them in their browser after proving they own the required attributes (e.g., email address, name, or identifying number) via [Yivi](https://yivi.app) (formerly [IRMA](https://irma.app/docs/what-is-irma/)).
66

77
## Architecture
88

@@ -13,23 +13,26 @@ Both the backend and frontend are written in Rust:
1313

1414
Supporting services: NGINX (reverse proxy), PostgreSQL (database), Mailhog (email testing).
1515

16+
The frontend is compiled and bundled using [Trunk](https://trunkrs.dev/) and uses the [Yew](https://yew.rs/) framework. Additional Rust library dependencies can be found in `Cargo.toml` in both the frontend and backend directories.
17+
18+
For a technical overview of IRMA Seal, see the [design document](https://github.com/Wassasin/irmaseal/blob/master/docs/design.md).
19+
1620
## Development
1721

1822
### Docker (recommended)
1923

2024
```bash
21-
# Development setup
22-
docker-compose -f docker-compose.dev.yml up
23-
24-
# Production-like setup
25-
docker-compose up
26-
2725
# Initialize the database
2826
./setup.sh
27+
28+
# Development setup
29+
docker-compose up
2930
```
3031

3132
The application is available at `http://tguard.localhost`.
3233

34+
The Docker setup includes the following software versions: Rust 1.57 (rust:bullseye), NGINX 1.21, PostgreSQL 12, and Mailhog 1.0.
35+
3336
### Manual Setup
3437

3538
Requires:

docs/repos/postguard-js.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const sealed = pg.encrypt({
8484
});
8585

8686
const encrypted = await sealed.toBytes();
87-
// encrypted is a Uint8Array
87+
// encrypted is a Uint8Array — attach it, send it, store it however you want
8888
```
8989

9090
## Decryption
@@ -134,16 +134,17 @@ pg.sign.apiKey('your-api-key')
134134
pg.sign.yivi({
135135
element: '#yivi-popup',
136136
senderEmail: 'alice@example.com',
137-
attributes: [
137+
attributes: [ // optional: request extra attributes
138138
{ t: 'pbdf.gemeente.personalData.fullname', optional: true },
139139
{ t: 'pbdf.sidn-pbdf.mobilenumber.mobilenumber', optional: true },
140140
],
141-
includeSender: true,
141+
includeSender: true, // optional: also encrypt for the sender
142142
})
143143

144144
// Custom session callback (email addons, mobile apps, etc.)
145145
pg.sign.session(
146146
async ({ con, sort }) => {
147+
// Show your own Yivi UI, return the JWT
147148
return await myCustomYiviFlow(con, sort);
148149
},
149150
{ senderEmail: 'alice@example.com' }
@@ -189,16 +190,27 @@ const sealed = pg.encrypt({
189190
});
190191

191192
const envelope = await pg.email.createEnvelope({ sealed, from: 'alice@example.com' });
192-
// envelope.subject, envelope.htmlBody, envelope.plainTextBody, envelope.attachment
193+
// envelope.subject → "PostGuard Encrypted Email"
194+
// envelope.htmlBody → Placeholder HTML with PostGuard branding
195+
// envelope.plainTextBody → Plain text fallback
196+
// envelope.attachment → File("postguard.encrypted")
193197

194-
// On the receiving side: extract and decrypt
198+
// --- On the receiving side ---
195199
const ciphertext = extractCiphertext({
196200
htmlBody: emailBodyHtml,
197201
attachments: [{ name: 'postguard.encrypted', data: attachmentBuffer }],
198202
});
199203

200204
const opened = pg.open({ data: ciphertext });
201205
const result = await opened.decrypt({ element: '#yivi-popup', recipient: 'bob@example.com' });
206+
// result.plaintext → decrypted MIME content
207+
// result.sender → verified sender identity
208+
```
209+
210+
Standalone email helpers (`buildMime`, `extractCiphertext`, `injectMimeHeaders`) can be imported directly without creating a PostGuard instance:
211+
212+
```ts
213+
import { buildMime, extractCiphertext, injectMimeHeaders } from '@e4a/pg-js';
202214
```
203215

204216
## Error Handling

docs/repos/postguard-tb-addon.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ cp .env.example .env # adjust if needed
2727
### Build and Run
2828

2929
```bash
30-
npm run build # production build dist/
31-
npm run build:dev # development build (no minification, keeps console.log)
30+
npm run build # production build, output in dist/
31+
npm run build:dev # development build (no minification, preserves console.log)
3232
npm run watch # dev build with file watching
3333
```
3434

docs/repos/postguard-website.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The PostGuard web frontend for encrypting and sending files. Users pick files, c
88

99
### Quick Start with Docker Compose (recommended)
1010

11-
Docker Compose sets up everything: the PostGuard website, Cryptify backend, IRMA server, PKG server, and a mail testing UI.
11+
Docker Compose sets up everything: the PostGuard website, Cryptify file share server, IRMA server, PKG server, and a Mailcrab mail testing UI.
1212

1313
```bash
1414
# Initialize submodules (Cryptify, etc.)
@@ -30,6 +30,25 @@ docker-compose -f docker-compose.prod.yml up
3030
# Access at http://localhost
3131
```
3232

33+
### Stopping Services
34+
35+
```bash
36+
# Development
37+
docker-compose down
38+
39+
# Production
40+
docker-compose -f docker-compose.prod.yml down
41+
```
42+
43+
### Building
44+
45+
Building is done automatically through GitHub Actions. You can also build manually:
46+
47+
```bash
48+
docker-compose build # Build via Docker
49+
npm run build # Build only the PostGuard website
50+
```
51+
3352
### Manual (without Docker)
3453

3554
```bash
@@ -50,10 +69,10 @@ npm run test # Playwright tests
5069

5170
### Mobile Debugging
5271

53-
To test on a physical Android device over USB (Yivi must be in [developer mode](https://docs.yivi.app/yivi-app/#developer-mode)):
72+
To test on a physical Android device, connect the phone with USB debugging enabled and make sure Yivi is in [developer mode](https://docs.yivi.app/yivi-app/#developer-mode):
5473

5574
```bash
56-
adb reverse tcp:8088 tcp:8088 # Yivi / IRMA server
75+
adb reverse tcp:8088 tcp:8088 # Yivi / IRMA server (for scanning QR codes)
5776
adb reverse tcp:8080 tcp:8080 # PostGuard website
5877
```
5978

0 commit comments

Comments
 (0)