aboutsummaryrefslogtreecommitdiff
path: root/internal/crypt
diff options
context:
space:
mode:
authorishaan <contact@ishaan.cc>2026-08-03 11:15:02 +0530
committerishaan <contact@ishaan.cc>2026-08-03 11:15:02 +0530
commit5375294e0bed1fa01cb5f4ff73f2c093b74cd8e2 (patch)
tree9049f67a82a40cce28c052a1f9e0de50bbc0e508 /internal/crypt
parentb65769aadfc79d22672d4bd512443f0dda8cf6ad (diff)
fix new --edit fallthrough, cleanup error handling
Diffstat (limited to 'internal/crypt')
-rw-r--r--internal/crypt/headers.go10
-rw-r--r--internal/crypt/salt.go4
2 files changed, 7 insertions, 7 deletions
diff --git a/internal/crypt/headers.go b/internal/crypt/headers.go
index c47d39c..ee38560 100644
--- a/internal/crypt/headers.go
+++ b/internal/crypt/headers.go
@@ -30,11 +30,11 @@ type FileHeaders struct {
}
type WrappedKey struct {
- PKType string // "ssh-ed25519"
- PubKeyBytes []byte
- EphemeralPub []byte // of X25519, for ECDH on decrypt (also can replace salt)
- Nonce [12]byte // for decrypting EncNoteKey
- EncNoteKey []byte // encrypted note key (ciphertext + 16B tag)
+ PKType string // "ssh-ed25519"
+ PubKeyBytes []byte
+ EphemeralPub []byte // of X25519, for ECDH on decrypt (also can replace salt)
+ Nonce [12]byte // for decrypting EncNoteKey
+ EncNoteKey []byte // encrypted note key (ciphertext + 16B tag)
}
func GetFileHeaders(b []byte) (FileHeaders, error) {
diff --git a/internal/crypt/salt.go b/internal/crypt/salt.go
index 46874bd..09b6c72 100644
--- a/internal/crypt/salt.go
+++ b/internal/crypt/salt.go
@@ -9,7 +9,7 @@ import (
func NewSalt() ([16]byte, error) {
salt := [16]byte{}
if _, err := io.ReadFull(rand.Reader, salt[:]); err != nil {
- return [16]byte{}, fmt.Errorf("crypt: failed to read salt: %w", err)
+ return [16]byte{}, fmt.Errorf("failed to read salt: %w", err)
}
return salt, nil
@@ -18,7 +18,7 @@ func NewSalt() ([16]byte, error) {
func NewNonce() ([12]byte, error) {
nonce := [12]byte{}
if _, err := io.ReadFull(rand.Reader, nonce[:]); err != nil {
- return [12]byte{}, fmt.Errorf("crypt: failed to read nonce: %w", err)
+ return [12]byte{}, fmt.Errorf("failed to read nonce: %w", err)
}
return nonce, nil