confidant_client/__init__.py
def create_blind_credential(
            self,
            blind_keys,
            contexts,
            name,
            credential_pairs,
            metadata=None,
            cipher_type='fernet',
            cipher_version=2,
            store_keys=True,
            enabled=True,
            documentation=None
            ):
        """Create a server blinded credential and store it in Confidant."""
        # Return a dict, always with an attribute that specifies whether or not
        # the function was able to successfully get a result.
        ret = {'result': False}
        if metadata is None:
            metadata = {}
        metadata['context'] = contexts
        data_keys, _credential_pairs = self._get_keys_and_encrypted_pairs(
            blind_keys,
            contexts,
            credential_pairs,
            cipher_type,
            cipher_version
        )
        data = {
            'name': name,
            'credential_pairs': _credential_pairs,
            'data_key': data_keys,
            'metadata': metadata,
            'cipher_type': cipher_type,
            'cipher_version': cipher_version,
            'enabled': enabled,
            'documentation': documentation
        }
        if store_keys:
            data['credential_keys'] = list(credential_pairs.keys())
        try:
            response = self._execute_request(
                'post',
                '{0}/v1/blind_credentials'.format(self.config['url']),
                headers=JSON_HEADERS,
                data=json.dumps(data),
            )
        except RequestExecutionError:
            logging.exception('Error with executing request')
            return ret
        try:
            data = response.json()
        except ValueError:
            logging.error('Received badly formatted json data from confidant.')
            return ret
        ret['blind_credential'] = data
        ret['result'] = True
        return ret
Create a server blinded credential and store it in Confidant.
Create a server blinded credential and store it in Confidant.
Create a server blinded credential and store it in Confidant .
def create_blind_credential(
            self,
            blind_keys,
            contexts,
            name,
            credential_pairs,
            metadata=None,
            cipher_type='fernet',
            cipher_version=2,
            store_keys=True,
            enabled=True,
            documentation=None
            ):
        ret = {'result': False}
        if metadata is None:
            metadata = {}
        metadata['context'] = contexts
        data_keys, _credential_pairs = self._get_keys_and_encrypted_pairs(
            blind_keys,
            contexts,
            credential_pairs,
            cipher_type,
            cipher_version
        )
        data = {
            'name': name,
            'credential_pairs': _credential_pairs,
            'data_key': data_keys,
            'metadata': metadata,
            'cipher_type': cipher_type,
            'cipher_version': cipher_version,
            'enabled': enabled,
            'documentation': documentation
        }
        if store_keys:
            data['credential_keys'] = list(credential_pairs.keys())
        try:
            response = self._execute_request(
                'post',
                '{0}/v1/blind_credentials'.format(self.config['url']),
                headers=JSON_HEADERS,
                data=json.dumps(data),
            )
        except RequestExecutionError:
            logging.exception('Error with executing request')
            return ret
        try:
            data = response.json()
        except ValueError:
            logging.error('Received badly formatted json data from confidant.')
            return ret
        ret['blind_credential'] = data
        ret['result'] = True
        return ret
def create_blind_credential ( self , blind_keys , contexts , name , credential_pairs , metadata = None , cipher_type = 'fernet' , cipher_version = 2 , store_keys = True , enabled = True , documentation = None ) : ret = { 'result' : False } if metadata is None : metadata = { } metadata [ 'context' ] = contexts data_keys , _credential_pairs = self . _get_keys_and_encrypted_pairs ( blind_keys , contexts , credential_pairs , cipher_type , cipher_version ) data = { 'name' : name , 'credential_pairs' : _credential_pairs , 'data_key' : data_keys , 'metadata' : metadata , 'cipher_type' : cipher_type , 'cipher_version' : cipher_version , 'enabled' : enabled , 'documentation' : documentation } if store_keys : data [ 'credential_keys' ] = list ( credential_pairs . keys ( ) ) try : response = self . _execute_request ( 'post' , '{0}/v1/blind_credentials' . format ( self . config [ 'url' ] ) , headers = JSON_HEADERS , data = json . dumps ( data ) , ) except RequestExecutionError : logging . exception ( 'Error with executing request' ) return ret try : data = response . json ( ) except ValueError : logging . error ( 'Received badly formatted json data from confidant.' ) return ret ret [ 'blind_credential' ] = data ret [ 'result' ] = True return ret
Create a server blinded credential and store it in Confidant.
Create a server blinded credential and store it in Confidant .
"""Create a server blinded credential and store it in Confidant.""" # Return a dict, always with an attribute that specifies whether or not # the function was able to successfully get a result.
self
blind_keys
contexts
name
credential_pairs
metadata
cipher_type
cipher_version
store_keys
enabled
documentation