[#114] simplified some code by returning early and added cap for slices

This commit is contained in:
Valley
2022-07-15 00:26:08 +08:00
committed by GitHub
parent 03a7bafa66
commit a16b0c9004
11 changed files with 124 additions and 147 deletions
+1 -6
View File
@@ -66,10 +66,5 @@ func Decrypt(cipherText string, key string) ([]byte, error) {
}
nonce, cipherByteClean := cipherByte[:nonceSize], cipherByte[nonceSize:]
plainData, err := gcm.Open(nil, nonce, cipherByteClean, nil)
if err != nil {
return nil, err
}
return plainData, nil
return gcm.Open(nil, nonce, cipherByteClean, nil)
}