-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add init_api_secure
function
#206
Conversation
…base64 payload for encrypted messages
…pted API error cases
init_api_secure
functioninit_api_secure
function
No longer WIP and ready for review, updated description in top comment |
tests/owner_v3_init_secure.rs
Outdated
let value: ECDHPubkey = res.unwrap(); | ||
let shared_key = derive_ecdh_key(sec_key_str, &value.ecdh_pubkey); | ||
|
||
// 12) A normal request, correct key |
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.
11 😄
controller/src/controller.rs
Outdated
@@ -308,15 +415,54 @@ where | |||
OwnerAPIHandlerV3 { wallet } | |||
} | |||
|
|||
//TODO: Unwraps |
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.
Has this been addressed?
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.
Yes, leftover reminder comment.
where | ||
OUT: DeserializeOwned, | ||
{ | ||
let url = Url::parse(dest).unwrap(); |
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.
Should we really have all of these unwraps in send_request_enc
and derive_ecdh_key
? What RPC error code would be returned if these panic?
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.
It's just test helper code, I don't usually worry too much about unwraps there. I've been careful to ensure the server side returns proper errors for all conditions (and never unwraps)
…bility to select owner api port via command line
* adding initial version of init_secure_api * rustfmt * fix ECDH algo * rustfmt * trying to figure out best way of doing encryption * refactor secure requests and responses into json-rpc responses, with base64 payload for encrypted messages * rustfmt * return proper errors from encrypted api, include tests covering encrypted API error cases * rustfmt * add test for normal error (unencrypted) * rustfmt * change ports for test, add foreign listener to V2 sanity tests, add ability to select owner api port via command line * rustfmt * turn it to 11 * explicit teardown after rpc tests * update tests with explicit teardowns * update tests to perform explicit teardown * fix warnings, ensure all tests teardown * log output to diagnose CI windows build failures * disable owner api doctests on windows * rustfmt
* adding initial version of init_secure_api * rustfmt * fix ECDH algo * rustfmt * trying to figure out best way of doing encryption * refactor secure requests and responses into json-rpc responses, with base64 payload for encrypted messages * rustfmt * return proper errors from encrypted api, include tests covering encrypted API error cases * rustfmt * add test for normal error (unencrypted) * rustfmt * change ports for test, add foreign listener to V2 sanity tests, add ability to select owner api port via command line * rustfmt * turn it to 11 * explicit teardown after rpc tests * update tests with explicit teardowns * update tests to perform explicit teardown * fix warnings, ensure all tests teardown * log output to diagnose CI windows build failures * disable owner api doctests on windows * rustfmt
init_secure_api
must be encrypted.init_secure_api
function to the V3 API, performs an ECDH exchange (using the usual libsecp256k1 curve, again supported by node.js), sets the shared key internally and returns the public key to the caller.