@workflow/core 4.2.0-beta.70 → 4.2.0-beta.72
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/class-serialization.d.ts +5 -1
- package/dist/class-serialization.d.ts.map +1 -1
- package/dist/class-serialization.js +6 -2
- package/dist/classify-error.d.ts +12 -0
- package/dist/classify-error.d.ts.map +1 -0
- package/dist/classify-error.js +17 -0
- package/dist/private.d.ts.map +1 -1
- package/dist/private.js +21 -1
- package/dist/runtime/constants.d.ts +2 -0
- package/dist/runtime/constants.d.ts.map +1 -0
- package/dist/runtime/constants.js +14 -0
- package/dist/runtime/helpers.d.ts.map +1 -1
- package/dist/runtime/helpers.js +18 -1
- package/dist/runtime/run.d.ts +23 -3
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +16 -3
- package/dist/runtime/runs.d.ts +1 -0
- package/dist/runtime/runs.d.ts.map +1 -1
- package/dist/runtime/runs.js +3 -3
- package/dist/runtime/start.d.ts +4 -5
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +1 -1
- package/dist/runtime/step-handler.d.ts.map +1 -1
- package/dist/runtime/step-handler.js +193 -109
- package/dist/runtime/suspension-handler.d.ts +2 -1
- package/dist/runtime/suspension-handler.d.ts.map +1 -1
- package/dist/runtime/suspension-handler.js +30 -38
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +75 -17
- package/dist/serialization-format.d.ts +9 -0
- package/dist/serialization-format.d.ts.map +1 -1
- package/dist/serialization-format.js +35 -1
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +29 -3
- package/dist/telemetry/semantic-conventions.d.ts +4 -0
- package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
- package/dist/telemetry/semantic-conventions.js +3 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workflow/hook.d.ts.map +1 -1
- package/dist/workflow/hook.js +3 -3
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +45 -26
- package/docs/api-reference/define-hook.mdx +2 -0
- package/docs/api-reference/get-writable.mdx +1 -0
- package/docs/foundations/common-patterns.mdx +4 -0
- package/docs/foundations/errors-and-retries.mdx +29 -0
- package/docs/foundations/serialization.mdx +211 -0
- package/docs/foundations/streaming.mdx +22 -0
- package/docs/how-it-works/encryption.mdx +93 -0
- package/docs/how-it-works/meta.json +2 -1
- package/package.json +5 -9
- package/dist/builtins.d.ts +0 -4
- package/dist/builtins.d.ts.map +0 -1
- package/dist/builtins.js +0 -13
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Encryption
|
|
3
|
+
description: Learn how Workflow DevKit encrypts user data end-to-end in the event log.
|
|
4
|
+
type: conceptual
|
|
5
|
+
summary: Understand how workflow and step data is encrypted at rest.
|
|
6
|
+
prerequisites:
|
|
7
|
+
- /docs/how-it-works/event-sourcing
|
|
8
|
+
related:
|
|
9
|
+
- /docs/observability
|
|
10
|
+
- /docs/deploying/world/vercel-world
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<Callout>
|
|
14
|
+
This guide explains how Workflow DevKit encrypts user data in the event log. Understanding these details is not required to use workflows — encryption is automatic and requires no code changes. For getting started, see the [getting started](/docs/getting-started) guides for your framework.
|
|
15
|
+
</Callout>
|
|
16
|
+
|
|
17
|
+
Workflow DevKit supports automatic end-to-end encryption of all user data before it is written to the event log. When a `World` implementation provides encryption support, it is safe to pass sensitive data — such as API keys, tokens, or user credentials — as workflow inputs, step arguments, and return values. The storage backend only ever sees ciphertext.
|
|
18
|
+
|
|
19
|
+
Encryption support varies by `World` implementation. See the [Worlds](/worlds) page to check which worlds support this feature. `World` implementations opt into encryption by providing a `getEncryptionKeyForRun()` method — the core runtime will use it automatically when present.
|
|
20
|
+
|
|
21
|
+
## What Is Encrypted
|
|
22
|
+
|
|
23
|
+
All user data flowing through the event log is encrypted:
|
|
24
|
+
|
|
25
|
+
- **Workflow inputs** — arguments passed when starting a workflow
|
|
26
|
+
- **Workflow return values** — the final output of a workflow
|
|
27
|
+
- **Step inputs** — arguments passed to step functions
|
|
28
|
+
- **Step return values** — the result returned by step functions
|
|
29
|
+
- **Hook metadata** — data attached when creating a hook
|
|
30
|
+
- **Hook payloads** — data received by hooks and webhooks
|
|
31
|
+
- **Stream data** — each frame in a `ReadableStream` or `WritableStream`
|
|
32
|
+
|
|
33
|
+
Metadata such as workflow names, step names, entity IDs, timestamps, and lifecycle states are **not** encrypted. This allows the observability tools to display run structure and timelines without requiring decryption.
|
|
34
|
+
|
|
35
|
+
## How It Works
|
|
36
|
+
|
|
37
|
+
### Key Management
|
|
38
|
+
|
|
39
|
+
Each workflow run is encrypted with its own unique key, provided by the `World` implementation via `getEncryptionKeyForRun()`. How the key is generated and stored is up to the `World`.
|
|
40
|
+
|
|
41
|
+
For example, the [Vercel World](/docs/deploying/world/vercel-world) provides unique keys per run and execution environment, ensuring that a given run can only decrypt data from that run itself.
|
|
42
|
+
|
|
43
|
+
### Encryption Algorithm
|
|
44
|
+
|
|
45
|
+
Data is encrypted using **AES-256-GCM** via the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API):
|
|
46
|
+
|
|
47
|
+
- A random 12-byte nonce is generated for each encryption operation
|
|
48
|
+
- The GCM authentication tag provides integrity verification — any tampering with the ciphertext is detected
|
|
49
|
+
- The same plaintext produces different ciphertext each time due to the random nonce
|
|
50
|
+
|
|
51
|
+
## Decrypting Data
|
|
52
|
+
|
|
53
|
+
When viewing workflow runs through the observability tools, encrypted fields display as locked placeholders until you explicitly choose to decrypt them.
|
|
54
|
+
|
|
55
|
+
### Permissions
|
|
56
|
+
|
|
57
|
+
Decryption access is controlled by the `World` implementation. On Vercel, decryption follows the same permissions model as project environment variables — if you don't have permission to view environment variable values for a project, you won't be able to decrypt workflow data either. Each decryption request is recorded in your [Vercel audit log](https://vercel.com/docs/audit-log), giving your team full visibility into when and by whom workflow data was accessed.
|
|
58
|
+
|
|
59
|
+
### Web Dashboard
|
|
60
|
+
|
|
61
|
+
Click the **Decrypt** button in the run detail panel to decrypt all data fields. Decryption happens entirely in the browser via the Web Crypto API — the observability server retrieves the encryption key but never sees your plaintext data.
|
|
62
|
+
|
|
63
|
+
### CLI
|
|
64
|
+
|
|
65
|
+
Add the `--decrypt` flag to any `inspect` command:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Inspect a specific run
|
|
69
|
+
npx workflow inspect run <run-id> --decrypt
|
|
70
|
+
|
|
71
|
+
# Inspect a specific step
|
|
72
|
+
npx workflow inspect step <step-id> --run <run-id> --decrypt
|
|
73
|
+
|
|
74
|
+
# List events for a run
|
|
75
|
+
npx workflow inspect events --run <run-id> --decrypt
|
|
76
|
+
|
|
77
|
+
# Inspect a specific stream
|
|
78
|
+
npx workflow inspect stream <stream-id> --run <run-id> --decrypt
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Without `--decrypt`, encrypted fields display as `🔒 Encrypted` placeholders.
|
|
82
|
+
|
|
83
|
+
## Custom World Implementations
|
|
84
|
+
|
|
85
|
+
The core runtime encrypts data automatically when the `World` implementation provides a `getEncryptionKeyForRun()` method. This method receives the run ID and returns the raw encryption key bytes.
|
|
86
|
+
|
|
87
|
+
To add encryption support to a custom `World`:
|
|
88
|
+
|
|
89
|
+
1. Implement `getEncryptionKeyForRun(runId: string)` on your `World` class
|
|
90
|
+
2. Return the raw 32-byte key as a `Uint8Array` — the core runtime uses it for AES-256-GCM operations
|
|
91
|
+
3. Ensure the same key is returned for the same run ID across invocations (for decryption during replay)
|
|
92
|
+
|
|
93
|
+
The [Vercel World](/docs/deploying/world/vercel-world) implementation uses HKDF derivation from a deployment-scoped key, but any consistent key management scheme will work.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow/core",
|
|
3
|
-
"version": "4.2.0-beta.
|
|
3
|
+
"version": "4.2.0-beta.72",
|
|
4
4
|
"description": "Core runtime and engine for Workflow DevKit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -52,10 +52,6 @@
|
|
|
52
52
|
"types": "./dist/class-serialization.d.ts",
|
|
53
53
|
"default": "./dist/class-serialization.js"
|
|
54
54
|
},
|
|
55
|
-
"./builtins": {
|
|
56
|
-
"types": "./dist/builtins.d.ts",
|
|
57
|
-
"default": "./dist/builtins.js"
|
|
58
|
-
},
|
|
59
55
|
"./serialization": {
|
|
60
56
|
"types": "./dist/serialization.d.ts",
|
|
61
57
|
"default": "./dist/serialization.js"
|
|
@@ -83,12 +79,12 @@
|
|
|
83
79
|
"seedrandom": "3.0.5",
|
|
84
80
|
"ulid": "~3.0.1",
|
|
85
81
|
"zod": "4.3.6",
|
|
86
|
-
"@workflow/errors": "4.1.0-beta.
|
|
82
|
+
"@workflow/errors": "4.1.0-beta.19",
|
|
87
83
|
"@workflow/serde": "4.1.0-beta.2",
|
|
88
84
|
"@workflow/utils": "4.1.0-beta.13",
|
|
89
|
-
"@workflow/world": "4.1.0-beta.
|
|
90
|
-
"@workflow/world-local": "4.1.0-beta.
|
|
91
|
-
"@workflow/world-vercel": "4.1.0-beta.
|
|
85
|
+
"@workflow/world": "4.1.0-beta.14",
|
|
86
|
+
"@workflow/world-local": "4.1.0-beta.45",
|
|
87
|
+
"@workflow/world-vercel": "4.1.0-beta.45"
|
|
92
88
|
},
|
|
93
89
|
"devDependencies": {
|
|
94
90
|
"@opentelemetry/api": "1.9.0",
|
package/dist/builtins.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function __builtin_response_array_buffer(res: Response): Promise<ArrayBuffer>;
|
|
2
|
-
export declare function __builtin_response_json(res: Response): Promise<unknown>;
|
|
3
|
-
export declare function __builtin_response_text(res: Response): Promise<string>;
|
|
4
|
-
//# sourceMappingURL=builtins.d.ts.map
|
package/dist/builtins.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,QAAQ,wBAGlE;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,oBAG1D;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,mBAG1D"}
|
package/dist/builtins.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export async function __builtin_response_array_buffer(res) {
|
|
2
|
-
'use step';
|
|
3
|
-
return res.arrayBuffer();
|
|
4
|
-
}
|
|
5
|
-
export async function __builtin_response_json(res) {
|
|
6
|
-
'use step';
|
|
7
|
-
return res.json();
|
|
8
|
-
}
|
|
9
|
-
export async function __builtin_response_text(res) {
|
|
10
|
-
'use step';
|
|
11
|
-
return res.text();
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbHRpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYnVpbHRpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxDQUFDLEtBQUssVUFBVSwrQkFBK0IsQ0FBQyxHQUFhO0lBQ2pFLFVBQVUsQ0FBQztJQUNYLE9BQU8sR0FBRyxDQUFDLFdBQVcsRUFBRSxDQUFDO0FBQzNCLENBQUM7QUFFRCxNQUFNLENBQUMsS0FBSyxVQUFVLHVCQUF1QixDQUFDLEdBQWE7SUFDekQsVUFBVSxDQUFDO0lBQ1gsT0FBTyxHQUFHLENBQUMsSUFBSSxFQUFFLENBQUM7QUFDcEIsQ0FBQztBQUVELE1BQU0sQ0FBQyxLQUFLLFVBQVUsdUJBQXVCLENBQUMsR0FBYTtJQUN6RCxVQUFVLENBQUM7SUFDWCxPQUFPLEdBQUcsQ0FBQyxJQUFJLEVBQUUsQ0FBQztBQUNwQixDQUFDIn0=
|