@mercuryworkshop/epoxy-transport 2.0.5 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +103 -93
- package/dist/module.js +103 -93
- package/package.json +3 -3
- package/src/main.ts +9 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercuryworkshop/epoxy-transport",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "a bare transport that implements end-to-end encryption with epoxy-tls and wisp",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"keywords": [],
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"license": "AGPL-3.0-only",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@mercuryworkshop/epoxy-tls": "^2.0.
|
|
11
|
+
"@mercuryworkshop/epoxy-tls": "^2.0.4-1",
|
|
12
12
|
"esbuild-plugin-umd-wrapper": "^2.0.0",
|
|
13
13
|
"rollup": "^4.12.0",
|
|
14
14
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
15
15
|
"rollup-plugin-typescript2": "^0.36.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@mercuryworkshop/bare-mux": "^
|
|
18
|
+
"@mercuryworkshop/bare-mux": "^2.0.0",
|
|
19
19
|
"esbuild": "^0.19.11",
|
|
20
20
|
"esbuild-plugin-d.ts": "^1.2.2"
|
|
21
21
|
},
|
package/src/main.ts
CHANGED
|
@@ -2,22 +2,27 @@ import { BareHeaders, BareResponse, TransferrableResponse, type BareTransport }
|
|
|
2
2
|
import epoxy from "@mercuryworkshop/epoxy-tls";
|
|
3
3
|
//@ts-expect-error typescript doesnt follow the npm exports for some reason
|
|
4
4
|
import ROOTS from "@mercuryworkshop/epoxy-tls/certs"
|
|
5
|
-
export class EpoxyClient implements BareTransport {
|
|
5
|
+
export default class EpoxyClient implements BareTransport {
|
|
6
6
|
canstart = true;
|
|
7
7
|
epxclient: Awaited<ReturnType<any>>["EpoxyClient"]["prototype"] = null!;
|
|
8
8
|
wisp: string;
|
|
9
|
+
wisp_v2: boolean;
|
|
10
|
+
udp_extension_required: boolean;
|
|
9
11
|
EpoxyHandlers: Awaited<ReturnType<any>>["EpoxyHandlers"]["prototype"] = null!;
|
|
10
12
|
|
|
11
|
-
constructor({ wisp }) {
|
|
13
|
+
constructor({ wisp, wisp_v2, udp_extension_required }) {
|
|
12
14
|
this.wisp = wisp;
|
|
15
|
+
this.wisp_v2 = wisp_v2 || true;
|
|
16
|
+
this.udp_extension_required = udp_extension_required || false;
|
|
13
17
|
}
|
|
14
18
|
async init() {
|
|
15
19
|
const { EpoxyClient, EpoxyClientOptions, EpoxyHandlers } = await epoxy();
|
|
16
20
|
|
|
17
21
|
let options = new EpoxyClientOptions();
|
|
18
22
|
options.user_agent = navigator.userAgent;
|
|
19
|
-
options.udp_extension_required =
|
|
20
|
-
|
|
23
|
+
options.udp_extension_required = this.udp_extension_required;
|
|
24
|
+
options.wisp_v2 = this.wisp_v2;
|
|
25
|
+
this.epxclient = new EpoxyClient(this.wisp, ROOTS, options);
|
|
21
26
|
this.EpoxyHandlers = EpoxyHandlers;
|
|
22
27
|
|
|
23
28
|
this.ready = true;
|