@powerlines/plugin-crypto 0.10.96 → 0.10.97
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/dist/_virtual/rolldown_runtime.cjs +37 -1
- package/dist/_virtual/rolldown_runtime.mjs +29 -1
- package/dist/components/crypto.cjs +24 -10
- package/dist/components/crypto.mjs +24 -10
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +3 -1
- package/dist/deepkit/schemas/reflection.cjs +3998 -1
- package/dist/deepkit/schemas/reflection.mjs +3996 -1
- package/dist/deepkit/schemas/reflection2.cjs +4112 -1
- package/dist/deepkit/schemas/reflection2.mjs +4110 -1
- package/dist/deepkit/src/capnp.cjs +913 -1
- package/dist/deepkit/src/capnp.mjs +911 -1
- package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
- package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
- package/dist/deepkit/src/reflect-type.cjs +22 -1
- package/dist/deepkit/src/reflect-type.mjs +20 -1
- package/dist/deepkit/src/resolve-reflections.cjs +16 -1
- package/dist/deepkit/src/resolve-reflections.mjs +15 -1
- package/dist/deepkit/src/transformer.cjs +52 -1
- package/dist/deepkit/src/transformer.mjs +49 -1
- package/dist/deepkit/src/transpile.cjs +29 -1
- package/dist/deepkit/src/transpile.mjs +27 -1
- package/dist/deepkit/src/utilities.cjs +66 -1
- package/dist/deepkit/src/utilities.mjs +65 -1
- package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
- package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
- package/dist/deepkit/src/vendor/type.cjs +20 -1
- package/dist/deepkit/src/vendor/type.mjs +11 -1
- package/dist/index.cjs +46 -1
- package/dist/index.mjs +41 -1
- package/dist/plugin-alloy/src/core/components/output.cjs +38 -1
- package/dist/plugin-alloy/src/core/components/output.mjs +37 -1
- package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
- package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
- package/dist/plugin-alloy/src/index.cjs +90 -1
- package/dist/plugin-alloy/src/index.mjs +88 -1
- package/dist/plugin-automd/src/index.cjs +101 -1
- package/dist/plugin-automd/src/index.mjs +98 -1
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
- package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
- package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
- package/dist/plugin-babel/src/helpers/index.cjs +5 -1
- package/dist/plugin-babel/src/helpers/index.mjs +7 -1
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
- package/dist/plugin-babel/src/helpers/options.cjs +50 -1
- package/dist/plugin-babel/src/helpers/options.mjs +47 -1
- package/dist/plugin-babel/src/index.cjs +91 -1
- package/dist/plugin-babel/src/index.mjs +89 -1
- package/dist/plugin-env/src/babel/index.cjs +1 -1
- package/dist/plugin-env/src/babel/index.mjs +3 -1
- package/dist/plugin-env/src/babel/plugin.cjs +120 -4
- package/dist/plugin-env/src/babel/plugin.mjs +118 -4
- package/dist/plugin-env/src/components/docs.cjs +9 -1
- package/dist/plugin-env/src/components/docs.mjs +11 -1
- package/dist/plugin-env/src/components/env.cjs +349 -11
- package/dist/plugin-env/src/components/env.mjs +347 -9
- package/dist/plugin-env/src/components/index.cjs +2 -1
- package/dist/plugin-env/src/components/index.mjs +4 -1
- package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -1
- package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -1
- package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -1
- package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -1
- package/dist/plugin-env/src/helpers/index.cjs +6 -1
- package/dist/plugin-env/src/helpers/index.mjs +8 -1
- package/dist/plugin-env/src/helpers/load.cjs +83 -1
- package/dist/plugin-env/src/helpers/load.mjs +80 -1
- package/dist/plugin-env/src/helpers/persistence.cjs +200 -1
- package/dist/plugin-env/src/helpers/persistence.mjs +189 -1
- package/dist/plugin-env/src/helpers/reflect.cjs +125 -1
- package/dist/plugin-env/src/helpers/reflect.mjs +117 -1
- package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -1
- package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -1
- package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -1
- package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -1
- package/dist/plugin-env/src/index.cjs +167 -5
- package/dist/plugin-env/src/index.mjs +165 -5
- package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
- package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
- package/dist/powerlines/src/lib/entry.cjs +12 -1
- package/dist/powerlines/src/lib/entry.mjs +14 -1
- package/dist/powerlines/src/lib/logger.cjs +41 -1
- package/dist/powerlines/src/lib/logger.mjs +39 -1
- package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
- package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
- package/dist/powerlines/src/lib/utilities/file-header.cjs +19 -7
- package/dist/powerlines/src/lib/utilities/file-header.mjs +18 -7
- package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
- package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
- package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
- package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
- package/dist/powerlines/src/types/context.d.cts +27 -3
- package/dist/powerlines/src/types/context.d.mts +27 -3
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +6 -6
|
@@ -1 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
23
|
+
if (symbols) {
|
|
24
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
|
+
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
26
|
+
}
|
|
27
|
+
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
|
|
36
|
+
exports.__reExport = __reExport;
|
|
37
|
+
exports.__toESM = __toESM;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
9
|
+
key = keys[i];
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
11
|
+
__defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
21
|
+
if (symbols) {
|
|
22
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
23
|
+
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
24
|
+
}
|
|
25
|
+
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { __reExport };
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_file_header = require('../powerlines/src/lib/utilities/file-header.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/components/crypto.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generates the crypto module content.
|
|
6
|
+
*
|
|
7
|
+
* @param context - The build context containing runtime information.
|
|
8
|
+
* @returns A string representing the crypto module code.
|
|
9
|
+
*/
|
|
10
|
+
function cryptoModule(context) {
|
|
11
|
+
return `
|
|
2
12
|
/**
|
|
3
13
|
* The cryptography module provides custom helper functions to support encrypting and decrypting data.
|
|
4
14
|
*
|
|
5
|
-
* @module ${
|
|
15
|
+
* @module ${context.config.output.builtinPrefix}:crypto
|
|
6
16
|
*/
|
|
7
17
|
|
|
8
|
-
${
|
|
18
|
+
${require_file_header.getFileHeader(context)}
|
|
9
19
|
|
|
10
20
|
import { xchacha20poly1305, chacha20poly1305 } from "@noble/ciphers/chacha.js";
|
|
11
21
|
import { randomBytes, managedNonce, hexToBytes } from "@noble/ciphers/utils.js";
|
|
12
22
|
import { scrypt } from "@noble/hashes/scrypt.js";
|
|
13
23
|
import { blake3 } from "@noble/hashes/blake3.js";
|
|
14
|
-
${
|
|
24
|
+
${context.config.crypto.encryptionKey ? `
|
|
15
25
|
const nonce = randomBytes(24);
|
|
16
|
-
const chacha = xchacha20poly1305(hexToBytes("${
|
|
26
|
+
const chacha = xchacha20poly1305(hexToBytes("${context.config.crypto.encryptionKey}"), nonce);
|
|
17
27
|
|
|
18
28
|
/**
|
|
19
29
|
* Symmetrically encrypts data using the [ChaCha20-Poly1305](https://en.wikipedia.org/wiki/ChaCha20-Poly1305) cipher.
|
|
@@ -48,7 +58,7 @@ export function decrypt(encrypted: string): string {
|
|
|
48
58
|
|
|
49
59
|
return new TextDecoder().decode(decrypted);
|
|
50
60
|
}
|
|
51
|
-
|
|
61
|
+
` : ""}
|
|
52
62
|
|
|
53
63
|
/**
|
|
54
64
|
* Symmetrically encrypts data using the [ChaCha20-Poly1305](https://en.wikipedia.org/wiki/ChaCha20-Poly1305) cipher with a password.
|
|
@@ -62,7 +72,7 @@ export function decrypt(encrypted: string): string {
|
|
|
62
72
|
export function encryptWithPassword(password: string, plaintext: string): string {
|
|
63
73
|
const key = scrypt(
|
|
64
74
|
new TextEncoder().encode(password),
|
|
65
|
-
hexToBytes("${
|
|
75
|
+
hexToBytes("${context.config.crypto.salt ? context.config.crypto.salt : "nonce"}"),
|
|
66
76
|
1048576, // requires 1GB of RAM to calculate
|
|
67
77
|
8,
|
|
68
78
|
1,
|
|
@@ -88,7 +98,7 @@ export function encryptWithPassword(password: string, plaintext: string): string
|
|
|
88
98
|
export function decryptWithPassword(password: string, encrypted: string): string {
|
|
89
99
|
const key = scrypt(
|
|
90
100
|
new TextEncoder().encode(password),
|
|
91
|
-
hexToBytes("${
|
|
101
|
+
hexToBytes("${context.config.crypto.salt ? context.config.crypto.salt : "nonce"}"),
|
|
92
102
|
1048576, // requires 1GB of RAM to calculate
|
|
93
103
|
8,
|
|
94
104
|
1,
|
|
@@ -115,7 +125,7 @@ export function decryptWithPassword(password: string, encrypted: string): string
|
|
|
115
125
|
export function hash(data: string): string {
|
|
116
126
|
return Buffer.from(
|
|
117
127
|
blake3(new TextEncoder().encode(data), {
|
|
118
|
-
key: ${
|
|
128
|
+
key: ${context.config.crypto.salt ? `hexToBytes("${context.config.crypto.salt}")` : "new TextEncoder().encode(\"powerlines\")"})
|
|
119
129
|
})
|
|
120
130
|
).toString("hex");
|
|
121
131
|
}
|
|
@@ -130,4 +140,8 @@ export * from '@noble/hashes/pbkdf2.js';
|
|
|
130
140
|
export * from '@noble/hashes/scrypt.js';
|
|
131
141
|
export * from '@noble/hashes/utils.js';
|
|
132
142
|
|
|
133
|
-
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
exports.cryptoModule = cryptoModule;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import{getFileHeader
|
|
1
|
+
import { getFileHeader } from "../powerlines/src/lib/utilities/file-header.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/components/crypto.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generates the crypto module content.
|
|
6
|
+
*
|
|
7
|
+
* @param context - The build context containing runtime information.
|
|
8
|
+
* @returns A string representing the crypto module code.
|
|
9
|
+
*/
|
|
10
|
+
function cryptoModule(context) {
|
|
11
|
+
return `
|
|
2
12
|
/**
|
|
3
13
|
* The cryptography module provides custom helper functions to support encrypting and decrypting data.
|
|
4
14
|
*
|
|
5
|
-
* @module ${
|
|
15
|
+
* @module ${context.config.output.builtinPrefix}:crypto
|
|
6
16
|
*/
|
|
7
17
|
|
|
8
|
-
${
|
|
18
|
+
${getFileHeader(context)}
|
|
9
19
|
|
|
10
20
|
import { xchacha20poly1305, chacha20poly1305 } from "@noble/ciphers/chacha.js";
|
|
11
21
|
import { randomBytes, managedNonce, hexToBytes } from "@noble/ciphers/utils.js";
|
|
12
22
|
import { scrypt } from "@noble/hashes/scrypt.js";
|
|
13
23
|
import { blake3 } from "@noble/hashes/blake3.js";
|
|
14
|
-
${
|
|
24
|
+
${context.config.crypto.encryptionKey ? `
|
|
15
25
|
const nonce = randomBytes(24);
|
|
16
|
-
const chacha = xchacha20poly1305(hexToBytes("${
|
|
26
|
+
const chacha = xchacha20poly1305(hexToBytes("${context.config.crypto.encryptionKey}"), nonce);
|
|
17
27
|
|
|
18
28
|
/**
|
|
19
29
|
* Symmetrically encrypts data using the [ChaCha20-Poly1305](https://en.wikipedia.org/wiki/ChaCha20-Poly1305) cipher.
|
|
@@ -48,7 +58,7 @@ export function decrypt(encrypted: string): string {
|
|
|
48
58
|
|
|
49
59
|
return new TextDecoder().decode(decrypted);
|
|
50
60
|
}
|
|
51
|
-
|
|
61
|
+
` : ""}
|
|
52
62
|
|
|
53
63
|
/**
|
|
54
64
|
* Symmetrically encrypts data using the [ChaCha20-Poly1305](https://en.wikipedia.org/wiki/ChaCha20-Poly1305) cipher with a password.
|
|
@@ -62,7 +72,7 @@ export function decrypt(encrypted: string): string {
|
|
|
62
72
|
export function encryptWithPassword(password: string, plaintext: string): string {
|
|
63
73
|
const key = scrypt(
|
|
64
74
|
new TextEncoder().encode(password),
|
|
65
|
-
hexToBytes("${
|
|
75
|
+
hexToBytes("${context.config.crypto.salt ? context.config.crypto.salt : "nonce"}"),
|
|
66
76
|
1048576, // requires 1GB of RAM to calculate
|
|
67
77
|
8,
|
|
68
78
|
1,
|
|
@@ -88,7 +98,7 @@ export function encryptWithPassword(password: string, plaintext: string): string
|
|
|
88
98
|
export function decryptWithPassword(password: string, encrypted: string): string {
|
|
89
99
|
const key = scrypt(
|
|
90
100
|
new TextEncoder().encode(password),
|
|
91
|
-
hexToBytes("${
|
|
101
|
+
hexToBytes("${context.config.crypto.salt ? context.config.crypto.salt : "nonce"}"),
|
|
92
102
|
1048576, // requires 1GB of RAM to calculate
|
|
93
103
|
8,
|
|
94
104
|
1,
|
|
@@ -115,7 +125,7 @@ export function decryptWithPassword(password: string, encrypted: string): string
|
|
|
115
125
|
export function hash(data: string): string {
|
|
116
126
|
return Buffer.from(
|
|
117
127
|
blake3(new TextEncoder().encode(data), {
|
|
118
|
-
key: ${
|
|
128
|
+
key: ${context.config.crypto.salt ? `hexToBytes("${context.config.crypto.salt}")` : "new TextEncoder().encode(\"powerlines\")"})
|
|
119
129
|
})
|
|
120
130
|
).toString("hex");
|
|
121
131
|
}
|
|
@@ -130,4 +140,8 @@ export * from '@noble/hashes/pbkdf2.js';
|
|
|
130
140
|
export * from '@noble/hashes/scrypt.js';
|
|
131
141
|
export * from '@noble/hashes/utils.js';
|
|
132
142
|
|
|
133
|
-
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
export { cryptoModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_crypto = require('./crypto.cjs');
|