@hugoalh/github-sodium 3.1.1 → 3.1.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/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # GitHub Sodium (NodeJS)
2
2
 
3
- [`GitHubSodium.NodeJS`](https://github.com/hugoalh-studio/github-sodium-nodejs)
4
-
5
3
  ![License](https://img.shields.io/static/v1?label=License&message=MIT&style=flat-square "License")
4
+ [![GitHub Repository](https://img.shields.io/badge/Repository-181717?logo=github&logoColor=ffffff&style=flat-square "GitHub Repository")](https://github.com/hugoalh-studio/github-sodium-nodejs)
6
5
  [![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)
7
6
  [![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)
8
7
  [![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)
@@ -25,16 +24,12 @@ This project is based on `libsodium.js` ([GitHub](https://github.com/jedisct1/li
25
24
 
26
25
  ### Getting Started
27
26
 
28
- #### Install
29
-
30
- - NodeJS ^ v12.20.0 || ^ v14.15.0 || >= v16.13.0
27
+ - NodeJS ^ v12.20.0 \|\| ^ v14.15.0 \|\| >= v16.13.0
31
28
 
32
29
  ```sh
33
30
  npm install @hugoalh/github-sodium
34
31
  ```
35
32
 
36
- #### Use
37
-
38
33
  ```js
39
34
  /* Either */
40
35
  import { ... } from "@hugoalh/github-sodium";// Named Import
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.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;;;;;;GAMG;AACH,iBAAS,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AACD,OAAO,EACN,kBAAkB,EAClB,IAAI,EACJ,CAAC;;;;;AACF,wBAGE"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,cAAM,kBAAkB;;IAEvB;;;OAGG;gBACS,SAAS,EAAE,MAAM;IAS7B;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAS9B;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CAGrD;AACD;;;;;;GAMG;AACH,iBAAS,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AACD,OAAO,EACN,kBAAkB,EAClB,IAAI,EACJ,CAAC;;;;;AACF,wBAGE"}
package/dist/main.js CHANGED
@@ -10,10 +10,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _GitHubSodiumSealer_publicKeyBuffer;
13
- import { StringItemFilter } from "@hugoalh/advanced-determine";
14
13
  import libsodium from "libsodium-wrappers";
15
14
  await libsodium.ready;
16
- const stringFilter = new StringItemFilter();
17
15
  /**
18
16
  * @class GitHubSodiumSealer
19
17
  * @description Encrypt value to GitHub secret value.
@@ -25,8 +23,11 @@ class GitHubSodiumSealer {
25
23
  */
26
24
  constructor(publicKey) {
27
25
  _GitHubSodiumSealer_publicKeyBuffer.set(this, void 0);
28
- if (!stringFilter.test(publicKey)) {
29
- throw new TypeError(`Argument \`publicKey\` must be type of string (non-empty)!`);
26
+ if (typeof publicKey !== "string") {
27
+ throw new TypeError(`Argument \`publicKey\` must be type of string!`);
28
+ }
29
+ if (!(publicKey.length > 0)) {
30
+ throw new Error(`Argument \`publicKey\` must be a string which is non-empty!`);
30
31
  }
31
32
  __classPrivateFieldSet(this, _GitHubSodiumSealer_publicKeyBuffer, Buffer.from(publicKey, "base64"), "f");
32
33
  }
@@ -36,8 +37,11 @@ class GitHubSodiumSealer {
36
37
  * @returns {string} An encrypted GitHub secret value.
37
38
  */
38
39
  encrypt(value) {
39
- if (!stringFilter.test(value)) {
40
- throw new TypeError(`Argument \`value\` must be type of string (non-empty)!`);
40
+ if (typeof value !== "string") {
41
+ throw new TypeError(`Argument \`value\` must be type of string!`);
42
+ }
43
+ if (!(value.length > 0)) {
44
+ throw new Error(`Argument \`value\` must be a string which is non-empty!`);
41
45
  }
42
46
  return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), __classPrivateFieldGet(this, _GitHubSodiumSealer_publicKeyBuffer, "f"))).toString("base64");
43
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hugoalh/github-sodium",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "A module to provide an easier sodium for GitHub secrets.",
5
5
  "keywords": [
6
6
  "github",
@@ -23,17 +23,16 @@
23
23
  "url": "git+https://github.com/hugoalh-studio/github-sodium-nodejs.git"
24
24
  },
25
25
  "dependencies": {
26
- "@hugoalh/advanced-determine": "^10.3.0",
27
26
  "libsodium-wrappers": "^0.7.11"
28
27
  },
29
28
  "devDependencies": {
30
29
  "@types/libsodium-wrappers": "^0.7.10",
31
30
  "@types/node": "^18.15.11",
32
- "@typescript-eslint/eslint-plugin": "^5.57.1",
33
- "@typescript-eslint/parser": "^5.57.1",
34
- "eslint": "^8.37.0",
31
+ "@typescript-eslint/eslint-plugin": "^5.59.0",
32
+ "@typescript-eslint/parser": "^5.59.0",
33
+ "eslint": "^8.38.0",
35
34
  "eslint-plugin-only-warn": "^1.1.0",
36
- "typescript": "^5.0.3"
35
+ "typescript": "^5.0.4"
37
36
  },
38
37
  "engines": {
39
38
  "node": "^12.20.0 || ^14.15.0 || >=16.13.0"