aboutsummaryrefslogtreecommitdiff
path: root/internal/util
diff options
context:
space:
mode:
Diffstat (limited to 'internal/util')
-rw-r--r--internal/util/io.go30
-rw-r--r--internal/util/util.go (renamed from internal/util/crypto.go)22
2 files changed, 22 insertions, 30 deletions
diff --git a/internal/util/io.go b/internal/util/io.go
deleted file mode 100644
index 143a520..0000000
--- a/internal/util/io.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package util
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
-
- "git.sigsum.org/sigsum-go/pkg/hex"
-)
-
-func BytesFromStdin() ([]byte, error) {
- b, err := ioutil.ReadAll(os.Stdin)
- if err != nil {
- return nil, fmt.Errorf("util: read stdin: %v", err)
- }
- return b, nil
-}
-
-func HexFromStdin() ([]byte, error) {
- b, err := BytesFromStdin()
- if err != nil {
- return nil, err
- }
- b, err = hex.Deserialize(string(bytes.TrimSpace(b)))
- if err != nil {
- return nil, fmt.Errorf("util: parse stdin: %v", err)
- }
- return b, nil
-}
diff --git a/internal/util/crypto.go b/internal/util/util.go
index a8c8fac..4d52245 100644
--- a/internal/util/crypto.go
+++ b/internal/util/util.go
@@ -1,15 +1,37 @@
package util
import (
+ "bytes"
"crypto"
"crypto/ed25519"
"fmt"
"io/ioutil"
+ "os"
"git.sigsum.org/sigsum-go/pkg/hex"
"git.sigsum.org/sigsum-go/pkg/types"
)
+func BytesFromStdin() ([]byte, error) {
+ b, err := ioutil.ReadAll(os.Stdin)
+ if err != nil {
+ return nil, fmt.Errorf("util: read stdin: %v", err)
+ }
+ return b, nil
+}
+
+func HexFromStdin() ([]byte, error) {
+ b, err := BytesFromStdin()
+ if err != nil {
+ return nil, err
+ }
+ b, err = hex.Deserialize(string(bytes.TrimSpace(b)))
+ if err != nil {
+ return nil, fmt.Errorf("util: parse stdin: %v", err)
+ }
+ return b, nil
+}
+
func SignerFromHex(s string) (crypto.Signer, error) {
b, err := hex.Deserialize(s)
if err != nil {