@camerontaylor/paseo-protocol 0.9.1-fork.1 → 0.10.2-fork.1
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/client-capabilities.d.ts +1 -0
- package/dist/client-capabilities.js +1 -0
- package/dist/daemon-endpoints.d.ts +7 -0
- package/dist/daemon-endpoints.js +42 -0
- package/dist/generated/validation/ws-outbound.aot.js +47642 -47308
- package/dist/messages.d.ts +782 -0
- package/dist/messages.js +55 -0
- package/dist/terminal-profiles.js +7 -1
- package/dist/validation/ws-outbound-schema-metadata.d.ts +175 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const CLIENT_CAPS = {
|
|
2
|
+
helloRejection: "hello_rejection",
|
|
2
3
|
// COMPAT(ownedSubscriptions): added in v0.8.0, remove legacy ownership after 2027-03-09.
|
|
3
4
|
ownedSubscriptions: "owned_subscriptions",
|
|
4
5
|
// Clients outside the Paseo app version series can explicitly accept provider IDs.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConnectionOfferV2 } from "./connection-offer.js";
|
|
1
2
|
export interface HostPortParts {
|
|
2
3
|
host: string;
|
|
3
4
|
port: number;
|
|
@@ -9,6 +10,12 @@ export interface ConnectionUriParts extends HostPortParts {
|
|
|
9
10
|
export interface ParsedConnectionUri extends ConnectionUriParts {
|
|
10
11
|
password?: string;
|
|
11
12
|
}
|
|
13
|
+
export interface ParsedRelayConnectionUri {
|
|
14
|
+
offer: ConnectionOfferV2;
|
|
15
|
+
password?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function parseRelayConnectionUri(input: string): ParsedRelayConnectionUri;
|
|
18
|
+
export declare function serializeRelayConnectionUri(parts: ParsedRelayConnectionUri): string;
|
|
12
19
|
export type RelayRole = "server" | "client";
|
|
13
20
|
export type RelayProtocolVersion = "1" | "2";
|
|
14
21
|
export declare const CURRENT_RELAY_PROTOCOL_VERSION: RelayProtocolVersion;
|
package/dist/daemon-endpoints.js
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
export function parseRelayConnectionUri(input) {
|
|
2
|
+
const trimmed = input.trim();
|
|
3
|
+
const connectIndex = trimmed.indexOf("#connect=");
|
|
4
|
+
const uri = connectIndex >= 0
|
|
5
|
+
? decodeURIComponent(trimmed.slice(connectIndex + "#connect=".length))
|
|
6
|
+
: trimmed;
|
|
7
|
+
let url;
|
|
8
|
+
try {
|
|
9
|
+
url = new URL(uri);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
throw new Error("Invalid relay connection URI");
|
|
13
|
+
}
|
|
14
|
+
if (url.protocol !== "relay:" || !url.hostname || !url.port || url.username || url.password) {
|
|
15
|
+
throw new Error("Invalid relay connection URI");
|
|
16
|
+
}
|
|
17
|
+
const serverId = decodeURIComponent(url.pathname.slice(1));
|
|
18
|
+
const key = url.searchParams.get("key");
|
|
19
|
+
if (!serverId || !key || serverId.includes("/")) {
|
|
20
|
+
throw new Error("Relay connection URI requires a server id and key");
|
|
21
|
+
}
|
|
22
|
+
const endpoint = normalizeHostPort(url.host);
|
|
23
|
+
const password = url.searchParams.get("password") || undefined;
|
|
24
|
+
return {
|
|
25
|
+
offer: {
|
|
26
|
+
v: 2,
|
|
27
|
+
serverId,
|
|
28
|
+
daemonPublicKeyB64: key,
|
|
29
|
+
relay: { endpoint, useTls: url.searchParams.get("ssl") === "true" },
|
|
30
|
+
},
|
|
31
|
+
...(password ? { password } : {}),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function serializeRelayConnectionUri(parts) {
|
|
35
|
+
const url = new URL(`relay://${parts.offer.relay.endpoint}/${encodeURIComponent(parts.offer.serverId)}`);
|
|
36
|
+
url.searchParams.set("key", parts.offer.daemonPublicKeyB64);
|
|
37
|
+
if (parts.offer.relay.useTls)
|
|
38
|
+
url.searchParams.set("ssl", "true");
|
|
39
|
+
if (parts.password)
|
|
40
|
+
url.searchParams.set("password", parts.password);
|
|
41
|
+
return url.toString();
|
|
42
|
+
}
|
|
1
43
|
export const CURRENT_RELAY_PROTOCOL_VERSION = "2";
|
|
2
44
|
export const DEFAULT_RELAY_ENDPOINT = "relay.paseo.sh:443";
|
|
3
45
|
export function normalizeRelayProtocolVersion(value, fallback = CURRENT_RELAY_PROTOCOL_VERSION) {
|