mirror of
https://github.com/tlsnotary/tlsn-js.git
synced 2026-04-02 03:00:18 -04:00
chore: update examples to alpha.9 + improve readme (#102)
This commit is contained in:
@@ -25,6 +25,6 @@ tracing-subscriber = { version ="0.3.18", features = ["env-filter"] }
|
||||
uuid = { version = "1.4.1", features = ["v4", "fast-rng"] }
|
||||
ws_stream_tungstenite = { version = "0.13", features = ["tokio_io"] }
|
||||
|
||||
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.8", package = "tlsn-core" }
|
||||
tlsn-prover = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.8", package = "tlsn-prover" }
|
||||
tlsn-common = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.8", package = "tlsn-common" }
|
||||
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-core" }
|
||||
tlsn-prover = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-prover" }
|
||||
tlsn-common = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-common" }
|
||||
@@ -32,7 +32,7 @@ tracing = "0.1.40"
|
||||
tracing-subscriber = { version ="0.3.18", features = ["env-filter"] }
|
||||
ws_stream_tungstenite = { version = "0.13", features = ["tokio_io"] }
|
||||
|
||||
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.8", package = "tlsn-core" }
|
||||
tlsn-verifier = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.8", package = "tlsn-verifier" }
|
||||
tlsn-common = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.8", package = "tlsn-common" }
|
||||
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-core" }
|
||||
tlsn-verifier = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-verifier" }
|
||||
tlsn-common = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.9", package = "tlsn-common" }
|
||||
tower-util = "0.3.1"
|
||||
|
||||
@@ -26,7 +26,7 @@ root.render(<App />);
|
||||
const local = true; // Toggle between local and remote notary
|
||||
const notaryUrl = local
|
||||
? 'http://localhost:7047'
|
||||
: 'https://notary.pse.dev/v0.1.0-alpha.8';
|
||||
: 'https://notary.pse.dev/v0.1.0-alpha.9';
|
||||
const websocketProxyUrl = local
|
||||
? 'ws://localhost:55688'
|
||||
: 'wss://notary.pse.dev/proxy?token=swapi.dev';
|
||||
|
||||
@@ -29,38 +29,31 @@ Note the `tcp:swapi.dev:443` argument on the last line, this is the server we wi
|
||||
|
||||
For this demo, we also need to run a local notary server.
|
||||
|
||||
1. Clone the TLSNotary repository:
|
||||
```shell
|
||||
git clone https://github.com/tlsnotary/tlsn.git --branch "v0.1.0-alpha.8"
|
||||
```
|
||||
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
|
||||
```
|
||||
3. Run the notary server:
|
||||
```shell
|
||||
cd notary/server
|
||||
cargo run --release
|
||||
```
|
||||
* Use docker
|
||||
```sh
|
||||
npm run notary
|
||||
```
|
||||
* Or, compile and run the notary server natively:
|
||||
```sh
|
||||
# Clone the TLSNotary repository:
|
||||
git clone https://github.com/tlsnotary/tlsn.git --branch "v0.1.0-alpha.9"
|
||||
cd tlsn/crates/notary/server/
|
||||
# Run the ntoary server
|
||||
cargo run --release -- --tls-enabled false
|
||||
```
|
||||
|
||||
The notary server will now be running in the background waiting for connections.
|
||||
|
||||
## `tlsn-js` in a React/Typescript app
|
||||
|
||||
### Run the
|
||||
1. Clone the repository
|
||||
```sh
|
||||
git clone https://github.com/tlsnotary/tlsn-js
|
||||
```
|
||||
2. Compile tlns-js
|
||||
1. Compile tlns-js
|
||||
```sh
|
||||
npm i
|
||||
npm run build
|
||||
```
|
||||
2. Go to the demo folder
|
||||
```sh
|
||||
cd ./tlsn-js/demo/react-ts-webpack
|
||||
cd demo/react-ts-webpack
|
||||
```
|
||||
3. Install dependencies
|
||||
```sh
|
||||
|
||||
14
readme.md
14
readme.md
@@ -39,17 +39,17 @@ The `./demo` folder contains three demos of `tlsn-js`:
|
||||
|
||||
In the demos, we attest data from the `https://swapi.dev` website. Because the browser does not allow for TCP connections, you need to set up a websocket proxy:
|
||||
|
||||
1. Install [websocat](https://github.com/vi/websocat):
|
||||
1. Install [wstcp](https://github.com/sile/wstcp):
|
||||
|
||||
| Tool | Command |
|
||||
| ------ | ------------------------------ |
|
||||
| cargo | `cargo install websocat` |
|
||||
| brew | `brew install websocat` |
|
||||
| source | https://github.com/vi/websocat |
|
||||
| Tool | Command |
|
||||
| ------ | ----------------------------- |
|
||||
| cargo | `cargo install wstcp` |
|
||||
| brew | `brew install wstcp` |
|
||||
| source | https://github.com/sile/wstcp |
|
||||
|
||||
2. Run a websocket proxy for `https://swapi.dev`:
|
||||
```sh
|
||||
websocat --binary -v ws-l:0.0.0.0:55688 tcp:swapi.dev:443
|
||||
wstcp --bind-addr 127.0.0.1:55688 swapi.dev:443
|
||||
```
|
||||
|
||||
## Install as NPM Package
|
||||
|
||||
Reference in New Issue
Block a user