@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 +1 -1
- package/README.md +5 -5
- package/dist/main.js +3 -16
- package/package.json +10 -8
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright © 2020\~
|
|
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
|
[](https://www.codefactor.io/repository/github/hugoalh-studio/github-sodium-nodejs)
|
|
5
5
|
|
|
6
|
-
| | **
|
|
7
|
-
|
|
8
|
-
| [](https://github.com/hugoalh-studio/github-sodium-nodejs) |
|
|
9
|
-
| [](https://www.npmjs.com/package/@hugoalh/github-sodium) | ](https://github.com/hugoalh-studio/github-sodium-nodejs) |  () |  () |
|
|
9
|
+
| [](https://www.npmjs.com/package/@hugoalh/github-sodium) |  |  |
|
|
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:**
|
|
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
|
-
|
|
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),
|
|
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": "
|
|
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
|
-
"@
|
|
30
|
-
"@types/
|
|
31
|
-
"@
|
|
32
|
-
"@typescript-eslint/
|
|
33
|
-
"eslint": "^
|
|
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.
|
|
37
|
+
"typescript": "^5.3.3"
|
|
36
38
|
},
|
|
37
39
|
"engines": {
|
|
38
|
-
"node": "
|
|
40
|
+
"node": ">=16.13.0"
|
|
39
41
|
},
|
|
40
42
|
"private": false,
|
|
41
43
|
"publishConfig": {
|