aboutsummaryrefslogtreecommitdiff
path: root/internal/readpassword
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-06-17 15:25:09 +0200
committerJakob Unterwurzacher2018-07-01 20:56:04 +0200
commitc6f6e8ec4d71475a24ebbb0e64f19ad94249efd9 (patch)
tree387469668b60e5eeddf50cf1103af43f352c0192 /internal/readpassword
parent02ab358451e23087cdba9cfdec6e8e31ae4adb4e (diff)
trezor: add skeleton for Trezor support
readpassword.Trezor() is not implemented yet and returns a hardcoded dummy key.
Diffstat (limited to 'internal/readpassword')
-rw-r--r--internal/readpassword/trezor.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/readpassword/trezor.go b/internal/readpassword/trezor.go
new file mode 100644
index 0000000..37dde79
--- /dev/null
+++ b/internal/readpassword/trezor.go
@@ -0,0 +1,26 @@
+package readpassword
+
+import (
+ "os"
+
+ "github.com/rfjakob/gocryptfs/internal/exitcodes"
+ "github.com/rfjakob/gocryptfs/internal/tlog"
+)
+
+// Trezor reads 16 deterministically derived bytes from a
+// SatoshiLabs Trezor USB security module.
+// The bytes are pseudorandom binary data and may contain null bytes.
+// This function either succeeds and returns 16 bytes or calls os.Exit to end
+// the application.
+func Trezor() []byte {
+ var err error
+ // TODO try to read bytes here....
+ // Handle errors
+ if err != nil {
+ tlog.Fatal.Printf("xxx some error was encountered...")
+ os.Exit(exitcodes.TrezorError)
+ }
+
+ tlog.Warn.Println("XXX readpassword.Trezor(): not implemented yet - returning hardcoded dummy bytes XXX")
+ return []byte("1234567890123456")
+}