ovsx 1.1.1 → 1.3.0

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 (132) hide show
  1. package/README.md +73 -1
  2. package/lib/check-license.d.ts.map +1 -1
  3. package/lib/check-license.js +3 -2
  4. package/lib/check-license.js.map +1 -1
  5. package/lib/get.js +6 -6
  6. package/lib/get.js.map +1 -1
  7. package/lib/http.d.ts +32 -0
  8. package/lib/http.d.ts.map +1 -0
  9. package/lib/http.js +170 -0
  10. package/lib/http.js.map +1 -0
  11. package/lib/index.d.ts +4 -0
  12. package/lib/index.d.ts.map +1 -1
  13. package/lib/index.js +4 -0
  14. package/lib/index.js.map +1 -1
  15. package/lib/list-options.d.ts +24 -0
  16. package/lib/list-options.d.ts.map +1 -0
  17. package/lib/list-options.js +15 -0
  18. package/lib/list-options.js.map +1 -0
  19. package/lib/list.d.ts +18 -0
  20. package/lib/list.d.ts.map +1 -0
  21. package/lib/list.js +46 -0
  22. package/lib/list.js.map +1 -0
  23. package/lib/main.js +111 -32
  24. package/lib/main.js.map +1 -1
  25. package/lib/oidc.d.ts +22 -0
  26. package/lib/oidc.d.ts.map +1 -0
  27. package/lib/oidc.js +59 -0
  28. package/lib/oidc.js.map +1 -0
  29. package/lib/publish-options.d.ts +8 -1
  30. package/lib/publish-options.d.ts.map +1 -1
  31. package/lib/publish.d.ts.map +1 -1
  32. package/lib/publish.js +150 -13
  33. package/lib/publish.js.map +1 -1
  34. package/lib/registry-options.d.ts +8 -0
  35. package/lib/registry-options.d.ts.map +1 -1
  36. package/lib/registry.d.ts +161 -5
  37. package/lib/registry.d.ts.map +1 -1
  38. package/lib/registry.js +259 -100
  39. package/lib/registry.js.map +1 -1
  40. package/lib/search-options.d.ts +48 -0
  41. package/lib/search-options.d.ts.map +1 -0
  42. package/lib/search-options.js +15 -0
  43. package/lib/search-options.js.map +1 -0
  44. package/lib/search.d.ts +22 -0
  45. package/lib/search.d.ts.map +1 -0
  46. package/lib/search.js +86 -0
  47. package/lib/search.js.map +1 -0
  48. package/lib/show-options.d.ts +33 -0
  49. package/lib/show-options.d.ts.map +1 -0
  50. package/lib/show-options.js +15 -0
  51. package/lib/show-options.js.map +1 -0
  52. package/lib/show.d.ts +18 -0
  53. package/lib/show.d.ts.map +1 -0
  54. package/lib/show.js +289 -0
  55. package/lib/show.js.map +1 -0
  56. package/lib/table.d.ts +27 -0
  57. package/lib/table.d.ts.map +1 -0
  58. package/lib/table.js +56 -0
  59. package/lib/table.js.map +1 -0
  60. package/lib/trusted-publishing-options.d.ts +30 -0
  61. package/lib/trusted-publishing-options.d.ts.map +1 -0
  62. package/lib/trusted-publishing-options.js +15 -0
  63. package/lib/trusted-publishing-options.js.map +1 -0
  64. package/lib/trusted-publishing.d.ts +35 -0
  65. package/lib/trusted-publishing.d.ts.map +1 -0
  66. package/lib/trusted-publishing.js +112 -0
  67. package/lib/trusted-publishing.js.map +1 -0
  68. package/lib/unpublish-options.d.ts +34 -0
  69. package/lib/unpublish-options.d.ts.map +1 -0
  70. package/lib/unpublish-options.js +15 -0
  71. package/lib/unpublish-options.js.map +1 -0
  72. package/lib/unpublish.d.ts +22 -0
  73. package/lib/unpublish.d.ts.map +1 -0
  74. package/lib/unpublish.js +137 -0
  75. package/lib/unpublish.js.map +1 -0
  76. package/lib/util.d.ts +51 -9
  77. package/lib/util.d.ts.map +1 -1
  78. package/lib/util.js +130 -67
  79. package/lib/util.js.map +1 -1
  80. package/lib/verify-options.d.ts +24 -0
  81. package/lib/verify-options.d.ts.map +1 -0
  82. package/lib/verify-options.js +15 -0
  83. package/lib/verify-options.js.map +1 -0
  84. package/lib/verify-signature-options.d.ts +32 -0
  85. package/lib/verify-signature-options.d.ts.map +1 -0
  86. package/lib/verify-signature-options.js +15 -0
  87. package/lib/verify-signature-options.js.map +1 -0
  88. package/lib/verify-signature.d.ts +28 -0
  89. package/lib/verify-signature.d.ts.map +1 -0
  90. package/lib/verify-signature.js +105 -0
  91. package/lib/verify-signature.js.map +1 -0
  92. package/lib/verify.d.ts +21 -0
  93. package/lib/verify.d.ts.map +1 -0
  94. package/lib/verify.js +97 -0
  95. package/lib/verify.js.map +1 -0
  96. package/lib/zip.d.ts +10 -0
  97. package/lib/zip.d.ts.map +1 -1
  98. package/lib/zip.js +33 -10
  99. package/lib/zip.js.map +1 -1
  100. package/package.json +21 -14
  101. package/src/check-license.ts +4 -3
  102. package/src/get.ts +7 -7
  103. package/src/http.ts +176 -0
  104. package/src/index.ts +4 -0
  105. package/src/list-options.ts +25 -0
  106. package/src/list.ts +48 -0
  107. package/src/main.ts +125 -34
  108. package/src/oidc.ts +65 -0
  109. package/src/publish-options.ts +8 -1
  110. package/src/publish.ts +208 -14
  111. package/src/registry-options.ts +8 -0
  112. package/src/registry.ts +379 -98
  113. package/src/search-options.ts +49 -0
  114. package/src/search.ts +95 -0
  115. package/src/show-options.ts +34 -0
  116. package/src/show.ts +328 -0
  117. package/src/table.ts +53 -0
  118. package/src/trusted-publishing-options.ts +30 -0
  119. package/src/trusted-publishing.ts +148 -0
  120. package/src/unpublish-options.ts +35 -0
  121. package/src/unpublish.ts +160 -0
  122. package/src/util.ts +138 -70
  123. package/src/verify-options.ts +25 -0
  124. package/src/verify-signature-options.ts +32 -0
  125. package/src/verify-signature.ts +124 -0
  126. package/src/verify.ts +107 -0
  127. package/src/zip.ts +33 -13
  128. package/lib/version.d.ts +0 -2
  129. package/lib/version.d.ts.map +0 -1
  130. package/lib/version.js +0 -5
  131. package/lib/version.js.map +0 -1
  132. package/src/version.ts +0 -1
package/lib/util.js CHANGED
@@ -9,63 +9,110 @@
9
9
  * SPDX-License-Identifier: EPL-2.0
10
10
  ********************************************************************************/
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.promisify = void 0;
12
+ exports.DEFAULT_TIMEOUT = void 0;
13
13
  exports.addEnvOptions = addEnvOptions;
14
+ exports.addTrustedPublishingEnvOptions = addTrustedPublishingEnvOptions;
15
+ exports.configuredTimeout = configuredTimeout;
16
+ exports.parseNonNegativeInt = parseNonNegativeInt;
14
17
  exports.matchExtensionId = matchExtensionId;
15
- exports.optionalStat = optionalStat;
16
- exports.makeDirs = makeDirs;
17
- exports.createTempFile = createTempFile;
18
+ exports.levenshtein = levenshtein;
19
+ exports.getTempFilePath = getTempFilePath;
18
20
  exports.rejectError = rejectError;
19
21
  exports.handleError = handleError;
22
+ exports.formatBytes = formatBytes;
23
+ exports.withStatus = withStatus;
24
+ exports.redactUrl = redactUrl;
20
25
  exports.statusError = statusError;
21
- exports.readFile = readFile;
22
26
  exports.readManifest = readManifest;
23
27
  exports.validateManifest = validateManifest;
24
- exports.writeFile = writeFile;
25
28
  exports.writeManifest = writeManifest;
29
+ const crypto = require("crypto");
26
30
  const fs = require("fs");
31
+ const os = require("os");
27
32
  const path = require("path");
28
- const tmp = require("tmp");
29
- var util_1 = require("util");
30
- Object.defineProperty(exports, "promisify", { enumerable: true, get: function () { return util_1.promisify; } });
31
33
  function addEnvOptions(options) {
32
34
  options.registryUrl ?? (options.registryUrl = process.env.OVSX_REGISTRY_URL);
33
35
  options.pat ?? (options.pat = process.env.OVSX_PAT);
34
36
  options.username ?? (options.username = process.env.OVSX_USERNAME);
35
37
  options.password ?? (options.password = process.env.OVSX_PASSWORD);
38
+ options.timeout ?? (options.timeout = parseIntEnv(process.env.OVSX_TIMEOUT));
39
+ }
40
+ function addTrustedPublishingEnvOptions(options) {
41
+ options.trustedPublishing ?? (options.trustedPublishing = parseBooleanEnv(process.env.OVSX_TRUSTED_PUBLISHING));
42
+ options.idToken ?? (options.idToken = process.env.OVSX_ID_TOKEN);
43
+ options.oidcAudience ?? (options.oidcAudience = process.env.OVSX_OIDC_AUDIENCE);
44
+ }
45
+ /** How long a request may make no progress before it is abandoned; see RegistryOptions.timeout. */
46
+ exports.DEFAULT_TIMEOUT = 30000;
47
+ /**
48
+ * The configured request timeout, for requests that have no RegistryOptions to read it from - the CI
49
+ * token exchange deliberately shares nothing with the registry, but there is no reason for it to be
50
+ * on a different clock.
51
+ */
52
+ function configuredTimeout() {
53
+ return parseIntEnv(process.env.OVSX_TIMEOUT) ?? exports.DEFAULT_TIMEOUT;
54
+ }
55
+ function parseIntEnv(value) {
56
+ if (value === undefined || value.trim().length === 0) {
57
+ return undefined;
58
+ }
59
+ const parsed = Number(value.trim());
60
+ // Left undefined rather than throwing, so a mistyped variable falls back to the default instead
61
+ // of stopping a command that would otherwise work.
62
+ return Number.isInteger(parsed) && parsed >= 0 ? parsed : undefined;
63
+ }
64
+ function parseBooleanEnv(value) {
65
+ if (value === undefined || value.trim().length === 0) {
66
+ return undefined;
67
+ }
68
+ return ['true', '1', 'yes'].includes(value.trim().toLowerCase());
69
+ }
70
+ /**
71
+ * Parses a commander option that must be a non-negative whole number, so a typo is reported by the
72
+ * CLI rather than sent to the registry as a bad request.
73
+ */
74
+ function parseNonNegativeInt(value) {
75
+ const parsed = Number(value);
76
+ if (!Number.isInteger(parsed) || parsed < 0) {
77
+ throw new Error(`Expected a non-negative whole number, got '${value}'.`);
78
+ }
79
+ return parsed;
36
80
  }
37
81
  function matchExtensionId(id) {
38
82
  return /^([\w-]+)(?:\.|\/)([\w-]+)$/.exec(id);
39
83
  }
40
- function optionalStat(path) {
41
- return new Promise((resolve, reject) => {
42
- fs.stat(path, (err, stats) => resolve(stats));
43
- });
44
- }
45
- function makeDirs(path) {
46
- return new Promise((resolve, reject) => {
47
- if (fs.existsSync(path)) {
48
- resolve();
49
- }
50
- else {
51
- fs.mkdir(path, { recursive: true }, (err) => {
52
- if (err)
53
- reject(err);
54
- else
55
- resolve();
56
- });
84
+ /**
85
+ * Levenshtein distance between `a` and `b`: the minimum number of single-character insertions,
86
+ * deletions or substitutions needed to turn one into the other. Used to suggest the closest known
87
+ * command for a typo.
88
+ */
89
+ function levenshtein(a, b) {
90
+ if (a === b) {
91
+ return 0;
92
+ }
93
+ // The distance is symmetric, so keep the shorter string in `b` to bound the row size.
94
+ if (b.length > a.length) {
95
+ [a, b] = [b, a];
96
+ }
97
+ // A single row of the edit distance matrix, seeded with the distance between the empty prefix
98
+ // of `a` and every prefix of `b`.
99
+ const row = Array.from({ length: b.length + 1 }, (_, j) => j);
100
+ for (let i = 1; i <= a.length; i++) {
101
+ let diagonal = row[0];
102
+ row[0] = i;
103
+ for (let j = 1; j <= b.length; j++) {
104
+ const above = row[j];
105
+ row[j] = Math.min(row[j - 1] + 1, above + 1, diagonal + (a[i - 1] === b[j - 1] ? 0 : 1));
106
+ diagonal = above;
57
107
  }
58
- });
59
- }
60
- function createTempFile(options) {
61
- return new Promise((resolve, reject) => {
62
- tmp.tmpName(options, (err, name) => {
63
- if (err)
64
- reject(err);
65
- else
66
- resolve(name);
67
- });
68
- });
108
+ }
109
+ return row[b.length];
110
+ }
111
+ /**
112
+ * Returns a random, not-yet-created file path ending in `postfix`, directly in the OS temp directory.
113
+ */
114
+ function getTempFilePath(postfix = '') {
115
+ return path.join(os.tmpdir(), `ovsx-${crypto.randomUUID()}${postfix}`);
69
116
  }
70
117
  function rejectError(err) {
71
118
  const reason = err instanceof Error ? err : new Error(String(err));
@@ -93,26 +140,54 @@ function handleError(debug, additionalMessage, exit = true) {
93
140
  }
94
141
  };
95
142
  }
143
+ /**
144
+ * Formats a byte count for display, e.g. `1536` -> `1.5 KB`. Mirrors the registry's own
145
+ * `FileUtils.byteCountToDisplaySize` formatting so client- and server-side size limit messages read
146
+ * the same way.
147
+ */
148
+ function formatBytes(bytes) {
149
+ const units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
150
+ let size = bytes;
151
+ let unit = 0;
152
+ while (size >= 1024 && unit < units.length - 1) {
153
+ size /= 1024;
154
+ unit++;
155
+ }
156
+ return `${Math.floor(size)} ${units[unit]}`;
157
+ }
158
+ function withStatus(error, status) {
159
+ const withStatusCode = error;
160
+ withStatusCode.status = status;
161
+ return withStatusCode;
162
+ }
163
+ /**
164
+ * A URL in the form it can safely be printed: no user info and no query string.
165
+ *
166
+ * The personal access token travels in a header now, but `createNamespace`, `verifyPat`, `publish`
167
+ * and `delete` still carry it in the query string too when talking to a registry too old to resolve
168
+ * it from the header (see `Registry.tokenQuery`, #1344). An error message goes straight to stderr
169
+ * and from there into CI logs, and the query carries nothing an error needs - so it stays dropped
170
+ * whole rather than filtered key by key, a filter having to be kept in step with every parameter
171
+ * anyone ever adds.
172
+ */
173
+ function redactUrl(url) {
174
+ try {
175
+ const parsed = typeof url === 'string' ? new URL(url) : url;
176
+ return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
177
+ }
178
+ catch {
179
+ // Not parseable, so nothing can be assumed about what it holds.
180
+ return '<url>';
181
+ }
182
+ }
96
183
  function statusError(response) {
97
- if (response.statusMessage)
98
- return new Error(`The server responded with status ${response.statusCode}: ${response.statusMessage}`);
99
- else
100
- return new Error(`The server responded with status ${response.statusCode}.`);
101
- }
102
- function readFile(name, packagePath, encoding = 'utf-8') {
103
- return new Promise((resolve, reject) => {
104
- fs.readFile(path.join(packagePath ?? process.cwd(), name), { encoding }, (err, content) => {
105
- if (err) {
106
- reject(err);
107
- }
108
- else {
109
- resolve(content);
110
- }
111
- });
112
- });
184
+ const message = response.statusMessage
185
+ ? `The server responded with status ${response.statusCode}: ${response.statusMessage}`
186
+ : `The server responded with status ${response.statusCode}.`;
187
+ return withStatus(new Error(message), response.statusCode);
113
188
  }
114
189
  async function readManifest(packagePath) {
115
- const content = await readFile('package.json', packagePath);
190
+ const content = await fs.promises.readFile(path.join(packagePath ?? process.cwd(), 'package.json'), 'utf-8');
116
191
  return JSON.parse(content);
117
192
  }
118
193
  function validateManifest(manifest) {
@@ -126,20 +201,8 @@ function validateManifest(manifest) {
126
201
  throw new Error("Missing required field 'version'.");
127
202
  }
128
203
  }
129
- function writeFile(name, content, packagePath, encoding = 'utf-8') {
130
- return new Promise((resolve, reject) => {
131
- fs.writeFile(path.join(packagePath ?? process.cwd(), name), content, { encoding }, (err) => {
132
- if (err) {
133
- reject(err);
134
- }
135
- else {
136
- resolve();
137
- }
138
- });
139
- });
140
- }
141
204
  function writeManifest(manifest, packagePath) {
142
205
  const content = JSON.stringify(manifest, null, 4);
143
- return writeFile('package.json', content, packagePath);
206
+ return fs.promises.writeFile(path.join(packagePath ?? process.cwd(), 'package.json'), content, 'utf-8');
144
207
  }
145
208
  //# sourceMappingURL=util.js.map
package/lib/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;kFAQkF;;;AAUlF,sCAKC;AAED,4CAEC;AAED,oCAIC;AAED,4BAaC;AAED,wCASC;AAED,kCAGC;AAED,kCAmBC;AAED,kCAKC;AAED,4BAcC;AAED,oCAGC;AAED,4CAUC;AAED,8BAeC;AAED,sCAGC;AAzID,yBAAyB;AACzB,6BAA6B;AAC7B,2BAA2B;AAI3B,6BAAiC;AAAxB,iGAAA,SAAS,OAAA;AAElB,SAAgB,aAAa,CAAC,OAAwB;IAClD,OAAO,CAAC,WAAW,KAAnB,OAAO,CAAC,WAAW,GAAK,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAC;IACtD,OAAO,CAAC,GAAG,KAAX,OAAO,CAAC,GAAG,GAAK,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAC;IACrC,OAAO,CAAC,QAAQ,KAAhB,OAAO,CAAC,QAAQ,GAAK,OAAO,CAAC,GAAG,CAAC,aAAa,EAAC;IAC/C,OAAO,CAAC,QAAQ,KAAhB,OAAO,CAAC,QAAQ,GAAK,OAAO,CAAC,GAAG,CAAC,aAAa,EAAC;AACnD,CAAC;AAED,SAAgB,gBAAgB,CAAC,EAAU;IACvC,OAAO,6BAA6B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,SAAgB,YAAY,CAAC,IAAiB;IAC1C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CA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Q,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5G,CAAC"}
@@ -0,0 +1,24 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
3
+ *
4
+ * See the NOTICE file(s) distributed with this work for additional
5
+ * information regarding copyright ownership.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License 2.0 which is available at
9
+ * https://www.eclipse.org/legal/epl-2.0
10
+ *
11
+ * SPDX-License-Identifier: EPL-2.0
12
+ *****************************************************************************/
13
+ import { RegistryOptions } from './registry-options';
14
+ export interface VerifyOptions extends RegistryOptions {
15
+ /**
16
+ * Path to the downloaded .vsix package to verify.
17
+ */
18
+ packagePath: string;
19
+ /**
20
+ * Target platform. Defaults to universal.
21
+ */
22
+ target?: string;
23
+ }
24
+ //# sourceMappingURL=verify-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-options.d.ts","sourceRoot":"","sources":["../src/verify-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,aAAc,SAAQ,eAAe;IAClD;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
4
+ *
5
+ * See the NOTICE file(s) distributed with this work for additional
6
+ * information regarding copyright ownership.
7
+ *
8
+ * This program and the accompanying materials are made available under the
9
+ * terms of the Eclipse Public License 2.0 which is available at
10
+ * https://www.eclipse.org/legal/epl-2.0
11
+ *
12
+ * SPDX-License-Identifier: EPL-2.0
13
+ *****************************************************************************/
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ //# sourceMappingURL=verify-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-options.js","sourceRoot":"","sources":["../src/verify-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E"}
@@ -0,0 +1,32 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
3
+ *
4
+ * See the NOTICE file(s) distributed with this work for additional
5
+ * information regarding copyright ownership.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License 2.0 which is available at
9
+ * https://www.eclipse.org/legal/epl-2.0
10
+ *
11
+ * SPDX-License-Identifier: EPL-2.0
12
+ *****************************************************************************/
13
+ export interface VerifySignatureOptions {
14
+ /**
15
+ * Path to the .vsix package.
16
+ */
17
+ packagePath: string;
18
+ /**
19
+ * Path to the signature manifest file (the `.signature.manifest` entry of a registry's
20
+ * signature archive).
21
+ */
22
+ manifestPath: string;
23
+ /**
24
+ * Path to the signature file (the `.signature.sig` entry of a registry's signature archive).
25
+ */
26
+ signaturePath: string;
27
+ /**
28
+ * Path to the registry's public key file, in PEM format.
29
+ */
30
+ publicKeyPath: string;
31
+ }
32
+ //# sourceMappingURL=verify-signature-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-signature-options.d.ts","sourceRoot":"","sources":["../src/verify-signature-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAE/E,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
4
+ *
5
+ * See the NOTICE file(s) distributed with this work for additional
6
+ * information regarding copyright ownership.
7
+ *
8
+ * This program and the accompanying materials are made available under the
9
+ * terms of the Eclipse Public License 2.0 which is available at
10
+ * https://www.eclipse.org/legal/epl-2.0
11
+ *
12
+ * SPDX-License-Identifier: EPL-2.0
13
+ *****************************************************************************/
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ //# sourceMappingURL=verify-signature-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-signature-options.js","sourceRoot":"","sources":["../src/verify-signature-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E"}
@@ -0,0 +1,28 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
3
+ *
4
+ * See the NOTICE file(s) distributed with this work for additional
5
+ * information regarding copyright ownership.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License 2.0 which is available at
9
+ * https://www.eclipse.org/legal/epl-2.0
10
+ *
11
+ * SPDX-License-Identifier: EPL-2.0
12
+ *****************************************************************************/
13
+ import { VerifySignatureOptions } from './verify-signature-options';
14
+ /**
15
+ * Verifies a package/manifest/signature file trio entirely offline, the same way `vsce
16
+ * verify-signature` does - no registry involved, every input is a local file. Unlike `verify`,
17
+ * which fetches everything it needs from a registry for a package identified by name, this is for
18
+ * a signature archive you already extracted yourself (e.g. the `.sigzip` a registry serves has a
19
+ * `.signature.sig` and a `.signature.manifest` entry, matching `--signaturePath` and
20
+ * `--manifestPath` here).
21
+ *
22
+ * `vsce verify-signature` validates against Microsoft's own (closed-source) signing scheme and
23
+ * has no need for a public key argument - VS Code's Marketplace keys are baked into its verifier.
24
+ * Open VSX's registries each hold their own Ed25519 key pair instead, so `--publicKeyPath` is
25
+ * required here to say which registry's signature this is supposed to be.
26
+ */
27
+ export declare function verifySignature(options: VerifySignatureOptions): Promise<void>;
28
+ //# sourceMappingURL=verify-signature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-signature.d.ts","sourceRoot":"","sources":["../src/verify-signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAK/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAYpE;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BpF"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
4
+ *
5
+ * See the NOTICE file(s) distributed with this work for additional
6
+ * information regarding copyright ownership.
7
+ *
8
+ * This program and the accompanying materials are made available under the
9
+ * terms of the Eclipse Public License 2.0 which is available at
10
+ * https://www.eclipse.org/legal/epl-2.0
11
+ *
12
+ * SPDX-License-Identifier: EPL-2.0
13
+ *****************************************************************************/
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.verifySignature = verifySignature;
16
+ const crypto = require("crypto");
17
+ const fs = require("fs");
18
+ const zip_1 = require("./zip");
19
+ /**
20
+ * Verifies a package/manifest/signature file trio entirely offline, the same way `vsce
21
+ * verify-signature` does - no registry involved, every input is a local file. Unlike `verify`,
22
+ * which fetches everything it needs from a registry for a package identified by name, this is for
23
+ * a signature archive you already extracted yourself (e.g. the `.sigzip` a registry serves has a
24
+ * `.signature.sig` and a `.signature.manifest` entry, matching `--signaturePath` and
25
+ * `--manifestPath` here).
26
+ *
27
+ * `vsce verify-signature` validates against Microsoft's own (closed-source) signing scheme and
28
+ * has no need for a public key argument - VS Code's Marketplace keys are baked into its verifier.
29
+ * Open VSX's registries each hold their own Ed25519 key pair instead, so `--publicKeyPath` is
30
+ * required here to say which registry's signature this is supposed to be.
31
+ */
32
+ async function verifySignature(options) {
33
+ const [packageBytes, manifestJson, signature, publicKeyPem] = await Promise.all([
34
+ fs.promises.readFile(options.packagePath),
35
+ fs.promises.readFile(options.manifestPath, 'utf-8'),
36
+ fs.promises.readFile(options.signaturePath),
37
+ fs.promises.readFile(options.publicKeyPath, 'utf-8')
38
+ ]);
39
+ let manifest;
40
+ try {
41
+ manifest = JSON.parse(manifestJson);
42
+ }
43
+ catch (err) {
44
+ throw new Error(`Failed to parse the manifest file as JSON: ${err instanceof Error ? err.message : err}`);
45
+ }
46
+ const publicKey = crypto.createPublicKey({ key: publicKeyPem, format: 'pem' });
47
+ const signatureValid = crypto.verify(null, packageBytes, publicKey, signature);
48
+ if (!signatureValid) {
49
+ throw new Error('Signature verification failed. The package may have been tampered with.');
50
+ }
51
+ const manifestIssues = await checkManifest(options.packagePath, packageBytes, manifest);
52
+ if (manifestIssues.length > 0) {
53
+ throw new Error('The signature is valid, but the package does not match the manifest:\n'
54
+ + manifestIssues.map(issue => ` - ${issue}`).join('\n'));
55
+ }
56
+ console.log('✅ Signature is valid.');
57
+ }
58
+ function sha256Base64(content) {
59
+ return crypto.createHash('sha256').update(content).digest('base64');
60
+ }
61
+ /**
62
+ * The manifest itself isn't part of what the signature covers - only the raw package bytes are
63
+ * signed - so this can't add cryptographic trust on its own. It does confirm the manifest wasn't
64
+ * corrupted or is stale relative to the actual package, and unlike the signature check alone, can
65
+ * point at exactly which entry doesn't match.
66
+ */
67
+ async function checkManifest(packagePath, packageBytes, manifest) {
68
+ const issues = [];
69
+ const packageDigest = manifest.package?.digests?.sha256;
70
+ if (packageDigest === undefined) {
71
+ issues.push('the manifest does not record a package digest');
72
+ }
73
+ else if (packageDigest !== sha256Base64(packageBytes)) {
74
+ issues.push('the package digest does not match the manifest');
75
+ }
76
+ const manifestEntries = manifest.entries ?? {};
77
+ const seenKeys = new Set();
78
+ // Streamed straight into a digest one entry at a time, rather than buffering every entry's
79
+ // full content into memory alongside the already-loaded package bytes.
80
+ const packageEntryDigests = await (0, zip_1.hashAllZipEntries)(packagePath);
81
+ for (const [name, actualDigest] of packageEntryDigests) {
82
+ const key = Buffer.from(name, 'utf-8').toString('base64');
83
+ seenKeys.add(key);
84
+ const entry = manifestEntries[key];
85
+ if (!entry) {
86
+ issues.push(`'${name}' is present in the package but missing from the manifest`);
87
+ continue;
88
+ }
89
+ const entryDigest = entry.digests?.sha256;
90
+ if (entryDigest === undefined) {
91
+ issues.push(`'${name}' has no recorded digest in the manifest`);
92
+ }
93
+ else if (entryDigest !== actualDigest) {
94
+ issues.push(`'${name}' does not match its digest in the manifest`);
95
+ }
96
+ }
97
+ for (const key of Object.keys(manifestEntries)) {
98
+ if (!seenKeys.has(key)) {
99
+ const name = Buffer.from(key, 'base64').toString('utf-8');
100
+ issues.push(`'${name}' is listed in the manifest but missing from the package`);
101
+ }
102
+ }
103
+ return issues;
104
+ }
105
+ //# sourceMappingURL=verify-signature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-signature.js","sourceRoot":"","sources":["../src/verify-signature.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;+EAW+E;;AA8B/E,0CA8BC;AA1DD,iCAAiC;AACjC,yBAAyB;AACzB,+BAA0C;AAa1C;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,eAAe,CAAC,OAA+B;IACjE,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5E,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC;QACzC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;QACnD,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC;QAC3C,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC;KACvD,CAAC,CAAC;IAEH,IAAI,QAA2B,CAAC;IAChC,IAAI,CAAC;QACD,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO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AAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC1D,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,0DAA0D,CAAC,CAAC;QACpF,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
3
+ *
4
+ * See the NOTICE file(s) distributed with this work for additional
5
+ * information regarding copyright ownership.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License 2.0 which is available at
9
+ * https://www.eclipse.org/legal/epl-2.0
10
+ *
11
+ * SPDX-License-Identifier: EPL-2.0
12
+ *****************************************************************************/
13
+ import { VerifyOptions } from './verify-options';
14
+ /**
15
+ * Verifies a downloaded .vsix package's signature against the registry's public key, the same way
16
+ * VS Code itself verifies signed packages on install. Mirrors `vsce verify-signature`, except the
17
+ * signature and public key are fetched from the registry instead of being passed in as separate
18
+ * files - the registry already exposes both for any published, signed version.
19
+ */
20
+ export declare function verify(options: VerifyOptions): Promise<void>;
21
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;+EAW+E;AAO/E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAsClE"}
package/lib/verify.js ADDED
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
4
+ *
5
+ * See the NOTICE file(s) distributed with this work for additional
6
+ * information regarding copyright ownership.
7
+ *
8
+ * This program and the accompanying materials are made available under the
9
+ * terms of the Eclipse Public License 2.0 which is available at
10
+ * https://www.eclipse.org/legal/epl-2.0
11
+ *
12
+ * SPDX-License-Identifier: EPL-2.0
13
+ *****************************************************************************/
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.verify = verify;
16
+ const crypto = require("crypto");
17
+ const fs = require("fs");
18
+ const registry_1 = require("./registry");
19
+ const util_1 = require("./util");
20
+ const zip_1 = require("./zip");
21
+ const SIGNATURE_ENTRY = '.signature.sig';
22
+ /**
23
+ * Verifies a downloaded .vsix package's signature against the registry's public key, the same way
24
+ * VS Code itself verifies signed packages on install. Mirrors `vsce verify-signature`, except the
25
+ * signature and public key are fetched from the registry instead of being passed in as separate
26
+ * files - the registry already exposes both for any published, signed version.
27
+ */
28
+ async function verify(options) {
29
+ (0, util_1.addEnvOptions)(options);
30
+ const registry = new registry_1.Registry(options);
31
+ const manifest = await (0, zip_1.readVSIXPackage)(options.packagePath);
32
+ const namespace = manifest.publisher;
33
+ const extensionName = manifest.name;
34
+ const latest = await registry.getMetadata(namespace, extensionName, options.target);
35
+ if (latest.error) {
36
+ throw new Error(latest.error);
37
+ }
38
+ const extension = await resolveVersion(registry, latest, manifest.version);
39
+ const description = `${namespace}.${extensionName} v${extension.version}`;
40
+ const signatureUrl = extension.files.signature;
41
+ const publicKeyUrl = extension.files.publicKey;
42
+ if (!signatureUrl || !publicKeyUrl) {
43
+ throw new Error(`${description} is not signed by the registry - there is nothing to verify.`);
44
+ }
45
+ const [signature, publicKeyPem] = await Promise.all([
46
+ downloadSignature(registry, signatureUrl),
47
+ downloadPublicKey(registry, publicKeyUrl)
48
+ ]);
49
+ const packageBytes = await fs.promises.readFile(options.packagePath);
50
+ const publicKey = crypto.createPublicKey({ key: publicKeyPem, format: 'pem' });
51
+ const verified = crypto.verify(null, packageBytes, publicKey, signature);
52
+ if (!verified) {
53
+ throw new Error(`${description} does not match the version published to ${registry.url}. `
54
+ + 'The package may have been tampered with, or did not come from that registry.');
55
+ }
56
+ console.log(`✅ This package is identical to ${description} as published to ${registry.url}.`);
57
+ }
58
+ /**
59
+ * `registry.getMetadata` always returns the latest version. Follow `allVersions` to the exact
60
+ * version recorded in the package's own manifest when it differs.
61
+ */
62
+ async function resolveVersion(registry, extension, version) {
63
+ if (extension.version === version) {
64
+ return extension;
65
+ }
66
+ const versionUrl = extension.allVersions[version];
67
+ if (!versionUrl) {
68
+ throw new Error(`${extension.namespace}.${extension.name} has no published version '${version}'.`);
69
+ }
70
+ return registry.getJson(new URL(versionUrl));
71
+ }
72
+ async function downloadSignature(registry, url) {
73
+ const sigzipPath = (0, util_1.getTempFilePath)('.sigzip');
74
+ try {
75
+ await registry.download(sigzipPath, new URL(url));
76
+ const entries = await (0, zip_1.readZip)(sigzipPath, name => name === SIGNATURE_ENTRY);
77
+ const signature = entries.get(SIGNATURE_ENTRY);
78
+ if (!signature) {
79
+ throw new Error(`The signature archive does not contain a '${SIGNATURE_ENTRY}' entry.`);
80
+ }
81
+ return signature;
82
+ }
83
+ finally {
84
+ await fs.promises.rm(sigzipPath, { force: true });
85
+ }
86
+ }
87
+ async function downloadPublicKey(registry, url) {
88
+ const publicKeyPath = (0, util_1.getTempFilePath)('.pem');
89
+ try {
90
+ await registry.download(publicKeyPath, new URL(url));
91
+ return await fs.promises.readFile(publicKeyPath, 'utf-8');
92
+ }
93
+ finally {
94
+ await fs.promises.rm(publicKeyPath, { force: true });
95
+ }
96
+ }
97
+ //# sourceMappingURL=verify.js.map