mirror of
https://github.com/tlsnotary/tlsn-js.git
synced 2026-01-09 20:47:55 -05:00
* Update to tlsnotary v0.1.0-alpha.10 * Prove data from GitHub server instead of swapi in tests * Log browser messages during test execution
1.9 KiB
1.9 KiB
Quick Start Guide
There is a simple react/typescript demo app in ./demo/react-ts-webpack. The directory contains a webpack configuration file that allows you to quickly bootstrap a webpack app using tlsn-js.
Run a local notary server and websocket proxy
Websocket Proxy
Since a web browser doesn't have the ability to make TCP connection, we need to use a websocket proxy server.
To run your own websocket proxy for https://swapi.dev locally:
-
Install websocat:
tool command cargo cargo install websocatbrew brew install websocatsource https://github.com/vi/websocat -
Run a websocket proxy for
https://swapi.dev:
websocat --binary -v ws-l:0.0.0.0:55688 tcp:swapi.dev:443
Note the tcp:swapi.dev:443 argument on the last line, this is the server we will use in this quick start.
Run a Local Notary Server
For this demo, we also need to run a local notary server.
- Use docker
npm run notary - Or, compile and run the notary server natively:
# Clone the TLSNotary repository: git clone https://github.com/tlsnotary/tlsn.git --branch "v0.1.0-alpha.10" 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
- Compile tlns-js
npm i npm run build - Go to the demo folder
cd demo/react-ts-webpack - Install dependencies
npm i - Start Webpack Dev Server:
npm run dev - Open
http://localhost:8080in your browser - Click the start demo button
- Open developer tools and monitor the console logs