yojimbo2 1.13.501 → 1.13.502

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # yojimbo (TypeScript)
2
2
 
3
- npm package: `yojimbo2` (plain `yojimbo` is taken on npm by an unrelated package). Install it with `npm install yojimbo2`, then `import { Client, Server, ... } from 'yojimbo2'`. Subpath entry points: `yojimbo2/webrtc/client`, `yojimbo2/webrtc/server`, `yojimbo2/webrtc/server-http` (Node), `yojimbo2/webrtc/token`, `yojimbo2/netcode`, `yojimbo2/reliable`, `yojimbo2/serialize`, `yojimbo2/sodium`. Versions (shared with the NuGet package) mirror upstream yojimbo with a port revision folded into the patch: `1.13.500` is upstream 1.13.5, and `1.13.501` is the first port fix on top of it. See the root README.
3
+ npm package: `yojimbo2` (plain `yojimbo` is taken on npm by an unrelated package). Install it with `npm install yojimbo2`, then `import { Client, Server, ... } from 'yojimbo2'`. TypeScript consumers need TypeScript 5.0 or later. Subpath entry points: `yojimbo2/webrtc/client`, `yojimbo2/webrtc/server`, `yojimbo2/webrtc/server-http` (Node), `yojimbo2/webrtc/token`, `yojimbo2/netcode`, `yojimbo2/reliable`, `yojimbo2/serialize`, `yojimbo2/sodium`. Versions (shared with the NuGet package) mirror upstream yojimbo with a port revision folded into the patch: `1.13.500` is upstream 1.13.5, and `1.13.501` is the first port fix on top of it. See the root README.
4
4
 
5
5
  TypeScript port of yojimbo 1.13.5, with netcode 1.4.8, reliable 1.4.5, serialize and the libsodium subset netcode uses. One codebase runs on Node (24+) and in the browser.
6
6
 
@@ -78,7 +78,7 @@ export declare class netcode_client_config_t {
78
78
  }
79
79
  export declare class netcode_server_config_t {
80
80
  protocol_id: bigint;
81
- private_key: Uint8Array<ArrayBuffer>;
81
+ private_key: Uint8Array;
82
82
  allocator_context: unknown;
83
83
  allocate_function: netcode_allocate_function_t | null;
84
84
  free_function: netcode_free_function_t | null;
@@ -233,9 +233,9 @@ export declare class netcode_connect_token_private_t {
233
233
  timeout_seconds: number;
234
234
  num_server_addresses: number;
235
235
  server_addresses: netcode_address_t[];
236
- client_to_server_key: Uint8Array<ArrayBuffer>;
237
- server_to_client_key: Uint8Array<ArrayBuffer>;
238
- user_data: Uint8Array<ArrayBuffer>;
236
+ client_to_server_key: Uint8Array;
237
+ server_to_client_key: Uint8Array;
238
+ user_data: Uint8Array;
239
239
  }
240
240
  export declare function netcode_generate_connect_token_private(connect_token: netcode_connect_token_private_t, client_id: bigint, timeout_seconds: number, num_server_addresses: number, server_addresses: netcode_address_t[], user_data: Uint8Array | null): void;
241
241
  export declare function netcode_write_connect_token_private(connect_token: netcode_connect_token_private_t, buffer: Uint8Array, buffer_length: number): void;
@@ -244,7 +244,7 @@ export declare function netcode_decrypt_connect_token_private(buffer: Uint8Array
244
244
  export declare function netcode_read_connect_token_private(buffer: Uint8Array, buffer_length: number, connect_token: netcode_connect_token_private_t): number;
245
245
  export declare class netcode_challenge_token_t {
246
246
  client_id: bigint;
247
- user_data: Uint8Array<ArrayBuffer>;
247
+ user_data: Uint8Array;
248
248
  }
249
249
  export declare function netcode_write_challenge_token(challenge_token: netcode_challenge_token_t, buffer: Uint8Array, buffer_length: number): void;
250
250
  export declare function netcode_encrypt_challenge_token(buffer: Uint8Array, buffer_length: number, sequence: bigint, key: Uint8Array): number;
@@ -260,11 +260,11 @@ export declare const NETCODE_CONNECTION_DISCONNECT_PACKET = 6;
260
260
  export declare const NETCODE_CONNECTION_NUM_PACKETS = 7;
261
261
  export declare class netcode_connection_request_packet_t {
262
262
  packet_type: number;
263
- version_info: Uint8Array<ArrayBuffer>;
263
+ version_info: Uint8Array;
264
264
  protocol_id: bigint;
265
265
  connect_token_expire_timestamp: bigint;
266
- connect_token_nonce: Uint8Array<ArrayBuffer>;
267
- connect_token_data: Uint8Array<ArrayBuffer>;
266
+ connect_token_nonce: Uint8Array;
267
+ connect_token_data: Uint8Array;
268
268
  }
269
269
  export declare class netcode_connection_denied_packet_t {
270
270
  packet_type: number;
@@ -272,12 +272,12 @@ export declare class netcode_connection_denied_packet_t {
272
272
  export declare class netcode_connection_challenge_packet_t {
273
273
  packet_type: number;
274
274
  challenge_token_sequence: bigint;
275
- challenge_token_data: Uint8Array<ArrayBuffer>;
275
+ challenge_token_data: Uint8Array;
276
276
  }
277
277
  export declare class netcode_connection_response_packet_t {
278
278
  packet_type: number;
279
279
  challenge_token_sequence: bigint;
280
- challenge_token_data: Uint8Array<ArrayBuffer>;
280
+ challenge_token_data: Uint8Array;
281
281
  }
282
282
  export declare class netcode_connection_keep_alive_packet_t {
283
283
  packet_type: number;
@@ -296,14 +296,14 @@ export declare class netcode_connection_disconnect_packet_t {
296
296
  export type netcode_packet_t = netcode_connection_request_packet_t | netcode_connection_denied_packet_t | netcode_connection_challenge_packet_t | netcode_connection_response_packet_t | netcode_connection_keep_alive_packet_t | netcode_connection_payload_packet_t | netcode_connection_disconnect_packet_t;
297
297
  export declare function netcode_create_payload_packet(payload_bytes: number, allocator_context: unknown, allocate_function: netcode_allocate_function_t | null): netcode_connection_payload_packet_t | null;
298
298
  export declare class netcode_context_t {
299
- write_packet_key: Uint8Array<ArrayBuffer>;
300
- read_packet_key: Uint8Array<ArrayBuffer>;
299
+ write_packet_key: Uint8Array;
300
+ read_packet_key: Uint8Array;
301
301
  }
302
302
  export declare function netcode_sequence_number_bytes_required(sequence: bigint): number;
303
303
  export declare function netcode_write_packet(packet: netcode_packet_t, buffer: Uint8Array, buffer_length: number, sequence: bigint, write_packet_key: Uint8Array, protocol_id: bigint): number;
304
304
  export declare class netcode_replay_protection_t {
305
305
  most_recent_sequence: bigint;
306
- received_packet: BigUint64Array<ArrayBuffer>;
306
+ received_packet: BigUint64Array;
307
307
  }
308
308
  export declare function netcode_replay_protection_reset(replay_protection: netcode_replay_protection_t): void;
309
309
  export declare function netcode_replay_protection_already_received(replay_protection: netcode_replay_protection_t, sequence: bigint): number;
@@ -316,17 +316,17 @@ export declare function netcode_read_packet(buffer: Uint8Array, buffer_length: n
316
316
  value: bigint;
317
317
  }, read_packet_key: Uint8Array | null, protocol_id: bigint, current_timestamp: bigint, min_connect_token_expire_timestamp: bigint, private_key: Uint8Array | null, allowed_packets: Uint8Array, replay_protection: netcode_replay_protection_t | null, allocator_context: unknown, allocate_function: netcode_allocate_function_t | null): netcode_packet_t | null;
318
318
  export declare class netcode_connect_token_t {
319
- version_info: Uint8Array<ArrayBuffer>;
319
+ version_info: Uint8Array;
320
320
  protocol_id: bigint;
321
321
  create_timestamp: bigint;
322
322
  expire_timestamp: bigint;
323
- nonce: Uint8Array<ArrayBuffer>;
324
- private_data: Uint8Array<ArrayBuffer>;
323
+ nonce: Uint8Array;
324
+ private_data: Uint8Array;
325
325
  timeout_seconds: number;
326
326
  num_server_addresses: number;
327
327
  server_addresses: netcode_address_t[];
328
- client_to_server_key: Uint8Array<ArrayBuffer>;
329
- server_to_client_key: Uint8Array<ArrayBuffer>;
328
+ client_to_server_key: Uint8Array;
329
+ server_to_client_key: Uint8Array;
330
330
  }
331
331
  export declare function netcode_write_connect_token(connect_token: netcode_connect_token_t, buffer: Uint8Array, buffer_length: number): void;
332
332
  export declare function netcode_read_connect_token(buffer: Uint8Array, buffer_length: number, connect_token: netcode_connect_token_t): number;
@@ -337,7 +337,7 @@ export declare class netcode_packet_queue_t {
337
337
  num_packets: number;
338
338
  start_index: number;
339
339
  packet_data: unknown[];
340
- packet_sequence: BigUint64Array<ArrayBuffer>;
340
+ packet_sequence: BigUint64Array;
341
341
  }
342
342
  export declare function netcode_packet_queue_init(queue: netcode_packet_queue_t, allocator_context: unknown, allocate_function: netcode_allocate_function_t | null, free_function: netcode_free_function_t | null): void;
343
343
  export declare function netcode_packet_queue_push(queue: netcode_packet_queue_t, packet_data: unknown, packet_sequence: bigint): number;
@@ -404,13 +404,13 @@ export declare class netcode_client_t {
404
404
  replay_protection: netcode_replay_protection_t;
405
405
  packet_receive_queue: netcode_packet_queue_t;
406
406
  challenge_token_sequence: bigint;
407
- challenge_token_data: Uint8Array<ArrayBuffer>;
407
+ challenge_token_data: Uint8Array;
408
408
  receive_packet_data: (Uint8Array | null)[];
409
- receive_packet_bytes: Int32Array<ArrayBuffer>;
409
+ receive_packet_bytes: Int32Array;
410
410
  receive_from: netcode_address_t[];
411
411
  loopback: number;
412
- packet_buffer: Uint8Array<ArrayBuffer>;
413
- receive_buffer: Uint8Array<ArrayBuffer>;
412
+ packet_buffer: Uint8Array;
413
+ receive_buffer: Uint8Array;
414
414
  receive_address: netcode_address_t;
415
415
  payload_packet: netcode_connection_payload_packet_t;
416
416
  }
@@ -455,14 +455,14 @@ export declare function netcode_client_server_address(client: netcode_client_t):
455
455
  export declare const NETCODE_MAX_ENCRYPTION_MAPPINGS: number;
456
456
  export declare class netcode_encryption_manager_t {
457
457
  num_encryption_mappings: number;
458
- timeout: Int32Array<ArrayBuffer>;
459
- expire_time: Float64Array<ArrayBuffer>;
460
- last_access_time: Float64Array<ArrayBuffer>;
458
+ timeout: Int32Array;
459
+ expire_time: Float64Array;
460
+ last_access_time: Float64Array;
461
461
  address: netcode_address_t[];
462
- client_index: Int32Array<ArrayBuffer>;
463
- connect_token_entry_index: Int32Array<ArrayBuffer>;
464
- send_key: Uint8Array<ArrayBuffer>;
465
- receive_key: Uint8Array<ArrayBuffer>;
462
+ client_index: Int32Array;
463
+ connect_token_entry_index: Int32Array;
464
+ send_key: Uint8Array;
465
+ receive_key: Uint8Array;
466
466
  }
467
467
  export declare function netcode_encryption_manager_reset(encryption_manager: netcode_encryption_manager_t): void;
468
468
  export declare function netcode_encryption_manager_entry_expired(encryption_manager: netcode_encryption_manager_t, index: number, time: number): number;
@@ -487,7 +487,7 @@ export declare class netcode_connect_token_entry_t {
487
487
  state: number;
488
488
  time: number;
489
489
  expire_timestamp: bigint;
490
- mac: Uint8Array<ArrayBuffer>;
490
+ mac: Uint8Array;
491
491
  address: netcode_address_t;
492
492
  }
493
493
  export declare function netcode_connect_token_entries_create(): netcode_connect_token_entry_t[];
@@ -520,17 +520,17 @@ export declare class netcode_server_t {
520
520
  global_sequence: bigint;
521
521
  challenge_sequence: bigint;
522
522
  min_connect_token_expire_timestamp: bigint;
523
- challenge_key: Uint8Array<ArrayBuffer>;
524
- client_connected: Int32Array<ArrayBuffer>;
525
- client_timeout: Int32Array<ArrayBuffer>;
526
- client_loopback: Int32Array<ArrayBuffer>;
527
- client_confirmed: Int32Array<ArrayBuffer>;
528
- client_disconnect_reason: Int32Array<ArrayBuffer>;
529
- client_encryption_index: Int32Array<ArrayBuffer>;
530
- client_id: BigUint64Array<ArrayBuffer>;
531
- client_sequence: BigUint64Array<ArrayBuffer>;
532
- client_last_packet_send_time: Float64Array<ArrayBuffer>;
533
- client_last_packet_receive_time: Float64Array<ArrayBuffer>;
523
+ challenge_key: Uint8Array;
524
+ client_connected: Int32Array;
525
+ client_timeout: Int32Array;
526
+ client_loopback: Int32Array;
527
+ client_confirmed: Int32Array;
528
+ client_disconnect_reason: Int32Array;
529
+ client_encryption_index: Int32Array;
530
+ client_id: BigUint64Array;
531
+ client_sequence: BigUint64Array;
532
+ client_last_packet_send_time: Float64Array;
533
+ client_last_packet_receive_time: Float64Array;
534
534
  client_user_data: Uint8Array[];
535
535
  client_replay_protection: netcode_replay_protection_t[];
536
536
  client_packet_queue: netcode_packet_queue_t[];
@@ -538,10 +538,10 @@ export declare class netcode_server_t {
538
538
  connect_token_entries: netcode_connect_token_entry_t[];
539
539
  encryption_manager: netcode_encryption_manager_t;
540
540
  receive_packet_data: (Uint8Array | null)[];
541
- receive_packet_bytes: Int32Array<ArrayBuffer>;
541
+ receive_packet_bytes: Int32Array;
542
542
  receive_from: netcode_address_t[];
543
- packet_buffer: Uint8Array<ArrayBuffer>;
544
- receive_buffer: Uint8Array<ArrayBuffer>;
543
+ packet_buffer: Uint8Array;
544
+ receive_buffer: Uint8Array;
545
545
  receive_address: netcode_address_t;
546
546
  payload_packet: netcode_connection_payload_packet_t;
547
547
  constructor();