-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More helpful exception message on NULL values.
If you do not declare a field optional, it generally will not accept NULL as a value on encrypt. Boolean is the exception to this rule (for backwards compat). However, non-optional fields (even booleans) must have a ciphertext on the decrypt path. ``` Encrypt: TYPE_BOOLEAN + (null) -> ciphertext TYPE_OPTIONAL_BOOLEAN + (null) -> ciphertext Decrypt: TYPE_BOOLEAN + (null) -> TypeError TYPE_OPTIONAL_BOOLEAN + (null) -> null ``` Booleans are the weird ones, though. ``` Encrypt: TYPE_TEXT + (null) -> TypeError TYPE_OPTIONAL_TEXT + (null) -> null Decrypt: TYPE_TEXT + (null) -> TypeError TYPE_OPTIONAL_BOOLEAN + (null) -> null ``` Every other type doesn't tolerate null implicitly. This behavior is because of a very early design decision with boolean types.
- Loading branch information
1 parent
575dda1
commit b368965
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters