| 1 |
|
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
|
| 6 |
class Argon2Error(Exception): |
| 7 |
""" |
| 8 |
Superclass of all argon2 exceptions. |
| 9 |
|
| 10 |
Never thrown directly. |
| 11 |
""" |
| 12 |
|
| 13 |
|
| 14 |
class VerificationError(Argon2Error): |
| 15 |
""" |
| 16 |
Verification failed. |
| 17 |
|
| 18 |
You can find the original error message from Argon2 in ``args[0]``. |
| 19 |
""" |
| 20 |
|
| 21 |
|
| 22 |
class VerifyMismatchError(VerificationError): |
| 23 |
""" |
| 24 |
The secret does not match the hash. |
| 25 |
|
| 26 |
Subclass of :exc:`argon2.exceptions.VerificationError`. |
| 27 |
|
| 28 |
.. versionadded:: 16.1.0 |
| 29 |
""" |
| 30 |
|
| 31 |
|
| 32 |
class HashingError(Argon2Error): |
| 33 |
""" |
| 34 |
Raised if hashing failed. |
| 35 |
|
| 36 |
You can find the original error message from Argon2 in ``args[0]``. |
| 37 |
""" |
| 38 |
|
| 39 |
|
| 40 |
class InvalidHashError(ValueError): |
| 41 |
""" |
| 42 |
Raised if the hash is invalid before passing it to Argon2. |
| 43 |
|
| 44 |
.. versionadded:: 23.1.0 |
| 45 |
As a replacement for :exc:`argon2.exceptions.InvalidHash`. |
| 46 |
""" |
| 47 |
|
| 48 |
|
| 49 |
class UnsupportedParametersError(ValueError): |
| 50 |
""" |
| 51 |
Raised if the current platform does not support the parameters. |
| 52 |
|
| 53 |
For example, in WebAssembly parallelism must be set to 1. |
| 54 |
|
| 55 |
.. versionadded:: 25.1.0 |
| 56 |
""" |
| 57 |
|
| 58 |
|
| 59 |
InvalidHash = InvalidHashError |
| 60 |
""" |
| 61 |
Deprecated alias for :class:`InvalidHashError`. |
| 62 |
|
| 63 |
.. versionadded:: 18.2.0 |
| 64 |
.. deprecated:: 23.1.0 |
| 65 |
Use :exc:`argon2.exceptions.InvalidHashError` instead. |
| 66 |
""" |