From 45f84262860853c0f42a6fd437709935918bc261 Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Thu, 19 Dec 2024 18:28:35 +0100 Subject: [PATCH 1/2] chore: expose upload_chunks_with_retries --- autonomi/src/client/data/public.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autonomi/src/client/data/public.rs b/autonomi/src/client/data/public.rs index 9f758edde8..669fd8cafa 100644 --- a/autonomi/src/client/data/public.rs +++ b/autonomi/src/client/data/public.rs @@ -177,7 +177,7 @@ impl Client { } // Upload chunks and retry failed uploads up to `RETRY_ATTEMPTS` times. - pub(crate) async fn upload_chunks_with_retries<'a>( + pub async fn upload_chunks_with_retries<'a>( &self, mut chunks: Vec<&'a Chunk>, receipt: &Receipt, From 968ddc6cb9a0248fc1decdec7729e2a493bf16a1 Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Fri, 20 Dec 2024 18:51:52 +0100 Subject: [PATCH 2/2] feat: add fn `vault_key_from_signature_hex` --- autonomi/src/client/vault/key.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/autonomi/src/client/vault/key.rs b/autonomi/src/client/vault/key.rs index e452eddfab..c87669907f 100644 --- a/autonomi/src/client/vault/key.rs +++ b/autonomi/src/client/vault/key.rs @@ -39,6 +39,17 @@ pub fn derive_vault_key(evm_sk_hex: &str) -> Result Result { + let signature_bytes = hex::decode(signature_hex) + .map_err(|e| VaultKeyError::FailedToGenerateVaultSecretKey(e.to_string()))?; + + let blst_key = derive_secret_key_from_seed(&signature_bytes)?; + let vault_sk = blst_to_blsttc(&blst_key)?; + + Ok(vault_sk) +} + /// Convert a blst secret key to a blsttc secret key and pray that endianness is the same pub(crate) fn blst_to_blsttc(sk: &BlstSecretKey) -> Result { let sk_bytes = sk.to_bytes();