@renovatebot/pgp 1.0.8 → 1.1.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "mainAssemblyName": "lib.dll",
3
3
  "resources": {
4
- "hash": "sha256-lBL0Uwh8/REz1E/9S2F63zkSu6KC9SMgh8O32AK39og=",
4
+ "hash": "sha256-m2EWXv33WLDJqhlaawf+nbAy4qpuCCY6I8Fa5WxlC5w=",
5
5
  "jsModuleNative": {
6
6
  "dotnet.native.js": "sha256-lUnZaKOZrca22AK52c0SgELsGEhATmW3t1xD+KNt32k="
7
7
  },
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "assembly": {
15
15
  "BouncyCastle.Cryptography.wasm": "sha256-BfAvv+pbSzJ6A0hsuL07oXaShyUdcrOuRM8RxYNqhT8=",
16
- "lib.wasm": "sha256-pdLasLJmwHbPXc5QUKq/0rEuZbY91gdTkmk8NVbGYzw=",
16
+ "lib.wasm": "sha256-uTXhCymsyZlfSeMmMbilG5KaARmiOsk8fE+2dYysDMk=",
17
17
  "System.Collections.Concurrent.wasm": "sha256-d65VITsSUGv/dWkWQeLVoxiMLfd5k9xRj4fCJdDd9YA=",
18
18
  "System.IO.Compression.wasm": "sha256-h83ub3ue0xbZ39MkU9MLaQGhVewvlezXG4Js4c12Qc0=",
19
19
  "System.Linq.wasm": "sha256-Xk/bFHhA8nsfLzNA+CCZzVK91+Ng7irOAdvgLYlRABE=",
Binary file
package/index.d.ts CHANGED
@@ -1,3 +1,20 @@
1
+ export type RuntimeType = 'js-java' | 'wasm-java' | 'wasm-dotnet';
2
+
3
+ export interface DecryptOptions {
4
+ runtime: RuntimeType;
5
+ }
6
+
7
+ /**
8
+ * List of supported runtimes.
9
+ */
10
+ export const SupportedRuntimes: readonly RuntimeType[];
11
+
12
+ /**
13
+ * Check if the given runtime is supported.
14
+ * @param runtime value to check
15
+ */
16
+ export function isSupportedRuntime(runtime: string): runtime is RuntimeType;
17
+
1
18
  /**
2
19
  * Decrypt data with .NET wasm implementations of Bouncy Castle.
3
20
  * @param key private key in PEM format
@@ -7,5 +24,5 @@
7
24
  export async function decrypt(
8
25
  key: string,
9
26
  data: string,
10
- options: { runtime: 'js-java' | 'wasm-java' | 'wasm-dotnet' },
27
+ options: DecryptOptions,
11
28
  ): Promise<string>;
package/index.js CHANGED
@@ -1,5 +1,11 @@
1
+ export const SupportedRuntimes = ['js-java', 'wasm-java', 'wasm-dotnet'];
2
+
1
3
  let decryptDotnet, decryptWasmJava, decryptJsJava;
2
4
 
5
+ export function isSupportedRuntime(runtime) {
6
+ return SupportedRuntimes.includes(runtime);
7
+ }
8
+
3
9
  export async function decrypt(key, data, options) {
4
10
  switch (options?.runtime) {
5
11
  case 'js-java':
@@ -23,6 +29,6 @@ export async function decrypt(key, data, options) {
23
29
  }
24
30
  return (await decryptDotnet).decrypt(key, data);
25
31
  default:
26
- throw new Error('Unsupported runtime specified in options');
32
+ throw new Error(`Unsupported runtime: ${options?.runtime}`);
27
33
  }
28
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@renovatebot/pgp",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "PGP library for renovate",
5
5
  "keywords": [
6
6
  "renovate",
@@ -29,6 +29,7 @@
29
29
  "husky": "9.1.7",
30
30
  "lint-staged": "16.2.6",
31
31
  "markdownlint-cli2": "0.18.1",
32
+ "npm-run-all2": "8.0.4",
32
33
  "openpgp": "6.2.2",
33
34
  "prettier": "3.6.2",
34
35
  "prettier-plugin-packagejson": "2.5.19",
@@ -41,7 +42,9 @@
41
42
  "pnpm": "^10.0.0"
42
43
  },
43
44
  "scripts": {
44
- "build": "./gradlew build && dotnet publish dotnet && node tools/patch-build.js",
45
+ "build": "run-p -l 'build:*'",
46
+ "build:dotnet": "dotnet publish dotnet && node tools/patch-build.js",
47
+ "build:java": "./gradlew build",
45
48
  "debug:teavm-wasm": "node --inspect-brk test/teavm/wasm.js",
46
49
  "prettier": "PRETTIER_EXPERIMENTAL_CLI=1 prettier -c -u .",
47
50
  "prettier:fix": "PRETTIER_EXPERIMENTAL_CLI=1 prettier -w -u .",