@hugoalh/github-sodium 2.0.0 → 3.0.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/LICENSE.md CHANGED
@@ -1,27 +1,35 @@
1
1
  # MIT License
2
2
 
3
- © 2020\~2022 hugoalh Studio
3
+ Copyright © 2020\~2022 hugoalh Studio
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
7
7
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
8
 
9
- The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
10
 
11
11
  ---
12
12
 
13
- *This is a short and simple list that mostly concluded this license about the permissions 🟢, conditions 🔵, and limitations 🔴, this license content section shall prevail.*
14
-
15
- - Commercial Use 🟢
16
- - Distribution 🟢
17
- - Modification 🟢
18
- - Patent Use
19
- - Private Use 🟢
20
- - Disclose Source
21
- - License & Copyright Notice 🔵
22
- - Network Use Is Distribution
23
- - Same License
24
- - State Changes
25
- - Liability 🔴
26
- - Trademark Use
27
- - Warranty 🔴
13
+ ## TLDR
14
+
15
+ This is a short and simple list that mostly concluded this license about the permissions, conditions, and limitations, this license content section shall prevail.
16
+
17
+ ### Permissions
18
+
19
+ - **Commercial Use:** The licensed material and derivatives may be used for commercial purposes.
20
+ - **Distribution:** The licensed material may be distributed.
21
+ - **Modification:** The licensed material may be modified.
22
+ - **Private Use:** The licensed material may be used and modified in private.
23
+
24
+ ### Conditions
25
+
26
+ - **License & Copyright Notice:** A copy of the license and copyright notice must be included with the licensed material.
27
+
28
+ ### Limitations
29
+
30
+ - **Liability:** This license includes a limitation of liability.
31
+ - **Warranty:** This license explicitly states that it does not provide any warranty.
32
+
33
+ ## Attribution
34
+
35
+ This license is adopted from [Choose A License](https://choosealicense.com/), available at [here](https://choosealicense.com/licenses/mit).
package/README.md CHANGED
@@ -1,28 +1,26 @@
1
1
  # GitHub Sodium (NodeJS)
2
2
 
3
3
  [`GitHubSodium.NodeJS`](https://github.com/hugoalh-studio/github-sodium-nodejs)
4
- [![GitHub Contributors](https://img.shields.io/github/contributors/hugoalh-studio/github-sodium-nodejs?label=Contributors&logo=github&logoColor=ffffff&style=flat-square)](https://github.com/hugoalh-studio/github-sodium-nodejs/graphs/contributors)
5
- [![GitHub Issues](https://img.shields.io/github/issues-raw/hugoalh-studio/github-sodium-nodejs?label=Issues&logo=github&logoColor=ffffff&style=flat-square)](https://github.com/hugoalh-studio/github-sodium-nodejs/issues)
6
- [![GitHub Pull Requests](https://img.shields.io/github/issues-pr-raw/hugoalh-studio/github-sodium-nodejs?label=Pull%20Requests&logo=github&logoColor=ffffff&style=flat-square)](https://github.com/hugoalh-studio/github-sodium-nodejs/pulls)
7
- [![GitHub Discussions](https://img.shields.io/github/discussions/hugoalh-studio/github-sodium-nodejs?label=Discussions&logo=github&logoColor=ffffff&style=flat-square)](https://github.com/hugoalh-studio/github-sodium-nodejs/discussions)
8
- [![GitHub Stars](https://img.shields.io/github/stars/hugoalh-studio/github-sodium-nodejs?label=Stars&logo=github&logoColor=ffffff&style=flat-square)](https://github.com/hugoalh-studio/github-sodium-nodejs/stargazers)
9
- [![GitHub Forks](https://img.shields.io/github/forks/hugoalh-studio/github-sodium-nodejs?label=Forks&logo=github&logoColor=ffffff&style=flat-square)](https://github.com/hugoalh-studio/github-sodium-nodejs/network/members)
10
- ![GitHub Languages](https://img.shields.io/github/languages/count/hugoalh-studio/github-sodium-nodejs?label=Languages&logo=github&logoColor=ffffff&style=flat-square)
11
- [![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/hugoalh-studio/github-sodium-nodejs?label=Grade&logo=codefactor&logoColor=ffffff&style=flat-square)](https://www.codefactor.io/repository/github/hugoalh-studio/github-sodium-nodejs)
12
- [![LGTM Alerts](https://img.shields.io/lgtm/alerts/g/hugoalh-studio/github-sodium-nodejs?label=Alerts&logo=lgtm&logoColor=ffffff&style=flat-square)
13
- ![LGTM Grade](https://img.shields.io/lgtm/grade/javascript/g/hugoalh-studio/github-sodium-nodejs?label=Grade&logo=lgtm&logoColor=ffffff&style=flat-square)](https://lgtm.com/projects/g/hugoalh-studio/github-sodium-nodejs)
14
- [![License](https://img.shields.io/static/v1?label=License&message=MIT&color=brightgreen&style=flat-square)](./LICENSE.md)
15
-
16
- | **Release** | **Latest** (![GitHub Latest Release Date](https://img.shields.io/github/release-date/hugoalh-studio/github-sodium-nodejs?label=%20&style=flat-square)) | **Pre** (![GitHub Latest Pre-Release Date](https://img.shields.io/github/release-date-pre/hugoalh-studio/github-sodium-nodejs?label=%20&style=flat-square)) |
4
+
5
+ ![NodeJS](https://img.shields.io/badge/NodeJS-339933?logo=nodedotjs&logoColor=ffffff&style=flat-square "NodeJS")
6
+ ![License](https://img.shields.io/static/v1?label=License&message=MIT&style=flat-square "License")
7
+ [![GitHub Stars](https://img.shields.io/github/stars/hugoalh-studio/github-sodium-nodejs?label=Stars&logo=github&logoColor=ffffff&style=flat-square "GitHub Stars")](https://github.com/hugoalh-studio/github-sodium-nodejs/stargazers)
8
+ [![GitHub Contributors](https://img.shields.io/github/contributors/hugoalh-studio/github-sodium-nodejs?label=Contributors&logo=github&logoColor=ffffff&style=flat-square "GitHub Contributors")](https://github.com/hugoalh-studio/github-sodium-nodejs/graphs/contributors)
9
+ [![GitHub Issues](https://img.shields.io/github/issues-raw/hugoalh-studio/github-sodium-nodejs?label=Issues&logo=github&logoColor=ffffff&style=flat-square "GitHub Issues")](https://github.com/hugoalh-studio/github-sodium-nodejs/issues)
10
+ [![GitHub Pull Requests](https://img.shields.io/github/issues-pr-raw/hugoalh-studio/github-sodium-nodejs?label=Pull%20Requests&logo=github&logoColor=ffffff&style=flat-square "GitHub Pull Requests")](https://github.com/hugoalh-studio/github-sodium-nodejs/pulls)
11
+ [![GitHub Discussions](https://img.shields.io/github/discussions/hugoalh-studio/github-sodium-nodejs?label=Discussions&logo=github&logoColor=ffffff&style=flat-square "GitHub Discussions")](https://github.com/hugoalh-studio/github-sodium-nodejs/discussions)
12
+ [![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/hugoalh-studio/github-sodium-nodejs?label=Grade&logo=codefactor&logoColor=ffffff&style=flat-square "CodeFactor Grade")](https://www.codefactor.io/repository/github/hugoalh-studio/github-sodium-nodejs)
13
+
14
+ | **Releases** | **Latest** (![GitHub Latest Release Date](https://img.shields.io/github/release-date/hugoalh-studio/github-sodium-nodejs?label=&style=flat-square "GitHub Latest Release Date")) | **Pre** (![GitHub Latest Pre-Release Date](https://img.shields.io/github/release-date-pre/hugoalh-studio/github-sodium-nodejs?label=&style=flat-square "GitHub Latest Pre-Release Date")) |
17
15
  |:-:|:-:|:-:|
18
- | [**GitHub**](https://github.com/hugoalh-studio/github-sodium-nodejs/releases) ![GitHub Total Downloads](https://img.shields.io/github/downloads/hugoalh-studio/github-sodium-nodejs/total?label=%20&style=flat-square) | ![GitHub Latest Release Version](https://img.shields.io/github/release/hugoalh-studio/github-sodium-nodejs?sort=semver&label=%20&style=flat-square) | ![GitHub Latest Pre-Release Version](https://img.shields.io/github/release/hugoalh-studio/github-sodium-nodejs?include_prereleases&sort=semver&label=%20&style=flat-square) |
19
- | [**NPM**](https://www.npmjs.com/package/@hugoalh/github-sodium) ![NPM Total Downloads](https://img.shields.io/npm/dt/@hugoalh/github-sodium?label=%20&style=flat-square) | ![NPM Latest Release Version](https://img.shields.io/npm/v/@hugoalh/github-sodium/latest?label=%20&style=flat-square) | ![NPM Latest Pre-Release Version](https://img.shields.io/npm/v/@hugoalh/github-sodium/pre?label=%20&style=flat-square) |
16
+ | [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=ffffff&style=flat-square "GitHub")](https://github.com/hugoalh-studio/github-sodium-nodejs/releases) ![GitHub Total Downloads](https://img.shields.io/github/downloads/hugoalh-studio/github-sodium-nodejs/total?label=&style=flat-square "GitHub Total Downloads") | ![GitHub Latest Release Version](https://img.shields.io/github/release/hugoalh-studio/github-sodium-nodejs?sort=semver&label=&style=flat-square "GitHub Latest Release Version") | ![GitHub Latest Pre-Release Version](https://img.shields.io/github/release/hugoalh-studio/github-sodium-nodejs?include_prereleases&sort=semver&label=&style=flat-square "GitHub Latest Pre-Release Version") |
17
+ | [![NPM](https://img.shields.io/badge/NPM-CB3837?logo=npm&logoColor=ffffff&style=flat-square "NPM")](https://www.npmjs.com/package/@hugoalh/github-sodium) ![NPM Total Downloads](https://img.shields.io/npm/dt/@hugoalh/github-sodium?label=&style=flat-square "NPM Total Downloads") | ![NPM Latest Release Version](https://img.shields.io/npm/v/@hugoalh/github-sodium/latest?label=&style=flat-square "NPM Latest Release Version") | ![NPM Latest Pre-Release Version](https://img.shields.io/npm/v/@hugoalh/github-sodium/pre?label=&style=flat-square "NPM Latest Pre-Release Version") |
20
18
 
21
19
  ## 📝 Description
22
20
 
23
- A NodeJS module to provide an easier sodium for GitHub secret.
21
+ A NodeJS module to provide an easier sodium for GitHub secrets.
24
22
 
25
- This project is based on LibSodiumJS ([GitHub](https://github.com/jedisct1/libsodium.js))([NPM](https://www.npmjs.com/package/libsodium))(for ModuleJS) and TweetSodium ([GitHub](https://github.com/github/tweetsodium))([NPM](https://www.npmjs.com/package/tweetsodium))(for CommonJS) with optimization for GitHub secret.
23
+ This project is based on `libsodium.js` ([GitHub](https://github.com/jedisct1/libsodium.js))([NPM](https://www.npmjs.com/package/libsodium)) with optimization for GitHub secrets.
26
24
 
27
25
  ## 📚 Documentation
28
26
 
@@ -30,20 +28,13 @@ This project is based on LibSodiumJS ([GitHub](https://github.com/jedisct1/libso
30
28
 
31
29
  #### Install
32
30
 
33
- - NodeJS >= v14.15.0
34
- - NPM >= v6.14.8
31
+ - NodeJS ^ v12.20.0 || ^ v14.15.0 || >= v16.13.0
35
32
 
36
33
  ```sh
37
34
  npm install @hugoalh/github-sodium
38
35
  ```
39
36
 
40
- #### Use In CommonJS
41
-
42
- ```js
43
- const githubSodium = require("@hugoalh/github-sodium");
44
- ```
45
-
46
- #### Use In ModuleJS
37
+ #### Use
47
38
 
48
39
  ```js
49
40
  /* Either */
@@ -56,13 +47,37 @@ import { ... } from "@hugoalh/github-sodium";// Part / Tree-shake
56
47
 
57
48
  #### Class
58
49
 
59
- - `GitHubSodiumSealer`
60
- - `@constructor(publicKey)`
61
- - `encrypt(value)`
50
+ <ul>
51
+ <li><code>GitHubSodiumSealer</code></li>
52
+ <ul>
53
+ <li>
54
+
55
+ ```ts
56
+ @constructor(publicKey: string): GitHubSodiumSealer
57
+ ```
58
+
59
+ </li>
60
+ <li>
61
+
62
+ ```ts
63
+ encrypt(value: string): string
64
+ ```
65
+
66
+ </li>
67
+ </ul>
68
+ </ul>
62
69
 
63
70
  #### Function
64
71
 
65
- - `seal(publicKey, value)`
72
+ <ul>
73
+ <li>
74
+
75
+ ```ts
76
+ seal(publicKey: string, value: string): string
77
+ ```
78
+
79
+ </li>
80
+ </ul>
66
81
 
67
82
  ### Example
68
83
 
@@ -1,20 +1,20 @@
1
- export default GitHubSodiumSealer;
2
- /**
3
- * @class GitHubSodiumSealer
4
- * @description Encrypt value to GitHub secret value.
5
- */
6
- declare class GitHubSodiumSealer {
7
- /**
8
- * @constructor
9
- * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
10
- */
11
- constructor(publicKey: string);
12
- /**
13
- * @method
14
- * @param {string} value Value that need to encrypt as secret value.
15
- * @returns {string} An encrypted GitHub secret value.
16
- */
17
- encrypt(value: string): string;
18
- #private;
19
- }
20
- //# sourceMappingURL=github-sodium-sealer.d.mts.map
1
+ export default GitHubSodiumSealer;
2
+ /**
3
+ * @class GitHubSodiumSealer
4
+ * @description Encrypt value to GitHub secret value.
5
+ */
6
+ declare class GitHubSodiumSealer {
7
+ /**
8
+ * @constructor
9
+ * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
10
+ */
11
+ constructor(publicKey: string);
12
+ /**
13
+ * @method
14
+ * @param {string} value Value that need to encrypt as secret value.
15
+ * @returns {string} An encrypted GitHub secret value.
16
+ */
17
+ encrypt(value: string): string;
18
+ #private;
19
+ }
20
+ //# sourceMappingURL=github-sodium-sealer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-sodium-sealer.d.ts","sourceRoot":"","sources":["github-sodium-sealer.js"],"names":[],"mappings":";AAGA;;;GAGG;AACH;IAEC;;;OAGG;IACH,uBAFW,MAAM,EAOhB;IACD;;;;OAIG;IACH,eAHW,MAAM,GACJ,MAAM,CAOlB;;CACD"}
@@ -1,31 +1,32 @@
1
- const advancedDetermine = require("@hugoalh/advanced-determine");
2
- const tweetsodium = require("tweetsodium");
1
+ import { isString as adIsString } from "@hugoalh/advanced-determine";
2
+ import libsodium from "libsodium-wrappers";
3
+ await libsodium.ready;
3
4
  /**
4
5
  * @class GitHubSodiumSealer
5
6
  * @description Encrypt value to GitHub secret value.
6
7
  */
7
8
  class GitHubSodiumSealer {
8
- #publicKey;
9
+ #publicKeyStorage;
9
10
  /**
10
11
  * @constructor
11
12
  * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
12
13
  */
13
14
  constructor(publicKey) {
14
- if (!advancedDetermine.isString(publicKey, { empty: false })) {
15
+ if (!adIsString(publicKey, { empty: false })) {
15
16
  throw new TypeError(`Argument \`publicKey\` must be type of string (non-empty)!`);
16
- };
17
- this.#publicKey = publicKey;
18
- };
17
+ }
18
+ this.#publicKeyStorage = Buffer.from(publicKey, "base64");
19
+ }
19
20
  /**
20
21
  * @method
21
22
  * @param {string} value Value that need to encrypt as secret value.
22
23
  * @returns {string} An encrypted GitHub secret value.
23
24
  */
24
25
  encrypt(value) {
25
- if (!advancedDetermine.isString(value, { empty: false })) {
26
+ if (!adIsString(value, { empty: false })) {
26
27
  throw new TypeError(`Argument \`value\` must be type of string (non-empty)!`);
27
- };
28
- return Buffer.from(tweetsodium.seal(Buffer.from(value), Buffer.from(this.#publicKey, "base64"))).toString("base64");
29
- };
30
- };
31
- module.exports = GitHubSodiumSealer;
28
+ }
29
+ return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), this.#publicKeyStorage)).toString("base64");
30
+ }
31
+ }
32
+ export default GitHubSodiumSealer;
@@ -1,9 +1,9 @@
1
- declare namespace _default {
2
- export { GitHubSodiumSealer };
3
- export { seal };
4
- }
5
- export default _default;
6
- import GitHubSodiumSealer from "./github-sodium-sealer.mjs";
7
- import seal from "./seal.mjs";
8
- export { GitHubSodiumSealer, seal };
9
- //# sourceMappingURL=main.d.mts.map
1
+ declare namespace _default {
2
+ export { GitHubSodiumSealer };
3
+ export { seal };
4
+ }
5
+ export default _default;
6
+ import GitHubSodiumSealer from "./github-sodium-sealer.js";
7
+ import seal from "./seal.js";
8
+ export { GitHubSodiumSealer, seal };
9
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.js"],"names":[],"mappings":""}
package/lib/main.js CHANGED
@@ -1,6 +1,10 @@
1
- const GitHubSodiumSealer = require("./github-sodium-sealer.js");
2
- const seal = require("./seal.js");
3
- module.exports = {
1
+ import GitHubSodiumSealer from "./github-sodium-sealer.js";
2
+ import seal from "./seal.js";
3
+ export {
4
+ GitHubSodiumSealer,
5
+ seal
6
+ };
7
+ export default {
4
8
  GitHubSodiumSealer,
5
9
  seal
6
10
  };
@@ -1,9 +1,9 @@
1
- export default seal;
2
- /**
3
- * @function seal
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.
5
- * @param {string} value Value that need to encrypt as secret value.
6
- * @returns {string} An encrypted GitHub secret value.
7
- */
8
- declare function seal(publicKey: string, value: string): string;
9
- //# sourceMappingURL=seal.d.mts.map
1
+ export default seal;
2
+ /**
3
+ * @function seal
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.
5
+ * @param {string} value Value that need to encrypt as secret value.
6
+ * @returns {string} An encrypted GitHub secret value.
7
+ */
8
+ declare function seal(publicKey: string, value: string): string;
9
+ //# sourceMappingURL=seal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["seal.js"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,iCAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB"}
package/lib/seal.js CHANGED
@@ -1,4 +1,4 @@
1
- const GitHubSodiumSealer = require("./github-sodium-sealer.js");
1
+ import GitHubSodiumSealer from "./github-sodium-sealer.js";
2
2
  /**
3
3
  * @function seal
4
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.
@@ -7,5 +7,5 @@ const GitHubSodiumSealer = require("./github-sodium-sealer.js");
7
7
  */
8
8
  function seal(publicKey, value) {
9
9
  return new GitHubSodiumSealer(publicKey).encrypt(value);
10
- };
11
- module.exports = seal;
10
+ }
11
+ export default seal;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hugoalh/github-sodium",
3
- "version": "2.0.0",
4
- "description": "A module to provide an easier sodium for GitHub secret.",
3
+ "version": "3.0.0",
4
+ "description": "A module to provide an easier sodium for GitHub secrets.",
5
5
  "keywords": [
6
6
  "github",
7
7
  "sodium"
@@ -12,26 +12,29 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "hugoalh",
15
+ "type": "module",
15
16
  "main": "./lib/main.js",
16
- "module": "./lib/main.mjs",
17
17
  "exports": {
18
- "import": "./lib/main.mjs",
19
- "require": "./lib/main.js"
18
+ "import": "./lib/main.js"
20
19
  },
21
- "types": "./@types/main.d.ts",
20
+ "types": "./lib/main.d.ts",
22
21
  "repository": {
23
22
  "type": "git",
24
23
  "url": "git+https://github.com/hugoalh-studio/github-sodium-nodejs.git"
25
24
  },
26
25
  "dependencies": {
27
- "@hugoalh/advanced-determine": "^7.1.0",
26
+ "@hugoalh/advanced-determine": "^7.1.4",
27
+ "libsodium-wrappers": "^0.7.10"
28
+ },
29
+ "devDependencies": {
28
30
  "@types/libsodium-wrappers": "^0.7.9",
29
- "libsodium-wrappers": "^0.7.10",
30
- "tweetsodium": "^0.0.6"
31
+ "@types/node": "^18.7.18",
32
+ "eslint": "^8.23.1",
33
+ "eslint-plugin-only-warn": "^1.0.3",
34
+ "typescript": "^4.8.3"
31
35
  },
32
36
  "engines": {
33
- "node": ">= 14.15.0",
34
- "npm": ">= 6.14.8"
37
+ "node": "^12.20.0 || ^14.15.0 || >=16.13.0"
35
38
  },
36
39
  "private": false
37
40
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"github-sodium-sealer.d.mts","sourceRoot":"","sources":["../lib/github-sodium-sealer.mjs"],"names":[],"mappings":";AAGA;;;GAGG;AACH;IAEC;;;OAGG;IACH,uBAFW,MAAM,EAOhB;IACD;;;;OAIG;IACH,eAHW,MAAM,GACJ,MAAM,CAOlB;;CACD"}
@@ -1,20 +0,0 @@
1
- export = GitHubSodiumSealer;
2
- /**
3
- * @class GitHubSodiumSealer
4
- * @description Encrypt value to GitHub secret value.
5
- */
6
- declare class GitHubSodiumSealer {
7
- /**
8
- * @constructor
9
- * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
10
- */
11
- constructor(publicKey: string);
12
- /**
13
- * @method
14
- * @param {string} value Value that need to encrypt as secret value.
15
- * @returns {string} An encrypted GitHub secret value.
16
- */
17
- encrypt(value: string): string;
18
- #private;
19
- }
20
- //# sourceMappingURL=github-sodium-sealer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github-sodium-sealer.d.ts","sourceRoot":"","sources":["../lib/github-sodium-sealer.js"],"names":[],"mappings":";AAEA;;;GAGG;AACH;IAEC;;;OAGG;IACH,uBAFW,MAAM,EAOhB;IACD;;;;OAIG;IACH,eAHW,MAAM,GACJ,MAAM,CAOlB;;CACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.mts","sourceRoot":"","sources":["../lib/main.mjs"],"names":[],"mappings":""}
package/@types/main.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import GitHubSodiumSealer = require("./github-sodium-sealer.js");
2
- import seal = require("./seal.js");
3
- export { GitHubSodiumSealer, seal };
4
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../lib/main.js"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"seal.d.mts","sourceRoot":"","sources":["../lib/seal.mjs"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,iCAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB"}
package/@types/seal.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export = seal;
2
- /**
3
- * @function seal
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.
5
- * @param {string} value Value that need to encrypt as secret value.
6
- * @returns {string} An encrypted GitHub secret value.
7
- */
8
- declare function seal(publicKey: string, value: string): string;
9
- //# sourceMappingURL=seal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../lib/seal.js"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,iCAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB"}
@@ -1,32 +0,0 @@
1
- import { isString as adIsString } from "@hugoalh/advanced-determine";
2
- import libsodium from "libsodium-wrappers";
3
- await libsodium.ready;
4
- /**
5
- * @class GitHubSodiumSealer
6
- * @description Encrypt value to GitHub secret value.
7
- */
8
- class GitHubSodiumSealer {
9
- #publicKey;
10
- /**
11
- * @constructor
12
- * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
13
- */
14
- constructor(publicKey) {
15
- if (!adIsString(publicKey, { empty: false })) {
16
- throw new TypeError(`Argument \`publicKey\` must be type of string (non-empty)!`);
17
- };
18
- this.#publicKey = publicKey;
19
- };
20
- /**
21
- * @method
22
- * @param {string} value Value that need to encrypt as secret value.
23
- * @returns {string} An encrypted GitHub secret value.
24
- */
25
- encrypt(value) {
26
- if (!adIsString(value, { empty: false })) {
27
- throw new TypeError(`Argument \`value\` must be type of string (non-empty)!`);
28
- };
29
- return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), Buffer.from(this.#publicKey, "base64"))).toString("base64");
30
- };
31
- };
32
- export default GitHubSodiumSealer;
package/lib/main.mjs DELETED
@@ -1,10 +0,0 @@
1
- import GitHubSodiumSealer from "./github-sodium-sealer.mjs";
2
- import seal from "./seal.mjs";
3
- export {
4
- GitHubSodiumSealer,
5
- seal
6
- };
7
- export default {
8
- GitHubSodiumSealer,
9
- seal
10
- };
package/lib/seal.mjs DELETED
@@ -1,11 +0,0 @@
1
- import GitHubSodiumSealer from "./github-sodium-sealer.mjs";
2
- /**
3
- * @function seal
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.
5
- * @param {string} value Value that need to encrypt as secret value.
6
- * @returns {string} An encrypted GitHub secret value.
7
- */
8
- function seal(publicKey, value) {
9
- return new GitHubSodiumSealer(publicKey).encrypt(value);
10
- };
11
- export default seal;