@hugoalh/github-sodium 2.0.0 → 2.0.2

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))(for ModuleJS) and `tweetsodium` ([GitHub](https://github.com/github/tweetsodium))([NPM](https://www.npmjs.com/package/tweetsodium))(for CommonJS) with optimization for GitHub secrets.
26
24
 
27
25
  ## 📚 Documentation
28
26
 
@@ -30,20 +28,21 @@ 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 >= v10.13.0
35
32
 
36
33
  ```sh
37
34
  npm install @hugoalh/github-sodium
38
35
  ```
39
36
 
40
- #### Use In CommonJS
37
+ #### Use
38
+
39
+ ##### CommonJS
41
40
 
42
41
  ```js
43
42
  const githubSodium = require("@hugoalh/github-sodium");
44
43
  ```
45
44
 
46
- #### Use In ModuleJS
45
+ ##### ModuleJS
47
46
 
48
47
  ```js
49
48
  /* Either */
@@ -56,13 +55,37 @@ import { ... } from "@hugoalh/github-sodium";// Part / Tree-shake
56
55
 
57
56
  #### Class
58
57
 
59
- - `GitHubSodiumSealer`
60
- - `@constructor(publicKey)`
61
- - `encrypt(value)`
58
+ <ul>
59
+ <li><code>GitHubSodiumSealer</code></li>
60
+ <ul>
61
+ <li>
62
+
63
+ ```ts
64
+ @constructor(publicKey: string): GitHubSodiumSealer
65
+ ```
66
+
67
+ </li>
68
+ <li>
69
+
70
+ ```ts
71
+ encrypt(value: string): string
72
+ ```
73
+
74
+ </li>
75
+ </ul>
76
+ </ul>
62
77
 
63
78
  #### Function
64
79
 
65
- - `seal(publicKey, value)`
80
+ <ul>
81
+ <li>
82
+
83
+ ```ts
84
+ seal(publicKey: string, value: string): string
85
+ ```
86
+
87
+ </li>
88
+ </ul>
66
89
 
67
90
  ### Example
68
91
 
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-sodium-sealer.d.mts","sourceRoot":"","sources":["github-sodium-sealer.mjs"],"names":[],"mappings":";AAGA;;;GAGG;AACH;IAEC;;;OAGG;IACH,uBAFW,MAAM,EAOhB;IACD;;;;OAIG;IACH,eAHW,MAAM,GACJ,MAAM,CAOlB;;CACD"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-sodium-sealer.d.ts","sourceRoot":"","sources":["github-sodium-sealer.js"],"names":[],"mappings":";AAEA;;;GAGG;AACH;IAEC;;;OAGG;IACH,uBAFW,MAAM,EAOhB;IACD;;;;OAIG;IACH,eAHW,MAAM,GACJ,MAAM,CAOlB;;CACD"}
@@ -5,7 +5,7 @@ const tweetsodium = require("tweetsodium");
5
5
  * @description Encrypt value to GitHub secret value.
6
6
  */
7
7
  class GitHubSodiumSealer {
8
- #publicKey;
8
+ #publicKeyStorage;
9
9
  /**
10
10
  * @constructor
11
11
  * @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
@@ -14,7 +14,7 @@ class GitHubSodiumSealer {
14
14
  if (!advancedDetermine.isString(publicKey, { empty: false })) {
15
15
  throw new TypeError(`Argument \`publicKey\` must be type of string (non-empty)!`);
16
16
  };
17
- this.#publicKey = publicKey;
17
+ this.#publicKeyStorage = Buffer.from(publicKey, "base64");
18
18
  };
19
19
  /**
20
20
  * @method
@@ -25,7 +25,7 @@ class GitHubSodiumSealer {
25
25
  if (!advancedDetermine.isString(value, { empty: false })) {
26
26
  throw new TypeError(`Argument \`value\` must be type of string (non-empty)!`);
27
27
  };
28
- return Buffer.from(tweetsodium.seal(Buffer.from(value), Buffer.from(this.#publicKey, "base64"))).toString("base64");
28
+ return Buffer.from(tweetsodium.seal(Buffer.from(value), this.#publicKeyStorage)).toString("base64");
29
29
  };
30
30
  };
31
31
  module.exports = GitHubSodiumSealer;
@@ -6,7 +6,7 @@ await libsodium.ready;
6
6
  * @description Encrypt value to GitHub secret value.
7
7
  */
8
8
  class GitHubSodiumSealer {
9
- #publicKey;
9
+ #publicKeyStorage;
10
10
  /**
11
11
  * @constructor
12
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.
@@ -15,7 +15,7 @@ class GitHubSodiumSealer {
15
15
  if (!adIsString(publicKey, { empty: false })) {
16
16
  throw new TypeError(`Argument \`publicKey\` must be type of string (non-empty)!`);
17
17
  };
18
- this.#publicKey = publicKey;
18
+ this.#publicKeyStorage = Buffer.from(publicKey, "base64");
19
19
  };
20
20
  /**
21
21
  * @method
@@ -26,7 +26,7 @@ class GitHubSodiumSealer {
26
26
  if (!adIsString(value, { empty: false })) {
27
27
  throw new TypeError(`Argument \`value\` must be type of string (non-empty)!`);
28
28
  };
29
- return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), Buffer.from(this.#publicKey, "base64"))).toString("base64");
29
+ return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), this.#publicKeyStorage)).toString("base64");
30
30
  };
31
31
  };
32
32
  export default GitHubSodiumSealer;
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.mts","sourceRoot":"","sources":["main.mjs"],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.js"],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seal.d.mts","sourceRoot":"","sources":["seal.mjs"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,iCAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB"}
File without changes
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hugoalh/github-sodium",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A module to provide an easier sodium for GitHub secret.",
5
5
  "keywords": [
6
6
  "github",
@@ -18,20 +18,21 @@
18
18
  "import": "./lib/main.mjs",
19
19
  "require": "./lib/main.js"
20
20
  },
21
- "types": "./@types/main.d.ts",
21
+ "types": "./lib/main.d.ts",
22
22
  "repository": {
23
23
  "type": "git",
24
24
  "url": "git+https://github.com/hugoalh-studio/github-sodium-nodejs.git"
25
25
  },
26
26
  "dependencies": {
27
- "@hugoalh/advanced-determine": "^7.1.0",
28
- "@types/libsodium-wrappers": "^0.7.9",
27
+ "@hugoalh/advanced-determine": "^7.1.5",
29
28
  "libsodium-wrappers": "^0.7.10",
30
- "tweetsodium": "^0.0.6"
29
+ "tweetsodium": "0.0.5"
30
+ },
31
+ "devDependencies": {
32
+ "@types/libsodium-wrappers": "^0.7.9"
31
33
  },
32
34
  "engines": {
33
- "node": ">= 14.15.0",
34
- "npm": ">= 6.14.8"
35
+ "node": ">=10.13.0"
35
36
  },
36
37
  "private": false
37
38
  }
@@ -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 +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":""}
@@ -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"}
@@ -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"}