Skip to content

Commit

Permalink
Merge pull request #2598 from mickvandijke/project-dave-compatibility
Browse files Browse the repository at this point in the history
Small autonomi API changes for Dave
  • Loading branch information
mickvandijke authored Jan 6, 2025
2 parents 246638f + 968ddc6 commit f47a611
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion autonomi/src/client/data/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions autonomi/src/client/vault/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ pub fn derive_vault_key(evm_sk_hex: &str) -> Result<VaultSecretKey, VaultKeyErro
Ok(vault_sk)
}

/// Derives the vault secret key from a signature hex string
pub fn vault_key_from_signature_hex(signature_hex: &str) -> Result<VaultSecretKey, VaultKeyError> {
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<bls::SecretKey, VaultKeyError> {
let sk_bytes = sk.to_bytes();
Expand Down

0 comments on commit f47a611

Please sign in to comment.