update branch pattern in tests.yml to allow nested branches
All checks were successful
🧪 ✨ Unit Tests Workflow / 🔍 🐹 Go Tests (push) Successful in 3m2s

This commit is contained in:
2026-02-06 17:42:21 -05:00
parent c9d6a3d28b
commit 61481244f9
2 changed files with 20 additions and 2 deletions

View File

@@ -113,14 +113,23 @@ func (f *EncryptedFile) WriteDecryptedFileToDisk(filePath string) error {
}
func (f *EncryptedFile) unpackFileAndDecrypt(packedFile []byte) error {
keyLen := f.privateKey.Size()
minReqLen := aes.BlockSize + keyLen + len(hmacKey)
if len(packedFile) < minReqLen {
return fmt.Errorf("packed file is too short to be valid")
}
if bytes.Contains(packedFile, []byte(hmacKey)) {
parts := bytes.SplitN(packedFile, []byte(hmacKey), 2)
packedFile, f.hmac = parts[0], parts[1]
}
keyLen := f.privateKey.Size()
lenWithoutKey := len(packedFile) - keyLen
if lenWithoutKey < aes.BlockSize {
return fmt.Errorf("packed file is too short to contain valid nonce and ciphertext")
}
packedFile, f.symmetricKeyEnc = packedFile[0:lenWithoutKey], packedFile[lenWithoutKey:]