core package

Submodules

core.cipherfactory module

class core.cipherfactory.CipherFactory[source]

Bases: object

Factory wrapper for dispatching appropriate cipher-based encryptor/decryptor

create_vault()[source]

Vault creation helper method

property decryptor

Returns a decryptor instance

property encryptor

Returns an encryptor instance

is_requested(operation)[source]
load_cmd_cfg(parse_obj: argparse.Namespace)[source]

Maintains command line arguments

load_param_cfg(config_obj: core.config.CipherConfig)[source]

Maintains yaml config arguments

update_cfg_file()[source]

Flushes new content into the config file

core.collection module

class core.collection.Collection[source]

Bases: object

Houses a collection of records

add_record(rcrd: core.record.Record)[source]

Helper for record insertion

Parameters

record – The record object to insert

:type Record

del_record(record_id)[source]

Helper for record deletion

Parameters

record_id – The identifier of the record to delete

:type int

display(mode='table', indent=1)[source]

Helper for displaying a collection

get_collection(enc: ciphers.cipher.Encryptor)[source]
get_record(record_id: int)[source]
load_vault(vault_content: str, dec: ciphers.cipher.Decryptor)[source]
modify_field(record_id, field, val)[source]

Helper for field modification within a record

Parameters

record_id – The identifier of the record to delete

:type int

Parameters

field – The field name within the record

:type str

Parameters

value – The value of corresponding field

:type str

modify_record(record_id, record)[source]

Helper for record modification

Parameters

record_id – The identifier of the record to delete

:type int

Parameters

record – The record object with modification

:type Record

core.config module

class core.config.CipherConfig[source]

Bases: object

Wrapper for handling yaml-based parameter configs

load(cfg_path)[source]

Template method for loading yaml file

:returns config object associated with cfg_path :returntype dict

property overwrite
store(cfg_filename, cfg_dirname, **config)[source]

Template method for dumping config into yaml file

core.model module

class core.model.Model(model, is_path=False)[source]

Bases: object

Represents a data model for a credential record

get_fields()[source]
load()[source]

Loads model from schema file

store()[source]
validate_record(content: dict)[source]

Validator method for a given record

:param record content :returntype bool

core.parser module

class core.parser.CLIParser(*args, **kwargs)[source]

Bases: argparse.ArgumentParser

Exposes options passed as arguments to sec-vault

parse_args(args=None, namespace=None)[source]

core.record module

class core.record.Record(model_type: str)[source]

Bases: object

Wrapper for an individual record maintained in the vault file

create_interactive()[source]

Populates record content interactively via end user

display(mode='table', indent=1)[source]

Displays contents of a record

Parameters

mode (str (json, yaml, table)) – The display format

load(content: dict)[source]

Populates record content from existing data

Parameters

content (dict) – Indexed record contents

modify_field(key: str, val: str)[source]

Modifies content of the given field

:param key :type key: str

:param val :type val: str

core.util module

class core.util.CollectionMeta(*args, **kwargs)[source]

Bases: type

Metaclass for accrual of supported suites and models

property cipher_suites
property model_collection
class core.util.Schema(*args, **kwargs)[source]

Bases: type

Metaclass for reserving the schema blueprint

property field_template
property model_template
core.util.copy(src: str, dst: str)[source]
core.util.get_abs_path(relative_path)[source]

Abstracts absolute path

Parameters

relative_path (str) – The current path relative to a reference

Return type

str

core.util.get_models_path()[source]
core.util.is_valid_dir(abs_path)[source]
core.util.is_valid_file(abs_path)[source]
core.util.is_valid_suite(suite_name: str)[source]

Cipher suite validity checker

Parameters

suite_name (str) – Name of the cipher suite

Return type

bool

core.util.join_path(parent_path, relative_path)[source]

Abstracts file path concatenation

Parameters
  • parent_path (str) – The path housing the relative path

  • relative_path (str) – The current path referenced from the base location

Return type

str

core.util.safe_write(directory, name, content, overwrite=False)[source]

Writes content in a temporary location and renames/overwrites the file accordingly

Parameters
  • directory (str) – The dir hosting the final file

  • name (str) – propogated name of the regular file

  • content (str) – Data to be written onto the file

  • overwrite (bool) – Overwrite file if existing

core.util.valid_encr_attr(attr)[source]

Filter for arg_param attributes for a cipher suite

Parameters

attr (str) – Argument field to be validated for a given cipher

Return type

bool

core.view module

class core.view.View[source]

Bases: object

Wrapper for the stdout messages directed to the end-user

print(*args, **kwargs)[source]
prompt_read(field)[source]
tabulate(*args)[source]

Module contents