2.0.1 • Published 8 years ago

untrust v2.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

untrust

$ npm install --save untrust

let untrust = require('untrust');

Run and communicate with untrusted javascript code through DSLs you define.

Use this module to run code in a sandbox. Define an object to provide to the sandboxed code as the global. Your global object creation runs in the same process as the sandboxed code (which is not the same process as the rest of your code), so serialization does not limit how you interact with the sandboxed code.

Defining a DSL

(Documentation incomplete.)

To understand how to use this module before this documentation gets completed, read the tests (located in test/test.js).

API

untrust.run(dsl_path, code, arg)

runs code in a sandbox, where dsl_path first creates its global object.

dsl_path: an absolute path to a javascript file containing your dsl code.

code: a string containing the code to run in a sandbox.

returns: a DownwardConnection object.

Connection

Event: 'message'

Event: 'request'

conn.request(arg)

conn.send(arg)

DownwardConnection

extends Connection.

Event: 'exit'

Event: 'error'

dc.kill()

dc.pid

dc.alive

UpwardConnection

extends Connection.

uc.error(err)

2.0.1

8 years ago

2.0.0

8 years ago

1.2.1

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago