From 4b38a5487728f2c4170366de720ffd82f2090265 Mon Sep 17 00:00:00 2001
From: Kenny Romanov <107574726+kennyromanov@users.noreply.github.com>
Date: Thu, 11 Sep 2025 16:33:06 +0500
Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73626=20add=20?=
=?UTF-8?q?@types/ncalayer-js-client=20by=20@kennyromanov?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
types/ncalayer-js-client/.npmignore | 5 +
types/ncalayer-js-client/index.d.ts | 208 ++++++++++++++++++
.../ncalayer-js-client-tests.ts | 112 ++++++++++
types/ncalayer-js-client/package.json | 17 ++
types/ncalayer-js-client/tsconfig.json | 19 ++
5 files changed, 361 insertions(+)
create mode 100644 types/ncalayer-js-client/.npmignore
create mode 100644 types/ncalayer-js-client/index.d.ts
create mode 100644 types/ncalayer-js-client/ncalayer-js-client-tests.ts
create mode 100644 types/ncalayer-js-client/package.json
create mode 100644 types/ncalayer-js-client/tsconfig.json
diff --git a/types/ncalayer-js-client/.npmignore b/types/ncalayer-js-client/.npmignore
new file mode 100644
index 00000000000000..93e307400a5456
--- /dev/null
+++ b/types/ncalayer-js-client/.npmignore
@@ -0,0 +1,5 @@
+*
+!**/*.d.ts
+!**/*.d.cts
+!**/*.d.mts
+!**/*.d.*.ts
diff --git a/types/ncalayer-js-client/index.d.ts b/types/ncalayer-js-client/index.d.ts
new file mode 100644
index 00000000000000..717d6dabeaef46
--- /dev/null
+++ b/types/ncalayer-js-client/index.d.ts
@@ -0,0 +1,208 @@
+///
+export {};
+
+/** Shape of errors thrown by client methods. */
+export type NCALayerErrorLike = Error & { canceledByUser?: boolean };
+
+export type Base64String = string;
+export type BinaryLike = ArrayBuffer | Blob | File;
+export type Signable = Base64String | BinaryLike;
+export type SignableMany = ReadonlyArray;
+
+export type StorageType = string;
+
+export interface BasicsCMSParams {
+ decode?: boolean;
+ encapsulate?: boolean;
+ digested?: boolean;
+ tsaProfile?: Record;
+ [key: string]: unknown;
+}
+
+export interface BasicsXMLParams {
+ [key: string]: unknown;
+}
+
+export interface BasicsSignerParams {
+ extKeyUsageOids: ReadonlyArray;
+ chain?: ReadonlyArray;
+ [key: string]: unknown;
+}
+
+export class NCALayerClient {
+ constructor(url?: string, allowKmdHttpApi?: boolean);
+
+ // Connection and environment
+ url: string;
+ wsConnection: unknown | null;
+ responseProcessed: boolean;
+ isKmd: boolean;
+ allowKmdHttpApi: boolean;
+ kmdHttpApiUrl: string;
+ isKmdHttpApiAvailable: boolean;
+
+ // KMD HTTP API operation state
+ KmdHTTPAPIOperationId: string | null;
+ KmdHTTPAPIOperationInBase64: boolean;
+ KmdHTTPAPIOperationTotal: number;
+ KmdHTTPAPIOperationProcessed: number;
+
+ // Branding
+ basicsLogo: Base64String | "";
+
+ // Testing hooks
+ onRequestReady: ((json: string) => void) | null;
+ onResponseReady: ((json: string) => void) | null;
+
+ /** Connects to NCALayer and resolves with its version string. */
+ connect(): Promise;
+
+ /** Whether multisign is available (always true for this API surface). */
+ readonly multisignAvailable: boolean;
+
+ // Storage type presets
+ static readonly basicsStorageKAZTOKEN: ReadonlyArray;
+ static readonly basicsStorageIDCard: ReadonlyArray;
+ static readonly basicsStorageEToken72k: ReadonlyArray;
+ static readonly basicsStorageEToken5110: ReadonlyArray;
+ static readonly basicsStorageJaCarta: ReadonlyArray;
+ static readonly basicsStorageAKey: ReadonlyArray;
+ static readonly basicsStoragePKCS12: ReadonlyArray;
+ static readonly basicsStorageJKS: ReadonlyArray;
+ static readonly basicsStorageAll: null;
+ static readonly basicsStorageHardware: ReadonlyArray;
+
+ // Signing params presets
+ static readonly basicsCMSParams: BasicsCMSParams;
+ static readonly basicsCMSParamsDetached: BasicsCMSParams;
+ static readonly basicsCMSParamsDetachedNoTSP: BasicsCMSParams;
+ static readonly basicsCMSParamsDetachedHash: BasicsCMSParams;
+ static readonly basicsCMSParamsAttached: BasicsCMSParams;
+ static readonly basicsXMLParams: BasicsXMLParams;
+
+ // Signer selection presets
+ static readonly basicsSignerAny: BasicsSignerParams;
+ static readonly basicsSignerSignAny: BasicsSignerParams;
+ static readonly basicsSignerSignPerson: BasicsSignerParams;
+ static readonly basicsSignerSignOrg: BasicsSignerParams;
+ static readonly basicsSignerSignHead: BasicsSignerParams;
+ static readonly basicsSignerSignTrusted: BasicsSignerParams;
+ static readonly basicsSignerSignEmployee: BasicsSignerParams;
+ static readonly basicsSignerAuthAny: BasicsSignerParams;
+ static readonly basicsSignerAuthPerson: BasicsSignerParams;
+ static readonly basicsSignerAuthOrg: BasicsSignerParams;
+ static readonly basicsSignerAuthHead: BasicsSignerParams;
+ static readonly basicsSignerAuthRight: BasicsSignerParams;
+ static readonly basicsSignerAuthEmployee: BasicsSignerParams;
+ static readonly basicsSignerTestAny: BasicsSignerParams;
+
+ /** Sets logo used by NCALayer Basics module UI from various sources. */
+ setLogoForBasicsSign(logo: Signable): Promise;
+
+ /** Generic Basics sign method. Overloads ensure data matches format. */
+ basicsSign(
+ allowedStorages: ReadonlyArray | null,
+ format: "cms",
+ data: Signable | SignableMany,
+ signingParams: BasicsCMSParams,
+ signerParams: BasicsSignerParams,
+ locale: string,
+ forceSingleSignature?: boolean,
+ ): Promise>;
+ basicsSign(
+ allowedStorages: ReadonlyArray | null,
+ format: "xml",
+ data: string | ReadonlyArray,
+ signingParams: BasicsXMLParams,
+ signerParams: BasicsSignerParams,
+ locale: string,
+ forceSingleSignature?: boolean,
+ ): Promise>;
+
+ /** Helper for CMS signing, supports single or multiple documents. */
+ basicsSignCMS(
+ allowedStorages: ReadonlyArray | null,
+ data: Signable | SignableMany,
+ signingParams: BasicsCMSParams,
+ signerParams: BasicsSignerParams,
+ locale?: string,
+ ): Promise>;
+
+ /** Helper for XML signing, supports single or multiple XML strings. */
+ basicsSignXML(
+ allowedStorages: ReadonlyArray | null,
+ data: string | ReadonlyArray,
+ signingParams: BasicsXMLParams,
+ signerParams: BasicsSignerParams,
+ locale?: string,
+ ): Promise>;
+
+ /** Checks KMD HTTP API multisign availability. */
+ kmdMultisignAvailable(): Promise;
+
+ /** Starts KMD HTTP API multisign operation. */
+ startKmdMultisign(numberOfDocuments: number, base64: boolean, encapsulateContent: boolean): Promise;
+
+ /** Signs next document in KMD multisign flow and returns base64 signature. */
+ kmdMultisignNext(data: Signable): Promise;
+
+ /** Returns active token storage types. */
+ getActiveTokens(): Promise>;
+
+ /** Returns info about one key pair (record) from given storage. */
+ getKeyInfo(storageType: StorageType): Promise>;
+
+ /** Creates CMS (CAdES) from data. */
+ createCAdESFromBase64(
+ storageType: StorageType,
+ data: Signable | SignableMany,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ attach?: boolean,
+ ): Promise;
+
+ /** Creates CMS (CAdES) from data hash. */
+ createCAdESFromBase64Hash(
+ storageType: StorageType,
+ hash: Signable | SignableMany,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ ): Promise;
+
+ /** Creates deprecated CMS with integrated TSP. */
+ createCMSSignatureFromBase64(
+ storageType: StorageType,
+ data: Signable | SignableMany,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ attach?: boolean,
+ ): Promise;
+
+ /** Signs XML and returns signed XML document. */
+ signXml(
+ storageType: StorageType,
+ xml: string,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ tbsElementXPath?: string,
+ signatureParentElementXPath?: string,
+ ): Promise;
+
+ /** Signs multiple XML documents and returns array of signed XML. */
+ signXmls(
+ storageType: StorageType,
+ xmls: ReadonlyArray,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ tbsElementXPath?: string,
+ signatureParentElementXPath?: string,
+ ): Promise>;
+
+ /** Changes NCALayer UI locale. */
+ changeLocale(localeId: string): Promise;
+
+ /** Name of file storage type ('PKCS12'). */
+ static readonly fileStorageType: string;
+
+ /** Utilities exposed by original class. */
+ static arrayBufferToB64(arrayBuffer: ArrayBuffer): string;
+ static normalizeDataToSign(data: Signable | SignableMany): Promise>;
+}
+
+export {};
+
diff --git a/types/ncalayer-js-client/ncalayer-js-client-tests.ts b/types/ncalayer-js-client/ncalayer-js-client-tests.ts
new file mode 100644
index 00000000000000..85e36a793eff32
--- /dev/null
+++ b/types/ncalayer-js-client/ncalayer-js-client-tests.ts
@@ -0,0 +1,112 @@
+import { NCALayerClient } from "ncalayer-js-client";
+
+const client = new NCALayerClient();
+
+// Connection and basic props
+// $ExpectType Promise
+client.connect();
+
+// $ExpectType boolean
+client.multisignAvailable;
+
+// $ExpectType string
+client.url;
+
+// Static presets and utilities
+// $ExpectType ReadonlyArray
+NCALayerClient.basicsStorageKAZTOKEN;
+// $ExpectType null
+NCALayerClient.basicsStorageAll;
+// Presets are available as static fields
+NCALayerClient.basicsCMSParams;
+NCALayerClient.basicsXMLParams;
+NCALayerClient.basicsSignerAny;
+// $ExpectType string
+NCALayerClient.fileStorageType;
+
+// $ExpectType string
+NCALayerClient.arrayBufferToB64(new ArrayBuffer(8));
+// $ExpectType Promise>
+NCALayerClient.normalizeDataToSign("aGVsbG8=");
+
+// Basics sign helpers
+// $ExpectType Promise>
+client.basicsSign(
+ null,
+ "cms",
+ "aGVsbG8=",
+ NCALayerClient.basicsCMSParams,
+ NCALayerClient.basicsSignerAny,
+ "ru",
+);
+
+// $ExpectType Promise>
+client.basicsSignCMS(
+ null,
+ "aGVsbG8=",
+ NCALayerClient.basicsCMSParams,
+ NCALayerClient.basicsSignerAny,
+);
+
+// $ExpectType Promise>
+client.basicsSignXML(
+ null,
+ "",
+ NCALayerClient.basicsXMLParams,
+ NCALayerClient.basicsSignerAny,
+);
+
+// Invalid basics format
+client.basicsSign(
+ null,
+ // @ts-expect-error
+ "pdf",
+ "a",
+ NCALayerClient.basicsCMSParams,
+ NCALayerClient.basicsSignerAny,
+ "ru",
+);
+
+// Logo setting accepts various inputs
+// $ExpectType Promise
+client.setLogoForBasicsSign("aGVsbG8=");
+client.setLogoForBasicsSign(
+ // @ts-expect-error
+ 123,
+);
+
+// KMD HTTP API helpers
+// $ExpectType Promise
+client.kmdMultisignAvailable();
+// $ExpectType Promise
+client.startKmdMultisign(2, true, true);
+// $ExpectType Promise
+client.kmdMultisignNext("aGVsbG8=");
+
+// Token and key info
+// $ExpectType Promise>
+client.getActiveTokens();
+// $ExpectType Promise>
+client.getKeyInfo("PKCS12");
+
+// CMS creation APIs
+// $ExpectType Promise
+client.createCAdESFromBase64("PKCS12", "aGVsbG8=");
+// $ExpectType Promise
+client.createCAdESFromBase64Hash("PKCS12", "aGVsbG8=");
+client.createCAdESFromBase64(
+ "PKCS12",
+ // @ts-expect-error
+ 42,
+);
+
+// XML signing APIs
+// $ExpectType Promise
+client.signXml("PKCS12", "");
+// $ExpectType Promise>
+client.signXmls("PKCS12", ["", ""]);
+
+// Locale
+// $ExpectType Promise
+client.changeLocale("kk");
+
diff --git a/types/ncalayer-js-client/package.json b/types/ncalayer-js-client/package.json
new file mode 100644
index 00000000000000..9bf70f4ba5bef2
--- /dev/null
+++ b/types/ncalayer-js-client/package.json
@@ -0,0 +1,17 @@
+{
+ "private": true,
+ "name": "@types/ncalayer-js-client",
+ "version": "1.5.9999",
+ "projects": [
+ "https://github.com/sigex-kz/ncalayer-js-client#readme"
+ ],
+ "devDependencies": {
+ "@types/ncalayer-js-client": "workspace:."
+ },
+ "owners": [
+ {
+ "name": "Kenny Romanov",
+ "githubUsername": "kennyromanov"
+ }
+ ]
+}
diff --git a/types/ncalayer-js-client/tsconfig.json b/types/ncalayer-js-client/tsconfig.json
new file mode 100644
index 00000000000000..3d62d8e0a9d43a
--- /dev/null
+++ b/types/ncalayer-js-client/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "node16",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictFunctionTypes": true,
+ "strictNullChecks": true,
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "ncalayer-js-client-tests.ts"
+ ]
+}
From 6013d566e214164b1201ce6104af634c519f209a Mon Sep 17 00:00:00 2001
From: TypeScript Bot
Date: Thu, 11 Sep 2025 11:33:41 +0000
Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A4=96=20dprint=20fmt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
types/ncalayer-js-client/index.d.ts | 363 +++++++++---------
.../ncalayer-js-client-tests.ts | 53 ++-
2 files changed, 207 insertions(+), 209 deletions(-)
diff --git a/types/ncalayer-js-client/index.d.ts b/types/ncalayer-js-client/index.d.ts
index 717d6dabeaef46..9c23cda89602ef 100644
--- a/types/ncalayer-js-client/index.d.ts
+++ b/types/ncalayer-js-client/index.d.ts
@@ -12,197 +12,196 @@ export type SignableMany = ReadonlyArray;
export type StorageType = string;
export interface BasicsCMSParams {
- decode?: boolean;
- encapsulate?: boolean;
- digested?: boolean;
- tsaProfile?: Record;
- [key: string]: unknown;
+ decode?: boolean;
+ encapsulate?: boolean;
+ digested?: boolean;
+ tsaProfile?: Record;
+ [key: string]: unknown;
}
export interface BasicsXMLParams {
- [key: string]: unknown;
+ [key: string]: unknown;
}
export interface BasicsSignerParams {
- extKeyUsageOids: ReadonlyArray;
- chain?: ReadonlyArray;
- [key: string]: unknown;
+ extKeyUsageOids: ReadonlyArray;
+ chain?: ReadonlyArray;
+ [key: string]: unknown;
}
export class NCALayerClient {
- constructor(url?: string, allowKmdHttpApi?: boolean);
-
- // Connection and environment
- url: string;
- wsConnection: unknown | null;
- responseProcessed: boolean;
- isKmd: boolean;
- allowKmdHttpApi: boolean;
- kmdHttpApiUrl: string;
- isKmdHttpApiAvailable: boolean;
-
- // KMD HTTP API operation state
- KmdHTTPAPIOperationId: string | null;
- KmdHTTPAPIOperationInBase64: boolean;
- KmdHTTPAPIOperationTotal: number;
- KmdHTTPAPIOperationProcessed: number;
-
- // Branding
- basicsLogo: Base64String | "";
-
- // Testing hooks
- onRequestReady: ((json: string) => void) | null;
- onResponseReady: ((json: string) => void) | null;
-
- /** Connects to NCALayer and resolves with its version string. */
- connect(): Promise;
-
- /** Whether multisign is available (always true for this API surface). */
- readonly multisignAvailable: boolean;
-
- // Storage type presets
- static readonly basicsStorageKAZTOKEN: ReadonlyArray;
- static readonly basicsStorageIDCard: ReadonlyArray;
- static readonly basicsStorageEToken72k: ReadonlyArray;
- static readonly basicsStorageEToken5110: ReadonlyArray;
- static readonly basicsStorageJaCarta: ReadonlyArray;
- static readonly basicsStorageAKey: ReadonlyArray;
- static readonly basicsStoragePKCS12: ReadonlyArray;
- static readonly basicsStorageJKS: ReadonlyArray;
- static readonly basicsStorageAll: null;
- static readonly basicsStorageHardware: ReadonlyArray;
-
- // Signing params presets
- static readonly basicsCMSParams: BasicsCMSParams;
- static readonly basicsCMSParamsDetached: BasicsCMSParams;
- static readonly basicsCMSParamsDetachedNoTSP: BasicsCMSParams;
- static readonly basicsCMSParamsDetachedHash: BasicsCMSParams;
- static readonly basicsCMSParamsAttached: BasicsCMSParams;
- static readonly basicsXMLParams: BasicsXMLParams;
-
- // Signer selection presets
- static readonly basicsSignerAny: BasicsSignerParams;
- static readonly basicsSignerSignAny: BasicsSignerParams;
- static readonly basicsSignerSignPerson: BasicsSignerParams;
- static readonly basicsSignerSignOrg: BasicsSignerParams;
- static readonly basicsSignerSignHead: BasicsSignerParams;
- static readonly basicsSignerSignTrusted: BasicsSignerParams;
- static readonly basicsSignerSignEmployee: BasicsSignerParams;
- static readonly basicsSignerAuthAny: BasicsSignerParams;
- static readonly basicsSignerAuthPerson: BasicsSignerParams;
- static readonly basicsSignerAuthOrg: BasicsSignerParams;
- static readonly basicsSignerAuthHead: BasicsSignerParams;
- static readonly basicsSignerAuthRight: BasicsSignerParams;
- static readonly basicsSignerAuthEmployee: BasicsSignerParams;
- static readonly basicsSignerTestAny: BasicsSignerParams;
-
- /** Sets logo used by NCALayer Basics module UI from various sources. */
- setLogoForBasicsSign(logo: Signable): Promise;
-
- /** Generic Basics sign method. Overloads ensure data matches format. */
- basicsSign(
- allowedStorages: ReadonlyArray | null,
- format: "cms",
- data: Signable | SignableMany,
- signingParams: BasicsCMSParams,
- signerParams: BasicsSignerParams,
- locale: string,
- forceSingleSignature?: boolean,
- ): Promise>;
- basicsSign(
- allowedStorages: ReadonlyArray | null,
- format: "xml",
- data: string | ReadonlyArray,
- signingParams: BasicsXMLParams,
- signerParams: BasicsSignerParams,
- locale: string,
- forceSingleSignature?: boolean,
- ): Promise>;
-
- /** Helper for CMS signing, supports single or multiple documents. */
- basicsSignCMS(
- allowedStorages: ReadonlyArray | null,
- data: Signable | SignableMany,
- signingParams: BasicsCMSParams,
- signerParams: BasicsSignerParams,
- locale?: string,
- ): Promise>;
-
- /** Helper for XML signing, supports single or multiple XML strings. */
- basicsSignXML(
- allowedStorages: ReadonlyArray | null,
- data: string | ReadonlyArray,
- signingParams: BasicsXMLParams,
- signerParams: BasicsSignerParams,
- locale?: string,
- ): Promise>;
-
- /** Checks KMD HTTP API multisign availability. */
- kmdMultisignAvailable(): Promise;
-
- /** Starts KMD HTTP API multisign operation. */
- startKmdMultisign(numberOfDocuments: number, base64: boolean, encapsulateContent: boolean): Promise;
-
- /** Signs next document in KMD multisign flow and returns base64 signature. */
- kmdMultisignNext(data: Signable): Promise;
-
- /** Returns active token storage types. */
- getActiveTokens(): Promise>;
-
- /** Returns info about one key pair (record) from given storage. */
- getKeyInfo(storageType: StorageType): Promise>;
-
- /** Creates CMS (CAdES) from data. */
- createCAdESFromBase64(
- storageType: StorageType,
- data: Signable | SignableMany,
- keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
- attach?: boolean,
- ): Promise;
-
- /** Creates CMS (CAdES) from data hash. */
- createCAdESFromBase64Hash(
- storageType: StorageType,
- hash: Signable | SignableMany,
- keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
- ): Promise;
-
- /** Creates deprecated CMS with integrated TSP. */
- createCMSSignatureFromBase64(
- storageType: StorageType,
- data: Signable | SignableMany,
- keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
- attach?: boolean,
- ): Promise;
-
- /** Signs XML and returns signed XML document. */
- signXml(
- storageType: StorageType,
- xml: string,
- keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
- tbsElementXPath?: string,
- signatureParentElementXPath?: string,
- ): Promise;
-
- /** Signs multiple XML documents and returns array of signed XML. */
- signXmls(
- storageType: StorageType,
- xmls: ReadonlyArray,
- keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
- tbsElementXPath?: string,
- signatureParentElementXPath?: string,
- ): Promise>;
-
- /** Changes NCALayer UI locale. */
- changeLocale(localeId: string): Promise;
-
- /** Name of file storage type ('PKCS12'). */
- static readonly fileStorageType: string;
-
- /** Utilities exposed by original class. */
- static arrayBufferToB64(arrayBuffer: ArrayBuffer): string;
- static normalizeDataToSign(data: Signable | SignableMany): Promise>;
+ constructor(url?: string, allowKmdHttpApi?: boolean);
+
+ // Connection and environment
+ url: string;
+ wsConnection: unknown | null;
+ responseProcessed: boolean;
+ isKmd: boolean;
+ allowKmdHttpApi: boolean;
+ kmdHttpApiUrl: string;
+ isKmdHttpApiAvailable: boolean;
+
+ // KMD HTTP API operation state
+ KmdHTTPAPIOperationId: string | null;
+ KmdHTTPAPIOperationInBase64: boolean;
+ KmdHTTPAPIOperationTotal: number;
+ KmdHTTPAPIOperationProcessed: number;
+
+ // Branding
+ basicsLogo: Base64String | "";
+
+ // Testing hooks
+ onRequestReady: ((json: string) => void) | null;
+ onResponseReady: ((json: string) => void) | null;
+
+ /** Connects to NCALayer and resolves with its version string. */
+ connect(): Promise;
+
+ /** Whether multisign is available (always true for this API surface). */
+ readonly multisignAvailable: boolean;
+
+ // Storage type presets
+ static readonly basicsStorageKAZTOKEN: ReadonlyArray;
+ static readonly basicsStorageIDCard: ReadonlyArray;
+ static readonly basicsStorageEToken72k: ReadonlyArray;
+ static readonly basicsStorageEToken5110: ReadonlyArray;
+ static readonly basicsStorageJaCarta: ReadonlyArray;
+ static readonly basicsStorageAKey: ReadonlyArray;
+ static readonly basicsStoragePKCS12: ReadonlyArray;
+ static readonly basicsStorageJKS: ReadonlyArray;
+ static readonly basicsStorageAll: null;
+ static readonly basicsStorageHardware: ReadonlyArray;
+
+ // Signing params presets
+ static readonly basicsCMSParams: BasicsCMSParams;
+ static readonly basicsCMSParamsDetached: BasicsCMSParams;
+ static readonly basicsCMSParamsDetachedNoTSP: BasicsCMSParams;
+ static readonly basicsCMSParamsDetachedHash: BasicsCMSParams;
+ static readonly basicsCMSParamsAttached: BasicsCMSParams;
+ static readonly basicsXMLParams: BasicsXMLParams;
+
+ // Signer selection presets
+ static readonly basicsSignerAny: BasicsSignerParams;
+ static readonly basicsSignerSignAny: BasicsSignerParams;
+ static readonly basicsSignerSignPerson: BasicsSignerParams;
+ static readonly basicsSignerSignOrg: BasicsSignerParams;
+ static readonly basicsSignerSignHead: BasicsSignerParams;
+ static readonly basicsSignerSignTrusted: BasicsSignerParams;
+ static readonly basicsSignerSignEmployee: BasicsSignerParams;
+ static readonly basicsSignerAuthAny: BasicsSignerParams;
+ static readonly basicsSignerAuthPerson: BasicsSignerParams;
+ static readonly basicsSignerAuthOrg: BasicsSignerParams;
+ static readonly basicsSignerAuthHead: BasicsSignerParams;
+ static readonly basicsSignerAuthRight: BasicsSignerParams;
+ static readonly basicsSignerAuthEmployee: BasicsSignerParams;
+ static readonly basicsSignerTestAny: BasicsSignerParams;
+
+ /** Sets logo used by NCALayer Basics module UI from various sources. */
+ setLogoForBasicsSign(logo: Signable): Promise;
+
+ /** Generic Basics sign method. Overloads ensure data matches format. */
+ basicsSign(
+ allowedStorages: ReadonlyArray | null,
+ format: "cms",
+ data: Signable | SignableMany,
+ signingParams: BasicsCMSParams,
+ signerParams: BasicsSignerParams,
+ locale: string,
+ forceSingleSignature?: boolean,
+ ): Promise>;
+ basicsSign(
+ allowedStorages: ReadonlyArray | null,
+ format: "xml",
+ data: string | ReadonlyArray,
+ signingParams: BasicsXMLParams,
+ signerParams: BasicsSignerParams,
+ locale: string,
+ forceSingleSignature?: boolean,
+ ): Promise>;
+
+ /** Helper for CMS signing, supports single or multiple documents. */
+ basicsSignCMS(
+ allowedStorages: ReadonlyArray | null,
+ data: Signable | SignableMany,
+ signingParams: BasicsCMSParams,
+ signerParams: BasicsSignerParams,
+ locale?: string,
+ ): Promise>;
+
+ /** Helper for XML signing, supports single or multiple XML strings. */
+ basicsSignXML(
+ allowedStorages: ReadonlyArray | null,
+ data: string | ReadonlyArray,
+ signingParams: BasicsXMLParams,
+ signerParams: BasicsSignerParams,
+ locale?: string,
+ ): Promise>;
+
+ /** Checks KMD HTTP API multisign availability. */
+ kmdMultisignAvailable(): Promise;
+
+ /** Starts KMD HTTP API multisign operation. */
+ startKmdMultisign(numberOfDocuments: number, base64: boolean, encapsulateContent: boolean): Promise;
+
+ /** Signs next document in KMD multisign flow and returns base64 signature. */
+ kmdMultisignNext(data: Signable): Promise;
+
+ /** Returns active token storage types. */
+ getActiveTokens(): Promise>;
+
+ /** Returns info about one key pair (record) from given storage. */
+ getKeyInfo(storageType: StorageType): Promise>;
+
+ /** Creates CMS (CAdES) from data. */
+ createCAdESFromBase64(
+ storageType: StorageType,
+ data: Signable | SignableMany,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ attach?: boolean,
+ ): Promise;
+
+ /** Creates CMS (CAdES) from data hash. */
+ createCAdESFromBase64Hash(
+ storageType: StorageType,
+ hash: Signable | SignableMany,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ ): Promise;
+
+ /** Creates deprecated CMS with integrated TSP. */
+ createCMSSignatureFromBase64(
+ storageType: StorageType,
+ data: Signable | SignableMany,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ attach?: boolean,
+ ): Promise;
+
+ /** Signs XML and returns signed XML document. */
+ signXml(
+ storageType: StorageType,
+ xml: string,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ tbsElementXPath?: string,
+ signatureParentElementXPath?: string,
+ ): Promise;
+
+ /** Signs multiple XML documents and returns array of signed XML. */
+ signXmls(
+ storageType: StorageType,
+ xmls: ReadonlyArray,
+ keyType?: "SIGNATURE" | "AUTHENTICATION" | string,
+ tbsElementXPath?: string,
+ signatureParentElementXPath?: string,
+ ): Promise>;
+
+ /** Changes NCALayer UI locale. */
+ changeLocale(localeId: string): Promise;
+
+ /** Name of file storage type ('PKCS12'). */
+ static readonly fileStorageType: string;
+
+ /** Utilities exposed by original class. */
+ static arrayBufferToB64(arrayBuffer: ArrayBuffer): string;
+ static normalizeDataToSign(data: Signable | SignableMany): Promise>;
}
export {};
-
diff --git a/types/ncalayer-js-client/ncalayer-js-client-tests.ts b/types/ncalayer-js-client/ncalayer-js-client-tests.ts
index 85e36a793eff32..dc216890f295f0 100644
--- a/types/ncalayer-js-client/ncalayer-js-client-tests.ts
+++ b/types/ncalayer-js-client/ncalayer-js-client-tests.ts
@@ -32,47 +32,47 @@ NCALayerClient.normalizeDataToSign("aGVsbG8=");
// Basics sign helpers
// $ExpectType Promise>
client.basicsSign(
- null,
- "cms",
- "aGVsbG8=",
- NCALayerClient.basicsCMSParams,
- NCALayerClient.basicsSignerAny,
- "ru",
+ null,
+ "cms",
+ "aGVsbG8=",
+ NCALayerClient.basicsCMSParams,
+ NCALayerClient.basicsSignerAny,
+ "ru",
);
// $ExpectType Promise>
client.basicsSignCMS(
- null,
- "aGVsbG8=",
- NCALayerClient.basicsCMSParams,
- NCALayerClient.basicsSignerAny,
+ null,
+ "aGVsbG8=",
+ NCALayerClient.basicsCMSParams,
+ NCALayerClient.basicsSignerAny,
);
// $ExpectType Promise>
client.basicsSignXML(
- null,
- "",
- NCALayerClient.basicsXMLParams,
- NCALayerClient.basicsSignerAny,
+ null,
+ "",
+ NCALayerClient.basicsXMLParams,
+ NCALayerClient.basicsSignerAny,
);
// Invalid basics format
client.basicsSign(
- null,
- // @ts-expect-error
- "pdf",
- "a",
- NCALayerClient.basicsCMSParams,
- NCALayerClient.basicsSignerAny,
- "ru",
+ null,
+ // @ts-expect-error
+ "pdf",
+ "a",
+ NCALayerClient.basicsCMSParams,
+ NCALayerClient.basicsSignerAny,
+ "ru",
);
// Logo setting accepts various inputs
// $ExpectType Promise
client.setLogoForBasicsSign("aGVsbG8=");
client.setLogoForBasicsSign(
- // @ts-expect-error
- 123,
+ // @ts-expect-error
+ 123,
);
// KMD HTTP API helpers
@@ -95,9 +95,9 @@ client.createCAdESFromBase64("PKCS12", "aGVsbG8=");
// $ExpectType Promise
client.createCAdESFromBase64Hash("PKCS12", "aGVsbG8=");
client.createCAdESFromBase64(
- "PKCS12",
- // @ts-expect-error
- 42,
+ "PKCS12",
+ // @ts-expect-error
+ 42,
);
// XML signing APIs
@@ -109,4 +109,3 @@ client.signXmls("PKCS12", ["", ""]);
// Locale
// $ExpectType Promise
client.changeLocale("kk");
-
From fdeef84c6e0461149e1e084b8e47fbcb1bddf621 Mon Sep 17 00:00:00 2001
From: Sandeep Somavarapu
Date: Thu, 11 Sep 2025 16:21:52 +0200
Subject: [PATCH 3/3] fix: update @types/vscode version to 1.104 (#73650)
---
types/vscode/index.d.ts | 222 +++++++++++++++++++++++++++++++++++++-
types/vscode/package.json | 2 +-
2 files changed, 220 insertions(+), 4 deletions(-)
diff --git a/types/vscode/index.d.ts b/types/vscode/index.d.ts
index 25fef02385cf2d..3c17c514bcfe87 100644
--- a/types/vscode/index.d.ts
+++ b/types/vscode/index.d.ts
@@ -5,7 +5,7 @@
*--------------------------------------------------------------------------------------------*/
/**
- * Type Definition for Visual Studio Code 1.103 Extension API
+ * Type Definition for Visual Studio Code 1.104 Extension API
* See https://code.visualstudio.com/api for more information
*/
@@ -12470,6 +12470,20 @@ declare module 'vscode' {
* This will only take effect when `terminal.integrated.enablePersistentSessions` is enabled.
*/
isTransient?: boolean;
+
+ /**
+ * The nonce to use to verify shell integration sequences are coming from a trusted source.
+ * An example impact of UX of this is if the command line is reported with a nonce, it will
+ * not need to verify with the user that the command line is correct before rerunning it
+ * via the [shell integration command decoration](https://code.visualstudio.com/docs/terminal/shell-integration#_command-decorations-and-the-overview-ruler).
+ *
+ * This should be used if the terminal includes [custom shell integration support](https://code.visualstudio.com/docs/terminal/shell-integration#_supported-escape-sequences).
+ * It should be set to a random GUID which will then set the `VSCODE_NONCE` environment
+ * variable. Inside the shell, this should then be removed from the environment so as to
+ * protect it from general access. Once that is done it can be passed through in the
+ * relevant sequences to make them trusted.
+ */
+ shellIntegrationNonce?: string;
}
/**
@@ -12509,6 +12523,18 @@ declare module 'vscode' {
* This will only take effect when `terminal.integrated.enablePersistentSessions` is enabled.
*/
isTransient?: boolean;
+
+ /**
+ * The nonce to use to verify shell integration sequences are coming from a trusted source.
+ * An example impact of UX of this is if the command line is reported with a nonce, it will
+ * not need to verify with the user that the command line is correct before rerunning it
+ * via the [shell integration command decoration](https://code.visualstudio.com/docs/terminal/shell-integration#_command-decorations-and-the-overview-ruler).
+ *
+ * This should be used if the terminal includes [custom shell integration support](https://code.visualstudio.com/docs/terminal/shell-integration#_supported-escape-sequences).
+ * It should be set to a random GUID. Inside the {@link Pseudoterminal} implementation, this value
+ * can be passed through in the relevant sequences to make them trusted.
+ */
+ shellIntegrationNonce?: string;
}
/**
@@ -13863,6 +13889,9 @@ declare module 'vscode' {
* In the same way, symbolic links are preserved, i.e. the file event will report the path of the
* symbolic link as it was provided for watching and not the target.
*
+ * *Note* that file events from deleting a folder may not include events for contained files. If possible
+ * events will be aggregated to reduce the overal number of emitted events.
+ *
* ### Examples
*
* The basic anatomy of a file watcher is as follows:
@@ -19972,7 +20001,7 @@ declare module 'vscode' {
* A string or heterogeneous array of things that a message can contain as content. Some parts may be message-type
* specific for some models.
*/
- content: Array;
+ content: Array;
/**
* The optional name of a user for this message.
@@ -19986,7 +20015,7 @@ declare module 'vscode' {
* @param content The content of the message.
* @param name The optional name of a user for the message.
*/
- constructor(role: LanguageModelChatMessageRole, content: string | Array, name?: string);
+ constructor(role: LanguageModelChatMessageRole, content: string | Array, name?: string);
}
/**
@@ -20352,6 +20381,184 @@ declare module 'vscode' {
resolveMcpServerDefinition?(server: T, token: CancellationToken): ProviderResult;
}
+ /**
+ * The provider version of {@linkcode LanguageModelChatRequestOptions}
+ */
+ export interface ProvideLanguageModelChatResponseOptions {
+ /**
+ * A set of options that control the behavior of the language model. These options are specific to the language model.
+ */
+ readonly modelOptions?: { readonly [name: string]: any };
+
+ /**
+ * An optional list of tools that are available to the language model. These could be registered tools available via
+ * {@link lm.tools}, or private tools that are just implemented within the calling extension.
+ *
+ * If the LLM requests to call one of these tools, it will return a {@link LanguageModelToolCallPart} in
+ * {@link LanguageModelChatResponse.stream}. It's the caller's responsibility to invoke the tool. If it's a tool
+ * registered in {@link lm.tools}, that means calling {@link lm.invokeTool}.
+ *
+ * Then, the tool result can be provided to the LLM by creating an Assistant-type {@link LanguageModelChatMessage} with a
+ * {@link LanguageModelToolCallPart}, followed by a User-type message with a {@link LanguageModelToolResultPart}.
+ */
+ readonly tools?: readonly LanguageModelChatTool[];
+
+ /**
+ * The tool-selecting mode to use. The provider must implement respecting this.
+ */
+ readonly toolMode: LanguageModelChatToolMode;
+ }
+
+ /**
+ * Represents a language model provided by a {@linkcode LanguageModelChatProvider}.
+ */
+ export interface LanguageModelChatInformation {
+
+ /**
+ * Unique identifier for the language model. Must be unique per provider, but not required to be globally unique.
+ */
+ readonly id: string;
+
+ /**
+ * Human-readable name of the language model.
+ */
+ readonly name: string;
+
+ /**
+ * Opaque family-name of the language model. Values might be `gpt-3.5-turbo`, `gpt4`, `phi2`, or `llama`
+ */
+ readonly family: string;
+
+ /**
+ * The tooltip to render when hovering the model. Used to provide more information about the model.
+ */
+ readonly tooltip?: string;
+
+ /**
+ * An optional, human-readable string which will be rendered alongside the model.
+ * Useful for distinguishing models of the same name in the UI.
+ */
+ readonly detail?: string;
+
+ /**
+ * Opaque version string of the model.
+ * This is used as a lookup value in {@linkcode LanguageModelChatSelector.version}
+ * An example is how GPT 4o has multiple versions like 2024-11-20 and 2024-08-06
+ */
+ readonly version: string;
+
+ /**
+ * The maximum number of tokens the model can accept as input.
+ */
+ readonly maxInputTokens: number;
+
+ /**
+ * The maximum number of tokens the model is capable of producing.
+ */
+ readonly maxOutputTokens: number;
+
+ /**
+ * Various features that the model supports such as tool calling or image input.
+ */
+ readonly capabilities: {
+
+ /**
+ * Whether image input is supported by the model.
+ * Common supported images are jpg and png, but each model will vary in supported mimetypes.
+ */
+ readonly imageInput?: boolean;
+
+ /**
+ * Whether tool calling is supported by the model.
+ * If a number is provided, that is the maximum number of tools that can be provided in a request to the model.
+ */
+ readonly toolCalling?: boolean | number;
+ };
+ }
+
+ /**
+ * The provider version of {@linkcode LanguageModelChatMessage}.
+ */
+ export interface LanguageModelChatRequestMessage {
+ /**
+ * The role of this message.
+ */
+ readonly role: LanguageModelChatMessageRole;
+
+ /**
+ * A heterogeneous array of things that a message can contain as content. Some parts may be message-type
+ * specific for some models.
+ */
+ readonly content: ReadonlyArray;
+
+ /**
+ * The optional name of a user for this message.
+ */
+ readonly name: string | undefined;
+ }
+
+ /**
+ * The various message types which a {@linkcode LanguageModelChatProvider} can emit in the chat response stream
+ */
+ export type LanguageModelResponsePart = LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart;
+
+ /**
+ * The various message types which can be sent via {@linkcode LanguageModelChat.sendRequest } and processed by a {@linkcode LanguageModelChatProvider}
+ */
+ export type LanguageModelInputPart = LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart;
+
+ /**
+ * A LanguageModelChatProvider implements access to language models, which users can then use through the chat view, or through extension API by acquiring a LanguageModelChat.
+ * An example of this would be an OpenAI provider that provides models like gpt-5, o3, etc.
+ */
+ export interface LanguageModelChatProvider {
+
+ /**
+ * An optional event fired when the available set of language models changes.
+ */
+ readonly onDidChangeLanguageModelChatInformation?: Event;
+
+ /**
+ * Get the list of available language models provided by this provider
+ * @param options Options which specify the calling context of this function
+ * @param token A cancellation token
+ * @returns The list of available language models
+ */
+ provideLanguageModelChatInformation(options: PrepareLanguageModelChatModelOptions, token: CancellationToken): ProviderResult;
+
+ /**
+ * Returns the response for a chat request, passing the results to the progress callback.
+ * The {@linkcode LanguageModelChatProvider} must emit the response parts to the progress callback as they are received from the language model.
+ * @param model The language model to use
+ * @param messages The messages to include in the request
+ * @param options Options for the request
+ * @param progress The progress to emit the streamed response chunks to
+ * @param token A cancellation token
+ * @returns A promise that resolves when the response is complete. Results are actually passed to the progress callback.
+ */
+ provideLanguageModelChatResponse(model: T, messages: readonly LanguageModelChatRequestMessage[], options: ProvideLanguageModelChatResponseOptions, progress: Progress, token: CancellationToken): Thenable;
+
+ /**
+ * Returns the number of tokens for a given text using the model-specific tokenizer logic
+ * @param model The language model to use
+ * @param text The text to count tokens for
+ * @param token A cancellation token
+ * @returns The number of tokens
+ */
+ provideTokenCount(model: T, text: string | LanguageModelChatRequestMessage, token: CancellationToken): Thenable;
+ }
+
+ /**
+ * The list of options passed into {@linkcode LanguageModelChatProvider.provideLanguageModelChatInformation}
+ */
+ export interface PrepareLanguageModelChatModelOptions {
+ /**
+ * Whether or not the user should be prompted via some UI flow, or if models should be attempted to be resolved silently.
+ * If silent is true, all models may not be resolved due to lack of info such as API keys.
+ */
+ readonly silent: boolean;
+ }
+
/**
* Namespace for language model related functionality.
*/
@@ -20458,6 +20665,15 @@ declare module 'vscode' {
* @returns A disposable that unregisters the provider when disposed.
*/
export function registerMcpServerDefinitionProvider(id: string, provider: McpServerDefinitionProvider): Disposable;
+
+ /**
+ * Registers a {@linkcode LanguageModelChatProvider}
+ * Note: You must also define the language model chat provider via the `languageModelChatProviders` contribution point in package.json
+ * @param vendor The vendor for this provider. Must be globally unique. An example is `copilot` or `openai`.
+ * @param provider The provider to register
+ * @returns A disposable that unregisters the provider when disposed
+ */
+ export function registerLanguageModelChatProvider(vendor: string, provider: LanguageModelChatProvider): Disposable;
}
/**
diff --git a/types/vscode/package.json b/types/vscode/package.json
index 241a7e0405ecdc..2d5644c4f0c5e1 100644
--- a/types/vscode/package.json
+++ b/types/vscode/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/vscode",
- "version": "1.103.9999",
+ "version": "1.104.9999",
"projects": [
"https://github.com/microsoft/vscode"
],