Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let stack = Hoek.displayStack();
console.log(stack);
// callStack(slice)
let stack2 = Hoek.callStack();
console.log(stack2);
// nextTick(fn)
let myFn = () => {
console.log('Do this later');
};
let nextFn = Hoek.nextTick(myFn);
nextFn();
console.log('Do this first');
// Results in:
//
// Do this first
// Do this later
// once(fn)
myFn = () => {
console.log('Ran myFn');
};
let onceFn = Hoek.once(myFn);
exports.authenticateMessage = function (host, port, message, authorization, credentialsFunc, options, callback) {
callback = Hoek.nextTick(callback);
// Default options
options.nonceFunc = options.nonceFunc || internals.nonceFunc;
options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
// Application time
const now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing
// Validate authorization
if (!authorization.id ||
!authorization.ts ||
!authorization.nonce ||
!authorization.hash ||
internals.Server.prototype.initialize = function (callback) {
var self = this;
Hoek.assert(callback, 'Missing start callback function');
var errorCallback = Hoek.nextTick(callback);
if (!this.connections.length) {
return errorCallback(new Error('No connections to start'));
}
if (this._registring) {
return errorCallback(new Error('Cannot start server before plugins finished registration'));
}
if (this._state !== 'stopped') {
return errorCallback(new Error('Cannot initialize server while it is in ' + this._state + ' state'));
}
// Assert dependencies
for (var i = 0, il = this._dependencies.length; i < il; ++i) {
var dependency = this._dependencies[i];
internals.encode = function (value, options, callback) {
callback = Hoek.nextTick(callback);
// Encodings: 'base64json', 'base64', 'form', 'iron', 'none'
if (value === undefined) {
return callback(null, value);
}
if (!options.encoding ||
options.encoding === 'none') {
return callback(null, value);
}
if (options.encoding === 'iron') {
Iron.seal(value, options.password, options.iron || Iron.defaults, function (err, sealed) {
exports.authenticate = function (req, credentialsFunc, options, callback) {
callback = Hoek.nextTick(callback);
// Default options
options.nonceFunc = options.nonceFunc || function (nonce, ts, nonceCallback) { return nonceCallback(); }; // No validation
options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
// Application time
var now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing
// Convert node Http request object to a request configuration object
var request = Utils.parseRequest(req, options);
if (request instanceof Error) {
return callback(Boom.badRequest(request.message));
}
exports.authenticateMessage = function (host, port, message, authorization, credentialsFunc, options, callback) {
callback = Hoek.nextTick(callback);
// Default options
options.nonceFunc = options.nonceFunc || internals.nonceFunc;
options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
// Application time
var now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing
// Validate authorization
if (!authorization.id ||
!authorization.ts ||
!authorization.nonce ||
!authorization.hash ||
module.exports = (options, callback) => {
const config = manifest.get('/');
const parsedSecureUrl = Url.parse(options.dotStencilFile.storeUrl); //The url to a secure page (prompted as login page)
const parsedNormalUrl = Url.parse(options.dotStencilFile.normalStoreUrl); //The host url of the homepage;
callback = Hoek.nextTick(callback);
config.connections[0].port = options.dotStencilFile.port;
config.plugins['./plugins/router/router.module'].storeUrl = parsedSecureUrl.protocol + '//' + parsedSecureUrl.host;
config.plugins['./plugins/router/router.module'].normalStoreUrl = parsedNormalUrl.protocol + '//' + parsedNormalUrl.host;
config.plugins['./plugins/router/router.module'].apiKey = options.dotStencilFile.apiKey;
config.plugins['./plugins/router/router.module'].port = options.dotStencilFile.port;
config.plugins['./plugins/router/router.module'].staplerUrl = options.dotStencilFile.staplerUrl;
config.plugins['./plugins/renderer/renderer.module'].useCache = options.useCache;
config.plugins['./plugins/renderer/renderer.module'].username = options.dotStencilFile.username;
config.plugins['./plugins/renderer/renderer.module'].token = options.dotStencilFile.token;
config.plugins['./plugins/renderer/renderer.module'].accessToken = options.dotStencilFile.accessToken;
config.plugins['./plugins/renderer/renderer.module'].customLayouts = options.dotStencilFile.customLayouts;
config.plugins['./plugins/renderer/renderer.module'].stencilEditorPort = options.stencilEditorPort;
config.plugins['./plugins/renderer/renderer.module'].themePath = options.themePath;
config.plugins['./plugins/theme-assets/theme-assets.module'].themePath = options.themePath;
'components/common/forms/select',
'components/common/forms/checkbox',
'components/common/forms/selectortext',
'components/common/forms/date',
'components/common/forms/number',
'components/common/forms/radio',
'components/common/forms/multiline',
'components/faceted-search/facets/hierarchy',
'components/faceted-search/facets/multi',
'components/faceted-search/facets/range',
'components/faceted-search/facets/rating'
],
configSetByHeader = false;
callback = Hoek.nextTick(callback);
if (request.headers['stencil-config']) {
configSetByHeader = true;
try {
ret.config = JSON.parse(request.headers['stencil-config']);
} catch (e) {
return callback(e);
}
}
Async.parallel([
function(callback) {
Async.each(_.union(options.templates, commonTemplates), resolvePartials, function (err) {
var frontmatter,
frontmatterRegex = /---\n(?:.|\s)*?\n---\n/g,
frontmatterMatch,
Scheme.prototype.authenticate = function (request, callback) {
var self = this;
callback = Hoek.nextTick(callback);
var validate = function () {
var sessionId;
if (!request.state.hasOwnProperty(self.settings.cookie)) {
return unauthenticated(self.hapi.error.unauthorized());
}
sessionId = request.state[self.settings.cookie];
if (typeof sessionId !== 'string') {
return unauthenticated(self.hapi.error.unauthorized());
}
self.cache.get(sessionId, function (err, session) {
if (!session) {
return unauthenticated(self.hapi.error.unauthorized());
internals.Connection.prototype.get = function (key, callback) {
callback = Hoek.nextTick(callback);
if (!this.cache) {
return callback(new Error('Connection not started'));
}
var segment = this.cache[key.segment];
if (!segment) {
return callback(null, null);
}
var envelope = segment[key.id];
if (!envelope) {
return callback(null, null);
}
var value = null;