-
Notifications
You must be signed in to change notification settings - Fork 251
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
feat(crypto-nodejs) Implement missing APIs #721
Conversation
Codecov Report
@@ Coverage Diff @@
## main #721 +/- ##
==========================================
- Coverage 71.61% 71.54% -0.07%
==========================================
Files 117 118 +1
Lines 16432 16487 +55
==========================================
+ Hits 11767 11796 +29
- Misses 4665 4691 +26
Continue to review full report at Codecov.
|
5447f96
to
af6e8a4
Compare
cd82085
to
dc7f038
Compare
cbd2e7c
to
7bb96e0
Compare
…iod_messages` are now `BigInt`.
Returning an `napi::Error` doesn't raise it. We must return a `Result<_, napi::Error>` to ensure `napi` will raise the error as expected.
…Requests` and `.markRequestAsSent`.
a37f400
to
12c53bb
Compare
125ce78
to
4dbddba
Compare
4c0361d
to
1b2c644
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete review, will continue later.
c9063d5
to
506f57a
Compare
let user_id = user_id.inner.clone(); | ||
let device_id = device_id.inner.clone(); | ||
|
||
OlmMachine { | ||
inner: matrix_sdk_crypto::OlmMachine::new(user_id.as_ref(), device_id.as_ref()).await, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should implement Deref<Target = ruma::UserId>
for the nodejs UserId
type, then this can be simplified to
let user_id = user_id.inner.clone(); | |
let device_id = device_id.inner.clone(); | |
OlmMachine { | |
inner: matrix_sdk_crypto::OlmMachine::new(user_id.as_ref(), device_id.as_ref()).await, | |
} | |
OlmMachine { | |
inner: matrix_sdk_crypto::OlmMachine::new(user_id, device_id).await, | |
} |
Implementation of #699.
The work has started in #675. This PR is the sequel of it.
Progress
The methods that are needed for basic encryption/decryption are:
OlmMachine::new()
->OlmMachine::initialize()
(since JavaScript cannot have async constructor, we use the factory pattern)OlmMachine::receive_sync_changes()
OlmMachine::outgoing_requests()
OlmMachine::mark_request_as_sent()
OlmMachine::decrypt_room_event()
OlmMachine::update_tracked_users()
OlmMachine::get_missing_sessions()
OlmMachine::share_room_key()
OlmMachine::encrypt_raw()
Bonus:
OlmMachine::user_id()
OlmMachine::device_id()
OlmMachine::identity_keys()
Note: This PR includes #723 temporarily.Other tasks than the binding itself:
README.md
is written (and helpful)