-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide error codes #66
Comments
Agreed, though I would prefer to stay very vague when decryption errors occur. For example if something went wrong in the decryption, I would throw the same error if the password was wrong as well as if the HMAC failed. Having too-specific error messages would provide a vector for easier brute-force attacks. Error messages around these security-conscious areas should be deliberately ambiguous and non-specific. More on this: When and how would we use these error codes? Are the messages not enough? I'm not sure that we would typically be able to discern any new information from a numeric identifier. |
That's fine, I agree with not giving the actual reason for the decryption failure. I just think that throwing an object like this would be better:
That means that users wanting to display this message in their own way can just check if |
Agreed - this is a sensible approach :)
|
Might be best throwing a custom error here, so that (err instanceof Error) is still correct. I don't much like throwing strings, objects etc. over using actual Errors. The code property can be part of the extended class. |
It'd be good to throw some error codes, as well as the message. Identifying the wrong decryption key right now is quite difficult because you need to compare the whole string.
The text was updated successfully, but these errors were encountered: