Added nonce generator for CSP header
This commit is contained in:
parent
7111ecd32c
commit
ce1b9b3a0e
7
api.js
7
api.js
@ -10,6 +10,7 @@ var conf = cl.load( "config.all" ).botanjs;
|
||||
|
||||
var Session = cl.load( "botansx.modular.session" );
|
||||
var hash = cl.load( "botansx.utils.hash" );
|
||||
var rand = cl.load( "botansx.utils.random" );
|
||||
|
||||
var BotanJS = function()
|
||||
{
|
||||
@ -17,6 +18,7 @@ var BotanJS = function()
|
||||
this.sv = {};
|
||||
this.kv = {};
|
||||
this.embed = {};
|
||||
this._nonce = {};
|
||||
};
|
||||
|
||||
util.inherits( BotanJS, events.EventEmitter );
|
||||
@ -66,6 +68,11 @@ BotanJS.prototype.storeForRender = function( rainet, type, ch )
|
||||
}
|
||||
};
|
||||
|
||||
BotanJS.prototype.nonce = function( type )
|
||||
{
|
||||
return ( this._nonce[ type ] ||= rand.randstr( 8 ) );
|
||||
};
|
||||
|
||||
BotanJS.prototype.compile = function( type )
|
||||
{
|
||||
var _self = this;
|
||||
|
Loading…
Reference in New Issue
Block a user