diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-04-17 20:26:55 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-04-17 20:26:55 -0400 |
| commit | f33d9227f7e49e7818b4d3771b6d1126a71bdce5 (patch) | |
| tree | c1cb1476b2b60f0f492b9a68d5653eb1fc60b5cb /key/box.go | |
| parent | 7b3042859c3f594c7638074987ebb6c32de5cc56 (diff) | |
| download | hose-f33d9227f7e49e7818b4d3771b6d1126a71bdce5.zip | |
load private signing key
Diffstat (limited to 'key/box.go')
| -rw-r--r-- | key/box.go | 18 |
1 files changed, 1 insertions, 17 deletions
@@ -4,8 +4,6 @@ import ( "bytes" "encoding/hex" "fmt" - "io" - "os" ) // BoxPublicKey is a public NaCl box key. @@ -46,21 +44,7 @@ func LoadBoxPublicKey() (BoxPublicKey, error) { // loadBoxKey reads a NaCl box key (public or private) from the specified file. func loadBoxKey(filename string) ([32]byte, error) { - // Open file. - f, err := os.Open(filename) - if err != nil { - return [32]byte{}, err - } - defer f.Close() - - // Read key from file. - buf, err := io.ReadAll(f) - if err != nil { - return [32]byte{}, err - } - - // Decode key. - return decodeBoxKey(buf) + return loadKey(filename, decodeBoxKey) } func (bpk1 BoxPublicKey) Compare(bpk2 BoxPublicKey) int { |