@hugoalh/github-sodium 2.0.1 → 2.0.3

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
@@ -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&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 `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 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 `libsodium.js` ([GitHub](https://github.com/jedisct1/li
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
 
@@ -13,9 +13,9 @@ class GitHubSodiumSealer {
13
13
  constructor(publicKey) {
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
17
  this.#publicKeyStorage = Buffer.from(publicKey, "base64");
18
- };
18
+ }
19
19
  /**
20
20
  * @method
21
21
  * @param {string} value Value that need to encrypt as secret value.
@@ -24,8 +24,8 @@ class GitHubSodiumSealer {
24
24
  encrypt(value) {
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
28
  return Buffer.from(tweetsodium.seal(Buffer.from(value), this.#publicKeyStorage)).toString("base64");
29
- };
30
- };
29
+ }
30
+ }
31
31
  module.exports = GitHubSodiumSealer;
@@ -14,9 +14,9 @@ class GitHubSodiumSealer {
14
14
  constructor(publicKey) {
15
15
  if (!adIsString(publicKey, { empty: false })) {
16
16
  throw new TypeError(`Argument \`publicKey\` must be type of string (non-empty)!`);
17
- };
17
+ }
18
18
  this.#publicKeyStorage = Buffer.from(publicKey, "base64");
19
- };
19
+ }
20
20
  /**
21
21
  * @method
22
22
  * @param {string} value Value that need to encrypt as secret value.
@@ -25,8 +25,8 @@ class GitHubSodiumSealer {
25
25
  encrypt(value) {
26
26
  if (!adIsString(value, { empty: false })) {
27
27
  throw new TypeError(`Argument \`value\` must be type of string (non-empty)!`);
28
- };
28
+ }
29
29
  return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), this.#publicKeyStorage)).toString("base64");
30
- };
31
- };
30
+ }
31
+ }
32
32
  export default GitHubSodiumSealer;
package/lib/seal.js CHANGED
@@ -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
- };
10
+ }
11
11
  module.exports = seal;
package/lib/seal.mjs CHANGED
@@ -7,5 +7,5 @@ import GitHubSodiumSealer from "./github-sodium-sealer.mjs";
7
7
  */
8
8
  function seal(publicKey, value) {
9
9
  return new GitHubSodiumSealer(publicKey).encrypt(value);
10
- };
10
+ }
11
11
  export default seal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hugoalh/github-sodium",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "A module to provide an easier sodium for GitHub secret.",
5
5
  "keywords": [
6
6
  "github",
@@ -24,16 +24,19 @@
24
24
  "url": "git+https://github.com/hugoalh-studio/github-sodium-nodejs.git"
25
25
  },
26
26
  "dependencies": {
27
- "@hugoalh/advanced-determine": "^7.1.3",
27
+ "@hugoalh/advanced-determine": "^7.2.0",
28
28
  "libsodium-wrappers": "^0.7.10",
29
- "tweetsodium": "^0.0.6"
29
+ "tweetsodium": "0.0.5"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/libsodium-wrappers": "^0.7.9"
32
+ "@types/libsodium-wrappers": "^0.7.10",
33
+ "@types/node": "^18.8.4",
34
+ "eslint": "^8.25.0",
35
+ "eslint-plugin-only-warn": "^1.0.3",
36
+ "typescript": "^4.8.4"
33
37
  },
34
38
  "engines": {
35
- "node": ">= 14.15.0",
36
- "npm": ">= 6.14.8"
39
+ "node": ">=10.13.0"
37
40
  },
38
41
  "private": false
39
42
  }