Skip to content

Commit

Permalink
Slatepack - Pt 2 - Encryption (#411)
Browse files Browse the repository at this point in the history
* recreate PR from #400

* first tests with slate encryption

* simplify slatepack model to contain encryption header in payload, and add de/ser tests

* update tests and confirm slatepack encryption working

* remove recipient list, add version check warning
  • Loading branch information
yeastplume authored May 22, 2020
1 parent 9450d2a commit 2769436
Show file tree
Hide file tree
Showing 21 changed files with 2,062 additions and 95 deletions.
538 changes: 453 additions & 85 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions api/src/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use chrono::prelude::*;
use ed25519_dalek::PublicKey as DalekPublicKey;
use ed25519_dalek::SecretKey as DalekSecretKey;
use uuid::Uuid;

use crate::config::{TorConfig, WalletConfig};
Expand Down Expand Up @@ -1913,6 +1914,16 @@ where
owner::get_public_proof_address(self.wallet_inst.clone(), keychain_mask, derivation_index)
}

// TODO: Doc
/// get public proof a
pub fn get_secret_key(
&self,
keychain_mask: Option<&SecretKey>,
derivation_index: u32,
) -> Result<DalekSecretKey, Error> {
owner::get_secret_key(self.wallet_inst.clone(), keychain_mask, derivation_index)
}

/// Helper function to convert an Onion v3 address to a payment proof address (essentially
/// exctacting and verifying the public key)
///
Expand Down
3 changes: 3 additions & 0 deletions controller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ grin_wallet_api = { path = "../api", version = "4.0.0-alpha.1" }
grin_wallet_impls = { path = "../impls", version = "4.0.0-alpha.1" }
grin_wallet_libwallet = { path = "../libwallet", version = "4.0.0-alpha.1" }
grin_wallet_config = { path = "../config", version = "4.0.0-alpha.1" }

[dev-dependencies]
x25519-dalek = "0.6"
1 change: 0 additions & 1 deletion controller/tests/no_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ fn no_change_test_impl(test_dir: &'static str) -> Result<(), libwallet::Error> {
api.tx_lock_outputs(m, &slate)?;
slate = api.finalize_tx(m, &slate)?;
println!("Posted Slate: {:?}", slate);
println!("Posted TX: {}", slate);
stored_excess = Some(slate.tx.as_ref().unwrap().body.kernels[0].excess);
api.post_tx(m, &slate, false)?;
Ok(())
Expand Down
Loading

0 comments on commit 2769436

Please sign in to comment.