Skip to content

Commit 42dd755

Browse files
authored
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
1 parent 73c2a2b commit 42dd755

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

demo/react-ts-webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"react": "^18.2.0",
1313
"react-dom": "^18.2.0",
1414
"react-loader-spinner": "^6.1.6",
15-
"tlsn-js": "0.1.0-alpha.4.1"
15+
"tlsn-js": "0.1.0-alpha.5.2"
1616
},
1717
"devDependencies": {
1818
"@types/react": "^18.0.26",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tlsn-js",
3-
"version": "v0.1.0-alpha.5.1",
3+
"version": "v0.1.0-alpha.5.2",
44
"description": "",
55
"repository": "https://github.com/tlsnotary/tlsn-js",
66
"main": "build/index.js",

quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ For this demo, we also need to run a local notary server.
2323

2424
1. Clone the TLSNotary repository:
2525
```shell
26-
git clone https://github.com/tlsnotary/tlsn.git --branch "v0.1.0-alpha.4"
26+
git clone https://github.com/tlsnotary/tlsn.git --branch "v0.1.0-alpha.5"
2727
```
2828
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.
2929
```yaml

wasm/prover/src/prover.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ pub async fn prover(
111111
.map_err(|e| JsValue::from_str(&format!("Could not parse notary_url: {:?}", e)))?;
112112
let notary_ssl = notary_url.scheme() == "https" || notary_url.scheme() == "wss";
113113
let notary_host = notary_url.authority();
114+
let notary_path = notary_url.path();
115+
let notary_path_str = if notary_path == "/" { "" } else { notary_path };
114116

115117
headers
116118
.append("Host", notary_host)
@@ -134,9 +136,10 @@ pub async fn prover(
134136

135137
// url
136138
let url = format!(
137-
"{}://{}/v0.1.0-alpha.5/session",
139+
"{}://{}{}/session",
138140
if notary_ssl { "https" } else { "http" },
139-
notary_host
141+
notary_host,
142+
notary_path_str
140143
);
141144
debug!("Request: {}", url);
142145
let rust_string = fetch_as_json_string(&url, &opts)
@@ -149,9 +152,10 @@ pub async fn prover(
149152

150153
info!("Notarization response: {:?}", notarization_response,);
151154
let notary_wss_url = format!(
152-
"{}://{}/v0.1.0-alpha.5/notarize?sessionId={}",
155+
"{}://{}{}/notarize?sessionId={}",
153156
if notary_ssl { "wss" } else { "ws" },
154157
notary_host,
158+
notary_path_str,
155159
notarization_response.session_id
156160
);
157161
let (_, notary_ws_stream) = WsMeta::connect(notary_wss_url, None)

0 commit comments

Comments
 (0)