Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.1.0 alpha.6 tlsn release #86

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/developers/notary_server.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Run a Notary Server

This guide shows you how to run a [notary server](https://github.com/tlsnotary/tlsn/tree/main/notary-server) in an Ubuntu server instance.
This guide shows you how to run a [notary server](https://github.com/tlsnotary/tlsn/tree/main/notary/server) in an Ubuntu server instance.

## Configure Server Setting
All the following settings can be configured in the [config file](https://github.com/tlsnotary/tlsn/blob/main/notary-server/config/config.yaml).
All the following settings can be configured in the [config file](https://github.com/tlsnotary/tlsn/blob/main/notary/server/config/config.yaml).

1. Before running a notary server you need the following files. The default dummy fixtures are for testing only and should never be used in production.

Expand All @@ -14,7 +14,7 @@ All the following settings can be configured in the [config file](https://github
| Notary signature private key | The private key used for the notary server's signature on the generated transcript of the TLS sessions with provers | A P256 elliptic curve private key in PKCS#8 PEM format | Yes | `openssl genpkey -algorithm EC -out eckey.pem -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve` |
| Notary signature public key | The public key used for the notary server's signature on the generated transcript of the TLS sessions with provers | A matching public key in PEM format | Yes | `openssl ec -in eckey.pem -pubout -out eckey.pub` |
2. Expose the notary server port (specified in the config file) on your server networking setting
3. Optionally one can turn on [authorization](https://github.com/tlsnotary/tlsn/tree/main/notary-server#authorization), or turn off [TLS](https://github.com/tlsnotary/tlsn/tree/main/notary-server#optional-tls) if TLS is handled by an external setup, e.g. reverse proxy, cloud setup
3. Optionally one can turn on [authorization](https://github.com/tlsnotary/tlsn/tree/main/notary/server#authorization), or turn off [TLS](https://github.com/tlsnotary/tlsn/tree/main/notary/server#optional-tls) if TLS is handled by an external setup, e.g. reverse proxy, cloud setup


## Using Cargo
Expand All @@ -34,28 +34,28 @@ source ~/.cargo/env
mkdir ~/src; cd ~/src
git clone https://github.com/tlsnotary/tlsn.git
```
4. Switch to your desired [released version](https://github.com/tlsnotary/tlsn/releases), or stay in the `dev` branch to use the latest code (⚠️ only prover of the same version is supported for now)
4. Switch to your desired [released version](https://github.com/tlsnotary/tlsn/releases), or stay in the `main` branch to use the latest version (⚠️ only prover of the same version is supported for now)
```bash
git checkout tags/<version>
```
5. To configure the [server setting](#configure-server-setting), please refer to the `Using Cargo` section in the repo's [readme](https://github.com/tlsnotary/tlsn/blob/main/notary-server/README.md#using-cargo)
5. To configure the [server setting](#configure-server-setting), please refer to the `Using Cargo` section in the repo's [readme](https://github.com/tlsnotary/tlsn/blob/main/notary/server/README.md#using-cargo)
6. Run the server
```bash
cd tlsn/notary-server
cd tlsn/notary/server
cargo run --release
```

## Using Docker

1. Install docker following your preferred method [here](https://docs.docker.com/engine/install/ubuntu/)
2. To configure the [server setting](#configure-server-setting), please refer to the `Using Docker` section in the repo's [readme](https://github.com/tlsnotary/tlsn/blob/main/notary-server/README.md#using-docker)
2. To configure the [server setting](#configure-server-setting), please refer to the `Using Docker` section in the repo's [readme](https://github.com/tlsnotary/tlsn/blob/main/notary/server/README.md#using-docker)
3. Run the notary server docker image of your desired version (⚠️ only prover of the same version is supported for now)
```bash
docker run --init -p 127.0.0.1:7047:7047 ghcr.io/tlsnotary/tlsn/notary-server:<version>
```

## API Endpoints
Please refer to the list of all HTTP APIs [here](./notary_server_api.html), and WebSocket APIs [here](https://github.com/tlsnotary/tlsn/tree/main/notary-server#websocket-apis).
Please refer to the list of all HTTP APIs [here](./notary_server_api.html), and WebSocket APIs [here](https://github.com/tlsnotary/tlsn/tree/main/notary/server#websocket-apis).

## PSE Development Notary Server

Expand All @@ -67,11 +67,10 @@ We host multiple versions of the notary server:

| Version | Notary URL | Info/Status | GitHub | Note |
|---------------|---------------------------------------|----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|-----------------------------------------------|
| v0.1.0-alpha.6 | https://notary.pse.dev/v0.1.0-alpha.6 | [info](https://notary.pse.dev/v0.1.0-alpha.6/info)/[health](https://notary.pse.dev/v0.1.0-alpha.6/healthcheck) | [v0.1.0-alpha.6](https://github.com/tlsnotary/tlsn/tree/v0.1.0-alpha.6/notary/server) | [Release notes](https://github.com/tlsnotary/tlsn/releases/tag/v0.1.0-alpha.6) |
| v0.1.0-alpha.5 | https://notary.pse.dev/v0.1.0-alpha.5 | [info](https://notary.pse.dev/v0.1.0-alpha.5/info)/[health](https://notary.pse.dev/v0.1.0-alpha.5/healthcheck) | [v0.1.0-alpha.5](https://github.com/tlsnotary/tlsn/tree/v0.1.0-alpha.5/notary-server) | [Release notes](https://github.com/tlsnotary/tlsn/releases/tag/v0.1.0-alpha.5) |
| (deprecated) | https://notary.pse.dev | [info](https://notary.pse.dev/info)/[health](https://notary.pse.dev/healthcheck) | [v0.1.0-alpha.4](https://github.com/tlsnotary/tlsn/tree/v0.1.0-alpha.4/notary-server) | This url will be removed when alpha.6 is released |
| v0.1.0-alpha.4 | https://notary.pse.dev/v0.1.0-alpha.4 | [info](https://notary.pse.dev/v0.1.0-alpha.4/info)/[health](https://notary.pse.dev/v0.1.0-alpha.4/healthcheck) | [v0.1.0-alpha.4](https://github.com/tlsnotary/tlsn/tree/v0.1.0-alpha.4/notary-server) | [Release notes](https://github.com/tlsnotary/tlsn/releases/tag/v0.1.0-alpha.4) |
| v0.1.0-alpha.3 | https://notary.pse.dev/v0.1.0-alpha.3 | [info](https://notary.pse.dev/v0.1.0-alpha.3/info)/[health](https://notary.pse.dev/v0.1.0-alpha.3/healthcheck) | [v0.1.0-alpha.3](https://github.com/tlsnotary/tlsn/tree/v0.1.0-alpha.3/notary-server) | [Release notes](https://github.com/tlsnotary/tlsn/releases/tag/v0.1.0-alpha.3) |
| nightly | https://notary.pse.dev/nightly | [info](https://notary.pse.dev/nightly/info)/[health](https://notary.pse.dev/nightly/healthcheck) | [dev](https://github.com/tlsnotary/tlsn/tree/dev/notary-server) | |
| nightly | https://notary.pse.dev/nightly | [info](https://notary.pse.dev/nightly/info)/[health](https://notary.pse.dev/nightly/healthcheck) | [dev](https://github.com/tlsnotary/tlsn/tree/dev/notary/server) | |

For more details on the deployment, refer to this [GitHub Action](https://github.com/tlsnotary/tlsn/blob/main/.github/workflows/cd-server.yml).

Expand All @@ -88,6 +87,13 @@ twitter.com:443
gateway.reddit.com:443
reddit.com:443
swapi.dev:443
api.x.com:443
x.com:443
discord.com:443
connect.garmin.com:443
uber.com:443
riders.uber.com:443
m.uber.com:443
```

You can utilize this WebSocket proxy with the following syntax:
Expand Down
2 changes: 1 addition & 1 deletion src/developers/notary_server_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script>
window.onload = () => {
window.ui = SwaggerUIBundle({
url: 'https://raw.githubusercontent.com/tlsnotary/tlsn/main/notary-server/openapi.yaml#/',
url: 'https://raw.githubusercontent.com/tlsnotary/tlsn/main/notary/server/openapi.yaml#/',
dom_id: '#swagger-ui',
});
};
Expand Down
17 changes: 11 additions & 6 deletions src/quick_start/browser_extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ First we need to [install](#install) and configure a [websocket proxy](#proxy) a

## Install Browser Extension (Chrome/Brave) <a name="install"></a>

The easiest way to install the TLSN browser extension is to use **[Chrome Web Store](https://chromewebstore.google.com/detail/gcfkkledipjbgdbimfpijgbkhajiaaph)**.

![](images/chromewebstore.png)

Alternatively, you can install it manually:
1. Download the browser extension from <https://github.com/tlsnotary/tlsn-extension/releases/download/0.1.0.5/tlsn-extension-0.1.0.5.zip>
2. Unzip
⚠️ This is a flat zip file, so be careful if you unzip from the command line, this zip file contains many file at the top level
Expand Down Expand Up @@ -33,9 +38,9 @@ To run your own websockify proxy **locally**, run:
```sh
git clone https://github.com/novnc/websockify && cd websockify
./docker/build.sh
docker run -it --rm -p 55688:80 novnc/websockify 80 api.twitter.com:443
docker run -it --rm -p 55688:80 novnc/websockify 80 api.x.com:443
```
Note the `api.twitter.com:443` argument on the last line.
Note the `api.x.com:443` argument on the last line.

Next use `ws://localhost:55688` as **proxy API** in Step 3 above.

Expand Down Expand Up @@ -63,15 +68,15 @@ If you plan to run a local notary server:

1. Clone the TLSNotary repository (defaults to the `main` branch, which points to the latest release):
```shell
git clone https://github.com/tlsnotary/tlsn.git
git clone --branch v0.1.0-alpha.5 https://github.com/tlsnotary/tlsn.git
heeckhau marked this conversation as resolved.
Show resolved Hide resolved
```
3. Edit the notary server config file (`notary-server/config/config.yaml`) to turn off TLS so that the browser extension can connect to the local notary server without requiring extra steps to accept self-signed certificates in the browser.
2. Edit the notary server config file (`notary-server/config/config.yaml`) to turn off TLS so that the browser extension can connect to the local notary server without requiring extra steps to accept self-signed certificates in the browser.
```yaml
tls:
enabled: false
...
```
4. Run the notary server:
3. Run the notary server:
```shell
cd notary-server
cargo run --release
Expand Down Expand Up @@ -106,7 +111,7 @@ If you use the hosted notary server, notarization will take multiple seconds. Yo
When the notarization is ready, you can click **View Proof**. If you did close the UI, you can find the proof by clicking **History** and **View Proof**.
<img width="477" src="images/extension_history.png">

You also have the option to download the proof. You can view this proof later by using the **Verify** button or via <https://tlsnotary.github.io/proof_viz/>.
You also have the option to download the proof. You can view this proof later by using the **Verify** button or via <https://explorer.tlsnotary.org/>. You can get the Notary public key by visiting the Notary API specified [above](#notary-server).

## Troubleshooting

Expand Down
Binary file added src/quick_start/images/chromewebstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/quick_start/images/explorer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/quick_start/images/explorer_redacted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 20 additions & 11 deletions src/quick_start/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The proof has been written to `simple_proof.json`

If you want to see more details, you can run the prover with extra logging:
```shell
RUST_LOG=DEBUG,yamux=INFO cargo run --release --example simple_prover
RUST_LOG=DEBUG,uid_mux=INFO,yamux=INFO cargo run --release --example simple_prover
```

### 2. Verify the Proof
Expand Down Expand Up @@ -107,11 +107,13 @@ cargo run --release --example simple_verifier
...
```

You can also use <https://tlsnotary.github.io/proof_viz/> to inspect your proofs. Open <https://tlsnotary.github.io/proof_viz/> and drag and drop `simple_proof.json` from your file explorer into the drop zone.
You can also use <https://explorer.tlsnotary.org/> to inspect your proofs. Open <https://explorer.tlsnotary.org/> and drag and drop `simple_proof.json` from your file explorer into the drop zone. [Notary public key](https://github.com/tlsnotary/tlsn/blob/main/notary/server/fixture/notary/notary.pub)

![Proof Visualization](images/proof_viz.png)
![Proof Visualization](images/explorer.png)

Redacted bytes are marked with <span style="color:red">red █ characters</span>.
Redacted bytes are marked with `X` characters.

![Proof Redacted](images/explorer_redacted.png)

### (Optional) Extra Experiments

Expand All @@ -130,10 +132,17 @@ We will also use an explicit (locally hosted) notary server this time.

The notary server used in this example is more functional compared to the (implicit) simple notary service used in the example above. This notary server should actually be run by the Verifier or a neutral party. To make things simple, we run everything on the same machine.

```shell
cd notary-server
cargo run --release
```
1. Edit the notary server config file (`notary/server/config/config.yaml`) to turn off TLS so that self-signed certificates can be avoided.
```yaml
tls:
enabled: false
...
```
2. Run the notary server:
```shell
cd notary/server
cargo run --release
```

The notary server will now be running in the background waiting for connections.

Expand Down Expand Up @@ -171,7 +180,7 @@ Next, run the `discord_dm` example to generate a proof:

```shell
cd tlsn/tlsn/examples/discord
RUST_LOG=debug,yamux=info cargo run --release --example discord_dm
RUST_LOG=debug,uid_mux=INFO,yamux=info cargo run --release --example discord_dm
```

If everything goes well, you should see this output:
Expand All @@ -191,7 +200,7 @@ The Notary server should log:
2023-11-03T15:53:51.147074Z INFO tokio-runtime-worker ThreadId(10) notary_server::service::tcp: Successful notarization using tcp! session_id="006b3293-8fba-44ac-8692-41daa47e4a9a"
```

If the transcript was too long, you may encounter the following error. This occurs because there is a default limit of notarization size to 16kB:
If the transcript was too long, you may encounter the following error. This occurs because there is a default limit of notarization size to 20KB:

```log
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: IOError(Custom { kind: InvalidData, error: BackendError(DecryptionError("Other: KOSReceiverActor is not setup")) })', /Users/heeckhau/tlsnotary/tlsn/tlsn/tlsn-prover/src/lib.rs:173:50
Expand All @@ -203,7 +212,7 @@ The proof is written to `discord_dm_proof.json`.

### Verify

Verify the proof by dropping the JSON file into <https://tlsnotary.github.io/proof_viz/> or by running:
Verify the proof by dropping the JSON file into <https://explorer.tlsnotary.org/> or by running:

```shell
cargo run --release --example discord_dm_verifier
Expand Down
4 changes: 2 additions & 2 deletions src/quick_start/tlsn-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ For this demo, we also need to run a local notary server.

1. Clone the TLSNotary repository (defaults to the `main` branch, which points to the latest release):
```sh
git clone https://github.com/tlsnotary/tlsn.git
git clone --branch v0.1.0-alpha.5 https://github.com/tlsnotary/tlsn.git
heeckhau marked this conversation as resolved.
Show resolved Hide resolved
```
2. Edit the notary server config file (`notary-server/config/config.yaml`) to turn off TLS so that the browser extension can connect to the local notary server without requiring extra steps to accept self-signed certificates in the browser.
2. Edit the notary server config file (`notary-server/config/config.yaml`) to turn off TLS so that self-signed certificates can be avoided.
```yaml
tls:
enabled: false
Expand Down