@workflow/web 5.0.0-beta.1 → 5.0.0-beta.11
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 +1 -1
- package/build/client/assets/encryption-g14N5vQl.js +51 -0
- package/build/client/assets/entry.client-DOJDY_4b.js +11899 -0
- package/build/client/assets/highlighted-body-B3W2YXNL-ByAVJfTI.js +18 -0
- package/build/client/assets/home-D68s49Hb.js +3983 -0
- package/build/client/assets/index-B6-SzLmT.js +308 -0
- package/build/client/assets/index-BXZSIDEp.js +9432 -0
- package/build/client/assets/manifest-f3e412ee.js +1 -0
- package/build/client/assets/mermaid-3ZIDBTTL-Cg06pRM9.js +48662 -0
- package/build/client/assets/root-CtIBMIdD.js +690 -0
- package/build/client/assets/root-D_G0HW97.css +1 -0
- package/build/client/assets/run-detail-B1sCKjMc.js +5856 -0
- package/build/client/assets/server-build-DyZioyz3.css +1 -0
- package/build/client/assets/worker-CqHKTA7D.js +115 -0
- package/build/client/assets/workflow-graph-viewer-D4OsX_TE.js +16175 -0
- package/build/client/assets/{workflow-graph-viewer-yls6qlc0.css → workflow-graph-viewer-DnlNuQQH.css} +1 -1
- package/build/server/assets/{app-DaJqmGT8.js → app-C26OkrrR.js} +1 -1
- package/build/server/assets/{highlighted-body-B3W2YXNL-xowfciga.js → highlighted-body-B3W2YXNL-2D25w_37.js} +5 -6
- package/build/server/assets/index-C6jZ_bJo.js +89 -0
- package/build/server/assets/{mermaid-3ZIDBTTL-nU8V7hWp.js → mermaid-3ZIDBTTL-BDYN9XOo.js} +6 -7
- package/build/server/assets/{server-build-rhQJXUIP.js → server-build-D82EKMvZ.js} +40955 -39875
- package/build/server/assets/{token-BZ35B6LQ.js → token-Bjcyh98U.js} +2 -2
- package/build/server/assets/{token-util-vRsmZMJV.js → token-util-CdvUIKt6.js} +2 -2
- package/build/server/index.js +1 -1
- package/package.json +8 -7
- package/build/client/assets/encryption-8OvC6eoJ.js +0 -1
- package/build/client/assets/entry.client-BiVEcoV8.js +0 -29
- package/build/client/assets/highlighted-body-B3W2YXNL-epbVCzUZ.js +0 -1
- package/build/client/assets/home-cYqw84jW.js +0 -40
- package/build/client/assets/index-BmZS3y7B.js +0 -59
- package/build/client/assets/manifest-2d7ab41e.js +0 -1
- package/build/client/assets/mermaid-3ZIDBTTL-CCXSRVd3.js +0 -210
- package/build/client/assets/root-aMfmV5uh.css +0 -1
- package/build/client/assets/root-kDmPgm4u.js +0 -26
- package/build/client/assets/run-detail-B5k2OYOu.js +0 -37
- package/build/client/assets/server-build-CiTtikBY.css +0 -1
- package/build/client/assets/worker-D-HfgUMl.js +0 -1
- package/build/client/assets/workflow-graph-viewer-B5c_xYyF.js +0 -161
- package/build/server/assets/index-CFBIzXaR.js +0 -81
package/README.md
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { W as WorkflowRuntimeError, R as RuntimeDecryptionError } from "./index-B6-SzLmT.js";
|
|
2
|
+
import "./index-BXZSIDEp.js";
|
|
3
|
+
const NONCE_LENGTH = 12;
|
|
4
|
+
const TAG_LENGTH = 128;
|
|
5
|
+
const KEY_LENGTH = 32;
|
|
6
|
+
async function importKey(raw, usages = ["encrypt", "decrypt"]) {
|
|
7
|
+
if (raw.byteLength !== KEY_LENGTH) {
|
|
8
|
+
throw new WorkflowRuntimeError(`Encryption key must be exactly ${KEY_LENGTH} bytes, got ${raw.byteLength}`);
|
|
9
|
+
}
|
|
10
|
+
return globalThis.crypto.subtle.importKey(
|
|
11
|
+
"raw",
|
|
12
|
+
raw,
|
|
13
|
+
"AES-GCM",
|
|
14
|
+
false,
|
|
15
|
+
// `KeyUsage` is a DOM-lib type that's not in scope under `es2022`.
|
|
16
|
+
// The `ReadonlyArray<'encrypt' | 'decrypt'>` parameter type matches
|
|
17
|
+
// a strict subset of `KeyUsage[]`, so this cast is sound.
|
|
18
|
+
usages
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
async function decrypt(key, data) {
|
|
22
|
+
const minLength = NONCE_LENGTH + TAG_LENGTH / 8;
|
|
23
|
+
if (data.byteLength < minLength) {
|
|
24
|
+
throw new RuntimeDecryptionError(`Encrypted data too short: expected at least ${minLength} bytes, got ${data.byteLength}`, {
|
|
25
|
+
context: {
|
|
26
|
+
operation: "decrypt",
|
|
27
|
+
byteLength: data.byteLength
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const nonce = data.subarray(0, NONCE_LENGTH);
|
|
32
|
+
const ciphertext = data.subarray(NONCE_LENGTH);
|
|
33
|
+
let plaintext;
|
|
34
|
+
try {
|
|
35
|
+
plaintext = await globalThis.crypto.subtle.decrypt({ name: "AES-GCM", iv: nonce, tagLength: TAG_LENGTH }, key, ciphertext);
|
|
36
|
+
} catch (cause) {
|
|
37
|
+
const causeMsg = cause instanceof Error ? cause.message : String(cause);
|
|
38
|
+
throw new RuntimeDecryptionError(`AES-256-GCM decryption failed: ${causeMsg}`, {
|
|
39
|
+
cause,
|
|
40
|
+
context: {
|
|
41
|
+
operation: "decrypt",
|
|
42
|
+
byteLength: data.byteLength
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return new Uint8Array(plaintext);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
decrypt,
|
|
50
|
+
importKey
|
|
51
|
+
};
|