@hugoalh/github-sodium 3.1.0 → 3.1.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/README.md +7 -19
- package/dist/main.d.ts +34 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +65 -2
- package/package.json +7 -7
- package/dist/github-sodium-sealer.d.ts +0 -28
- package/dist/github-sodium-sealer.d.ts.map +0 -1
- package/dist/github-sodium-sealer.js +0 -56
- package/dist/seal.d.ts +0 -10
- package/dist/seal.d.ts.map +0 -1
- package/dist/seal.js +0 -12
package/README.md
CHANGED
|
@@ -46,28 +46,16 @@ import githubSodium from "@hugoalh/github-sodium";// Default Import
|
|
|
46
46
|
|
|
47
47
|
#### Class
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
new GitHubSodiumSealer(publicKey: string): GitHubSodiumSealer;
|
|
54
|
-
.encrypt(value: string): string;
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
</li>
|
|
58
|
-
</ul>
|
|
49
|
+
- ```ts
|
|
50
|
+
new GitHubSodiumSealer(publicKey: string): GitHubSodiumSealer;
|
|
51
|
+
.encrypt(value: string): string;
|
|
52
|
+
```
|
|
59
53
|
|
|
60
54
|
#### Function
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
seal(publicKey: string, value: string): string;
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
</li>
|
|
70
|
-
</ul>
|
|
56
|
+
- ```ts
|
|
57
|
+
seal(publicKey: string, value: string): string;
|
|
58
|
+
```
|
|
71
59
|
|
|
72
60
|
### Example
|
|
73
61
|
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @class GitHubSodiumSealer
|
|
3
|
+
* @description Encrypt value to GitHub secret value.
|
|
4
|
+
*/
|
|
5
|
+
declare class GitHubSodiumSealer {
|
|
6
|
+
#private;
|
|
7
|
+
/**
|
|
8
|
+
* @constructor
|
|
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.
|
|
10
|
+
*/
|
|
11
|
+
constructor(publicKey: string);
|
|
12
|
+
/**
|
|
13
|
+
* @method encrypt
|
|
14
|
+
* @param {string} value Value that need to encrypt as secret value.
|
|
15
|
+
* @returns {string} An encrypted GitHub secret value.
|
|
16
|
+
*/
|
|
17
|
+
encrypt(value: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* @static seal
|
|
20
|
+
* @description Encrypt value to GitHub secret value.
|
|
21
|
+
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
22
|
+
* @param {string} value Value that need to encrypt as secret value.
|
|
23
|
+
* @returns {string} An encrypted GitHub secret value.
|
|
24
|
+
*/
|
|
25
|
+
static seal(publicKey: string, value: string): string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @function seal
|
|
29
|
+
* @description Encrypt value to GitHub secret value.
|
|
30
|
+
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
31
|
+
* @param {string} value Value that need to encrypt as secret value.
|
|
32
|
+
* @returns {string} An encrypted GitHub secret value.
|
|
33
|
+
*/
|
|
34
|
+
declare function seal(publicKey: string, value: string): string;
|
|
3
35
|
export { GitHubSodiumSealer, seal };
|
|
4
36
|
declare const _default: {
|
|
5
37
|
GitHubSodiumSealer: typeof GitHubSodiumSealer;
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
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_publicKeyBuffer.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_publicKeyBuffer, Buffer.from(publicKey, "base64"), "f");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @method encrypt
|
|
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_publicKeyBuffer, "f"))).toString("base64");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @static seal
|
|
46
|
+
* @description Encrypt value to GitHub secret value.
|
|
47
|
+
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
48
|
+
* @param {string} value Value that need to encrypt as secret value.
|
|
49
|
+
* @returns {string} An encrypted GitHub secret value.
|
|
50
|
+
*/
|
|
51
|
+
static seal(publicKey, value) {
|
|
52
|
+
return new this(publicKey).encrypt(value);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
_GitHubSodiumSealer_publicKeyBuffer = new WeakMap();
|
|
56
|
+
/**
|
|
57
|
+
* @function seal
|
|
58
|
+
* @description Encrypt value to GitHub secret value.
|
|
59
|
+
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
60
|
+
* @param {string} value Value that need to encrypt as secret value.
|
|
61
|
+
* @returns {string} An encrypted GitHub secret value.
|
|
62
|
+
*/
|
|
63
|
+
function seal(publicKey, value) {
|
|
64
|
+
return new GitHubSodiumSealer(publicKey).encrypt(value);
|
|
65
|
+
}
|
|
3
66
|
export { GitHubSodiumSealer, seal };
|
|
4
67
|
export default {
|
|
5
68
|
GitHubSodiumSealer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hugoalh/github-sodium",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "A module to provide an easier sodium for GitHub secrets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"url": "git+https://github.com/hugoalh-studio/github-sodium-nodejs.git"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@hugoalh/advanced-determine": "^10.
|
|
26
|
+
"@hugoalh/advanced-determine": "^10.3.0",
|
|
27
27
|
"libsodium-wrappers": "^0.7.11"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/libsodium-wrappers": "^0.7.10",
|
|
31
|
-
"@types/node": "^18.15.
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
33
|
-
"@typescript-eslint/parser": "^5.
|
|
34
|
-
"eslint": "^8.
|
|
31
|
+
"@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",
|
|
35
35
|
"eslint-plugin-only-warn": "^1.1.0",
|
|
36
|
-
"typescript": "^
|
|
36
|
+
"typescript": "^5.0.3"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": "^12.20.0 || ^14.15.0 || >=16.13.0"
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @class GitHubSodiumSealer
|
|
3
|
-
* @description Encrypt value to GitHub secret value.
|
|
4
|
-
*/
|
|
5
|
-
declare class GitHubSodiumSealer {
|
|
6
|
-
#private;
|
|
7
|
-
/**
|
|
8
|
-
* @constructor
|
|
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.
|
|
10
|
-
*/
|
|
11
|
-
constructor(publicKey: string);
|
|
12
|
-
/**
|
|
13
|
-
* @method encrypt
|
|
14
|
-
* @param {string} value Value that need to encrypt as secret value.
|
|
15
|
-
* @returns {string} An encrypted GitHub secret value.
|
|
16
|
-
*/
|
|
17
|
-
encrypt(value: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* @static seal
|
|
20
|
-
* @description Encrypt value to GitHub secret value.
|
|
21
|
-
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
22
|
-
* @param {string} value Value that need to encrypt as secret value.
|
|
23
|
-
* @returns {string} An encrypted GitHub secret value.
|
|
24
|
-
*/
|
|
25
|
-
static seal(publicKey: string, value: string): string;
|
|
26
|
-
}
|
|
27
|
-
export default GitHubSodiumSealer;
|
|
28
|
-
//# sourceMappingURL=github-sodium-sealer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IAM9B;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CAGrD;AACD,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
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 encrypt
|
|
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
|
-
* @static seal
|
|
46
|
-
* @description Encrypt value to GitHub secret value.
|
|
47
|
-
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
48
|
-
* @param {string} value Value that need to encrypt as secret value.
|
|
49
|
-
* @returns {string} An encrypted GitHub secret value.
|
|
50
|
-
*/
|
|
51
|
-
static seal(publicKey, value) {
|
|
52
|
-
return new this(publicKey).encrypt(value);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
_GitHubSodiumSealer_publicKeyStorage = new WeakMap();
|
|
56
|
-
export default GitHubSodiumSealer;
|
package/dist/seal.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @function seal
|
|
3
|
-
* @description Encrypt value to GitHub secret value.
|
|
4
|
-
* @param {string} publicKey Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
|
|
5
|
-
* @param {string} value Value that need to encrypt as secret value.
|
|
6
|
-
* @returns {string} An encrypted GitHub secret value.
|
|
7
|
-
*/
|
|
8
|
-
declare function seal(publicKey: string, value: string): string;
|
|
9
|
-
export default seal;
|
|
10
|
-
//# sourceMappingURL=seal.d.ts.map
|
package/dist/seal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../src/seal.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,iBAAS,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AACD,eAAe,IAAI,CAAC"}
|
package/dist/seal.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import GitHubSodiumSealer from "./github-sodium-sealer.js";
|
|
2
|
-
/**
|
|
3
|
-
* @function seal
|
|
4
|
-
* @description Encrypt value to GitHub secret value.
|
|
5
|
-
* @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
|
-
* @param {string} value Value that need to encrypt as secret value.
|
|
7
|
-
* @returns {string} An encrypted GitHub secret value.
|
|
8
|
-
*/
|
|
9
|
-
function seal(publicKey, value) {
|
|
10
|
-
return new GitHubSodiumSealer(publicKey).encrypt(value);
|
|
11
|
-
}
|
|
12
|
-
export default seal;
|