space-data-module-sdk 0.1.0 → 0.2.5
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 +190 -0
- package/README.md +236 -73
- package/bin/space-data-module.js +24 -0
- package/package.json +16 -4
- package/schemas/ModuleBundle.fbs +108 -0
- package/schemas/PluginInvokeRequest.fbs +18 -0
- package/schemas/PluginInvokeResponse.fbs +30 -0
- package/schemas/PluginManifest.fbs +33 -1
- package/schemas/TypedArenaBuffer.fbs +23 -2
- package/src/bundle/codec.js +268 -0
- package/src/bundle/constants.js +8 -0
- package/src/bundle/index.js +3 -0
- package/src/bundle/wasm.js +447 -0
- package/src/compiler/compileModule.js +353 -37
- package/src/compiler/emceptionNode.js +217 -0
- package/src/compiler/flatcSupport.js +66 -0
- package/src/compiler/invokeGlue.js +884 -0
- package/src/compliance/pluginCompliance.js +575 -1
- package/src/generated/orbpro/invoke/plugin-invoke-request.d.ts +51 -0
- package/src/generated/orbpro/invoke/plugin-invoke-request.d.ts.map +1 -0
- package/src/generated/orbpro/invoke/plugin-invoke-request.js +131 -0
- package/src/generated/orbpro/invoke/plugin-invoke-request.js.map +1 -0
- package/src/generated/orbpro/invoke/plugin-invoke-request.ts +173 -0
- package/src/generated/orbpro/invoke/plugin-invoke-response.d.ts +76 -0
- package/src/generated/orbpro/invoke/plugin-invoke-response.d.ts.map +1 -0
- package/src/generated/orbpro/invoke/plugin-invoke-response.js +184 -0
- package/src/generated/orbpro/invoke/plugin-invoke-response.js.map +1 -0
- package/src/generated/orbpro/invoke/plugin-invoke-response.ts +243 -0
- package/src/generated/orbpro/invoke.d.ts +3 -0
- package/src/generated/orbpro/invoke.d.ts.map +1 -0
- package/src/generated/orbpro/invoke.js +5 -0
- package/src/generated/orbpro/invoke.js.map +1 -0
- package/src/generated/orbpro/invoke.ts +6 -0
- package/src/generated/orbpro/manifest/accepted-type-set.d.ts +4 -4
- package/src/generated/orbpro/manifest/accepted-type-set.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/accepted-type-set.js +18 -11
- package/src/generated/orbpro/manifest/accepted-type-set.js.map +1 -1
- package/src/generated/orbpro/manifest/build-artifact.d.ts +1 -1
- package/src/generated/orbpro/manifest/build-artifact.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/build-artifact.js +28 -15
- package/src/generated/orbpro/manifest/build-artifact.js.map +1 -1
- package/src/generated/orbpro/manifest/capability-kind.d.ts +26 -1
- package/src/generated/orbpro/manifest/capability-kind.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/capability-kind.js +25 -0
- package/src/generated/orbpro/manifest/capability-kind.js.map +1 -1
- package/src/generated/orbpro/manifest/capability-kind.ts +25 -0
- package/src/generated/orbpro/manifest/drain-policy.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/drain-policy.js.map +1 -1
- package/src/generated/orbpro/manifest/host-capability.d.ts +2 -2
- package/src/generated/orbpro/manifest/host-capability.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/host-capability.js +19 -11
- package/src/generated/orbpro/manifest/host-capability.js.map +1 -1
- package/src/generated/orbpro/manifest/invoke-surface.d.ts +8 -0
- package/src/generated/orbpro/manifest/invoke-surface.d.ts.map +1 -0
- package/src/generated/orbpro/manifest/invoke-surface.js +11 -0
- package/src/generated/orbpro/manifest/invoke-surface.js.map +1 -0
- package/src/generated/orbpro/manifest/invoke-surface.ts +11 -0
- package/src/generated/orbpro/manifest/method-manifest.d.ts +6 -6
- package/src/generated/orbpro/manifest/method-manifest.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/method-manifest.js +33 -16
- package/src/generated/orbpro/manifest/method-manifest.js.map +1 -1
- package/src/generated/orbpro/manifest/plugin-family.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/plugin-family.js.map +1 -1
- package/src/generated/orbpro/manifest/plugin-manifest.d.ts +10 -2
- package/src/generated/orbpro/manifest/plugin-manifest.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/plugin-manifest.js +48 -9
- package/src/generated/orbpro/manifest/plugin-manifest.js.map +1 -1
- package/src/generated/orbpro/manifest/plugin-manifest.ts +322 -491
- package/src/generated/orbpro/manifest/port-manifest.d.ts +4 -4
- package/src/generated/orbpro/manifest/port-manifest.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/port-manifest.js +26 -13
- package/src/generated/orbpro/manifest/port-manifest.js.map +1 -1
- package/src/generated/orbpro/manifest/protocol-spec.d.ts +1 -1
- package/src/generated/orbpro/manifest/protocol-spec.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/protocol-spec.js +28 -15
- package/src/generated/orbpro/manifest/protocol-spec.js.map +1 -1
- package/src/generated/orbpro/manifest/timer-spec.d.ts +1 -1
- package/src/generated/orbpro/manifest/timer-spec.d.ts.map +1 -1
- package/src/generated/orbpro/manifest/timer-spec.js +27 -16
- package/src/generated/orbpro/manifest/timer-spec.js.map +1 -1
- package/src/generated/orbpro/manifest.d.ts +13 -0
- package/src/generated/orbpro/manifest.d.ts.map +1 -0
- package/src/generated/orbpro/manifest.js +1 -0
- package/src/generated/orbpro/manifest.js.map +1 -0
- package/src/generated/orbpro/manifest.ts +16 -0
- package/src/generated/orbpro/module/canonicalization-rule.d.ts +48 -0
- package/src/generated/orbpro/module/canonicalization-rule.js +95 -0
- package/src/generated/orbpro/module/canonicalization-rule.ts +142 -0
- package/src/generated/orbpro/module/module-bundle-entry-role.d.ts +11 -0
- package/src/generated/orbpro/module/module-bundle-entry-role.js +14 -0
- package/src/generated/orbpro/module/module-bundle-entry-role.ts +15 -0
- package/src/generated/orbpro/module/module-bundle-entry.d.ts +97 -0
- package/src/generated/orbpro/module/module-bundle-entry.js +219 -0
- package/src/generated/orbpro/module/module-bundle-entry.ts +287 -0
- package/src/generated/orbpro/module/module-bundle.d.ts +86 -0
- package/src/generated/orbpro/module/module-bundle.js +213 -0
- package/src/generated/orbpro/module/module-bundle.ts +277 -0
- package/src/generated/orbpro/module/module-payload-encoding.d.ts +9 -0
- package/src/generated/orbpro/module/module-payload-encoding.js +12 -0
- package/src/generated/orbpro/module/module-payload-encoding.ts +13 -0
- package/src/generated/orbpro/module.d.ts +5 -0
- package/src/generated/orbpro/module.js +7 -0
- package/src/generated/orbpro/module.ts +9 -0
- package/src/generated/orbpro/stream/buffer-mutability.d.ts.map +1 -1
- package/src/generated/orbpro/stream/buffer-mutability.js.map +1 -1
- package/src/generated/orbpro/stream/buffer-ownership.d.ts.map +1 -1
- package/src/generated/orbpro/stream/buffer-ownership.js.map +1 -1
- package/src/generated/orbpro/stream/flat-buffer-type-ref.d.ts +22 -5
- package/src/generated/orbpro/stream/flat-buffer-type-ref.d.ts.map +1 -1
- package/src/generated/orbpro/stream/flat-buffer-type-ref.js +107 -17
- package/src/generated/orbpro/stream/flat-buffer-type-ref.js.map +1 -1
- package/src/generated/orbpro/stream/flat-buffer-type-ref.ts +126 -2
- package/src/generated/orbpro/stream/payload-wire-format.d.ts +8 -0
- package/src/generated/orbpro/stream/payload-wire-format.d.ts.map +1 -0
- package/src/generated/orbpro/stream/payload-wire-format.js +11 -0
- package/src/generated/orbpro/stream/payload-wire-format.js.map +1 -0
- package/src/generated/orbpro/stream/payload-wire-format.ts +11 -0
- package/src/generated/orbpro/stream/typed-arena-buffer.d.ts +4 -4
- package/src/generated/orbpro/stream/typed-arena-buffer.d.ts.map +1 -1
- package/src/generated/orbpro/stream/typed-arena-buffer.js +42 -24
- package/src/generated/orbpro/stream/typed-arena-buffer.js.map +1 -1
- package/src/host/abi.js +282 -0
- package/src/host/cron.js +247 -0
- package/src/host/index.js +3 -0
- package/src/host/nodeHost.js +2165 -0
- package/src/index.d.ts +958 -0
- package/src/index.js +12 -2
- package/src/invoke/codec.js +278 -0
- package/src/invoke/index.js +9 -0
- package/src/manifest/codec.js +10 -2
- package/src/manifest/index.js +5 -2
- package/src/manifest/normalize.js +90 -1
- package/src/runtime/constants.js +29 -0
- package/src/transport/pki.js +0 -5
- package/src/utils/encoding.js +9 -1
- package/src/utils/wasmCrypto.js +49 -1
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,958 @@
|
|
|
1
|
+
// --- Manifest ---
|
|
2
|
+
|
|
3
|
+
export type PayloadWireFormat = "flatbuffer" | "aligned-binary";
|
|
4
|
+
export type InvokeSurface = "direct" | "command";
|
|
5
|
+
|
|
6
|
+
export interface PayloadTypeRef {
|
|
7
|
+
schemaName?: string;
|
|
8
|
+
fileIdentifier?: string;
|
|
9
|
+
schemaHash?: string | number[] | Uint8Array;
|
|
10
|
+
acceptsAnyFlatbuffer?: boolean;
|
|
11
|
+
wireFormat?: PayloadWireFormat;
|
|
12
|
+
rootTypeName?: string;
|
|
13
|
+
fixedStringLength?: number;
|
|
14
|
+
byteLength?: number;
|
|
15
|
+
requiredAlignment?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type AllowedType = PayloadTypeRef;
|
|
19
|
+
|
|
20
|
+
export interface AcceptedTypeSet {
|
|
21
|
+
setId: string;
|
|
22
|
+
allowedTypes: PayloadTypeRef[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface PortManifest {
|
|
26
|
+
portId: string;
|
|
27
|
+
acceptedTypeSets: AcceptedTypeSet[];
|
|
28
|
+
minStreams: number;
|
|
29
|
+
maxStreams: number;
|
|
30
|
+
required: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface MethodManifest {
|
|
34
|
+
methodId: string;
|
|
35
|
+
displayName?: string;
|
|
36
|
+
inputPorts: PortManifest[];
|
|
37
|
+
outputPorts: PortManifest[];
|
|
38
|
+
maxBatch: number;
|
|
39
|
+
drainPolicy: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ExternalInterface {
|
|
43
|
+
interfaceId: string;
|
|
44
|
+
kind: string;
|
|
45
|
+
direction: string;
|
|
46
|
+
capability?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface PluginManifest {
|
|
50
|
+
pluginId: string;
|
|
51
|
+
name: string;
|
|
52
|
+
version: string;
|
|
53
|
+
pluginFamily: string;
|
|
54
|
+
capabilities?: string[];
|
|
55
|
+
invokeSurfaces?: InvokeSurface[];
|
|
56
|
+
runtimeTargets?: string[];
|
|
57
|
+
externalInterfaces?: ExternalInterface[];
|
|
58
|
+
methods: MethodManifest[];
|
|
59
|
+
schemasUsed?: PayloadTypeRef[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function encodePluginManifest(manifest: PluginManifest): Uint8Array;
|
|
63
|
+
export function decodePluginManifest(
|
|
64
|
+
data: Uint8Array | ArrayBuffer | ArrayBufferView,
|
|
65
|
+
): PluginManifest;
|
|
66
|
+
export function toEmbeddedPluginManifest(manifest: PluginManifest): {
|
|
67
|
+
manifest: unknown;
|
|
68
|
+
warnings: string[];
|
|
69
|
+
};
|
|
70
|
+
export function generateEmbeddedManifestSource(options: {
|
|
71
|
+
manifest: unknown;
|
|
72
|
+
}): string;
|
|
73
|
+
export function writeEmbeddedManifestArtifacts(options: {
|
|
74
|
+
manifest: unknown;
|
|
75
|
+
outputDir: string;
|
|
76
|
+
}): Promise<{ sourcePath: string; headerPath: string }>;
|
|
77
|
+
|
|
78
|
+
// --- Invoke ---
|
|
79
|
+
|
|
80
|
+
export interface InvokeFrame {
|
|
81
|
+
portId?: string | null;
|
|
82
|
+
typeRef?: PayloadTypeRef | null;
|
|
83
|
+
alignment?: number;
|
|
84
|
+
offset?: number;
|
|
85
|
+
size?: number;
|
|
86
|
+
ownership?: number | string;
|
|
87
|
+
generation?: number;
|
|
88
|
+
mutability?: number | string;
|
|
89
|
+
traceId?: bigint | number | string;
|
|
90
|
+
streamId?: number;
|
|
91
|
+
sequence?: bigint | number | string;
|
|
92
|
+
endOfStream?: boolean;
|
|
93
|
+
payload?: Uint8Array | ArrayBuffer | ArrayBufferView | null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface PluginInvokeRequestEnvelope {
|
|
97
|
+
methodId: string;
|
|
98
|
+
inputs?: InvokeFrame[];
|
|
99
|
+
inputFrames?: InvokeFrame[];
|
|
100
|
+
payloadArena?: Uint8Array;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface PluginInvokeResponseEnvelope {
|
|
104
|
+
statusCode?: number;
|
|
105
|
+
yielded?: boolean;
|
|
106
|
+
backlogRemaining?: number;
|
|
107
|
+
outputs?: InvokeFrame[];
|
|
108
|
+
outputFrames?: InvokeFrame[];
|
|
109
|
+
payloadArena?: Uint8Array;
|
|
110
|
+
errorCode?: string | null;
|
|
111
|
+
errorMessage?: string | null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function encodePluginInvokeRequest(
|
|
115
|
+
request: PluginInvokeRequestEnvelope,
|
|
116
|
+
): Uint8Array;
|
|
117
|
+
export function decodePluginInvokeRequest(
|
|
118
|
+
data: Uint8Array | ArrayBuffer | ArrayBufferView,
|
|
119
|
+
): PluginInvokeRequestEnvelope;
|
|
120
|
+
export function encodePluginInvokeResponse(
|
|
121
|
+
response: PluginInvokeResponseEnvelope,
|
|
122
|
+
): Uint8Array;
|
|
123
|
+
export function decodePluginInvokeResponse(
|
|
124
|
+
data: Uint8Array | ArrayBuffer | ArrayBufferView,
|
|
125
|
+
): PluginInvokeResponseEnvelope;
|
|
126
|
+
export function normalizeInvokeSurfaceName(
|
|
127
|
+
value: InvokeSurface | number | string | null | undefined,
|
|
128
|
+
): InvokeSurface | null;
|
|
129
|
+
export function normalizeInvokeSurfaces(
|
|
130
|
+
value: Array<InvokeSurface | number | string> | null | undefined,
|
|
131
|
+
): InvokeSurface[];
|
|
132
|
+
|
|
133
|
+
// --- Compliance ---
|
|
134
|
+
|
|
135
|
+
export interface ComplianceIssue {
|
|
136
|
+
severity: "error" | "warning";
|
|
137
|
+
code: string;
|
|
138
|
+
message: string;
|
|
139
|
+
location?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface ComplianceReport {
|
|
143
|
+
ok: boolean;
|
|
144
|
+
sourceName: string;
|
|
145
|
+
manifest: PluginManifest;
|
|
146
|
+
issues: ComplianceIssue[];
|
|
147
|
+
errors: ComplianceIssue[];
|
|
148
|
+
warnings: ComplianceIssue[];
|
|
149
|
+
checkedArtifact: boolean;
|
|
150
|
+
exportNames: string[];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const RecommendedCapabilityIds: readonly string[];
|
|
154
|
+
|
|
155
|
+
export function validatePluginManifest(
|
|
156
|
+
manifest: unknown,
|
|
157
|
+
options?: { sourceName?: string },
|
|
158
|
+
): ComplianceReport;
|
|
159
|
+
|
|
160
|
+
export function validatePluginArtifact(options: {
|
|
161
|
+
manifest: PluginManifest;
|
|
162
|
+
manifestPath?: string;
|
|
163
|
+
wasmPath?: string;
|
|
164
|
+
exportNames?: string[];
|
|
165
|
+
sourceName?: string;
|
|
166
|
+
}): Promise<ComplianceReport>;
|
|
167
|
+
|
|
168
|
+
export function validateManifestWithStandards(
|
|
169
|
+
manifest: PluginManifest,
|
|
170
|
+
options?: { sourceName?: string },
|
|
171
|
+
): Promise<ComplianceReport>;
|
|
172
|
+
|
|
173
|
+
export function validateArtifactWithStandards(options: {
|
|
174
|
+
manifest: PluginManifest;
|
|
175
|
+
manifestPath?: string;
|
|
176
|
+
wasmPath?: string;
|
|
177
|
+
exportNames?: string[];
|
|
178
|
+
sourceName?: string;
|
|
179
|
+
}): Promise<ComplianceReport>;
|
|
180
|
+
|
|
181
|
+
export function loadManifestFromFile(manifestPath: string): Promise<PluginManifest>;
|
|
182
|
+
export function findManifestFiles(rootDirectory: string): Promise<string[]>;
|
|
183
|
+
export function resolveManifestFiles(rootDirectory: string): Promise<string[]>;
|
|
184
|
+
export function loadComplianceConfig(
|
|
185
|
+
rootDirectory: string,
|
|
186
|
+
): Promise<{ path: string; config: Record<string, unknown> } | null>;
|
|
187
|
+
export function getWasmExportNames(wasmBytes: Uint8Array): string[];
|
|
188
|
+
export function getWasmExportNamesFromFile(wasmPath: string): Promise<string[]>;
|
|
189
|
+
|
|
190
|
+
// --- Auth ---
|
|
191
|
+
|
|
192
|
+
export interface DeploymentTarget {
|
|
193
|
+
kind?: string;
|
|
194
|
+
id?: string | null;
|
|
195
|
+
audience?: string | null;
|
|
196
|
+
url?: string | null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface DeploymentAuthorization {
|
|
200
|
+
version: number;
|
|
201
|
+
action: string;
|
|
202
|
+
artifactId: string;
|
|
203
|
+
programId: string;
|
|
204
|
+
graphHash: string | null;
|
|
205
|
+
manifestHash: string | null;
|
|
206
|
+
target: DeploymentTarget;
|
|
207
|
+
capabilities: string[];
|
|
208
|
+
issuedAt: number;
|
|
209
|
+
expiresAt: number;
|
|
210
|
+
nonce: string;
|
|
211
|
+
constraints: unknown;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface SignedEnvelope {
|
|
215
|
+
protected: {
|
|
216
|
+
algorithm: string;
|
|
217
|
+
curve: string | null;
|
|
218
|
+
publicKeyHex: string | null;
|
|
219
|
+
derivationPath: string | null;
|
|
220
|
+
keyId: string | null;
|
|
221
|
+
};
|
|
222
|
+
payload: DeploymentAuthorization;
|
|
223
|
+
signatureHex: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface Signer {
|
|
227
|
+
algorithm: string;
|
|
228
|
+
curve: string;
|
|
229
|
+
publicKeyHex: string;
|
|
230
|
+
derivationPath: string | null;
|
|
231
|
+
keyId: string | null;
|
|
232
|
+
sign(bytes: Uint8Array): Promise<Uint8Array>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface Verifier {
|
|
236
|
+
verify(
|
|
237
|
+
bytes: Uint8Array,
|
|
238
|
+
signature: Uint8Array,
|
|
239
|
+
header: Record<string, unknown>,
|
|
240
|
+
payload: DeploymentAuthorization,
|
|
241
|
+
): Promise<boolean>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function createDeploymentAuthorization(options?: {
|
|
245
|
+
artifactId?: string;
|
|
246
|
+
programId?: string;
|
|
247
|
+
graphHash?: string;
|
|
248
|
+
manifestHash?: string;
|
|
249
|
+
target?: string | DeploymentTarget;
|
|
250
|
+
capabilities?: string[];
|
|
251
|
+
issuedAt?: number;
|
|
252
|
+
ttlMs?: number;
|
|
253
|
+
nonce?: string;
|
|
254
|
+
constraints?: unknown;
|
|
255
|
+
}): Promise<DeploymentAuthorization>;
|
|
256
|
+
|
|
257
|
+
export function signAuthorization(options: {
|
|
258
|
+
authorization: DeploymentAuthorization;
|
|
259
|
+
signer: Signer;
|
|
260
|
+
}): Promise<SignedEnvelope>;
|
|
261
|
+
|
|
262
|
+
export function verifyAuthorization(options: {
|
|
263
|
+
envelope: SignedEnvelope;
|
|
264
|
+
verifier: Verifier;
|
|
265
|
+
now?: number;
|
|
266
|
+
}): Promise<boolean>;
|
|
267
|
+
|
|
268
|
+
export function assertDeploymentAuthorization(options: {
|
|
269
|
+
envelope: SignedEnvelope;
|
|
270
|
+
artifact?: {
|
|
271
|
+
artifactId?: string;
|
|
272
|
+
programId?: string;
|
|
273
|
+
graphHash?: string;
|
|
274
|
+
manifestHash?: string;
|
|
275
|
+
};
|
|
276
|
+
target?: string | DeploymentTarget;
|
|
277
|
+
requiredCapabilities?: string[];
|
|
278
|
+
now?: number;
|
|
279
|
+
}): boolean;
|
|
280
|
+
|
|
281
|
+
export function createHdWalletSigner(options: {
|
|
282
|
+
signDigest: (digest: Uint8Array) => Promise<Uint8Array>;
|
|
283
|
+
publicKeyHex: string;
|
|
284
|
+
derivationPath?: string;
|
|
285
|
+
keyId?: string;
|
|
286
|
+
algorithm?: string;
|
|
287
|
+
curve?: string;
|
|
288
|
+
}): Signer;
|
|
289
|
+
|
|
290
|
+
export function createHdWalletVerifier(options: {
|
|
291
|
+
verifyDigest: (
|
|
292
|
+
digest: Uint8Array,
|
|
293
|
+
signature: Uint8Array,
|
|
294
|
+
header: Record<string, unknown>,
|
|
295
|
+
payload: DeploymentAuthorization,
|
|
296
|
+
) => Promise<boolean>;
|
|
297
|
+
}): Verifier;
|
|
298
|
+
|
|
299
|
+
export function stableStringify(value: unknown): string;
|
|
300
|
+
export function canonicalBytes(value: unknown): Uint8Array;
|
|
301
|
+
export function hashCanonicalValue(value: unknown): Promise<Uint8Array>;
|
|
302
|
+
|
|
303
|
+
// --- Transport ---
|
|
304
|
+
|
|
305
|
+
export interface X25519Keypair {
|
|
306
|
+
publicKey: Uint8Array;
|
|
307
|
+
privateKey: Uint8Array;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface EncryptedEnvelope {
|
|
311
|
+
version: number;
|
|
312
|
+
scheme: string;
|
|
313
|
+
context: string;
|
|
314
|
+
senderPublicKeyBase64: string;
|
|
315
|
+
saltBase64: string;
|
|
316
|
+
ivBase64: string;
|
|
317
|
+
ciphertextBase64: string;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export function generateX25519Keypair(): Promise<X25519Keypair>;
|
|
321
|
+
|
|
322
|
+
export function encryptBytesForRecipient(options: {
|
|
323
|
+
plaintext: Uint8Array | ArrayBuffer;
|
|
324
|
+
recipientPublicKey: Uint8Array | string;
|
|
325
|
+
context?: string;
|
|
326
|
+
senderKeyPair?: X25519Keypair;
|
|
327
|
+
}): Promise<EncryptedEnvelope>;
|
|
328
|
+
|
|
329
|
+
export function decryptBytesFromEnvelope(options: {
|
|
330
|
+
envelope: EncryptedEnvelope;
|
|
331
|
+
recipientPrivateKey: Uint8Array | string;
|
|
332
|
+
}): Promise<Uint8Array>;
|
|
333
|
+
|
|
334
|
+
export function encryptJsonForRecipient(options: {
|
|
335
|
+
payload: unknown;
|
|
336
|
+
recipientPublicKey: Uint8Array | string;
|
|
337
|
+
context?: string;
|
|
338
|
+
senderKeyPair?: X25519Keypair;
|
|
339
|
+
}): Promise<EncryptedEnvelope>;
|
|
340
|
+
|
|
341
|
+
export function decryptJsonFromEnvelope(options: {
|
|
342
|
+
envelope: EncryptedEnvelope;
|
|
343
|
+
recipientPrivateKey: Uint8Array | string;
|
|
344
|
+
}): Promise<unknown>;
|
|
345
|
+
|
|
346
|
+
// --- Compiler ---
|
|
347
|
+
|
|
348
|
+
export interface CompilationResult {
|
|
349
|
+
compiler: string;
|
|
350
|
+
language: string;
|
|
351
|
+
outputPath: string | null;
|
|
352
|
+
tempDir: string | null;
|
|
353
|
+
wasmBytes: Uint8Array;
|
|
354
|
+
manifestWarnings: string[];
|
|
355
|
+
report: ComplianceReport;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface ProtectedArtifact {
|
|
359
|
+
mnemonic: string;
|
|
360
|
+
signingPublicKeyHex: string;
|
|
361
|
+
signingPath: string;
|
|
362
|
+
payload: {
|
|
363
|
+
version: number;
|
|
364
|
+
format: string;
|
|
365
|
+
artifactId: string;
|
|
366
|
+
programId: string;
|
|
367
|
+
manifest: PluginManifest;
|
|
368
|
+
manifestBase64: string;
|
|
369
|
+
wasmBase64: string;
|
|
370
|
+
wasmHashHex: string;
|
|
371
|
+
manifestHashHex: string;
|
|
372
|
+
authorization: SignedEnvelope;
|
|
373
|
+
};
|
|
374
|
+
encrypted: boolean;
|
|
375
|
+
encryptedEnvelope: EncryptedEnvelope | null;
|
|
376
|
+
singleFileBundle: { wasmBytes: Uint8Array } | null;
|
|
377
|
+
bundledWasmBytes: Uint8Array | null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export function compileModuleFromSource(options: {
|
|
381
|
+
manifest: PluginManifest;
|
|
382
|
+
sourceCode: string;
|
|
383
|
+
language?: string;
|
|
384
|
+
outputPath?: string;
|
|
385
|
+
allowUndefinedImports?: boolean;
|
|
386
|
+
}): Promise<CompilationResult>;
|
|
387
|
+
|
|
388
|
+
export function cleanupCompilation(
|
|
389
|
+
result: CompilationResult,
|
|
390
|
+
): Promise<void>;
|
|
391
|
+
|
|
392
|
+
export function protectModuleArtifact(options: {
|
|
393
|
+
manifest: PluginManifest;
|
|
394
|
+
wasmBytes?: Uint8Array;
|
|
395
|
+
wasmBase64?: string;
|
|
396
|
+
artifactId?: string;
|
|
397
|
+
recipientPublicKeyHex?: string;
|
|
398
|
+
mnemonic?: string;
|
|
399
|
+
target?: string | DeploymentTarget;
|
|
400
|
+
targetUrl?: string;
|
|
401
|
+
capabilities?: string[];
|
|
402
|
+
singleFileBundle?: boolean;
|
|
403
|
+
bundleEntries?: Record<string, unknown>;
|
|
404
|
+
}): Promise<ProtectedArtifact>;
|
|
405
|
+
|
|
406
|
+
export function createRecipientKeypairHex(): Promise<{
|
|
407
|
+
publicKeyHex: string;
|
|
408
|
+
privateKeyHex: string;
|
|
409
|
+
}>;
|
|
410
|
+
|
|
411
|
+
// --- Standards ---
|
|
412
|
+
|
|
413
|
+
export interface StandardsEntry {
|
|
414
|
+
schemaCode: string;
|
|
415
|
+
schemaName: string;
|
|
416
|
+
fileIdentifier: string | null;
|
|
417
|
+
hash: string | null;
|
|
418
|
+
version: string | null;
|
|
419
|
+
files: string[];
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export function loadStandardsCatalog(): Promise<StandardsEntry[]>;
|
|
423
|
+
export function loadKnownTypeCatalog(): Promise<StandardsEntry[]>;
|
|
424
|
+
export function resolveStandardsTypeRef(
|
|
425
|
+
typeRef: PayloadTypeRef,
|
|
426
|
+
catalog?: StandardsEntry[],
|
|
427
|
+
): StandardsEntry | null;
|
|
428
|
+
export function validateManifestAgainstStandardsCatalog(
|
|
429
|
+
manifest: PluginManifest,
|
|
430
|
+
options?: { sourceName?: string; catalog?: StandardsEntry[] },
|
|
431
|
+
): Promise<{ catalog: StandardsEntry[]; issues: ComplianceIssue[] }>;
|
|
432
|
+
|
|
433
|
+
// --- Bundle ---
|
|
434
|
+
|
|
435
|
+
export const SDS_BUNDLE_SECTION_NAME: string;
|
|
436
|
+
export const DEFAULT_HASH_ALGORITHM: string;
|
|
437
|
+
|
|
438
|
+
export function createSingleFileBundle(options: {
|
|
439
|
+
wasmBytes: Uint8Array;
|
|
440
|
+
manifest: PluginManifest;
|
|
441
|
+
authorization: SignedEnvelope;
|
|
442
|
+
transportEnvelope?: EncryptedEnvelope | null;
|
|
443
|
+
entries?: Record<string, unknown>;
|
|
444
|
+
}): Promise<{ wasmBytes: Uint8Array }>;
|
|
445
|
+
|
|
446
|
+
export function parseSingleFileBundle(
|
|
447
|
+
wasmBytes: Uint8Array,
|
|
448
|
+
): unknown;
|
|
449
|
+
|
|
450
|
+
export function parseWasmModuleSections(
|
|
451
|
+
bytes: Uint8Array,
|
|
452
|
+
): { id: number; payload: Uint8Array }[];
|
|
453
|
+
|
|
454
|
+
export function encodeUnsignedLeb128(value: number): Uint8Array;
|
|
455
|
+
export function decodeUnsignedLeb128(
|
|
456
|
+
bytes: Uint8Array,
|
|
457
|
+
offset?: number,
|
|
458
|
+
): { value: number; bytesRead: number };
|
|
459
|
+
|
|
460
|
+
// --- Host ---
|
|
461
|
+
|
|
462
|
+
export interface CronField {
|
|
463
|
+
source: string;
|
|
464
|
+
values: number[];
|
|
465
|
+
hasWildcard: boolean;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export interface CronSchedule {
|
|
469
|
+
expression: string;
|
|
470
|
+
minute: CronField;
|
|
471
|
+
hour: CronField;
|
|
472
|
+
dayOfMonth: CronField;
|
|
473
|
+
month: CronField;
|
|
474
|
+
dayOfWeek: CronField;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export interface NodeHostContextStore {
|
|
478
|
+
get(scope: string, key: string): Promise<unknown>;
|
|
479
|
+
set(scope: string, key: string, value: unknown): Promise<void>;
|
|
480
|
+
delete(scope: string, key: string): Promise<boolean>;
|
|
481
|
+
listKeys(scope: string): Promise<string[]>;
|
|
482
|
+
listScopes(): Promise<string[]>;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export interface NodeHostHttpRequest {
|
|
486
|
+
url: string;
|
|
487
|
+
method?: string;
|
|
488
|
+
headers?: Record<string, string>;
|
|
489
|
+
body?: Uint8Array | ArrayBuffer | ArrayBufferView | string | null;
|
|
490
|
+
responseType?: "bytes" | "text" | "json";
|
|
491
|
+
timeoutMs?: number;
|
|
492
|
+
signal?: unknown;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export interface NodeHostHttpResponse<TBody = unknown> {
|
|
496
|
+
url: string;
|
|
497
|
+
status: number;
|
|
498
|
+
statusText: string;
|
|
499
|
+
ok: boolean;
|
|
500
|
+
headers: Record<string, string>;
|
|
501
|
+
body: TBody;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export interface NodeHostFilesystemEntry {
|
|
505
|
+
name: string;
|
|
506
|
+
isFile: boolean;
|
|
507
|
+
isDirectory: boolean;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export interface NodeHostFilesystemStat {
|
|
511
|
+
path: string;
|
|
512
|
+
size: number;
|
|
513
|
+
isFile: boolean;
|
|
514
|
+
isDirectory: boolean;
|
|
515
|
+
ctimeMs: number;
|
|
516
|
+
mtimeMs: number;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export interface NodeHostSocketResponse<TBody = Uint8Array | string> {
|
|
520
|
+
host: string;
|
|
521
|
+
port: number;
|
|
522
|
+
localAddress: string | null;
|
|
523
|
+
localPort: number | null;
|
|
524
|
+
remoteAddress: string;
|
|
525
|
+
remotePort: number;
|
|
526
|
+
body: TBody;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export interface NodeHostTlsResponse<TBody = Uint8Array | string>
|
|
530
|
+
extends NodeHostSocketResponse<TBody> {
|
|
531
|
+
authorized: boolean;
|
|
532
|
+
authorizationError: string | null;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export interface NodeHostWebSocketResponse<TBody = Uint8Array | string | unknown> {
|
|
536
|
+
url: string;
|
|
537
|
+
protocol: string;
|
|
538
|
+
extensions: string;
|
|
539
|
+
closeCode: number | null;
|
|
540
|
+
closeReason: string;
|
|
541
|
+
body: TBody | null;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export interface NodeHostMqttPublishResult {
|
|
545
|
+
host: string;
|
|
546
|
+
port: number;
|
|
547
|
+
clientId: string;
|
|
548
|
+
topic: string;
|
|
549
|
+
payloadBytes: number;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export interface NodeHostMqttMessage<TBody = Uint8Array | string | unknown> {
|
|
553
|
+
host: string;
|
|
554
|
+
port: number;
|
|
555
|
+
clientId: string;
|
|
556
|
+
topic: string;
|
|
557
|
+
body: TBody;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export interface HostcallBridge {
|
|
561
|
+
moduleName: string;
|
|
562
|
+
imports: Record<string, Record<string, (...args: number[]) => number>>;
|
|
563
|
+
getLastEnvelope(): unknown;
|
|
564
|
+
getLastResponseBytes(): Uint8Array;
|
|
565
|
+
getLastResponseText(): string;
|
|
566
|
+
getLastResponseJson(): unknown;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export interface NodeHostOptions {
|
|
570
|
+
manifest?: PluginManifest;
|
|
571
|
+
grantedCapabilities?: string[];
|
|
572
|
+
capabilities?: string[];
|
|
573
|
+
filesystemRoot?: string;
|
|
574
|
+
fsRoot?: string;
|
|
575
|
+
allowedHttpOrigins?: string[];
|
|
576
|
+
allowedWebSocketOrigins?: string[];
|
|
577
|
+
allowedCommands?: string[];
|
|
578
|
+
allowedMqttHosts?: string[];
|
|
579
|
+
allowedMqttPorts?: number[];
|
|
580
|
+
allowedTcpHosts?: string[];
|
|
581
|
+
allowedTcpPorts?: number[];
|
|
582
|
+
allowedUdpHosts?: string[];
|
|
583
|
+
allowedUdpPorts?: number[];
|
|
584
|
+
allowedTlsHosts?: string[];
|
|
585
|
+
allowedTlsPorts?: number[];
|
|
586
|
+
contextFilePath?: string;
|
|
587
|
+
contextStore?: NodeHostContextStore;
|
|
588
|
+
fetch?: (...args: any[]) => Promise<any>;
|
|
589
|
+
WebSocket?: any;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export class HostCapabilityError extends Error {
|
|
593
|
+
code: string;
|
|
594
|
+
capability: string | null;
|
|
595
|
+
operation: string | null;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export class HostFilesystemScopeError extends Error {
|
|
599
|
+
code: string;
|
|
600
|
+
requestedPath: string | null;
|
|
601
|
+
filesystemRoot: string | null;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export class NodeHost {
|
|
605
|
+
runtimeTarget: string;
|
|
606
|
+
filesystemRoot: string;
|
|
607
|
+
allowedHttpOrigins: Set<string> | null;
|
|
608
|
+
allowedWebSocketOrigins: Set<string> | null;
|
|
609
|
+
allowedCommands: Set<string> | null;
|
|
610
|
+
allowedMqttHosts: Set<string> | null;
|
|
611
|
+
allowedMqttPorts: Set<number> | null;
|
|
612
|
+
allowedTcpHosts: Set<string> | null;
|
|
613
|
+
allowedTcpPorts: Set<number> | null;
|
|
614
|
+
allowedUdpHosts: Set<string> | null;
|
|
615
|
+
allowedUdpPorts: Set<number> | null;
|
|
616
|
+
allowedTlsHosts: Set<string> | null;
|
|
617
|
+
allowedTlsPorts: Set<number> | null;
|
|
618
|
+
WebSocket: any;
|
|
619
|
+
clock: {
|
|
620
|
+
now(): number;
|
|
621
|
+
monotonicNow(): number;
|
|
622
|
+
nowIso(): string;
|
|
623
|
+
};
|
|
624
|
+
random: {
|
|
625
|
+
bytes(length: number): Promise<Uint8Array>;
|
|
626
|
+
};
|
|
627
|
+
timers: {
|
|
628
|
+
delay(ms: number, options?: { signal?: unknown }): Promise<void>;
|
|
629
|
+
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): unknown;
|
|
630
|
+
clearTimeout(handle: unknown): void;
|
|
631
|
+
setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): unknown;
|
|
632
|
+
clearInterval(handle: unknown): void;
|
|
633
|
+
};
|
|
634
|
+
schedule: {
|
|
635
|
+
parse(expression: string): CronSchedule;
|
|
636
|
+
matches(expression: string | CronSchedule, date?: Date | number | string): boolean;
|
|
637
|
+
next(expression: string | CronSchedule, from?: Date | number | string): Date;
|
|
638
|
+
};
|
|
639
|
+
http: {
|
|
640
|
+
request<TBody = unknown>(
|
|
641
|
+
options: NodeHostHttpRequest,
|
|
642
|
+
): Promise<NodeHostHttpResponse<TBody>>;
|
|
643
|
+
};
|
|
644
|
+
websocket: {
|
|
645
|
+
exchange<TBody = unknown>(options: {
|
|
646
|
+
url: string;
|
|
647
|
+
protocols?: string | string[];
|
|
648
|
+
message?: Uint8Array | ArrayBuffer | ArrayBufferView | string | null;
|
|
649
|
+
responseType?: "bytes" | "utf8" | "json";
|
|
650
|
+
timeoutMs?: number;
|
|
651
|
+
expectResponse?: boolean;
|
|
652
|
+
WebSocketImpl?: any;
|
|
653
|
+
}): Promise<NodeHostWebSocketResponse<TBody>>;
|
|
654
|
+
};
|
|
655
|
+
mqtt: {
|
|
656
|
+
publish(options: {
|
|
657
|
+
host: string;
|
|
658
|
+
port: number;
|
|
659
|
+
clientId?: string;
|
|
660
|
+
topic: string;
|
|
661
|
+
payload?: Uint8Array | ArrayBuffer | ArrayBufferView | string | null;
|
|
662
|
+
username?: string;
|
|
663
|
+
password?: string;
|
|
664
|
+
keepAliveSeconds?: number;
|
|
665
|
+
timeoutMs?: number;
|
|
666
|
+
}): Promise<NodeHostMqttPublishResult>;
|
|
667
|
+
subscribeOnce<TBody = unknown>(options: {
|
|
668
|
+
host: string;
|
|
669
|
+
port: number;
|
|
670
|
+
clientId?: string;
|
|
671
|
+
topic: string;
|
|
672
|
+
username?: string;
|
|
673
|
+
password?: string;
|
|
674
|
+
keepAliveSeconds?: number;
|
|
675
|
+
timeoutMs?: number;
|
|
676
|
+
responseType?: "bytes" | "utf8" | "json";
|
|
677
|
+
packetId?: number;
|
|
678
|
+
}): Promise<NodeHostMqttMessage<TBody>>;
|
|
679
|
+
};
|
|
680
|
+
filesystem: {
|
|
681
|
+
resolvePath(path: string): string;
|
|
682
|
+
readFile(
|
|
683
|
+
path: string,
|
|
684
|
+
options?: { encoding?: string | null },
|
|
685
|
+
): Promise<string | Uint8Array>;
|
|
686
|
+
writeFile(
|
|
687
|
+
path: string,
|
|
688
|
+
value: Uint8Array | ArrayBuffer | ArrayBufferView | string,
|
|
689
|
+
options?: { encoding?: string | null },
|
|
690
|
+
): Promise<{ path: string }>;
|
|
691
|
+
appendFile(
|
|
692
|
+
path: string,
|
|
693
|
+
value: Uint8Array | ArrayBuffer | ArrayBufferView | string,
|
|
694
|
+
options?: { encoding?: string | null },
|
|
695
|
+
): Promise<{ path: string }>;
|
|
696
|
+
deleteFile(path: string): Promise<{ path: string }>;
|
|
697
|
+
mkdir(
|
|
698
|
+
path: string,
|
|
699
|
+
options?: { recursive?: boolean },
|
|
700
|
+
): Promise<{ path: string }>;
|
|
701
|
+
readdir(path?: string): Promise<NodeHostFilesystemEntry[]>;
|
|
702
|
+
stat(path: string): Promise<NodeHostFilesystemStat>;
|
|
703
|
+
rename(
|
|
704
|
+
fromPath: string,
|
|
705
|
+
toPath: string,
|
|
706
|
+
): Promise<{ from: string; to: string }>;
|
|
707
|
+
};
|
|
708
|
+
tcp: {
|
|
709
|
+
request(options: {
|
|
710
|
+
host: string;
|
|
711
|
+
port: number;
|
|
712
|
+
data?: Uint8Array | ArrayBuffer | ArrayBufferView | string | null;
|
|
713
|
+
timeoutMs?: number;
|
|
714
|
+
responseEncoding?: "utf8" | "bytes";
|
|
715
|
+
}): Promise<NodeHostSocketResponse<string | Uint8Array>>;
|
|
716
|
+
};
|
|
717
|
+
udp: {
|
|
718
|
+
request(options: {
|
|
719
|
+
host: string;
|
|
720
|
+
port: number;
|
|
721
|
+
data: Uint8Array | ArrayBuffer | ArrayBufferView | string;
|
|
722
|
+
timeoutMs?: number;
|
|
723
|
+
responseEncoding?: "utf8" | "bytes";
|
|
724
|
+
bindAddress?: string;
|
|
725
|
+
bindPort?: number;
|
|
726
|
+
type?: "udp4" | "udp6";
|
|
727
|
+
expectResponse?: boolean;
|
|
728
|
+
}): Promise<NodeHostSocketResponse<string | Uint8Array>>;
|
|
729
|
+
};
|
|
730
|
+
tls: {
|
|
731
|
+
request(options: {
|
|
732
|
+
host: string;
|
|
733
|
+
port: number;
|
|
734
|
+
data?: Uint8Array | ArrayBuffer | ArrayBufferView | string | null;
|
|
735
|
+
timeoutMs?: number;
|
|
736
|
+
responseEncoding?: "utf8" | "bytes";
|
|
737
|
+
ca?:
|
|
738
|
+
| string
|
|
739
|
+
| Uint8Array
|
|
740
|
+
| ArrayBuffer
|
|
741
|
+
| ArrayBufferView
|
|
742
|
+
| Array<string | Uint8Array | ArrayBuffer | ArrayBufferView>;
|
|
743
|
+
cert?: string | Uint8Array | ArrayBuffer | ArrayBufferView;
|
|
744
|
+
key?: string | Uint8Array | ArrayBuffer | ArrayBufferView;
|
|
745
|
+
rejectUnauthorized?: boolean;
|
|
746
|
+
servername?: string;
|
|
747
|
+
}): Promise<NodeHostTlsResponse<string | Uint8Array>>;
|
|
748
|
+
};
|
|
749
|
+
exec: {
|
|
750
|
+
execFile(options: {
|
|
751
|
+
file: string;
|
|
752
|
+
args?: string[];
|
|
753
|
+
cwd?: string;
|
|
754
|
+
env?: Record<string, string>;
|
|
755
|
+
input?: Uint8Array | ArrayBuffer | ArrayBufferView | string | null;
|
|
756
|
+
timeoutMs?: number;
|
|
757
|
+
encoding?: "utf8" | "bytes";
|
|
758
|
+
}): Promise<{
|
|
759
|
+
exitCode: number | null;
|
|
760
|
+
signal: string | null;
|
|
761
|
+
stdout: string | Uint8Array;
|
|
762
|
+
stderr: string | Uint8Array;
|
|
763
|
+
}>;
|
|
764
|
+
};
|
|
765
|
+
context: {
|
|
766
|
+
get(scope: string, key: string): Promise<unknown>;
|
|
767
|
+
set(scope: string, key: string, value: unknown): Promise<void>;
|
|
768
|
+
delete(scope: string, key: string): Promise<boolean>;
|
|
769
|
+
listKeys(scope?: string): Promise<string[]>;
|
|
770
|
+
listScopes(): Promise<string[]>;
|
|
771
|
+
};
|
|
772
|
+
crypto: {
|
|
773
|
+
sha256(
|
|
774
|
+
value: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
775
|
+
): Promise<Uint8Array>;
|
|
776
|
+
sha512(
|
|
777
|
+
value: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
778
|
+
): Promise<Uint8Array>;
|
|
779
|
+
hkdf(options: {
|
|
780
|
+
ikm: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
781
|
+
salt: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
782
|
+
info?: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
783
|
+
length: number;
|
|
784
|
+
}): Promise<Uint8Array>;
|
|
785
|
+
aesGcmEncrypt(options: {
|
|
786
|
+
key: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
787
|
+
plaintext: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
788
|
+
iv: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
789
|
+
aad?: Uint8Array | ArrayBuffer | ArrayBufferView | number[] | null;
|
|
790
|
+
}): Promise<{ ciphertext: Uint8Array; tag: Uint8Array }>;
|
|
791
|
+
aesGcmDecrypt(options: {
|
|
792
|
+
key: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
793
|
+
ciphertext: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
794
|
+
tag: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
795
|
+
iv: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
796
|
+
aad?: Uint8Array | ArrayBuffer | ArrayBufferView | number[] | null;
|
|
797
|
+
}): Promise<Uint8Array>;
|
|
798
|
+
generateX25519Keypair(): Promise<X25519Keypair>;
|
|
799
|
+
x25519PublicKey(
|
|
800
|
+
privateKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
801
|
+
): Promise<Uint8Array>;
|
|
802
|
+
x25519SharedSecret(
|
|
803
|
+
privateKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
804
|
+
publicKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
805
|
+
): Promise<Uint8Array>;
|
|
806
|
+
encryptForRecipient(options: {
|
|
807
|
+
plaintext: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
808
|
+
recipientPublicKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
809
|
+
context?: string;
|
|
810
|
+
senderKeyPair?: X25519Keypair;
|
|
811
|
+
}): Promise<EncryptedEnvelope>;
|
|
812
|
+
decryptFromEnvelope(options: {
|
|
813
|
+
envelope: EncryptedEnvelope;
|
|
814
|
+
recipientPrivateKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[];
|
|
815
|
+
}): Promise<Uint8Array>;
|
|
816
|
+
secp256k1: {
|
|
817
|
+
publicKeyFromPrivate(
|
|
818
|
+
privateKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
819
|
+
): Promise<Uint8Array>;
|
|
820
|
+
signDigest(
|
|
821
|
+
digest: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
822
|
+
privateKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
823
|
+
): Promise<Uint8Array>;
|
|
824
|
+
verifyDigest(
|
|
825
|
+
digest: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
826
|
+
signature: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
827
|
+
publicKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
828
|
+
): Promise<boolean>;
|
|
829
|
+
};
|
|
830
|
+
ed25519: {
|
|
831
|
+
publicKeyFromSeed(
|
|
832
|
+
seed: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
833
|
+
): Promise<Uint8Array>;
|
|
834
|
+
sign(
|
|
835
|
+
message: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
836
|
+
seed: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
837
|
+
): Promise<Uint8Array>;
|
|
838
|
+
verify(
|
|
839
|
+
message: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
840
|
+
signature: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
841
|
+
publicKey: Uint8Array | ArrayBuffer | ArrayBufferView | number[],
|
|
842
|
+
): Promise<boolean>;
|
|
843
|
+
};
|
|
844
|
+
};
|
|
845
|
+
constructor(options?: NodeHostOptions);
|
|
846
|
+
listCapabilities(): string[];
|
|
847
|
+
listSupportedCapabilities(): string[];
|
|
848
|
+
listOperations(): string[];
|
|
849
|
+
hasCapability(capability: string): boolean;
|
|
850
|
+
assertCapability(capability: string, operation?: string | null): string;
|
|
851
|
+
invoke(operation: string, params?: Record<string, any>): Promise<any>;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
export const NodeHostSupportedCapabilities: readonly string[];
|
|
855
|
+
export const NodeHostSupportedOperations: readonly string[];
|
|
856
|
+
export const DEFAULT_HOSTCALL_IMPORT_MODULE: string;
|
|
857
|
+
export const HOSTCALL_STATUS_OK: number;
|
|
858
|
+
export const HOSTCALL_STATUS_ERROR: number;
|
|
859
|
+
export const NodeHostSyncHostcallOperations: readonly string[];
|
|
860
|
+
|
|
861
|
+
export function createNodeHost(options?: NodeHostOptions): NodeHost;
|
|
862
|
+
export function parseCronExpression(expression: string): CronSchedule;
|
|
863
|
+
export function matchesCronExpression(
|
|
864
|
+
expression: string | CronSchedule,
|
|
865
|
+
date?: Date | number | string,
|
|
866
|
+
): boolean;
|
|
867
|
+
export function nextCronOccurrence(
|
|
868
|
+
expression: string | CronSchedule,
|
|
869
|
+
from?: Date | number | string,
|
|
870
|
+
): Date;
|
|
871
|
+
export function dispatchNodeHostSyncOperation(
|
|
872
|
+
host: NodeHost,
|
|
873
|
+
operation: string,
|
|
874
|
+
params?: unknown,
|
|
875
|
+
): unknown;
|
|
876
|
+
export function createNodeHostSyncDispatcher(
|
|
877
|
+
host: NodeHost,
|
|
878
|
+
): (operation: string, params?: unknown) => unknown;
|
|
879
|
+
export function createJsonHostcallBridge(options: {
|
|
880
|
+
dispatch: (operation: string, params?: unknown) => unknown;
|
|
881
|
+
getMemory: () => { buffer: ArrayBuffer | SharedArrayBuffer };
|
|
882
|
+
moduleName?: string;
|
|
883
|
+
maxRequestBytes?: number;
|
|
884
|
+
maxResponseBytes?: number;
|
|
885
|
+
}): HostcallBridge;
|
|
886
|
+
export function createNodeHostSyncHostcallBridge(options: {
|
|
887
|
+
host: NodeHost;
|
|
888
|
+
getMemory: () => { buffer: ArrayBuffer | SharedArrayBuffer };
|
|
889
|
+
moduleName?: string;
|
|
890
|
+
maxRequestBytes?: number;
|
|
891
|
+
maxResponseBytes?: number;
|
|
892
|
+
}): HostcallBridge;
|
|
893
|
+
|
|
894
|
+
// --- Runtime constants ---
|
|
895
|
+
|
|
896
|
+
export const DefaultManifestExports: {
|
|
897
|
+
pluginBytesSymbol: string;
|
|
898
|
+
pluginSizeSymbol: string;
|
|
899
|
+
flowBytesSymbol: string;
|
|
900
|
+
flowSizeSymbol: string;
|
|
901
|
+
};
|
|
902
|
+
|
|
903
|
+
export const DefaultInvokeExports: {
|
|
904
|
+
invokeSymbol: string;
|
|
905
|
+
allocSymbol: string;
|
|
906
|
+
freeSymbol: string;
|
|
907
|
+
commandSymbol: string;
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
export const DrainPolicy: {
|
|
911
|
+
SINGLE_SHOT: string;
|
|
912
|
+
DRAIN_UNTIL_YIELD: string;
|
|
913
|
+
DRAIN_TO_EMPTY: string;
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
export const ExternalInterfaceDirection: {
|
|
917
|
+
INPUT: string;
|
|
918
|
+
OUTPUT: string;
|
|
919
|
+
BIDIRECTIONAL: string;
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
export const ExternalInterfaceKind: {
|
|
923
|
+
CLOCK: string;
|
|
924
|
+
RANDOM: string;
|
|
925
|
+
TIMER: string;
|
|
926
|
+
SCHEDULE: string;
|
|
927
|
+
PUBSUB: string;
|
|
928
|
+
PROTOCOL: string;
|
|
929
|
+
HTTP: string;
|
|
930
|
+
WEBSOCKET: string;
|
|
931
|
+
MQTT: string;
|
|
932
|
+
TCP: string;
|
|
933
|
+
UDP: string;
|
|
934
|
+
TLS: string;
|
|
935
|
+
FILESYSTEM: string;
|
|
936
|
+
PIPE: string;
|
|
937
|
+
NETWORK: string;
|
|
938
|
+
DATABASE: string;
|
|
939
|
+
EXEC: string;
|
|
940
|
+
CRYPTO: string;
|
|
941
|
+
CONTEXT: string;
|
|
942
|
+
LOCAL_RUNTIME: string;
|
|
943
|
+
HOST_SERVICE: string;
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
export const InvokeSurface: {
|
|
947
|
+
DIRECT: string;
|
|
948
|
+
COMMAND: string;
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
export const RuntimeTarget: {
|
|
952
|
+
NODE: string;
|
|
953
|
+
BROWSER: string;
|
|
954
|
+
WASI: string;
|
|
955
|
+
SERVER: string;
|
|
956
|
+
DESKTOP: string;
|
|
957
|
+
EDGE: string;
|
|
958
|
+
};
|