mirror of
https://github.com/nab138/isideload.git
synced 2026-03-02 06:26:16 +01:00
Fix clippy
This commit is contained in:
@@ -137,7 +137,7 @@ impl Application {
|
||||
let extensions = self.bundle.app_extensions_mut();
|
||||
for ext in extensions.iter_mut() {
|
||||
if let Some(id) = ext.bundle_identifier() {
|
||||
if !(id.starts_with(&main_app_bundle_id) && id.len() > main_app_bundle_id.len()) {
|
||||
if !(id.starts_with(main_app_bundle_id) && id.len() > main_app_bundle_id.len()) {
|
||||
bail!(SideloadError::InvalidBundle(format!(
|
||||
"Extension {} is not part of the main app bundle identifier: {}",
|
||||
ext.bundle_name().unwrap_or("Unknown"),
|
||||
@@ -152,7 +152,7 @@ impl Application {
|
||||
}
|
||||
}
|
||||
}
|
||||
self.bundle.set_bundle_identifier(&main_app_id_str);
|
||||
self.bundle.set_bundle_identifier(main_app_id_str);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -168,7 +168,7 @@ impl Application {
|
||||
bundles_with_app_id.extend(extension_refs);
|
||||
|
||||
let list_app_ids_response = dev_session
|
||||
.list_app_ids(&team, None)
|
||||
.list_app_ids(team, None)
|
||||
.await
|
||||
.context("Failed to list app IDs for the developer team")?;
|
||||
let app_ids_to_register = bundles_with_app_id
|
||||
@@ -195,9 +195,9 @@ impl Application {
|
||||
for bundle in app_ids_to_register {
|
||||
let id = bundle.bundle_identifier().unwrap_or("");
|
||||
let name = bundle.bundle_name().unwrap_or("");
|
||||
dev_session.add_app_id(&team, name, id, None).await?;
|
||||
dev_session.add_app_id(team, name, id, None).await?;
|
||||
}
|
||||
let list_app_id_response = dev_session.list_app_ids(&team, None).await?;
|
||||
let list_app_id_response = dev_session.list_app_ids(team, None).await?;
|
||||
let app_ids: Vec<_> = list_app_id_response
|
||||
.app_ids
|
||||
.into_iter()
|
||||
|
||||
@@ -61,7 +61,7 @@ impl CertificateIdentity {
|
||||
p12_keystore::KeyStoreEntry::PrivateKeyChain(key_chain),
|
||||
);
|
||||
|
||||
let writer = keystore.writer(&password);
|
||||
let writer = keystore.writer(password);
|
||||
let p12 = writer.write().context("Failed to write PKCS#12 archive")?;
|
||||
Ok(p12)
|
||||
}
|
||||
@@ -127,16 +127,16 @@ impl CertificateIdentity {
|
||||
let email_hash = hex::encode(hasher.finalize());
|
||||
|
||||
let private_key = storage.retrieve_data(&format!("{}/key", email_hash))?;
|
||||
if private_key.is_some() {
|
||||
if let Some(priv_key) = private_key {
|
||||
info!("Using existing private key from storage");
|
||||
return Ok(RsaPrivateKey::from_pkcs8_der(&private_key.unwrap())?);
|
||||
return Ok(RsaPrivateKey::from_pkcs8_der(&priv_key)?);
|
||||
}
|
||||
|
||||
let mut rng = rand::rng();
|
||||
let private_key = RsaPrivateKey::new(&mut rng, 2048)?;
|
||||
storage.store_data(
|
||||
&format!("{}/key", email_hash),
|
||||
&private_key.to_pkcs8_der()?.as_bytes(),
|
||||
private_key.to_pkcs8_der()?.as_bytes(),
|
||||
)?;
|
||||
|
||||
Ok(private_key)
|
||||
@@ -239,7 +239,7 @@ impl CertificateIdentity {
|
||||
*code,
|
||||
"Maximum number of certificates reached".to_string(),
|
||||
),
|
||||
&mut existing_certs.as_mut().unwrap(),
|
||||
existing_certs.as_mut().unwrap(),
|
||||
)
|
||||
.await?;
|
||||
} else {
|
||||
@@ -297,7 +297,7 @@ impl CertificateIdentity {
|
||||
Ok(())
|
||||
} else {
|
||||
error!("No more certificates to revoke but still hitting max certs error");
|
||||
return Err(error.into());
|
||||
Err(error.into())
|
||||
}
|
||||
}
|
||||
MaxCertsBehavior::Error => Err(error.into()),
|
||||
|
||||
@@ -23,8 +23,8 @@ pub fn sign(
|
||||
let mut settings = signing_settings(cert_identity)?;
|
||||
let entitlements: Dictionary = entitlements_from_prov(
|
||||
provisioning_profile.encoded_profile.as_ref(),
|
||||
&special,
|
||||
&team,
|
||||
special,
|
||||
team,
|
||||
)?;
|
||||
|
||||
settings
|
||||
|
||||
@@ -39,6 +39,12 @@ pub struct InMemoryStorage {
|
||||
storage: Mutex<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
impl Default for InMemoryStorage {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl InMemoryStorage {
|
||||
pub fn new() -> Self {
|
||||
InMemoryStorage {
|
||||
|
||||
Reference in New Issue
Block a user