Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _add_new_security_token() {
this._stop_security_token_watch_dog();
this.lastTokenId += 1;
this.channelId = this.__hash;
assert(this.channelId > 0);
const securityToken = new ChannelSecurityToken({
channelId: this.channelId,
createdAt: new Date(), // now
revisedLifetime: this.revisedLifetime,
tokenId: this.lastTokenId // todo ?
});
assert(!hasTokenExpired(securityToken));
assert(_.isFinite(securityToken.revisedLifetime));
this.securityToken = securityToken;
debugLog("SecurityToken", securityToken.tokenId);
this._start_security_token_watch_dog();
}
this.revisedLifetime = 0;
this.parent = options.parent;
this.protocolVersion = 0;
this.lastTokenId = 0;
this.timeout = options.timeout || 30000; // connection timeout
debugLog("server secure channel layer tiemput = ", this.timeout);
this.defaultSecureTokenLifetime = options.defaultSecureTokenLifetime || 600000;
// uninitialized securityToken
this.securityToken = new ChannelSecurityToken({
channelId: this.__hash,
revisedLifetime: 0,
tokenId: 0
});
assert(this.securityToken.channelId > 0);
this.serverNonce = null; // will be created when needed
this.messageBuilder = new MessageBuilder({
name: "server",
objectFactory: options.objectFactory,
privateKey: this.getPrivateKey()
});
this.messageBuilder.on("error", (err) => {
// istanbul ignore next