fix: parse version from notary url (#45)

* fix: parse version from notary url

* fix: rename variable

* fix: bump version in demo

* fix: change version in quickstart.md
This commit is contained in:
tsukino
2024-04-09 12:44:28 -04:00
committed by GitHub
parent 73c2a2b631
commit 42dd75526e
4 changed files with 10 additions and 6 deletions

View File

@@ -12,7 +12,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-loader-spinner": "^6.1.6",
"tlsn-js": "0.1.0-alpha.4.1"
"tlsn-js": "0.1.0-alpha.5.2"
},
"devDependencies": {
"@types/react": "^18.0.26",

View File

@@ -1,6 +1,6 @@
{
"name": "tlsn-js",
"version": "v0.1.0-alpha.5.1",
"version": "v0.1.0-alpha.5.2",
"description": "",
"repository": "https://github.com/tlsnotary/tlsn-js",
"main": "build/index.js",

View File

@@ -23,7 +23,7 @@ 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.4"
git clone https://github.com/tlsnotary/tlsn.git --branch "v0.1.0-alpha.5"
```
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

View File

@@ -111,6 +111,8 @@ pub async fn prover(
.map_err(|e| JsValue::from_str(&format!("Could not parse notary_url: {:?}", e)))?;
let notary_ssl = notary_url.scheme() == "https" || notary_url.scheme() == "wss";
let notary_host = notary_url.authority();
let notary_path = notary_url.path();
let notary_path_str = if notary_path == "/" { "" } else { notary_path };
headers
.append("Host", notary_host)
@@ -134,9 +136,10 @@ pub async fn prover(
// url
let url = format!(
"{}://{}/v0.1.0-alpha.5/session",
"{}://{}{}/session",
if notary_ssl { "https" } else { "http" },
notary_host
notary_host,
notary_path_str
);
debug!("Request: {}", url);
let rust_string = fetch_as_json_string(&url, &opts)
@@ -149,9 +152,10 @@ pub async fn prover(
info!("Notarization response: {:?}", notarization_response,);
let notary_wss_url = format!(
"{}://{}/v0.1.0-alpha.5/notarize?sessionId={}",
"{}://{}{}/notarize?sessionId={}",
if notary_ssl { "wss" } else { "ws" },
notary_host,
notary_path_str,
notarization_response.session_id
);
let (_, notary_ws_stream) = WsMeta::connect(notary_wss_url, None)