UNPKG

@discue/somewhat-secure-insecure-fn-executor

Version:

Tries to isolate execution of untrusted code

20 lines (19 loc) 1.02 kB
export function createNewIsolatedContext(memoryLimit?: number): IsolateAndContext; export function runWithIsolatedContext({ memoryLimit }: { memoryLimit?: number; }, callback: ContextCallback): object; export function freezeGlobals(isolate: import('isolated-vm').Isolate, context: import('isolated-vm').Context): Promise<undefined>; export function createTransferableReference(any: object): import('isolated-vm').Reference; export function copyValueFromReference(reference: import('isolated-vm').Reference, key: string, defaultValue?: object): object; export function callFunctionWithArguments(context: import('isolated-vm').Context, script: string, ...args: any[]): import('isolated-vm').Reference; export type IsolateAndContext = { /** * the isolate used to run the script */ isolate: import('isolated-vm').Isolate; /** * the isolated execution environment */ context: import('isolated-vm').Context; }; export type ContextCallback = (isolateAndContext: IsolateAndContext) => any;