-
Notifications
You must be signed in to change notification settings - Fork 143
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
Update JsThemis tests #620
Commits on Apr 8, 2020
-
Secure Cell: reuse WasmThemis tests
Update Secure Cell test suite with the tests used in WasmThemis. There are some minor tweaks here and there to make them compatible, but it's all the same tests otherwise.
Configuration menu - View commit details
-
Copy full SHA for 239f8ed - Browse repository at this point
Copy the full SHA 239f8edView commit details -
Secure Cell: report TypeError correctly
Instead of throwing a generic error with INVALID_PARAMETER status code, throw a proper TypeError when we notice an issue with input types. This commit updates all cryptosystems, not only Secure Cell.
Configuration menu - View commit details
-
Copy full SHA for 47f1ca2 - Browse repository at this point
Copy the full SHA 47f1ca2View commit details -
Secure Cell: allow "null" for context values
In addition to allowing empty buffers and omitted arguments, accept explicit "null" values when the context is not used. This improves API compatibility with WasmThemis.
Configuration menu - View commit details
-
Copy full SHA for 39a910e - Browse repository at this point
Copy the full SHA 39a910eView commit details -
Secure Message: reuse WasmThemis tests
In JsThemis there is no SecureMessageSign and SecureMessageVerify objects, empty keys should be used instead.
Configuration menu - View commit details
-
Copy full SHA for ac3bb87 - Browse repository at this point
Copy the full SHA ac3bb87View commit details -
Secure Message: allow "null" keys for sign/verify
Allow omitted keys to be specified with "null" values in addition to empty buffers. This improves compatibility with WasmThemis API and is consistent with other places where we allow optional values.
Configuration menu - View commit details
-
Copy full SHA for ef25982 - Browse repository at this point
Copy the full SHA ef25982View commit details -
Secure Message: disallow both empty keys
Check that the user has provided either public or private key, do not allow both keys to be omitted.
Configuration menu - View commit details
-
Copy full SHA for 37a9cc9 - Browse repository at this point
Copy the full SHA 37a9cc9View commit details -
Secure Comparator: reuse WasmThemis tests
Note that JsThemis uses a bit different naming and does not have a "destroy()" method. The Secure Comparator object is freed when Node.js runtime collects the garbage.
Configuration menu - View commit details
-
Copy full SHA for c9359a0 - Browse repository at this point
Copy the full SHA c9359a0View commit details -
Secure Session: reuse WasmThemis tests
API is slightly different in JsThemis and WasmThemis, the names are not the same and JsThemis does not have a dedicated negotiation method, using just unwrap() for that.
Configuration menu - View commit details
-
Copy full SHA for b316e55 - Browse repository at this point
Copy the full SHA b316e55View commit details -
Secure Session: check private key validity
WasmThemis verifies the private key during Secure Session construction. Don't defer this to usage in JsThemis either.
Configuration menu - View commit details
-
Copy full SHA for 86d5696 - Browse repository at this point
Copy the full SHA 86d5696View commit details -
Secure Session: handle exceptions in callback
We should check the call result as it may be empty if the callback throws an exception. Failure to check for this leads to process abort: FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. 1: 0x8fa090 node::Abort() [node] 2: 0x8fa0dc [node] 3: 0xb0030a v8::Utils::ReportApiFailure(char const*, char const*) [node] 4: 0x7ff9182b1785 jsthemis::SecureSession::get_public_key_for_id_callback(void const*, unsigned long, void*, unsigned long, void*) [...] 9: 0xb8e96f [node] 10: 0xb8f4d9 v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node] 11: 0x1762fd45be1d Aborted (core dumped) We don't want this to happen.
Configuration menu - View commit details
-
Copy full SHA for 983edd6 - Browse repository at this point
Copy the full SHA 983edd6View commit details -
Retroactively apply copyright to tests
Since we're publishing test code on npm now, we should properly attribute this file. The tests were added in 944b9e0 ("Add JSTHEMIS test", 2016-01-17).
Configuration menu - View commit details
-
Copy full SHA for 6d8f4af - Browse repository at this point
Copy the full SHA 6d8f4afView commit details
Commits on Apr 9, 2020
-
Simplify sign/verify test case
We know that JsThemis returns results as instances of Node.js Buffer so we can verify that signed message includes the plaintext by using the "includes" method. We don't need to write it ourselves.
Configuration menu - View commit details
-
Copy full SHA for 10d26da - Browse repository at this point
Copy the full SHA 10d26daView commit details -
Configuration menu - View commit details
-
Copy full SHA for c618c01 - Browse repository at this point
Copy the full SHA c618c01View commit details