diff --git a/api.js b/api.js index 9646b1d..5da33cc 100644 --- a/api.js +++ b/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;