How to use the node-opcua-service-secure-channel.MessageSecurityMode.get 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 / src / message_builder.js View on Github external
MessageBuilder.prototype.setSecurity = function (securityMode, securityPolicy) {
    assert(this.securityMode === MessageSecurityMode.INVALID, "security already set");
    this.securityPolicy = SecurityPolicy.get(securityPolicy);
    this.securityMode = MessageSecurityMode.get(securityMode);
    assert(this.securityPolicy !== undefined, "invalid security policy " + securityPolicy);
    assert(this.securityMode !== undefined, "invalid security mode " + securityMode);
    assert(this.securityPolicy !== SecurityPolicy.Invalid);
    assert(this.securityMode !== MessageSecurityMode.INVALID);
};
github node-opcua / node-opcua / packages / node-opcua-client / src / client_base.js View on Github external
OPCUAClientBase.prototype.findEndpointForSecurity = function (securityMode, securityPolicy) {
    securityMode = MessageSecurityMode.get(securityMode);
    securityPolicy = SecurityPolicy.get(securityPolicy);
    assert(this.knowsServerEndpoint, "Server end point are not known yet");
    return _.find(this._server_endpoints, function (endpoint) {
        return endpoint.securityMode === securityMode &&
            endpoint.securityPolicyUri === securityPolicy.value;
    });
};
github node-opcua / node-opcua / packages / node-opcua-client / src / client_base.js View on Github external
this._sessions = [];


    this._server_endpoints = [];
    this._secureChannel = null;

    this.defaultSecureTokenLifetime = options.defaultSecureTokenLifetime || 600000;
    this.tokenRenewalInterval = options.tokenRenewalInterval || 0;
    assert(_.isFinite(this.tokenRenewalInterval) && this.tokenRenewalInterval >= 0);
    /**
     * @property securityMode
     * @type MessageSecurityMode
     */
    this.securityMode = options.securityMode || MessageSecurityMode.NONE;
    this.securityMode = MessageSecurityMode.get(this.securityMode);

    /**
     * @property securityPolicy
     * @type {SecurityPolicy}
     */
    this.securityPolicy = options.securityPolicy || toURI("None");
    this.securityPolicy = SecurityPolicy.get(this.securityPolicy);

    /**
     * @property serverCertificate
     * @type {Certificate}
     */
    this.serverCertificate = options.serverCertificate || null;

    /**
     * true if session shall periodically probe the server to keep the session alive and prevent timeout