From c3fbeb2e78df9b9bd4ccebbc2ef91e9cfbaa0dab Mon Sep 17 00:00:00 2001 From: Alois Date: Thu, 2 Jul 2026 23:58:40 +0200 Subject: [PATCH] (feat): add descriptor to wasm & ts-sdk --- src/sdk/index.ts | 7 +++++++ wasm/types/mtp_wasm.d.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/src/sdk/index.ts b/src/sdk/index.ts index 3e3d077..9038e06 100644 --- a/src/sdk/index.ts +++ b/src/sdk/index.ts @@ -93,6 +93,7 @@ export interface MTPClientCredentials { export interface MTPClientOptions { url: string; + descriptor?: string; hostPublicKey?: MTPBytesInput | string; credentials?: MTPCredentials | string | null; credentialsStorageKey?: string; @@ -296,6 +297,9 @@ function validateOptions(options) { if (typeof options.url !== "string" || !options.url.trim()) { throw new TypeError("MTPClient.create requires a non-empty url"); } + if (options.descriptor != null && typeof options.descriptor !== "string") { + throw new TypeError("descriptor must be a string"); + } if (options.storage) { for (const method of ["getItem", "setItem", "removeItem"]) { if (typeof options.storage[method] !== "function") { @@ -427,6 +431,9 @@ export class MTPClient { if (this.#options.maxMessageSize != null) { config.max_message_size = this.#options.maxMessageSize; } + if (this.#options.descriptor != null) { + config.description = this.#options.descriptor; + } return config; } diff --git a/wasm/types/mtp_wasm.d.ts b/wasm/types/mtp_wasm.d.ts index 4ecec6b..b7ac775 100644 --- a/wasm/types/mtp_wasm.d.ts +++ b/wasm/types/mtp_wasm.d.ts @@ -48,6 +48,7 @@ export class ConnectionConfig implements DisposableWasmObject { free(): void; [Symbol.dispose](): void; client_id: bigint; + description: string | undefined; max_message_size: number; server_certificate_hashes: string[]; readonly url: string;