Class: ParametersBuilder

ParametersBuilder()

Builder for configuring KDC-JS communication parameters. Provides default configuration values and fluent methods for customizing serialization, compression, encryption, CRC checking, and Agent class registration. Standard Agent and Reply classes are automatically registered for interoperability with KDC-Java. The builder is mutable. Calling build() creates a Parameters instance using the current configuration. Default configuration: - autoStart: true - maxReceiveBufferSize: 1,048,576 bytes (1 MiB) - compressed: false - encryptionKey: null - crcCheck: false - agentRegistry: new AgentClassRegistry

Constructor

new ParametersBuilder()

Creates a builder with default configuration values and registers the standard KDC Agent classes.

Classes

ParametersBuilder

Members

agentRegistry :AgentClassRegistry

Type:

autoStart :boolean

Type:
  • boolean

compressed :boolean

Type:
  • boolean

crcCheck :boolean

Type:
  • boolean

encryptionKey :Uint8Array|null

Type:
  • Uint8Array | null

maxReceiveBufferSize :number

Type:
  • number

Methods

build() → {Parameters}

Creates a Parameters instance from the current builder configuration.
Returns:
Configured Parameters instance.
Type
Parameters

registerAgent(jsClass, javaFqcn) → {this}

Registers a JavaScript Agent class with its corresponding Java fully qualified class name. Used to reconstruct the correct JavaScript class when receiving serialized Agents from KDC-Java.
Parameters:
Name Type Description
jsClass function JavaScript Agent constructor.
javaFqcn string Fully qualified Java class name.
Returns:
This builder for method chaining.
Type
this

registerAgents(agentMap) → {this}

Registers multiple Agent classes. Each Map entry associates a JavaScript constructor with its corresponding Java fully qualified class name.
Parameters:
Name Type Description
agentMap Map.<function(), string> Map of JavaScript constructors to Java class names.
Throws:
If agentMap is not a Map.
Type
Error
Returns:
This builder for method chaining.
Type
this

withCompressed(value) → {this}

Enables or disables GZIP compression.
Parameters:
Name Type Description
value boolean Whether compression is enabled.
Returns:
This builder for method chaining.
Type
this

withCrcCheck(value) → {this}

Enables or disables CRC checking for Agent packets.
Parameters:
Name Type Description
value boolean Whether CRC checking is enabled.
Returns:
This builder for method chaining.
Type
this

withEncryptionKey(value) → {this}

Configures the encryption key used for AES-GCM. A null value disables encryption.
Parameters:
Name Type Description
value Uint8Array | null Raw AES encryption key, or null.
Returns:
This builder for method chaining.
Type
this

withMaxReceiveBufferSize(value) → {this}

Sets the maximum permitted receive buffer size.
Parameters:
Name Type Description
value number Maximum receive buffer size in bytes.
Throws:
If value is not a positive integer.
Type
Error
Returns:
This builder for method chaining.
Type
this