-
SES, the Hardened JavaScript shim https://github.com/endojs/endo/tree/master/packages/ses
-
TC39 Compartments Proposal https://github.com/tc39/proposal-compartments
-
Slides for “Dear Google, Let’s Harden JavaScript” https://kriskowal.com/dear-google-hardened-javascript.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const streamWithContext = (context, stream) => ({ | |
async next(value) { | |
return Promise.race([context.cancelled, stream.next(await value)]); | |
}, | |
async return(value) { | |
return Promise.race([context.cancelled, stream.return(await value)]); | |
}, | |
async throw(error) { | |
return Promise.race([context.cancelled, stream.throw(await error)]); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { makeStream, nullQueue } from '@endo/stream'; | |
/** | |
* @template TValue | |
*/ | |
const makePubSub = () => { | |
// Request pubsub async queue internals | |
let { promise: tailPromise, resolve: tailResolve } = makePromiseKit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { makeStream, nullQueue } from '@endo/stream'; | |
/** | |
* @template TValue | |
*/ | |
const makePubSub = () => { | |
// Request pubsub async queue internals | |
let { promise: tailPromise, resolve: tailResolve } = makePromiseKit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const makeNearReader = reader => | |
Far('Reader', { | |
async next() { | |
const iteration = await reader.next(); | |
if (iteration.done) { | |
return iteration; | |
} | |
return harden({ value: encodeBase64(iteration.value) }); | |
}, | |
async return(value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"colors": { | |
"darkBlue": "#61B2E4", | |
"darkRed": "#D22F27", | |
"darkGreen": "#5C9E31", | |
"lightPurple": "#B399C8" | |
}, | |
"levels": [ | |
{ | |
"topology": "torus", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @template T | |
* @typedef {object} Schema | |
* @prop {() => T} number | |
* @prop {() => T} boolean | |
* @prop {() => T} string | |
* @prop {(t: T) => T} optional | |
* @prop {(t: T) => T} list | |
* @prop {(t: T) => T} dict | |
* @prop {(shape: Record<string, T>) => T} struct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"colors": { | |
"lightBlue": "#92D3F5", | |
"darkBlue": "#61B2E4", | |
"lightRed": "#EA5A47", | |
"darkRed": "#D22F27", | |
"lightGreen": "#B14CC3", | |
"darkGreen": "#5C9E31", | |
"lightYellow": "#FCEA2B", | |
"darkYellow": "#F1B31C", |
NewerOlder