Skip to content

Version 4.5.1

Compare
Choose a tag to compare
@paragonie-security paragonie-security released this 28 Oct 10:19
· 15 commits to master since this release
v4.5.1

More helpful exception message on NULL values. See #95, #92, #93.

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.