|
6 | 6 | //! |
7 | 7 | //! Please see the [restapi/examples/server.rs](https://github.com/jay-johnson/restapi/blob/main/examples/server.rs) for developing your own rest api. |
8 | 8 | //! |
9 | | -//! ### Overview |
| 9 | +//! ## Overview |
| 10 | +//! |
| 11 | +//! ### User |
10 | 12 | //! |
11 | | -//! - User authentication enabled by default and implemented with custom tls assets to encrypt all JWT tokens with storage in postgres. |
12 | | -//! - Users can upload and manage files stored on AWS S3 (assuming valid credentials are loaded outside this rust project). |
13 | 13 | //! - User password reset and user email change support using one-time-use tokens that are stored in postgres. |
| 14 | +//! - Users can upload and manage files stored on AWS S3 (assuming valid credentials are loaded outside this rust project). |
14 | 15 | //! - User passwords are hashed using [argon2](https://docs.rs/argon2/latest/argon2/). |
15 | | -//! - The hyper server hosts tls assets that can be re-generated with the tools in this repository. |
16 | | -//! - JWT encryption and decryption keys included and [documentation for building new keys as needed](https://github.com/jay-johnson/restapi/tree/main/jwt). |
17 | | -//! - Includes a tls asset generator tool ([./certs/generate-tls-assets.sh](https://github.com/jay-johnson/restapi/blob/main/certs/generate-tls-assets.sh)) for building self-signed tls assets (requires docker). |
18 | | -//! - The postgres database requires each client include the postgres tls certificate authority file for encrypting data in-transit. |
| 16 | +//! |
| 17 | +//! ### Auth |
| 18 | +//! |
| 19 | +//! - User authentication enabled by default |
| 20 | +//! - Default JWT signing keys included with [documentation for building new keys as needed](https://github.com/jay-johnson/restapi/tree/main/jwt). |
| 21 | +//! |
| 22 | +//! ### Database |
| 23 | +//! |
19 | 24 | //! - The rest api server utilizes postgres with a [bb8 client threadpool](https://github.com/djc/bb8). |
| 25 | +//! - The postgres database requires each client connection include the postgres tls certificate authority file for encrypting data in-transit. |
20 | 26 | //! - Includes [pg4admin](https://www.pgadmin.org/docs/pgadmin4/latest/index.html) for database management in a browser (deployed with docker compose). |
21 | 27 | //! |
22 | | -//! ### TLS Encryption Status |
| 28 | +//! ### TLS Encryption |
| 29 | +//! |
| 30 | +//! - Includes a tls asset generator tool ([./certs/generate-tls-assets.sh](https://github.com/jay-johnson/restapi/blob/main/certs/generate-tls-assets.sh)) for building self-signed tls assets (requires docker). |
| 31 | +//! |
| 32 | +//! #### Ingress |
23 | 33 | //! |
24 | 34 | //! Component | Status |
25 | 35 | //! ---------------- | ------ |
26 | 36 | //! Rest API Server | Listening for encrypted client connections on tcp port **3000** |
27 | | -//! JWT | Encrypting and decrypting tokens with [ECDSA using SHA-256](https://docs.rs/jsonwebtoken/latest/jsonwebtoken/enum.Algorithm.html#variant.ES256) |
28 | 37 | //! Postgres | Listening for encrypted client connections on tcp port **5432** (tls Certificate Authority required) |
29 | 38 | //! pgAdmin | Listening for encrypted HTTP client connections on tcp port **5433** |
30 | | -//! AWS S3 | Encrypted at rest with [AES256](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) |
31 | 39 | //! |
32 | 40 | //! ## Getting Started |
33 | 41 | //! |
|
44 | 52 | //! |
45 | 53 | //! Here's how to generate them under the ``./certs`` directory: |
46 | 54 | //! |
47 | | -//! <a href="https://asciinema.org/a/473131?autoplay=1" width="600" height="400" target="_blank"><img src="https://asciinema.org/a/473131.png"/></a> |
48 | | -//! |
49 | 55 | //! ```bash |
50 | 56 | //! cd certs |
51 | 57 | //! ./generate-tls-assets.sh -f -c ./configs/dev-network.yml |
52 | 58 | //! cd .. |
53 | 59 | //! ``` |
54 | 60 | //! |
55 | | -//! ### Generate JWT Keys |
56 | | -//! |
57 | | -//! Authentication using JWT requires encrypting and decrypting using your own keys. Please refer to the [How to build JWT private and public keys for the jsonwebtokens crate doc](./certs/README.md) for more information. |
| 61 | +//! <a href="https://asciinema.org/a/473131?autoplay=1" width="600" height="400" target="_blank"><img src="https://asciinema.org/a/473131.png"/></a> |
58 | 62 | //! |
59 | | -//! Here's how to generate the jwt keys under the ``./jwt`` directory: |
| 63 | +//! ### Generate JWT Keys |
60 | 64 | //! |
61 | | -//! <a href="https://asciinema.org/a/473132?autoplay=1" width="600" height="400" target="_blank"><img src="https://asciinema.org/a/473132.png"/></a> |
| 65 | +//! This repo includes default JWT signing keys, but you should generate your own signing keys under the ``./jwt`` directory with these commands: |
62 | 66 | //! |
63 | 67 | //! ```bash |
64 | 68 | //! cd jwt |
|
68 | 72 | //! cd .. |
69 | 73 | //! ``` |
70 | 74 | //! |
| 75 | +//! <a href="https://asciinema.org/a/473132?autoplay=1" width="600" height="400" target="_blank"><img src="https://asciinema.org/a/473132.png"/></a> |
| 76 | +//! |
| 77 | +//! Please refer to the [How to build JWT private and public keys for the jsonwebtokens crate doc](./certs/README.md) for more information. |
| 78 | +//! |
71 | 79 | //! ### Build the Postgres docker image |
72 | 80 | //! |
73 | 81 | //! Please refer to the [Build and Deploy a Secured Postgres backend doc](./docker/db/README.md) for more information. |
|
83 | 91 | //! ### Run API Server |
84 | 92 | //! |
85 | 93 | //! ```bash |
86 | | -//! cargo run --example server |
| 94 | +//! export RUST_BACKTRACE=1 && export RUST_LOG=info && ./target/debug/examples/server |
87 | 95 | //! ``` |
88 | 96 | //! |
89 | 97 | //! ## Supported APIs |
|
225 | 233 | //! ## Build and run the example server |
226 | 234 | //! |
227 | 235 | //! ```bash |
228 | | -//! time cargo build --example server && export RUST_BACKTRACE=1 && export RUST_LOG=info && time ./target/debug/examples/server |
| 236 | +//! cargo build --example server && export RUST_BACKTRACE=1 && export RUST_LOG=info && ./target/debug/examples/server |
229 | 237 | //! ``` |
230 | 238 | //! |
231 | 239 | //! # Integration Tests Using curl Guide |
|
0 commit comments