@hugoalh/github-sodium 4.0.0 → 5.0.1

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,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright © 2020\~2023 hugoalh Studio
3
+ Copyright © 2020\~2024 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
 
package/README.md CHANGED
@@ -3,10 +3,10 @@
3
3
  [⚖️ MIT](./LICENSE.md)
4
4
  [![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)
5
5
 
6
- | | **Heat** | **Release - Latest** | **Release - Pre** |
7
- |:-:|:-:|:-:|:-:|
8
- | [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=ffffff&style=flat-square "GitHub")](https://github.com/hugoalh-studio/github-sodium-nodejs) | [![GitHub Stars](https://img.shields.io/github/stars/hugoalh-studio/github-sodium-nodejs?label=&logoColor=ffffff&style=flat-square "GitHub Stars")](https://github.com/hugoalh-studio/github-sodium-nodejs/stargazers) \| ![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 Release Date](https://img.shields.io/github/release-date/hugoalh-studio/github-sodium-nodejs?label=&style=flat-square "GitHub Latest Release Date")) | ![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") (![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")) |
9
- | [![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") |
6
+ | | **Release - Latest** | **Release - Pre** |
7
+ |:-:|:-:|:-:|
8
+ | [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=ffffff&style=flat-square "GitHub")](https://github.com/hugoalh-studio/github-sodium-nodejs) | ![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 Release Date](https://img.shields.io/github/release-date/hugoalh-studio/github-sodium-nodejs?label=&style=flat-square "GitHub Latest Release Date")) | ![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") (![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")) |
9
+ | [![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 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") |
10
10
 
11
11
  A NodeJS module to provide an easier sodium for GitHub secrets.
12
12
 
@@ -34,7 +34,7 @@ This project is based on libsodium.js ([GitHub](https://github.com/jedisct1/libs
34
34
 
35
35
  ### NodeJS
36
36
 
37
- - **Target Version:** ^ v12.20.0 \|\| ^ v14.15.0 \|\| >= v16.13.0, &:
37
+ - **Target Version:** >= v16.13.0, &:
38
38
  - TypeScript >= v5.1.0 *\[Development\]*
39
39
  - **Require Permission:** *N/A*
40
40
  - **Domain/Registry:**
package/dist/main.js CHANGED
@@ -1,30 +1,18 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _GitHubSodiumSealer_publicKeyBuffer;
13
1
  import libsodium from "libsodium-wrappers";
14
2
  await libsodium.ready;
15
3
  /**
16
4
  * GitHub sodium sealer for encrypt value to GitHub secret value.
17
5
  */
18
6
  export class GitHubSodiumSealer {
7
+ #publicKeyBuffer;
19
8
  /**
20
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.
21
10
  */
22
11
  constructor(publicKey) {
23
- _GitHubSodiumSealer_publicKeyBuffer.set(this, void 0);
24
12
  if (!(publicKey.length > 0)) {
25
13
  throw new SyntaxError(`Argument \`publicKey\` is not a string which is non-empty!`);
26
14
  }
27
- __classPrivateFieldSet(this, _GitHubSodiumSealer_publicKeyBuffer, Buffer.from(publicKey, "base64"), "f");
15
+ this.#publicKeyBuffer = Buffer.from(publicKey, "base64");
28
16
  }
29
17
  /**
30
18
  * Encrypt value to GitHub secret value.
@@ -35,7 +23,7 @@ export class GitHubSodiumSealer {
35
23
  if (!(value.length > 0)) {
36
24
  throw new SyntaxError(`Argument \`value\` is not a string which is non-empty!`);
37
25
  }
38
- return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), __classPrivateFieldGet(this, _GitHubSodiumSealer_publicKeyBuffer, "f"))).toString("base64");
26
+ return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), this.#publicKeyBuffer)).toString("base64");
39
27
  }
40
28
  /**
41
29
  * Encrypt value to GitHub secret value.
@@ -47,7 +35,6 @@ export class GitHubSodiumSealer {
47
35
  return new this(publicKey).encrypt(value);
48
36
  }
49
37
  }
50
- _GitHubSodiumSealer_publicKeyBuffer = new WeakMap();
51
38
  export default GitHubSodiumSealer;
52
39
  /**
53
40
  * Encrypt value to GitHub secret value.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hugoalh/github-sodium",
3
- "version": "4.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "A module to provide an easier sodium for GitHub secrets.",
5
5
  "keywords": [
6
6
  "github",
@@ -15,6 +15,7 @@
15
15
  "type": "module",
16
16
  "main": "./dist/main.js",
17
17
  "exports": {
18
+ "types": "./dist/main.d.ts",
18
19
  "import": "./dist/main.js"
19
20
  },
20
21
  "types": "./dist/main.d.ts",
@@ -26,16 +27,17 @@
26
27
  "libsodium-wrappers": "^0.7.13"
27
28
  },
28
29
  "devDependencies": {
29
- "@types/libsodium-wrappers": "^0.7.11",
30
- "@types/node": "^20.8.4",
31
- "@typescript-eslint/eslint-plugin": "^6.7.5",
32
- "@typescript-eslint/parser": "^6.7.5",
33
- "eslint": "^8.51.0",
30
+ "@stylistic/eslint-plugin": "^1.5.3",
31
+ "@types/libsodium-wrappers": "^0.7.13",
32
+ "@types/node": "^20.11.0",
33
+ "@typescript-eslint/eslint-plugin": "^6.18.1",
34
+ "@typescript-eslint/parser": "^6.18.1",
35
+ "eslint": "^8.56.0",
34
36
  "eslint-plugin-only-warn": "^1.1.0",
35
- "typescript": "^5.2.2"
37
+ "typescript": "^5.3.3"
36
38
  },
37
39
  "engines": {
38
- "node": "^12.20.0 || ^14.15.0 || >=16.13.0"
40
+ "node": ">=16.13.0"
39
41
  },
40
42
  "private": false,
41
43
  "publishConfig": {