How to use the node-opcua-service-secure-channel.ChannelSecurityToken function in node-opcua-service-secure-channel

To help you get started, we’ve selected a few node-opcua-service-secure-channel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-secure-channel / source / server / server_secure_channel_layer.ts View on Github external
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();
    }
github node-opcua / node-opcua / packages / node-opcua-secure-channel / source / server / server_secure_channel_layer.ts View on Github external
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