mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-12-04 12:54:07 +01:00
Add init_api_secure function (#206)
* 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
This commit is contained in:
@@ -36,7 +36,7 @@ impl HttpSlateSender {
|
||||
}
|
||||
|
||||
/// Check version of the listening wallet
|
||||
fn check_other_version(&self) -> Result<(), Error> {
|
||||
fn check_other_version(&self, url: &Url) -> Result<(), Error> {
|
||||
let req = json!({
|
||||
"jsonrpc": "2.0",
|
||||
"method": "check_version",
|
||||
@@ -44,7 +44,7 @@ impl HttpSlateSender {
|
||||
"params": []
|
||||
});
|
||||
|
||||
let res: String = post(&self.base_url, None, &req).map_err(|e| {
|
||||
let res: String = post(url, None, &req).map_err(|e| {
|
||||
let mut report = format!("Performing version check (is recipient listening?): {}", e);
|
||||
let err_string = format!("{}", e);
|
||||
if err_string.contains("404") {
|
||||
@@ -101,7 +101,7 @@ impl SlateSender for HttpSlateSender {
|
||||
.expect("/v2/foreign is an invalid url path");
|
||||
debug!("Posting transaction slate to {}", url);
|
||||
|
||||
self.check_other_version()?;
|
||||
self.check_other_version(&url)?;
|
||||
|
||||
// Note: not using easy-jsonrpc as don't want the dependencies in this crate
|
||||
let req = json!({
|
||||
|
||||
@@ -359,7 +359,7 @@ impl SlateReceiver for KeybaseAllChannels {
|
||||
DefaultWalletImpl::<'static, HTTPNodeClient>::new(node_client.clone()).unwrap(),
|
||||
)
|
||||
as Box<
|
||||
WalletInst<
|
||||
dyn WalletInst<
|
||||
'static,
|
||||
DefaultLCProvider<HTTPNodeClient, ExtKeychain>,
|
||||
HTTPNodeClient,
|
||||
|
||||
@@ -124,6 +124,7 @@ where
|
||||
match LMDBBackend::new(&data_dir_name, self.node_client.clone()) {
|
||||
Err(e) => {
|
||||
let msg = format!("Error creating wallet: {}, Data Dir: {}", e, &data_dir_name);
|
||||
error!("{}", msg);
|
||||
return Err(ErrorKind::Lifecycle(msg).into());
|
||||
}
|
||||
Ok(d) => d,
|
||||
|
||||
Reference in New Issue
Block a user