Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = config => {
ow(config, ow.object.exactShape({
render: ow.optional.function,
createNode: ow.function,
createTextNode: ow.function,
setTextNodeValue: ow.function,
appendNode: ow.function,
insertBeforeNode: ow.optional.function,
updateNode: ow.optional.function,
removeNode: ow.optional.function
}));
const fullConfig = {
schedulePassiveEffects: unstable_scheduleCallback, // eslint-disable-line camelcase
cancelPassiveEffects: unstable_cancelCallback, // eslint-disable-line camelcase
now: Date.now,
getRootHostContext: () => NO_CONTEXT,
prepareForCommit: noop,
resetAfterCommit: () => {
if (typeof config.render === 'function') {
module.exports = config => {
ow(config, ow.object.exactShape({
render: ow.optional.function,
createNode: ow.function,
createTextNode: ow.function,
setTextNodeValue: ow.function,
appendNode: ow.function,
insertBeforeNode: ow.optional.function,
updateNode: ow.optional.function,
removeNode: ow.optional.function
}));
const fullConfig = {
schedulePassiveEffects: unstable_scheduleCallback, // eslint-disable-line camelcase
cancelPassiveEffects: unstable_cancelCallback, // eslint-disable-line camelcase
now: Date.now,
getRootHostContext: () => NO_CONTEXT,
prepareForCommit: noop,
resetAfterCommit: () => {
if (typeof config.render === 'function') {
config.render();
}
},
module.exports = config => {
ow(config, ow.object.exactShape({
render: ow.optional.function,
createNode: ow.function,
createTextNode: ow.function,
setTextNodeValue: ow.function,
appendNode: ow.function,
insertBeforeNode: ow.optional.function,
updateNode: ow.optional.function,
removeNode: ow.optional.function
}));
const fullConfig = {
schedulePassiveEffects: unstable_scheduleCallback, // eslint-disable-line camelcase
cancelPassiveEffects: unstable_cancelCallback, // eslint-disable-line camelcase
now: Date.now,
getRootHostContext: () => NO_CONTEXT,
prepareForCommit: noop,
resetAfterCommit: () => {
if (typeof config.render === 'function') {
config.render();
}
module.exports = config => {
ow(config, ow.object.exactShape({
render: ow.optional.function,
createNode: ow.function,
createTextNode: ow.function,
setTextNodeValue: ow.function,
appendNode: ow.function,
insertBeforeNode: ow.optional.function,
updateNode: ow.optional.function,
removeNode: ow.optional.function
}));
const fullConfig = {
schedulePassiveEffects: unstable_scheduleCallback, // eslint-disable-line camelcase
cancelPassiveEffects: unstable_cancelCallback, // eslint-disable-line camelcase
now: Date.now,
getRootHostContext: () => NO_CONTEXT,
prepareForCommit: noop,
resetAfterCommit: () => {
if (typeof config.render === 'function') {
config.render();
public reporter (fn: (emitter: EventEmitter) => void): this {
ow(fn, 'callback', ow.function)
this._reporterFn = fn
return this
}
exports.db = ({ config, mixins = exports.mixins, values }) => {
ow(config, ow.optional.object);
if (config) {
ow(config.opts, ow.object);
ow(config.opts.access, ow.optional.array.ofType(ow.string));
}
ow(mixins, ow.object.valuesOfType(ow.function));
ow(values, ow.array);
const _ = lodash.runInContext();
const boundMixins = {};
Object.keys(mixins).forEach(key => {
boundMixins[key] = (...args) => mixins[key](_, config, ...args);
});
_.mixin(boundMixins);
return _.chain(values.slice(0));
};
static $setRole(name, resolver, options = {}) {
ow(name, ow.string.nonEmpty);
ow(resolver, ow.function);
ow(options, ow.object);
const roles = this.__getRoles();
const role = new Role(this, name, resolver, options);
roles[name] = role;
return role;
}
$setAfterInvokeReceivedQuery(afterInvokeReceivedQuery) {
ow(afterInvokeReceivedQuery, ow.function);
this._afterInvokeReceivedQuery = afterInvokeReceivedQuery;
}
const PaddingOracle = (options: PaddingOracleOptions) => {
const { networkStats, callOracle } = OracleCaller(options)
const {
ciphertext, plaintext, origBytes, foundBytes, interBytes, foundOffsets,
url: _url, blockSize, blockCount, startFromFirstBlock,
transformPayload, concurrency = 128, isDecryptionSuccess,
logMode = 'full', isCacheEnabled = true, initFirstPayloadBlockWithOrigBytes = false
} = options
ow(_url, 'url', ow.string)
ow(blockSize, ow.number)
ow(concurrency, ow.number)
ow(isDecryptionSuccess, ow.function)
if (transformPayload) ow(transformPayload, ow.function)
ow(logMode, ow.string)
let stopLoggingProgress = false
function constructPayload({ byteI, blockI, byte, currentPadding }: { byteI: number, blockI: number, byte: number, currentPadding: number }) {
const firstBlock = Buffer.alloc(blockSize)
if (initFirstPayloadBlockWithOrigBytes) ciphertext.copy(firstBlock, 0, blockI * blockSize)
firstBlock[byteI] = byte
for (const i of range(byteI + 1, blockSize)) {
const offset = (blockSize * blockI) + i
const interByte = interBytes[offset]
firstBlock[i] = interByte ^ currentPadding
}
const start = (blockI + 1) * blockSize
const secondBlock = ciphertext.slice(start, start + blockSize)
const twoBlocks = Buffer.concat([firstBlock, secondBlock])
const PaddingOracle = (options: PaddingOracleOptions) => {
const { networkStats, callOracle } = OracleCaller(options)
const {
ciphertext, plaintext, origBytes, foundBytes, interBytes, foundOffsets,
url: _url, blockSize, blockCount, startFromFirstBlock,
transformPayload, concurrency = 128, isDecryptionSuccess,
logMode = 'full', isCacheEnabled = true, initFirstPayloadBlockWithOrigBytes = false
} = options
ow(_url, 'url', ow.string)
ow(blockSize, ow.number)
ow(concurrency, ow.number)
ow(isDecryptionSuccess, ow.function)
if (transformPayload) ow(transformPayload, ow.function)
ow(logMode, ow.string)
let stopLoggingProgress = false
function constructPayload({ byteI, blockI, byte, currentPadding }: { byteI: number, blockI: number, byte: number, currentPadding: number }) {
const firstBlock = Buffer.alloc(blockSize)
if (initFirstPayloadBlockWithOrigBytes) ciphertext.copy(firstBlock, 0, blockI * blockSize)
firstBlock[byteI] = byte
for (const i of range(byteI + 1, blockSize)) {
const offset = (blockSize * blockI) + i
const interByte = interBytes[offset]
firstBlock[i] = interByte ^ currentPadding
}
const start = (blockI + 1) * blockSize
const secondBlock = ciphertext.slice(start, start + blockSize)