diff options
Diffstat (limited to 'internal/crud/cli_edit.go')
| -rw-r--r-- | internal/crud/cli_edit.go | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/internal/crud/cli_edit.go b/internal/crud/cli_edit.go index 50bb8d2..0683439 100644 --- a/internal/crud/cli_edit.go +++ b/internal/crud/cli_edit.go @@ -3,7 +3,6 @@ package crud import ( "fmt" "os" - "strconv" "gitlab.com/whiteboardguy/eno/internal/crypt" "gitlab.com/whiteboardguy/eno/internal/editor" @@ -90,28 +89,7 @@ func EditNoteSSH(notePath, privKeyPath, editorString string) error { return err } - idx := -1 - for i, b := range ciphertext { - if b == ':' { - idx = i - break - } - } - if idx == -1 { - return fmt.Errorf("invalid file format: no header length prefix found") - } - - headerLen, err := strconv.Atoi(string(ciphertext[:idx])) - if err != nil { - return fmt.Errorf("failed to parse header length: %v", err) - } - - if headerLen < 0 || idx+1+headerLen > len(ciphertext) { - return fmt.Errorf("invalid header length %d", headerLen) - } - - headerBytes := ciphertext[idx+1 : idx+1+headerLen] - headers, err := crypt.GetFileHeaders(headerBytes) + headers, _, err := crypt.ParseFileHeaders(ciphertext) if err != nil { return fmt.Errorf("failed to read file headers: %v", err) } |