@xconnio/xconn 0.0.0-stage → 0.6.2

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE +22 -0
  3. package/README.md +281 -2
  4. package/dist/auth.d.ts +51 -0
  5. package/dist/auth.js +57 -0
  6. package/dist/call.d.ts +38 -0
  7. package/dist/call.js +146 -0
  8. package/dist/client.d.ts +21 -0
  9. package/dist/client.js +62 -0
  10. package/dist/constants.d.ts +60 -0
  11. package/dist/constants.js +61 -0
  12. package/dist/crypto.d.ts +9 -0
  13. package/dist/crypto.js +25 -0
  14. package/dist/discovery.d.ts +20 -0
  15. package/dist/discovery.js +25 -0
  16. package/dist/exception.d.ts +12 -0
  17. package/dist/exception.js +28 -0
  18. package/dist/inbox.d.ts +14 -0
  19. package/dist/inbox.js +71 -0
  20. package/dist/index.d.ts +26 -0
  21. package/dist/index.js +15 -0
  22. package/dist/message.d.ts +33 -0
  23. package/dist/message.js +59 -0
  24. package/dist/native.d.ts +6 -0
  25. package/dist/native.js +35 -0
  26. package/dist/package.json +1 -0
  27. package/dist/payload.d.ts +48 -0
  28. package/dist/payload.js +314 -0
  29. package/dist/peer.d.ts +16 -0
  30. package/dist/peer.js +124 -0
  31. package/dist/requests.d.ts +57 -0
  32. package/dist/requests.js +121 -0
  33. package/dist/rpc-streams.d.ts +13 -0
  34. package/dist/rpc-streams.js +31 -0
  35. package/dist/serializers.d.ts +29 -0
  36. package/dist/serializers.js +44 -0
  37. package/dist/session.d.ts +67 -0
  38. package/dist/session.js +528 -0
  39. package/dist/toolchain.txt +3 -0
  40. package/dist/transport.d.ts +47 -0
  41. package/dist/transport.js +201 -0
  42. package/dist/types.d.ts +70 -0
  43. package/dist/types.js +140 -0
  44. package/dist/util.d.ts +2 -0
  45. package/dist/util.js +20 -0
  46. package/dist/wasm/xconn_browser.d.ts +176 -0
  47. package/dist/wasm/xconn_browser.js +1467 -0
  48. package/dist/wasm/xconn_browser_bg.wasm +0 -0
  49. package/dist/wasm/xconn_browser_bg.wasm.d.ts +53 -0
  50. package/dist/webrtc.d.ts +98 -0
  51. package/dist/webrtc.js +712 -0
  52. package/dist/webtransport.d.ts +31 -0
  53. package/dist/webtransport.js +242 -0
  54. package/package.json +48 -4
@@ -0,0 +1,47 @@
1
+ import { BaseSession, SessionDetails } from "./types.js";
2
+ import type { Message } from "./message.js";
3
+ import type { Payload, Serializer } from "./serializers.js";
4
+ export declare function sendPayload(socket: WebSocket, payload: Payload): void;
5
+ /** One ordered receiver stays installed across the join/session handoff. */
6
+ export declare class SocketInbox {
7
+ private readonly socket;
8
+ private readonly queue;
9
+ private readonly waiters;
10
+ private readonly listeners;
11
+ private queuedBytes;
12
+ private failure?;
13
+ private chain;
14
+ private resolveOpen;
15
+ private rejectOpen;
16
+ readonly opened: Promise<void>;
17
+ constructor(socket: WebSocket);
18
+ private readonly onOpen;
19
+ private readonly onMessage;
20
+ private readonly onClose;
21
+ private readonly onError;
22
+ private size;
23
+ receive(): Promise<Payload>;
24
+ onDisconnect(callback: (reason?: string) => void): void;
25
+ connected(): boolean;
26
+ stop(error: Error): void;
27
+ }
28
+ export declare class WebSocketBaseSession extends BaseSession {
29
+ private readonly socket;
30
+ private readonly sessionDetails;
31
+ private readonly codec;
32
+ private readonly inbox;
33
+ constructor(socket: WebSocket, messageHandler: unknown, sessionDetails: SessionDetails, codec: Serializer);
34
+ id(): number;
35
+ realm(): string;
36
+ authid(): string;
37
+ authrole(): string;
38
+ serializer(): Serializer;
39
+ getSessionDetails(): SessionDetails;
40
+ isConnected(): boolean;
41
+ send(data: Payload): void;
42
+ receive(): Promise<Payload>;
43
+ sendMessage(message: Message): void;
44
+ receiveMessage(): Promise<Message>;
45
+ onDisconnect(callback: (reason?: string) => void | Promise<void>): void;
46
+ close(): Promise<void>;
47
+ }
@@ -0,0 +1,201 @@
1
+ import { ProtocolError } from "./exception.js";
2
+ import { BaseSession, SessionDetails } from "./types.js";
3
+ export function sendPayload(socket, payload) {
4
+ if (typeof payload === "string") {
5
+ socket.send(payload);
6
+ return;
7
+ }
8
+ const buffer = payload.buffer;
9
+ const bytes = buffer instanceof ArrayBuffer
10
+ ? new Uint8Array(buffer, payload.byteOffset, payload.byteLength)
11
+ : Uint8Array.from(payload);
12
+ socket.send(bytes);
13
+ }
14
+ /** One ordered receiver stays installed across the join/session handoff. */
15
+ export class SocketInbox {
16
+ socket;
17
+ queue = [];
18
+ waiters = [];
19
+ listeners = new Set();
20
+ queuedBytes = 0;
21
+ failure;
22
+ chain = Promise.resolve();
23
+ resolveOpen;
24
+ rejectOpen;
25
+ opened = new Promise((resolve, reject) => {
26
+ this.resolveOpen = resolve;
27
+ this.rejectOpen = reject;
28
+ });
29
+ constructor(socket) {
30
+ this.socket = socket;
31
+ socket.binaryType = "arraybuffer";
32
+ socket.addEventListener("open", this.onOpen);
33
+ socket.addEventListener("message", this.onMessage);
34
+ socket.addEventListener("close", this.onClose);
35
+ socket.addEventListener("error", this.onError);
36
+ if (socket.readyState === WebSocket.OPEN) {
37
+ this.resolveOpen();
38
+ }
39
+ }
40
+ onOpen = () => this.resolveOpen();
41
+ onMessage = (event) => {
42
+ this.chain = this.chain
43
+ .then(async () => {
44
+ let value;
45
+ if (typeof event.data === "string" || event.data instanceof Uint8Array) {
46
+ value = event.data;
47
+ }
48
+ else if (event.data instanceof ArrayBuffer) {
49
+ value = new Uint8Array(event.data);
50
+ }
51
+ else if (event.data instanceof Blob) {
52
+ value = new Uint8Array(await event.data.arrayBuffer());
53
+ }
54
+ else {
55
+ throw new ProtocolError("Unsupported WebSocket payload");
56
+ }
57
+ if (this.failure) {
58
+ return;
59
+ }
60
+ const waiter = this.waiters.shift();
61
+ if (waiter) {
62
+ waiter.resolve(value);
63
+ }
64
+ else {
65
+ const size = this.size(value);
66
+ this.queuedBytes += size;
67
+ if (this.queue.length >= 1024 || this.queuedBytes > 64 * 1024 * 1024) {
68
+ throw new ProtocolError("WebSocket receive queue exceeded its limit");
69
+ }
70
+ this.queue.push({ value, size });
71
+ }
72
+ })
73
+ .catch((error) => {
74
+ this.stop(error instanceof Error ? error : new ProtocolError(String(error)));
75
+ this.socket.close();
76
+ });
77
+ };
78
+ onClose = (event) => {
79
+ void this.chain.then(() => this.stop(new ProtocolError(event.reason || "Connection closed")));
80
+ };
81
+ onError = () => {
82
+ void this.chain.then(() => this.stop(new ProtocolError("WebSocket connection failed")));
83
+ };
84
+ size(value) {
85
+ return typeof value === "string" ? new TextEncoder().encode(value).length : value.byteLength;
86
+ }
87
+ receive() {
88
+ const queued = this.queue.shift();
89
+ if (queued !== undefined) {
90
+ this.queuedBytes -= queued.size;
91
+ return Promise.resolve(queued.value);
92
+ }
93
+ if (this.failure) {
94
+ return Promise.reject(this.failure);
95
+ }
96
+ return new Promise((resolve, reject) => this.waiters.push({ resolve, reject }));
97
+ }
98
+ onDisconnect(callback) {
99
+ if (this.failure) {
100
+ queueMicrotask(() => callback(this.failure?.message));
101
+ }
102
+ else {
103
+ this.listeners.add(callback);
104
+ }
105
+ }
106
+ connected() {
107
+ return !this.failure && this.socket.readyState === WebSocket.OPEN;
108
+ }
109
+ stop(error) {
110
+ if (this.failure) {
111
+ return;
112
+ }
113
+ this.failure = error;
114
+ this.rejectOpen(error);
115
+ this.socket.removeEventListener("open", this.onOpen);
116
+ this.socket.removeEventListener("message", this.onMessage);
117
+ this.socket.removeEventListener("close", this.onClose);
118
+ this.socket.removeEventListener("error", this.onError);
119
+ for (const waiter of this.waiters.splice(0)) {
120
+ waiter.reject(error);
121
+ }
122
+ this.queue.length = 0;
123
+ this.queuedBytes = 0;
124
+ for (const callback of this.listeners) {
125
+ callback(error.message);
126
+ }
127
+ this.listeners.clear();
128
+ }
129
+ }
130
+ export class WebSocketBaseSession extends BaseSession {
131
+ socket;
132
+ sessionDetails;
133
+ codec;
134
+ inbox;
135
+ constructor(socket, messageHandler, sessionDetails, codec) {
136
+ super();
137
+ this.socket = socket;
138
+ this.sessionDetails = sessionDetails;
139
+ this.codec = codec;
140
+ if (messageHandler instanceof SocketInbox) {
141
+ this.inbox = messageHandler;
142
+ }
143
+ else {
144
+ if (typeof messageHandler === "function") {
145
+ socket.removeEventListener("message", messageHandler);
146
+ }
147
+ this.inbox = new SocketInbox(socket);
148
+ // An externally supplied socket may already be closed before anyone awaits opened.
149
+ void this.inbox.opened.catch(() => undefined);
150
+ }
151
+ }
152
+ id() {
153
+ return this.sessionDetails.sessionID;
154
+ }
155
+ realm() {
156
+ return this.sessionDetails.realm;
157
+ }
158
+ authid() {
159
+ return this.sessionDetails.authid;
160
+ }
161
+ authrole() {
162
+ return this.sessionDetails.authrole;
163
+ }
164
+ serializer() {
165
+ return this.codec;
166
+ }
167
+ getSessionDetails() {
168
+ return this.sessionDetails;
169
+ }
170
+ isConnected() {
171
+ return this.inbox.connected();
172
+ }
173
+ send(data) {
174
+ if (!this.isConnected()) {
175
+ throw new ProtocolError("Connection closed");
176
+ }
177
+ sendPayload(this.socket, data);
178
+ }
179
+ receive() {
180
+ return this.inbox.receive();
181
+ }
182
+ sendMessage(message) {
183
+ this.send(this.codec.serialize(message));
184
+ }
185
+ async receiveMessage() {
186
+ return this.codec.deserialize(await this.receive());
187
+ }
188
+ onDisconnect(callback) {
189
+ this.inbox.onDisconnect((reason) => {
190
+ void Promise.resolve()
191
+ .then(() => callback(reason))
192
+ .catch((error) => console.error(error));
193
+ });
194
+ }
195
+ async close() {
196
+ this.inbox.stop(new ProtocolError("Connection closed"));
197
+ if (this.socket.readyState < WebSocket.CLOSING) {
198
+ this.socket.close();
199
+ }
200
+ }
201
+ }
@@ -0,0 +1,70 @@
1
+ import type { RPCStream } from "./rpc-streams.js";
2
+ import { Payload as PayloadAccess } from "./payload.js";
3
+ import type { Session } from "./session.js";
4
+ import type { Serializer, Payload } from "./serializers.js";
5
+ import type { Dictionary, Message } from "./message.js";
6
+ export declare class SessionDetails {
7
+ readonly sessionID: number;
8
+ readonly realm: string;
9
+ readonly authid: string;
10
+ readonly authrole: string;
11
+ readonly authmethod?: string | undefined;
12
+ readonly authextra?: Dictionary | undefined;
13
+ readonly roles?: Dictionary | undefined;
14
+ constructor(sessionID: number, realm: string, authid: string, authrole: string, authmethod?: string | undefined, authextra?: Dictionary | undefined, roles?: Dictionary | undefined);
15
+ }
16
+ export declare abstract class BaseSession {
17
+ id(): number;
18
+ realm(): string;
19
+ authid(): string;
20
+ authrole(): string;
21
+ serializer(): Serializer;
22
+ send(_data: Payload): void;
23
+ receive(): Promise<Payload>;
24
+ sendMessage(message: Message): void;
25
+ receiveMessage(): Promise<Message>;
26
+ close(): Promise<void>;
27
+ isConnected(): boolean;
28
+ onDisconnect(_callback: (reason?: string) => void | Promise<void>): void;
29
+ getSessionDetails(): SessionDetails;
30
+ }
31
+ export declare class Result extends PayloadAccess {
32
+ private readonly openStream?;
33
+ get progress(): boolean;
34
+ static create(...args: unknown[]): Result;
35
+ details: Dictionary;
36
+ constructor(args?: unknown[] | null, kwargs?: Dictionary | null, details?: Dictionary | null, openStream?: ((reference: unknown) => Promise<RPCStream>) | undefined);
37
+ argStream(index: number): Promise<RPCStream>;
38
+ }
39
+ export declare class Invocation extends PayloadAccess {
40
+ readonly details: Dictionary;
41
+ readonly signal: AbortSignal;
42
+ private readonly progress?;
43
+ private readonly openStream?;
44
+ constructor(args?: unknown[], kwargs?: Dictionary, details?: Dictionary, signal?: AbortSignal, progress?: ((args: unknown[], kwargs: Dictionary) => void) | undefined, openStream?: ((reference: unknown) => Promise<RPCStream>) | undefined);
45
+ argStream(index: number): Promise<RPCStream>;
46
+ sendProgress(args?: unknown[], kwargs?: Dictionary): Promise<void>;
47
+ }
48
+ export declare class Event extends PayloadAccess {
49
+ readonly details: Dictionary;
50
+ constructor(args?: unknown[], kwargs?: Dictionary, details?: Dictionary);
51
+ }
52
+ export declare class Registration {
53
+ readonly registrationID: number;
54
+ private readonly session;
55
+ constructor(registrationID: number, session: Session);
56
+ unregister(): Promise<void>;
57
+ }
58
+ export declare class Subscription {
59
+ readonly subscriptionID: number;
60
+ private readonly session;
61
+ constructor(subscriptionID: number, session: Session);
62
+ unsubscribe(): Promise<void>;
63
+ }
64
+ export type InvocationHandler = (invocation: Invocation) => Result | void | null | Promise<Result | void | null>;
65
+ export type EventHandler = (event: Event) => void | Promise<void>;
66
+ export interface CallControl {
67
+ signal?: AbortSignal;
68
+ timeout?: number;
69
+ onProgress?: (result: Result) => void | Promise<void>;
70
+ }
package/dist/types.js ADDED
@@ -0,0 +1,140 @@
1
+ import { Payload as PayloadAccess } from "./payload.js";
2
+ export class SessionDetails {
3
+ sessionID;
4
+ realm;
5
+ authid;
6
+ authrole;
7
+ authmethod;
8
+ authextra;
9
+ roles;
10
+ constructor(sessionID, realm, authid, authrole, authmethod, authextra, roles) {
11
+ this.sessionID = sessionID;
12
+ this.realm = realm;
13
+ this.authid = authid;
14
+ this.authrole = authrole;
15
+ this.authmethod = authmethod;
16
+ this.authextra = authextra;
17
+ this.roles = roles;
18
+ }
19
+ }
20
+ export class BaseSession {
21
+ id() {
22
+ return this.getSessionDetails().sessionID;
23
+ }
24
+ realm() {
25
+ return this.getSessionDetails().realm;
26
+ }
27
+ authid() {
28
+ return this.getSessionDetails().authid;
29
+ }
30
+ authrole() {
31
+ return this.getSessionDetails().authrole;
32
+ }
33
+ serializer() {
34
+ throw new Error("UnimplementedError");
35
+ }
36
+ send(_data) {
37
+ throw new Error("UnimplementedError");
38
+ }
39
+ async receive() {
40
+ throw new Error("UnimplementedError");
41
+ }
42
+ sendMessage(message) {
43
+ this.send(this.serializer().serialize(message));
44
+ }
45
+ async receiveMessage() {
46
+ return this.serializer().deserialize(await this.receive());
47
+ }
48
+ async close() {
49
+ throw new Error("UnimplementedError");
50
+ }
51
+ isConnected() {
52
+ throw new Error("UnimplementedError");
53
+ }
54
+ onDisconnect(_callback) {
55
+ throw new Error("UnimplementedError");
56
+ }
57
+ getSessionDetails() {
58
+ throw new Error("UnimplementedError");
59
+ }
60
+ }
61
+ export class Result extends PayloadAccess {
62
+ openStream;
63
+ get progress() {
64
+ return this.details.progress === true;
65
+ }
66
+ static create(...args) {
67
+ return new Result(args);
68
+ }
69
+ details;
70
+ constructor(args, kwargs, details, openStream) {
71
+ super(args ?? [], kwargs ?? {});
72
+ this.openStream = openStream;
73
+ this.details = details ?? {};
74
+ }
75
+ argStream(index) {
76
+ if (!this.openStream)
77
+ throw new Error("Result has no stream transport");
78
+ if (!Number.isInteger(index) || index < 0 || index >= this.args.length) {
79
+ throw new RangeError("Stream argument index out of range");
80
+ }
81
+ return this.openStream(this.args[index]);
82
+ }
83
+ }
84
+ export class Invocation extends PayloadAccess {
85
+ details;
86
+ signal;
87
+ progress;
88
+ openStream;
89
+ constructor(args = [], kwargs = {}, details = {}, signal = new AbortController().signal, progress, openStream) {
90
+ super(args, kwargs);
91
+ this.details = details;
92
+ this.signal = signal;
93
+ this.progress = progress;
94
+ this.openStream = openStream;
95
+ }
96
+ argStream(index) {
97
+ if (!this.openStream)
98
+ throw new Error("Invocation has no stream transport");
99
+ if (!Number.isInteger(index) || index < 0 || index >= this.args.length) {
100
+ throw new RangeError("Stream argument index out of range");
101
+ }
102
+ return this.openStream(this.args[index]);
103
+ }
104
+ async sendProgress(args = [], kwargs = {}) {
105
+ this.signal.throwIfAborted();
106
+ if (!this.progress) {
107
+ throw new Error("Progress was not requested by the caller");
108
+ }
109
+ this.progress(args, kwargs);
110
+ }
111
+ }
112
+ export class Event extends PayloadAccess {
113
+ details;
114
+ constructor(args = [], kwargs = {}, details = {}) {
115
+ super(args, kwargs);
116
+ this.details = details;
117
+ }
118
+ }
119
+ export class Registration {
120
+ registrationID;
121
+ session;
122
+ constructor(registrationID, session) {
123
+ this.registrationID = registrationID;
124
+ this.session = session;
125
+ }
126
+ unregister() {
127
+ return this.session.unregister(this);
128
+ }
129
+ }
130
+ export class Subscription {
131
+ subscriptionID;
132
+ session;
133
+ constructor(subscriptionID, session) {
134
+ this.subscriptionID = subscriptionID;
135
+ this.session = session;
136
+ }
137
+ unsubscribe() {
138
+ return this.session.unsubscribe(this);
139
+ }
140
+ }
package/dist/util.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function timeoutValue(value: number, name: string): number;
2
+ export declare function abortable<T>(promise: Promise<T>, signal: AbortSignal): Promise<T>;
package/dist/util.js ADDED
@@ -0,0 +1,20 @@
1
+ export function timeoutValue(value, name) {
2
+ if (!Number.isFinite(value) || value < 0 || value > 2147483647) {
3
+ throw new RangeError(`${name} is out of range`);
4
+ }
5
+ return value;
6
+ }
7
+ export function abortable(promise, signal) {
8
+ if (signal.aborted) {
9
+ void promise.catch(() => undefined);
10
+ return Promise.reject(signal.reason);
11
+ }
12
+ return new Promise((resolve, reject) => {
13
+ const abort = () => {
14
+ signal.removeEventListener("abort", abort);
15
+ reject(signal.reason);
16
+ };
17
+ signal.addEventListener("abort", abort, { once: true });
18
+ promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
19
+ });
20
+ }
@@ -0,0 +1,176 @@
1
+ /// <reference lib="esnext.disposable" />
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ /**
6
+ * The same bounded message assembler used by the native WebRTC transport.
7
+ */
8
+ export class ChannelFraming {
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ encode(message: Uint8Array): Array<any>;
12
+ feed(chunk: Uint8Array): Uint8Array | undefined;
13
+ constructor(maximum?: number | null);
14
+ }
15
+
16
+ export class ClientProtocol {
17
+ free(): void;
18
+ [Symbol.dispose](): void;
19
+ check_challenge(): void;
20
+ details(): any;
21
+ hello(): any;
22
+ joined(): boolean;
23
+ constructor(realm: string, codec: string, method: string, authid: string, extra: any);
24
+ receive(wire: any): any;
25
+ set_authentication(wire: any): void;
26
+ }
27
+
28
+ export class NativeAuthenticator {
29
+ free(): void;
30
+ [Symbol.dispose](): void;
31
+ authenticate(wire: any): any;
32
+ extra(): any;
33
+ constructor(method: string, authid: string, secret: string, extra: any);
34
+ }
35
+
36
+ export class NativeCodec {
37
+ free(): void;
38
+ [Symbol.dispose](): void;
39
+ decode(payload: Uint8Array): any;
40
+ encode(wire: any): Uint8Array;
41
+ constructor(name: string);
42
+ }
43
+
44
+ /**
45
+ * Static adapters allocate no persistent WASM resource handles.
46
+ */
47
+ export class PacketCrypto {
48
+ private constructor();
49
+ free(): void;
50
+ [Symbol.dispose](): void;
51
+ static decrypt(packet: Uint8Array, key: Uint8Array, additional_data: Uint8Array): Uint8Array;
52
+ static derive_key(secret: Uint8Array, info: Uint8Array): Uint8Array;
53
+ static encrypt(plaintext: Uint8Array, key: Uint8Array, additional_data: Uint8Array): Uint8Array;
54
+ static key_pair(): any;
55
+ static shared_secret(_private: Uint8Array, _public: Uint8Array): Uint8Array;
56
+ }
57
+
58
+ /**
59
+ * RawSocket negotiation and bounded headers shared by browser transports.
60
+ */
61
+ export class RawSocketFraming {
62
+ free(): void;
63
+ [Symbol.dispose](): void;
64
+ accept_handshake(data: Uint8Array): void;
65
+ handshake(): Uint8Array;
66
+ header(kind: number, length: number): Uint8Array;
67
+ constructor(codec: string, maximum?: number | null);
68
+ parse_header(data: Uint8Array): Uint32Array;
69
+ send_limit(): number;
70
+ }
71
+
72
+ export class RequestIds {
73
+ free(): void;
74
+ [Symbol.dispose](): void;
75
+ constructor();
76
+ next(): number;
77
+ }
78
+
79
+ export function channel_message_limit(): number;
80
+
81
+ export function channel_packet_limit(): number;
82
+
83
+ export function has_binary_codecs(): boolean;
84
+
85
+ export function inspect_message(wire: any): any;
86
+
87
+ export function make_message(code: number, value: any): any;
88
+
89
+ export function raw_channel_protocol(): string;
90
+
91
+ export function rawsocket_receive_limit(): number;
92
+
93
+ export function signaling_decode(text: string): any;
94
+
95
+ /**
96
+ * WebRTC signaling uses Rust JSON, independently of the WAMP session codec.
97
+ */
98
+ export function signaling_encode(value: any): string;
99
+
100
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
101
+
102
+ export interface InitOutput {
103
+ readonly memory: WebAssembly.Memory;
104
+ readonly __wbg_channelframing_free: (a: number, b: number) => void;
105
+ readonly __wbg_clientprotocol_free: (a: number, b: number) => void;
106
+ readonly __wbg_nativeauthenticator_free: (a: number, b: number) => void;
107
+ readonly __wbg_nativecodec_free: (a: number, b: number) => void;
108
+ readonly __wbg_packetcrypto_free: (a: number, b: number) => void;
109
+ readonly __wbg_rawsocketframing_free: (a: number, b: number) => void;
110
+ readonly __wbg_requestids_free: (a: number, b: number) => void;
111
+ readonly channel_message_limit: () => number;
112
+ readonly channel_packet_limit: () => number;
113
+ readonly channelframing_encode: (a: number, b: number, c: number, d: number) => void;
114
+ readonly channelframing_feed: (a: number, b: number, c: number, d: number) => void;
115
+ readonly channelframing_new: (a: number, b: number) => void;
116
+ readonly clientprotocol_check_challenge: (a: number, b: number) => void;
117
+ readonly clientprotocol_details: (a: number, b: number) => void;
118
+ readonly clientprotocol_hello: (a: number, b: number) => void;
119
+ readonly clientprotocol_joined: (a: number) => number;
120
+ readonly clientprotocol_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
121
+ readonly clientprotocol_receive: (a: number, b: number, c: number) => void;
122
+ readonly clientprotocol_set_authentication: (a: number, b: number, c: number) => void;
123
+ readonly has_binary_codecs: () => number;
124
+ readonly inspect_message: (a: number, b: number) => void;
125
+ readonly make_message: (a: number, b: number, c: number) => void;
126
+ readonly nativeauthenticator_authenticate: (a: number, b: number, c: number) => void;
127
+ readonly nativeauthenticator_extra: (a: number, b: number) => void;
128
+ readonly nativeauthenticator_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
129
+ readonly nativecodec_decode: (a: number, b: number, c: number, d: number) => void;
130
+ readonly nativecodec_encode: (a: number, b: number, c: number) => void;
131
+ readonly nativecodec_new: (a: number, b: number, c: number) => void;
132
+ readonly packetcrypto_decrypt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
133
+ readonly packetcrypto_derive_key: (a: number, b: number, c: number, d: number, e: number) => void;
134
+ readonly packetcrypto_encrypt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
135
+ readonly packetcrypto_key_pair: (a: number) => void;
136
+ readonly packetcrypto_shared_secret: (a: number, b: number, c: number, d: number, e: number) => void;
137
+ readonly raw_channel_protocol: (a: number) => void;
138
+ readonly rawsocket_receive_limit: () => number;
139
+ readonly rawsocketframing_accept_handshake: (a: number, b: number, c: number, d: number) => void;
140
+ readonly rawsocketframing_handshake: (a: number, b: number) => void;
141
+ readonly rawsocketframing_header: (a: number, b: number, c: number, d: number) => void;
142
+ readonly rawsocketframing_new: (a: number, b: number, c: number, d: number) => void;
143
+ readonly rawsocketframing_parse_header: (a: number, b: number, c: number, d: number) => void;
144
+ readonly rawsocketframing_send_limit: (a: number) => number;
145
+ readonly requestids_new: () => number;
146
+ readonly requestids_next: (a: number) => number;
147
+ readonly signaling_decode: (a: number, b: number, c: number) => void;
148
+ readonly signaling_encode: (a: number, b: number) => void;
149
+ readonly __wbindgen_export: (a: number, b: number) => number;
150
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
151
+ readonly __wbindgen_export3: (a: number) => void;
152
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
153
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
154
+ }
155
+
156
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
157
+
158
+ /**
159
+ * Instantiates the given `module`, which can either be bytes or
160
+ * a precompiled `WebAssembly.Module`.
161
+ *
162
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
163
+ *
164
+ * @returns {InitOutput}
165
+ */
166
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
167
+
168
+ /**
169
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
170
+ * for everything else, calls `WebAssembly.instantiate` directly.
171
+ *
172
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
173
+ *
174
+ * @returns {Promise<InitOutput>}
175
+ */
176
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;