Renders and returns the Secretfile construct
325106
def render_secretfile(opt):
    """"""
    LOG.debug("Using Secretfile %s", opt.secretfile)
    secretfile_path = abspath(opt.secretfile)
    obj = load_vars(opt)
    return render(secretfile_path, obj)
810923
def _update_secret(namespace, name, data, apiserver_url):
    ''''''
    # Prepare URL
    url = "{0}/api/v1/namespaces/{1}/secrets/{2}".format(apiserver_url,
                                                         namespace, name)
    # Prepare data
    data = [{"op": "replace", "path": "/data", "value": data}]
    # Make request
    ret = _kpatch(url, data)
    if ret.get("status") == 404:
        return "Node {0} doesn't exist".format(url)
    return ret
949778
def load(self, record_key, secret_key=''):
        
        '''
            
        '''
        
        title = '%s.load' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key,
            'secret_key': secret_key
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)
    
    # retrieve record data from s3
        record_data, record_metadata = self.s3.read_record(self.bucket_name, record_key)
    
    # validate secret key
        error_msg = '%s(secret_key="...") required to decrypt record "%s"' % (title, record_key)
        if 'encryption' in record_metadata['metadata'].keys():
            if record_metadata['metadata']['encryption'] == 'lab512':
                if not secret_key:
                    raise Exception(error_msg)
            else:
                self.s3.iam.printer('[WARNING]: %s uses unrecognized encryption method. Decryption skipped.' % record_key)
                secret_key = ''
                
    # decrypt (if necessary)
        if secret_key:
            from labpack.encryption import cryptolab
            record_data = cryptolab.decrypt(record_data, secret_key)
    
        return record_data
325716
def get_client_secret(self):
        
        self._client_secret = predix.config.get_env_value(predix.app.Manifest, 'client_secret')
        return self._client_secret
1350054
def generate_request_access_signature(parameters, secret_key):
    
    # pull out the parameter keys
    keys = parameters.keys()

    # alphanumerically sort the keys in place
    keys.sort()

    # create an array of url encoded key:value pairs
    encoded_pairs = [urlencode({key: parameters[key]}) for key in keys]

    # create the serialized parameters in a single, URL style string
    serialized_parameters = '&'.join(encoded_pairs)

    # create the string with the secret key and the parameters which will be hashed
    string_to_hash = '%s:%s' % (secret_key, serialized_parameters)

    # return the hex digest of the hashed string
    return sha256(string_to_hash).hexdigest()
1139948
def get_secret(key, *args, **kwargs):
    """"""
    env_value = os.environ.get(key.replace('.', '_').upper())
    if not env_value:
        # Backwards compatibility: the deprecated secrets vault
        return _get_secret_from_vault(key, *args, **kwargs)
    return env_value
786634
function getCustomSensitiveData(projectDir) {
    const sensitiveDataFile = pathJoin(projectDir, '.sensitivedata');
    const content = readFile(sensitiveDataFile).toString();
    const allPatterns = content
        .split(/\n|\r/)
        .map((line) => line.replace(/[\t]/g, ' '))
        .map((line) => line.trim())
        .filter((line) => line && line.length > 0)
        .filter((line) => !line.startsWith('#'));

    const sensitiveData = allPatterns.filter(
        (pattern) => !pattern.startsWith('!')
    );

    const ignoredData = allPatterns
        .filter((pattern) => pattern.startsWith('!'))
        .map((pattern) => pattern.replace('!', ''))
        .map((pattern) => pattern.trim());

    return {
        sensitiveData,
        ignoredData,
    };
}
484918
def export(vault_client, opt):
    """"""
    ctx = Context.load(get_secretfile(opt), opt) \
                 .fetch(vault_client)
    for resource in ctx.resources():
        resource.export(opt.directory)
589499
function(secret) {
        var keyIv;
        if (!secret) {
          throw new CError('missing secret').log();
        }
        // secret is a Base64 string
        if(secret.isBase64()){
          try {
            keyIv = forge.util.decode64(secret);
          } catch (e) {
            throw new CError('secret not valid').log();
          }
        } else {
          keyIv = secret;
        }
        return keyIv;
      }
1318516
public String generate(byte[] secret) {
    String hp = header.encode() + "." + payload.encode();
    return hp + "." + new String(
      SignerFactory.get(header.algorithm).sign(hp.getBytes(StandardCharsets.UTF_8), secret),
      StandardCharsets.UTF_8
    );
  }
407217
def get_common_secret(self, server_public, client_public):
        
        return self.hash(self.pad(client_public), self.pad(server_public))
235236
def generate_secret(length=30):
    
    rand = random.SystemRandom()
    ascii_characters = string.ascii_letters + string.digits

    return ''.join(rand.choice(ascii_characters) for _ in range(length))
870579
def secret_file(filename):
    """"""
    filestat = os.stat(abspath(filename))
    if stat.S_ISREG(filestat.st_mode) == 0 and \
       stat.S_ISLNK(filestat.st_mode) == 0:
        e_msg = "Secret file %s must be a real file or symlink" % filename
        raise aomi.exceptions.AomiFile(e_msg)

    if platform.system() != "Windows":
        if filestat.st_mode & stat.S_IROTH or \
           filestat.st_mode & stat.S_IWOTH or \
           filestat.st_mode & stat.S_IWGRP:
            e_msg = "Secret file %s has too loose permissions" % filename
            raise aomi.exceptions.AomiFile(e_msg)
584656
def _create_secret(namespace, name, data, apiserver_url):
    '''  '''
    # Prepare URL
    url = "{0}/api/v1/namespaces/{1}/secrets".format(apiserver_url, namespace)
    # Prepare data
    request = {
        "apiVersion": "v1",
        "kind": "Secret",
        "metadata": {
            "name": name,
            "namespace": namespace,
        },
        "data": data
    }
    # Make request
    ret = _kpost(url, request)
    return ret
1001724
def render(pass_info, saltenv='base', sls='', argline='', **kwargs):
    '''
    
    '''
    try:
        _get_pass_exec()
    except SaltRenderError:
        raise

    # Make sure environment variable HOME is set, since Pass looks for the
    # password-store under ~/.password-store.
    os.environ['HOME'] = expanduser('~')
    return _decrypt_object(pass_info)
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
326425
function renderFromFile(inputFile, destination) {
  const unique = crypto.createHmac('sha1', PLUGIN_NAME).update(inputFile).digest('hex');
  const mmdcExecutable = which.sync('mmdc');
  const svgFilename = `${unique}.svg`;
  const svgPath = path.join(destination, svgFilename);

  // Invoke mermaid.cli
  execSync(`${mmdcExecutable} -i ${inputFile} -o ${svgPath} -b transparent`);

  return `./${svgFilename}`;
}