/*

[Client The client's instance]

@param {string} config.public_key The application's public key
@param {string} config.secret_key The application's secret key
510703
function Client (config) {
    this.token = null
    this.public_key = config.public_key
    this.secret_key = config.secret_key

    this.baseUrl = 'https://api.marketcloud.it'

    // Marketcloud's api is versioned by URL
    // for instance, the current api is api.marketcloud.it/v0/<endpoint>
    this.apiVersion = 'v0'

    // If this is true, then api responses with status code >= 400
    //  are rejected as errors.
    //  If set to false all responses from server are resolved
    //
    //  In both cases, "failures" are rejected.
    this.rejectApiErrors = config.rejectApiErrors || true

    // When the client is unable to re-authenticate for a number of times that
    // exceeds MAX_RETRIES
    this.throwErrorWhenOutOfRetries = config.throwErrorWhenOutOfRetries || true

    // Creating resources instances
    for (var endpointName in endpoints) {
      var e = new endpoints[endpointName](this)
      this[e.name] = e
    }

    this.RETRIES = 0
    this.MAX_RETRIES = 2

    // This is the property that will hold a reference to the last
    // request's configuration.
    this.LAST_REQUEST = null
  }
1226273
async function removeMemberFromCryptoKeyPolicy(
  projectId = 'your-project-id', // Your GCP projectId
  keyRingId = 'my-key-ring', // Name of the crypto key's key ring
  cryptoKeyId = 'my-key', // Name of the crypto key, e.g. "my-key"
  member = 'user:dev@example.com', // Member to add to the crypto key
  role = 'roles/viewer' // Role to give the member
) {
  // Import the library and create a client
  const kms = require('@google-cloud/kms');
  const client = new kms.KeyManagementServiceClient();

  // The location of the crypto key's key ring, e.g. "global"
  const locationId = 'global';

  // Get the full path to the crypto key
  const resource = client.cryptoKeyPath(
    projectId,
    locationId,
    keyRingId,
    cryptoKeyId
  );

  // Gets the IAM policy of a crypto key
  const [result] = await client.getIamPolicy({resource});
  let policy = Object.assign({bindings: []}, result);
  const index = policy.bindings.findIndex(binding => binding.role === role);
  const members = [];
  const binding = Object.assign({role, members}, policy.bindings[index]);
  if (index === -1) {
    return;
  }
  if (!binding.members.includes(member)) {
    return;
  }

  // Remove the role/member combo from the policy
  binding.members.splice(binding.members.indexOf(member), 1);

  const request = {resource, policy};
  console.log(JSON.stringify(request, null, 2));

  // Removes the member/role combo from the policy of the crypto key
  [policy] = await client.setIamPolicy(request);
  console.log(
    `${member}/${role} combo removed from policy for crypto key ${cryptoKeyId}.`
  );
  if (policy.bindings) {
    policy.bindings.forEach(binding => {
      if (binding.members && binding.members.length) {
        console.log(`${binding.role}:`);
        binding.members.forEach(member => {
          console.log(`  ${member}`);
        });
      }
    });
  } else {
    console.log(`Policy for crypto key ${cryptoKeyId} is empty.`);
  }
}
824480
function initClient() {

    var scope = "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/genomics https://www.googleapis.com/auth/devstorage.read_only https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive.readonly";

    let browser;

    igv.google.loadGoogleProperties("https://s3.amazonaws.com/igv.org.app/web_client_google")

        .then(function (properties) {

            return gapi.client.init({
                'clientId': properties["client_id"],
                'scope': scope
            });
        })
        
        .then(function (ignore) {
            gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
        })

        .then(function () {

            var div, options;

            div = $("#myDiv")[0];
            options = {
                genome: "hg19",
                apiKey: igv.google.properties["api_key"],
                queryParametersSupported: true
            };

            igv.createBrowser(div, options)
                .then(function (b) {
                    igv.browser = b;
                })

            
        })

    //
    // function handleSignInClick(event) {
    //     // Nothing to do
    // }

    function updateSigninStatus(isSignedIn) {

        if (isSignedIn) {
            //$("#signInButton").hide();

            var user = gapi.auth2.getAuthInstance().currentUser.get();
            var profile = user.getBasicProfile();
            var username = profile.getName();
            $("#switchUserLink").html("Logged in as: " + username);

        }

    }

}
931072
function Provider(id, secret) {
  if (!(this instanceof Provider)) {
    return new Provider(id, secret);
  }

  this.client = new AWS.SQS({
    accessKeyId: id,
    secretAccessKey: secret,
    region: 'us-east-1'
  });

  this.queues = {};
}
840204
function ImboClient(options, publicKey, privateKey) {
    // Run a feature check, ensuring all required features are present
    features.checkFeatures();

    // Initialize options
    var opts = this.options = {
        hosts: parseUrls(options.hosts || options),
        publicKey: options.publicKey || publicKey,
        privateKey: options.privateKey || privateKey,
        user: options.user || options.publicKey || publicKey
    };

    // Validate options
    ['publicKey', 'privateKey', 'user'].forEach(function validateOption(opt) {
        if (!opts[opt] || typeof opts[opt] !== 'string') {
            throw new Error('`options.' + opt + '` must be a valid string');
        }
    });
}
97635
function (cb) {
			o1._client.auth(function (err) {
				if (err && !(err instanceof Error)) {
					err = new Error(err.message || err);
				}

				if (!err) {
					o1.config = {
						storage : o1._client._serviceUrl
					};
				}
				cb(err);
			});
		}
866256
function(params, callback) {
                var keyId;

                if (params) {
                    if (params.keyId != 'undefined') {
                        keyId = params.keyId;
                    }
                }

                var httpRequestParams = {
                    url: SERVICE_ADDRESSES.SSO_ADDRESS + SERVICES_PATH.SSO_GET_KEY + keyId,
                    method: 'GET',
                    headers: {
                        'Authorization': 'Bearer ' + token
                    }
                };

                httpRequest(httpRequestParams, function(result) {
                    if (!result.hasError) {
                        try {
                            var response = JSON.parse(result.result.responseText);
                        }
                        catch (e) {
                            console.log(e);
                        }

                        callback && callback({
                            hasError: false,
                            secretKey: response.secretKey
                        });
                    }
                    else {
                        callback && callback({
                            hasError: true,
                            code: result.errorCode,
                            message: result.errorMessage
                        });

                        fireEvent('error', {
                            code: result.errorCode,
                            message: result.errorMessage,
                            error: result
                        });
                    }
                });
            }
317015
function getOBAuth(config) {
  // debugger;

  // Encoding as per API Specification.
  const combinedCredential = `${config.clientId}:${config.clientSecret}`;
  // var base64Credential = window.btoa(combinedCredential);
  const base64Credential = Buffer.from(combinedCredential).toString("base64");
  const readyCredential = `Basic ${base64Credential}`;

  return readyCredential;
}
666252
function configure(receiver, secret) {
    this.Configuration.setDefault(new this.Configuration(receiver, secret));
    this.config = this.Configuration.getDefault();
  }
1339085
function Embdr(key) {
    if (!(this instanceof Embdr)) {
        return new Embdr(key);
    }

    this._api = {
        'auth': null,
        'host': Embdr.DEFAULT_HOST,
        'port': Embdr.DEFAULT_PORT,
        'basePath': Embdr.DEFAULT_BASE_PATH,
        'protocol': Embdr.DEFAULT_PROTOCOL
    };

    this.setApiKey(key);
    this._exposeApis();
}
606114
@Override
    public String key(String key, Object[] args) {

        if (hasConfigValue(key)) {
            return getConfigValue(key, args);
        }
        return m_messages.key(key, args);
    }
825005
function (callback) {
    fs.readFile(clientSecretPath, function processClientSecrets(err, content) {
        if (err) {
            debug('Error loading client secret file: ' + err);
            return callback(err);
        } else {
            credentials = JSON.parse(content);
            return callback();
        }
    });
}
205563
function Provider(id, secret) {
  if (!(this instanceof Provider)) {
    return new Provider(id, secret);
  }

  this.client = new ironMQ.Client({
    project_id: id, 
    token: secret
  });

  this.queues = {};
}
1119034
function(configStrategy) {
  if (!configStrategy.hasOwnProperty('cache') || !configStrategy.cache.hasOwnProperty('engine')) {
    throw 'CACHING_ENGINE parameter is missing.';
  }
  if (configStrategy.cache.engine === undefined) {
    throw 'CACHING_ENGINE parameter is empty.';
  }

  // Grab the required details from the configStrategy.
  const cacheEngine = configStrategy.cache.engine.toString();
  let isConsistentBehaviour = configStrategy.cache.consistentBehavior;

  // Sanitize isConsistentBehaviour
  isConsistentBehaviour = isConsistentBehaviour === undefined ? true : isConsistentBehaviour != '0';

  // Stores the endpoint for key generation of instanceMap.
  let endpointDetails = null;

  // Generate endpointDetails for key generation of instanceMap.
  if (cacheEngine == 'redis') {
    const redisMandatoryParams = ['host', 'port', 'password', 'enableTsl'];

    // Check if all the mandatory connection parameters for Redis are available or not.
    for (let i = 0; i < redisMandatoryParams.length; i++) {
      if (!configStrategy.cache.hasOwnProperty(redisMandatoryParams[i])) {
        throw 'Redis - mandatory connection parameters missing.';
      }
      if (configStrategy.cache[redisMandatoryParams[i]] === undefined) {
        throw 'Redis - connection parameters are empty.';
      }
    }

    endpointDetails =
      configStrategy.cache.host.toLowerCase() +
      '-' +
      configStrategy.cache.port.toString() +
      '-' +
      configStrategy.cache.enableTsl.toString();
  } else if (cacheEngine == 'memcached') {
    if (!configStrategy.cache.hasOwnProperty('servers')) {
      throw 'Memcached - mandatory connection parameters missing.';
    }
    if (configStrategy.cache.servers === undefined) {
      throw 'MEMCACHE_SERVERS(configStrategy.cache.servers) parameter is empty. ';
    }
    endpointDetails = configStrategy.cache.servers.join(',').toLowerCase();
  } else {
    endpointDetails = configStrategy.cache.namespace || '';
  }

  return cacheEngine + '-' + isConsistentBehaviour.toString() + '-' + endpointDetails;
}
1119699
func ConfigUserKey(user, keyString string) (*ssh.ClientConfig, error) {
	// Decode the RSA private key

	key, err := ssh.ParsePrivateKey([]byte(keyString))
	if err != nil {
		return nil, fmt.Errorf("bad private key: %s", err)
	}

	return &ssh.ClientConfig{
		User: user,
		Auth: []ssh.AuthMethod{
			ssh.PublicKeys(key),
		},
		Config: ssh.Config{
			Ciphers: []string{
				"aes128-ctr", "aes192-ctr", "aes256-ctr", "aes128-gcm@openssh.com",
				"arcfour256", "arcfour128", "aes128-cbc",
			},
		},
		HostKeyCallback: ssh.InsecureIgnoreHostKey(),
		Timeout:         timeout,
	}, nil
}
991539
def _add_secret_hash(self, parameters, key):
        
        if self.client_secret is not None:
            secret_hash = AWSSRP.get_secret_hash(self.username, self.client_id,
                                                 self.client_secret)
            parameters[key] = secret_hash
883142
public boolean setPublicKey (PublicKey key)
    {
        if (SecureUtil.ciphersSupported(key)) {
            _publicKey = key;
            return true;
        }
        return false;
    }