Source: node_modules/kurento-client-elements/lib/complexTypes/SDES.js

/* Autogenerated with Kurento Idl */

/*
 * (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var inherits = require('inherits');

var kurentoClient = require('kurento-client');

var checkType = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;

var ComplexType = require('kurento-client-core').complexTypes.ComplexType;


/**
 * Security Descriptions for Media Streams
 *
 * @constructor module:elements/complexTypes.SDES
 *
 * @property {external:String} key
 *  <p>Master key and salt (plain text)</p>
 *            <p>
 *            This field provides the the cryptographic master key appended with
 *            </p>
 *            <p>
 *            The expected length of the key (as provided to this parameter) is 
 *            determined by the crypto-suite for which the key applies (30 
 *            characters for AES_CM_128, 46 characters for AES_CM_256). If the 
 *            length does not match the expected value, the key will be 
 *            considered invalid.
 *            </p>
 *            <p>
 *            If no key is provided, a random one will be generated using the 
 *            `getrandom` system call.
 *            </p>
 * @property {external:String} keyBase64
 *  <p>Master key and salt (base64 encoded)</p>
 *            <p>
 *            This field provides the cryptographic master key appended with the
 *            </p>
 *            <p>
 *            The expected length of the key (after being decoded from base64) 
 *            is determined by the crypto-suite for which the key applies (30 
 *            bytes for AES_CM_128, 46 bytes for AES_CM_256). If the length does
 *            </p>
 *            <p>
 *            If no key is provided, a random one will be generated using the 
 *            `getrandom` system call.
 *            </p>
 * @property {module:elements/complexTypes.CryptoSuite} crypto
 *  Selects the cryptographic suite to be used. For available values, please see
 */
function SDES(sDESDict){
  if(!(this instanceof SDES))
    return new SDES(sDESDict)

  sDESDict = sDESDict || {}

  // Check sDESDict has the required fields
  // 
  // checkType('String', 'sDESDict.key', sDESDict.key);
  //  
  // checkType('String', 'sDESDict.keyBase64', sDESDict.keyBase64);
  //  
  // checkType('CryptoSuite', 'sDESDict.crypto', sDESDict.crypto);
  //  

  // Init parent class
  SDES.super_.call(this, sDESDict)

  // Set object properties
  Object.defineProperties(this, {
    key: {
      writable: true,
      enumerable: true,
      value: sDESDict.key
    },
    keyBase64: {
      writable: true,
      enumerable: true,
      value: sDESDict.keyBase64
    },
    crypto: {
      writable: true,
      enumerable: true,
      value: sDESDict.crypto
    }
  })
}
inherits(SDES, ComplexType)

// Private identifiers to allow re-construction of the complexType on the server
// They need to be enumerable so JSON.stringify() can access to them
Object.defineProperties(SDES.prototype, {
  __module__: {
    enumerable: true,
    value: "kurento"
  },
  __type__: {
    enumerable: true,
    value: "SDES"
  }
})

/**
 * Checker for {@link module:elements/complexTypes.SDES}
 *
 * @memberof module:elements/complexTypes
 *
 * @param {external:String} key
 * @param {module:elements/complexTypes.SDES} value
 */
function checkSDES(key, value)
{
  if(!(value instanceof SDES))
    throw ChecktypeError(key, SDES, value);
};


module.exports = SDES;

SDES.check = checkSDES;