@hugoalh/github-sodium 3.0.2 → 3.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.
package/README.md CHANGED
@@ -37,9 +37,9 @@ npm install @hugoalh/github-sodium
37
37
 
38
38
  ```js
39
39
  /* Either */
40
- import * as githubSodium from "@hugoalh/github-sodium";// All
41
- import githubSodium from "@hugoalh/github-sodium";// All (>= v2.0.0)
42
- import { ... } from "@hugoalh/github-sodium";// Part / Tree-shake
40
+ import { ... } from "@hugoalh/github-sodium";// Named Import
41
+ import * as githubSodium from "@hugoalh/github-sodium";// Namespace Import
42
+ import githubSodium from "@hugoalh/github-sodium";// Default Import
43
43
  ```
44
44
 
45
45
  ### API
@@ -50,8 +50,8 @@ import { ... } from "@hugoalh/github-sodium";// Part / Tree-shake
50
50
  <li>
51
51
 
52
52
  ```ts
53
- GitHubSodiumSealer(publicKey: string): GitHubSodiumSealer;
54
- GitHubSodiumSealer.encrypt(value: string): string;
53
+ new GitHubSodiumSealer(publicKey: string): GitHubSodiumSealer;
54
+ .encrypt(value: string): string;
55
55
  ```
56
56
 
57
57
  </li>
@@ -10,11 +10,19 @@ declare class GitHubSodiumSealer {
10
10
  */
11
11
  constructor(publicKey: string);
12
12
  /**
13
- * @method
13
+ * @method encrypt
14
14
  * @param {string} value Value that need to encrypt as secret value.
15
15
  * @returns {string} An encrypted GitHub secret value.
16
16
  */
17
17
  encrypt(value: string): string;
18
+ /**
19
+ * @static seal
20
+ * @description Encrypt value to GitHub secret value.
21
+ * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
22
+ * @param {string} value Value that need to encrypt as secret value.
23
+ * @returns {string} An encrypted GitHub secret value.
24
+ */
25
+ static seal(publicKey: string, value: string): string;
18
26
  }
19
27
  export default GitHubSodiumSealer;
20
28
  //# sourceMappingURL=github-sodium-sealer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"github-sodium-sealer.d.ts","sourceRoot":"","sources":["../src/github-sodium-sealer.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,cAAM,kBAAkB;;IAEvB;;;OAGG;gBACS,SAAS,EAAE,MAAM;IAM7B;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAM9B;AACD,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"github-sodium-sealer.d.ts","sourceRoot":"","sources":["../src/github-sodium-sealer.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,cAAM,kBAAkB;;IAEvB;;;OAGG;gBACS,SAAS,EAAE,MAAM;IAM7B;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAM9B;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CAGrD;AACD,eAAe,kBAAkB,CAAC"}
@@ -31,7 +31,7 @@ class GitHubSodiumSealer {
31
31
  __classPrivateFieldSet(this, _GitHubSodiumSealer_publicKeyStorage, Buffer.from(publicKey, "base64"), "f");
32
32
  }
33
33
  /**
34
- * @method
34
+ * @method encrypt
35
35
  * @param {string} value Value that need to encrypt as secret value.
36
36
  * @returns {string} An encrypted GitHub secret value.
37
37
  */
@@ -41,6 +41,16 @@ class GitHubSodiumSealer {
41
41
  }
42
42
  return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), __classPrivateFieldGet(this, _GitHubSodiumSealer_publicKeyStorage, "f"))).toString("base64");
43
43
  }
44
+ /**
45
+ * @static seal
46
+ * @description Encrypt value to GitHub secret value.
47
+ * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
48
+ * @param {string} value Value that need to encrypt as secret value.
49
+ * @returns {string} An encrypted GitHub secret value.
50
+ */
51
+ static seal(publicKey, value) {
52
+ return new this(publicKey).encrypt(value);
53
+ }
44
54
  }
45
55
  _GitHubSodiumSealer_publicKeyStorage = new WeakMap();
46
56
  export default GitHubSodiumSealer;
package/dist/seal.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * @function seal
3
+ * @description Encrypt value to GitHub secret value.
3
4
  * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
4
5
  * @param {string} value Value that need to encrypt as secret value.
5
6
  * @returns {string} An encrypted GitHub secret value.
@@ -1 +1 @@
1
- {"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../src/seal.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AACH,iBAAS,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AACD,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../src/seal.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,iBAAS,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AACD,eAAe,IAAI,CAAC"}
package/dist/seal.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import GitHubSodiumSealer from "./github-sodium-sealer.js";
2
2
  /**
3
3
  * @function seal
4
+ * @description Encrypt value to GitHub secret value.
4
5
  * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
5
6
  * @param {string} value Value that need to encrypt as secret value.
6
7
  * @returns {string} An encrypted GitHub secret value.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hugoalh/github-sodium",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "A module to provide an easier sodium for GitHub secrets.",
5
5
  "keywords": [
6
6
  "github",
@@ -23,15 +23,15 @@
23
23
  "url": "git+https://github.com/hugoalh-studio/github-sodium-nodejs.git"
24
24
  },
25
25
  "dependencies": {
26
- "@hugoalh/advanced-determine": "^10.0.0",
26
+ "@hugoalh/advanced-determine": "^10.2.1",
27
27
  "libsodium-wrappers": "^0.7.11"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/libsodium-wrappers": "^0.7.10",
31
- "@types/node": "^18.14.1",
32
- "@typescript-eslint/eslint-plugin": "^5.53.0",
33
- "@typescript-eslint/parser": "^5.53.0",
34
- "eslint": "^8.34.0",
31
+ "@types/node": "^18.15.0",
32
+ "@typescript-eslint/eslint-plugin": "^5.54.1",
33
+ "@typescript-eslint/parser": "^5.54.1",
34
+ "eslint": "^8.36.0",
35
35
  "eslint-plugin-only-warn": "^1.1.0",
36
36
  "typescript": "^4.9.5"
37
37
  },