mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-11-15 20:03:52 +01:00
Update deps (#768)
* build: update grin submodule to last staging * build: update grin submodule * build: remove remove_dir_all dependency * build: update rpassword * build: update semver * build: remove unused deps * build: update ring * build: update lock file deps * build: update rustyline * build: update ed25519-dalek * build: update curve25519-dalek * build: update age * build: update uuid * fix: uuid test * build: update x25519-dalek * fix: x25519-dalek build * build: update arti * build: update grin submodule * build: update hyper * fix: initialize rustls provider for tests * build: update grin submodule * fix: rustls install provider * tor: share getting private key * fix: show an error on node version parse * cli: renamed prompt password method * fix: replace into_boxed_slice with try_from * fix: dalek tests for onion * config: comment expanded secret key * fix: import api body for controller * password: handle prompt error * wallet: parse node error message * tests: do not use random values for sign messages * build: make hook executable * build: cargo format all * rustls: do not install provider at tests and globally * build: update grin submodule * build: fix api channel from grin submodule * args: use read_password for piped prompt * build: remove unused dep * test: fixed signature * preserve piped pw input --------- Co-authored-by: wiesche <wiesche89@googlemail.com>
This commit is contained in:
@@ -104,7 +104,7 @@ mod tests {
|
||||
use grin_core::global;
|
||||
|
||||
fn clean_output_dir(test_dir: &str) {
|
||||
let _ = remove_dir_all::remove_dir_all(test_dir);
|
||||
let _ = fs::remove_dir_all(test_dir);
|
||||
}
|
||||
|
||||
fn setup(test_dir: &str) {
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::tor::config::exp_sec_key_bytes;
|
||||
use crate::tor::{ArtiRuntimeWrapper, Tor};
|
||||
use arti_client::config::pt::TransportConfigBuilder;
|
||||
use arti_client::config::{BridgeConfigBuilder, TorClientConfigBuilder};
|
||||
use arti_client::{TorClient, TorClientConfig};
|
||||
use arti_ed25519_dalek::hazmat::ExpandedSecretKey;
|
||||
use bytes::Bytes;
|
||||
use curve25519_dalek::digest::Digest;
|
||||
use ed25519_dalek::hazmat::ExpandedSecretKey;
|
||||
use ed25519_dalek::Digest;
|
||||
use fs_mistrust::Mistrust;
|
||||
use grin_util::secp::SecretKey;
|
||||
use grin_wallet_config::TorConfig;
|
||||
@@ -402,10 +403,7 @@ fn add_service_key(
|
||||
|
||||
let expanded_sk =
|
||||
ExpandedSecretKey::from_bytes(Sha512::default().chain_update(key).finalize().as_ref());
|
||||
|
||||
let mut sk_bytes = [0_u8; 64];
|
||||
sk_bytes[0..32].copy_from_slice(&expanded_sk.scalar.to_bytes());
|
||||
sk_bytes[32..64].copy_from_slice(&expanded_sk.hash_prefix);
|
||||
let sk_bytes = exp_sec_key_bytes(expanded_sk);
|
||||
match ExpandedKeypair::from_secret_key_bytes(sk_bytes) {
|
||||
None => {
|
||||
return Err(Error::TorProcess(
|
||||
|
||||
+16
-9
@@ -17,9 +17,9 @@ use crate::util::secp::key::SecretKey;
|
||||
use crate::Error;
|
||||
use grin_wallet_util::OnionV3Address;
|
||||
|
||||
use ed25519_dalek::ExpandedSecretKey;
|
||||
use ed25519_dalek::PublicKey as DalekPublicKey;
|
||||
use ed25519_dalek::SecretKey as DalekSecretKey;
|
||||
use ed25519_dalek::hazmat::ExpandedSecretKey;
|
||||
use ed25519_dalek::SigningKey as DalekSecretKey;
|
||||
use ed25519_dalek::VerifyingKey as DalekPublicKey;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
use std::fs::{self, File};
|
||||
@@ -92,6 +92,14 @@ impl TorRcConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert expanded secret key to byte array (works for both external Tor process and Arti).
|
||||
pub(crate) fn exp_sec_key_bytes(expanded_sk: ExpandedSecretKey) -> [u8; 64] {
|
||||
let mut sk_bytes = [0_u8; 64];
|
||||
sk_bytes[0..32].copy_from_slice(&expanded_sk.scalar.to_bytes());
|
||||
sk_bytes[32..64].copy_from_slice(&expanded_sk.hash_prefix);
|
||||
sk_bytes
|
||||
}
|
||||
|
||||
pub fn create_onion_service_sec_key_file(
|
||||
os_directory: &str,
|
||||
sec_key: &DalekSecretKey,
|
||||
@@ -101,9 +109,9 @@ pub fn create_onion_service_sec_key_file(
|
||||
// Tag is always 32 bytes, so pad with null zeroes
|
||||
file.write(b"== ed25519v1-secret: type0 ==\0\0\0")
|
||||
.map_err(|_| Error::IO)?;
|
||||
let expanded_skey: ExpandedSecretKey = ExpandedSecretKey::from(sec_key);
|
||||
file.write_all(&expanded_skey.to_bytes())
|
||||
.map_err(|_| Error::IO)?;
|
||||
let expanded_skey: ExpandedSecretKey = ExpandedSecretKey::from(sec_key.as_bytes());
|
||||
let sk_bytes = exp_sec_key_bytes(expanded_skey);
|
||||
file.write_all(&sk_bytes).map_err(|_| Error::IO)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -138,8 +146,7 @@ pub fn output_onion_service_config(
|
||||
tor_config_directory: &str,
|
||||
sec_key: &SecretKey,
|
||||
) -> Result<OnionV3Address, Error> {
|
||||
let d_sec_key = DalekSecretKey::from_bytes(&sec_key.0)
|
||||
.map_err(|_| Error::ED25519Key("Unable to parse private key".into()))?;
|
||||
let d_sec_key = DalekSecretKey::from_bytes(&sec_key.0);
|
||||
let address = OnionV3Address::from_private(&sec_key.0)?;
|
||||
let hs_dir_file_path = format!(
|
||||
"{}{}{}{}{}",
|
||||
@@ -291,7 +298,7 @@ mod tests {
|
||||
use crate::util::{self, secp, static_secp_instance};
|
||||
|
||||
pub fn clean_output_dir(test_dir: &str) {
|
||||
let _ = remove_dir_all::remove_dir_all(test_dir);
|
||||
let _ = fs::remove_dir_all(test_dir);
|
||||
}
|
||||
|
||||
pub fn setup(test_dir: &str) {
|
||||
|
||||
Reference in New Issue
Block a user