@hugoalh/github-sodium 3.0.0 → 3.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 +1 -1
- package/README.md +3 -13
- package/{lib → dist}/github-sodium-sealer.d.ts +2 -2
- package/dist/github-sodium-sealer.d.ts.map +1 -0
- package/dist/github-sodium-sealer.js +46 -0
- package/{lib → dist}/main.d.ts +5 -5
- package/dist/main.d.ts.map +1 -0
- package/{lib → dist}/main.js +3 -6
- package/{lib → dist}/seal.d.ts +1 -1
- package/dist/seal.d.ts.map +1 -0
- package/{lib → dist}/seal.js +1 -1
- package/package.json +13 -11
- package/lib/github-sodium-sealer.d.ts.map +0 -1
- package/lib/github-sodium-sealer.js +0 -32
- package/lib/main.d.ts.map +0 -1
- package/lib/seal.d.ts.map +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright © 2020\~
|
|
3
|
+
Copyright © 2020\~2023 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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[`GitHubSodium.NodeJS`](https://github.com/hugoalh-studio/github-sodium-nodejs)
|
|
4
4
|
|
|
5
|
-

|
|
6
5
|

|
|
7
6
|
[](https://github.com/hugoalh-studio/github-sodium-nodejs/stargazers)
|
|
8
7
|
[](https://github.com/hugoalh-studio/github-sodium-nodejs/graphs/contributors)
|
|
@@ -48,24 +47,15 @@ import { ... } from "@hugoalh/github-sodium";// Part / Tree-shake
|
|
|
48
47
|
#### Class
|
|
49
48
|
|
|
50
49
|
<ul>
|
|
51
|
-
<li><code>GitHubSodiumSealer</code></li>
|
|
52
|
-
<ul>
|
|
53
|
-
<li>
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
@constructor(publicKey: string): GitHubSodiumSealer
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
</li>
|
|
60
50
|
<li>
|
|
61
51
|
|
|
62
52
|
```ts
|
|
63
|
-
|
|
53
|
+
GitHubSodiumSealer(publicKey: string): GitHubSodiumSealer;
|
|
54
|
+
GitHubSodiumSealer.encrypt(value: string): string;
|
|
64
55
|
```
|
|
65
56
|
|
|
66
57
|
</li>
|
|
67
58
|
</ul>
|
|
68
|
-
</ul>
|
|
69
59
|
|
|
70
60
|
#### Function
|
|
71
61
|
|
|
@@ -73,7 +63,7 @@ encrypt(value: string): string
|
|
|
73
63
|
<li>
|
|
74
64
|
|
|
75
65
|
```ts
|
|
76
|
-
seal(publicKey: string, value: string): string
|
|
66
|
+
seal(publicKey: string, value: string): string;
|
|
77
67
|
```
|
|
78
68
|
|
|
79
69
|
</li>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export default GitHubSodiumSealer;
|
|
2
1
|
/**
|
|
3
2
|
* @class GitHubSodiumSealer
|
|
4
3
|
* @description Encrypt value to GitHub secret value.
|
|
5
4
|
*/
|
|
6
5
|
declare class GitHubSodiumSealer {
|
|
6
|
+
#private;
|
|
7
7
|
/**
|
|
8
8
|
* @constructor
|
|
9
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.
|
|
@@ -15,6 +15,6 @@ declare class GitHubSodiumSealer {
|
|
|
15
15
|
* @returns {string} An encrypted GitHub secret value.
|
|
16
16
|
*/
|
|
17
17
|
encrypt(value: string): string;
|
|
18
|
-
#private;
|
|
19
18
|
}
|
|
19
|
+
export default GitHubSodiumSealer;
|
|
20
20
|
//# sourceMappingURL=github-sodium-sealer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-sodium-sealer.d.ts","sourceRoot":"","sources":["../src/github-sodium-sealer.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,cAAM,kBAAkB;;IAEvB;;;OAGG;gBACS,SAAS,EAAE,MAAM;IAM7B;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAM9B;AACD,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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_publicKeyStorage;
|
|
13
|
+
import { StringItemFilter } from "@hugoalh/advanced-determine";
|
|
14
|
+
import libsodium from "libsodium-wrappers";
|
|
15
|
+
await libsodium.ready;
|
|
16
|
+
const stringFilter = new StringItemFilter();
|
|
17
|
+
/**
|
|
18
|
+
* @class GitHubSodiumSealer
|
|
19
|
+
* @description Encrypt value to GitHub secret value.
|
|
20
|
+
*/
|
|
21
|
+
class GitHubSodiumSealer {
|
|
22
|
+
/**
|
|
23
|
+
* @constructor
|
|
24
|
+
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
25
|
+
*/
|
|
26
|
+
constructor(publicKey) {
|
|
27
|
+
_GitHubSodiumSealer_publicKeyStorage.set(this, void 0);
|
|
28
|
+
if (!stringFilter.test(publicKey)) {
|
|
29
|
+
throw new TypeError(`Argument \`publicKey\` must be type of string (non-empty)!`);
|
|
30
|
+
}
|
|
31
|
+
__classPrivateFieldSet(this, _GitHubSodiumSealer_publicKeyStorage, Buffer.from(publicKey, "base64"), "f");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @method
|
|
35
|
+
* @param {string} value Value that need to encrypt as secret value.
|
|
36
|
+
* @returns {string} An encrypted GitHub secret value.
|
|
37
|
+
*/
|
|
38
|
+
encrypt(value) {
|
|
39
|
+
if (!stringFilter.test(value)) {
|
|
40
|
+
throw new TypeError(`Argument \`value\` must be type of string (non-empty)!`);
|
|
41
|
+
}
|
|
42
|
+
return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), __classPrivateFieldGet(this, _GitHubSodiumSealer_publicKeyStorage, "f"))).toString("base64");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
_GitHubSodiumSealer_publicKeyStorage = new WeakMap();
|
|
46
|
+
export default GitHubSodiumSealer;
|
package/{lib → dist}/main.d.ts
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export { GitHubSodiumSealer };
|
|
3
|
-
export { seal };
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
6
1
|
import GitHubSodiumSealer from "./github-sodium-sealer.js";
|
|
7
2
|
import seal from "./seal.js";
|
|
8
3
|
export { GitHubSodiumSealer, seal };
|
|
4
|
+
declare const _default: {
|
|
5
|
+
GitHubSodiumSealer: typeof GitHubSodiumSealer;
|
|
6
|
+
seal: typeof seal;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
9
|
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACN,kBAAkB,EAClB,IAAI,EACJ,CAAC;;;;;AACF,wBAGE"}
|
package/{lib → dist}/main.js
RENAMED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import GitHubSodiumSealer from "./github-sodium-sealer.js";
|
|
2
2
|
import seal from "./seal.js";
|
|
3
|
-
export {
|
|
4
|
-
GitHubSodiumSealer,
|
|
5
|
-
seal
|
|
6
|
-
};
|
|
3
|
+
export { GitHubSodiumSealer, seal };
|
|
7
4
|
export default {
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
GitHubSodiumSealer,
|
|
6
|
+
seal
|
|
10
7
|
};
|
package/{lib → dist}/seal.d.ts
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export default seal;
|
|
2
1
|
/**
|
|
3
2
|
* @function seal
|
|
4
3
|
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
@@ -6,4 +5,5 @@ export default seal;
|
|
|
6
5
|
* @returns {string} An encrypted GitHub secret value.
|
|
7
6
|
*/
|
|
8
7
|
declare function seal(publicKey: string, value: string): string;
|
|
8
|
+
export default seal;
|
|
9
9
|
//# sourceMappingURL=seal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../src/seal.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AACH,iBAAS,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AACD,eAAe,IAAI,CAAC"}
|
package/{lib → dist}/seal.js
RENAMED
|
@@ -6,6 +6,6 @@ import GitHubSodiumSealer from "./github-sodium-sealer.js";
|
|
|
6
6
|
* @returns {string} An encrypted GitHub secret value.
|
|
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": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "A module to provide an easier sodium for GitHub secrets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -13,25 +13,27 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "hugoalh",
|
|
15
15
|
"type": "module",
|
|
16
|
-
"main": "./
|
|
16
|
+
"main": "./dist/main.js",
|
|
17
17
|
"exports": {
|
|
18
|
-
"import": "./
|
|
18
|
+
"import": "./dist/main.js"
|
|
19
19
|
},
|
|
20
|
-
"types": "./
|
|
20
|
+
"types": "./dist/main.d.ts",
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
23
|
"url": "git+https://github.com/hugoalh-studio/github-sodium-nodejs.git"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@hugoalh/advanced-determine": "^
|
|
27
|
-
"libsodium-wrappers": "^0.7.
|
|
26
|
+
"@hugoalh/advanced-determine": "^10.0.0",
|
|
27
|
+
"libsodium-wrappers": "^0.7.11"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/libsodium-wrappers": "^0.7.
|
|
31
|
-
"@types/node": "^18.
|
|
32
|
-
"eslint": "^
|
|
33
|
-
"eslint
|
|
34
|
-
"
|
|
30
|
+
"@types/libsodium-wrappers": "^0.7.10",
|
|
31
|
+
"@types/node": "^18.14.1",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
33
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
34
|
+
"eslint": "^8.34.0",
|
|
35
|
+
"eslint-plugin-only-warn": "^1.1.0",
|
|
36
|
+
"typescript": "^4.9.5"
|
|
35
37
|
},
|
|
36
38
|
"engines": {
|
|
37
39
|
"node": "^12.20.0 || ^14.15.0 || >=16.13.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-sodium-sealer.d.ts","sourceRoot":"","sources":["github-sodium-sealer.js"],"names":[],"mappings":";AAGA;;;GAGG;AACH;IAEC;;;OAGG;IACH,uBAFW,MAAM,EAOhB;IACD;;;;OAIG;IACH,eAHW,MAAM,GACJ,MAAM,CAOlB;;CACD"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { isString as adIsString } from "@hugoalh/advanced-determine";
|
|
2
|
-
import libsodium from "libsodium-wrappers";
|
|
3
|
-
await libsodium.ready;
|
|
4
|
-
/**
|
|
5
|
-
* @class GitHubSodiumSealer
|
|
6
|
-
* @description Encrypt value to GitHub secret value.
|
|
7
|
-
*/
|
|
8
|
-
class GitHubSodiumSealer {
|
|
9
|
-
#publicKeyStorage;
|
|
10
|
-
/**
|
|
11
|
-
* @constructor
|
|
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.
|
|
13
|
-
*/
|
|
14
|
-
constructor(publicKey) {
|
|
15
|
-
if (!adIsString(publicKey, { empty: false })) {
|
|
16
|
-
throw new TypeError(`Argument \`publicKey\` must be type of string (non-empty)!`);
|
|
17
|
-
}
|
|
18
|
-
this.#publicKeyStorage = Buffer.from(publicKey, "base64");
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @method
|
|
22
|
-
* @param {string} value Value that need to encrypt as secret value.
|
|
23
|
-
* @returns {string} An encrypted GitHub secret value.
|
|
24
|
-
*/
|
|
25
|
-
encrypt(value) {
|
|
26
|
-
if (!adIsString(value, { empty: false })) {
|
|
27
|
-
throw new TypeError(`Argument \`value\` must be type of string (non-empty)!`);
|
|
28
|
-
}
|
|
29
|
-
return Buffer.from(libsodium.crypto_box_seal(Buffer.from(value), this.#publicKeyStorage)).toString("base64");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export default GitHubSodiumSealer;
|
package/lib/main.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.js"],"names":[],"mappings":""}
|
package/lib/seal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["seal.js"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,iCAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB"}
|