CryptoPill
CryptoPill copied to clipboard
Include an NSError out on SecretBox methods for better error handling
When there is a problem encrypting or decrypting SecretBox returns nil. This is fine but it would be good to include an NSError out which lists why.
For example, instead of:
+ (NSData *)secretBoxDataOpen:(NSData *)encryptedData key:(SecureData *)key {
+ (NSData *)secretBoxDataOpen:(NSData *)encryptedData key:(SecureData *)key error:(NSError **)error {
and then in the method before returning nil in an error case:
if (error) *error = [NSError errorWithDomain.... ];
which gives the reason for the error.