<NME> crypt.py
<BEF> ADDFILE
<MSG> Redesign credential as a class

<DFF> @@ -0,0 +1,25 @@
+import os
+import gnupg
+import logging
+
+from .utils import which
+
+
+def create_key_input(gpg, passphrase, testing=False):
+    key_input = gpg.gen_key_input(
+        name_real='Pysswords',
+        name_email='pysswords@pysswords',
+        name_comment='Autogenerated by Pysswords',
+        passphrase=passphrase,
+        testing=testing
+    )
+    return key_input
+
+
+def create_gpg(binary, database_path, passphrase):
+    gnupg_path = os.path.join(database_path, ".gnupg")
+    gpg = gnupg.GPG(which(binary), homedir=gnupg_path)
+    gpg.gen_key(create_key_input(gpg, passphrase))
+    logging.info("Pysswords database initialized at `{}`".format(
+        database_path))
+    return gpg

{'addition_count': 25, 'commit_subject': 'Redesign credential as a class', 'deletion_count': 0, 'file_extension': '.py', 'lang': 'py', 'license': 'mit', 'repo_name': 'marcwebbie/passpie'}