处理平台机密的简单方法。
black-holes的Python项目详细描述
黑洞
黑洞是使用database
或Consul.io
处理项目机密的简单方法。
重要:Work-in-Progress. Beta version. Non production software.
安装
从Pip
(pyenv) $ pip install blackhole
从sources
安装:
(pyenv) $ cd black_holes (pyenv) $ python setup.py install
用法:
SqliteBlackHole
基于数据库黑洞
简单使用db黑洞
普通存储。
fromblack_holesimportSqliteBlackHole# Create a new SqliteBlackHole instancenear_black_hole=SqliteBlackHole()# Create a key called "key" with value "value"near_black_hole['key']='value'# print keyprint(near_black_hole['key'])# >>> value
高级使用数据库黑洞:
加密存储。
fromblack_holesimportSqliteBlackHole# Create a new SqliteBlackHole instance# By default AES password is `qwerty12345678`near_black_hole=SqliteBlackHole()# Create a new custom password_callback functionmy_pass=lambdainstance:'my-very-poor-password'near_black_hole=SqliteBlackHole(password_callback=my_pass)# Create a AES Encrypted keynear_black_hole['encrypted_key']='it is a secret'# Encrypted valueprint(near_black_hole['key'])# >>> Encrypted Value# Decrypted valueprint(near_black_hole['decrypted_key'])# >>> Decrypted Value
ConsulBlackHole
consul.io基于黑洞
简单使用consul黑洞
普通存储。
fromblack_holesimportConsulBlackHole# Create a new DEV ConsulBlackHole instanceremote_black_hole=ConsulBlackHole()# You can also creates a new ConsulBlackHole instance using consul auth token# remote_black_hole = ConsulBlackHole(token='{consul-io-token}')# Create a key called "key" with value "value"remote_black_hole['key']='value'# print keyprint(remote_black_hole['key'])# >>> value
通过{str 1}$dtecdeal使用成功