aboutsummaryrefslogtreecommitdiff
path: root/internal/crud/handler_new.go
diff options
context:
space:
mode:
authorishaan <contact@ishaan.cc>2026-07-12 16:41:00 +0530
committerishaan <contact@ishaan.cc>2026-07-12 16:41:00 +0530
commit050db499d18c61d90a68096027ac0d5aaa842f57 (patch)
tree2d0cd6db07407c2d44c8ea7ec899fb3088766d01 /internal/crud/handler_new.go
parent7b5328536a82755c2724f2075c31035d709588df (diff)
add init/new/edit subcommands, config, mlock/cleared sensitive info
Diffstat (limited to 'internal/crud/handler_new.go')
-rw-r--r--internal/crud/handler_new.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/crud/handler_new.go b/internal/crud/handler_new.go
new file mode 100644
index 0000000..b40eec5
--- /dev/null
+++ b/internal/crud/handler_new.go
@@ -0,0 +1,36 @@
+package crud
+
+import (
+ "fmt"
+ "os"
+
+ "gitlab.com/whiteboardguy/eno/internal/crypt"
+ "gitlab.com/whiteboardguy/eno/internal/utils"
+)
+
+func NewNote(noteName, output string) error {
+ fmt.Printf("Enter the super secure passphrase: ")
+ password, err := utils.TakeSecureUserInput()
+ if err != nil {
+ return fmt.Errorf("failed to read passphrase: %v", err)
+ }
+
+ encrypted, err := crypt.EncryptRawBytes([]byte(noteName), password)
+ if err != nil {
+ return err
+ }
+
+ fmt.Println(output)
+ file, err := os.Create(output)
+ if err != nil {
+ return err
+ }
+
+ _, err = file.Write(encrypted)
+ if err != nil {
+ return err
+ }
+
+ file.Sync()
+ return nil
+}