summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-02-01 13:33:15 +0200
committerLars Wirzenius <liw@liw.fi>2018-02-02 11:22:14 +0200
commit2000cc4cf56fcda7e7d53b3f852d95ea32db5fbd (patch)
tree7eaa833ddf31986ffbde8dd48cedb68a3ed4e268
parenteb0a8a9d58df1993f7ddb14aad2fde585e9e164f (diff)
downloadqvisqve-2000cc4cf56fcda7e7d53b3f852d95ea32db5fbd.tar.gz
Add: salami-hash command line tool
-rwxr-xr-xsalami-hash36
1 files changed, 36 insertions, 0 deletions
diff --git a/salami-hash b/salami-hash
new file mode 100755
index 0000000..9a0c4ff
--- /dev/null
+++ b/salami-hash
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+# Copyright (C) 2017 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+# Run this and type the client secret at the prompt. Output is some YAML
+# that can be copy-pasted into the Salami config file.
+
+
+import getpass
+import sys
+
+
+import yaml
+
+
+import salami_secrets
+
+
+prompt = 'Give secret: '
+secret = getpass.getpass(prompt)
+sh = salami_secrets.SecretHasher()
+hashed = sh.hash(secret)
+yaml.safe_dump(hashed, sys.stdout, default_flow_style=False)